From ac52e83f4c76992925e13d0f4e901ffd4c207261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 30 Jan 2013 17:38:21 +0100 Subject: ARM: use read_cpuid_id() instead of read_cpuid(CPUID_ID) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both calls are identical currently. This patch prepares to deprecate read_cpuid on machines without cp15. Also move an unconditional usage of read_cpuid_cachetype to a more local scope as read_cpuid_cachetype uses read_cpuid, too. Signed-off-by: Uwe Kleine-König Message-Id: 1359646587-1788-1-git-send-email-u.kleine-koenig@pengutronix.de --- arch/arm/mach-omap2/id.c | 4 ++-- arch/arm/mach-omap2/omap-smp.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 45cc7ed4dd58..1377c363fded 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -300,7 +300,7 @@ void __init omap3xxx_check_revision(void) * If the processor type is Cortex-A8 and the revision is 0x0 * it means its Cortex r0p0 which is 3430 ES1.0. */ - cpuid = read_cpuid(CPUID_ID); + cpuid = read_cpuid_id(); if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) { omap_revision = OMAP3430_REV_ES1_0; cpu_rev = "1.0"; @@ -450,7 +450,7 @@ void __init omap4xxx_check_revision(void) * Use ARM register to detect the correct ES version */ if (!rev && (hawkeye != 0xb94e) && (hawkeye != 0xb975)) { - idcode = read_cpuid(CPUID_ID); + idcode = read_cpuid_id(); rev = (idcode & 0xf) - 1; } diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index cd42d921940d..707098ecf8d3 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c @@ -209,7 +209,7 @@ static void __init omap4_smp_init_cpus(void) unsigned int i = 0, ncores = 1, cpu_id; /* Use ARM cpuid check here, as SoC detection will not work so early */ - cpu_id = read_cpuid(CPUID_ID) & CPU_MASK; + cpu_id = read_cpuid_id() & CPU_MASK; if (cpu_id == CPU_CORTEX_A9) { /* * Currently we can't call ioremap here because -- cgit v1.2.3 From d808aa69a7e85dea850ffe7b3d076be696da35be Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 24 Feb 2013 10:52:18 +0000 Subject: ARM: cleanup: debugfs error handling Debugfs functions return NULL when they fail, or an error pointer when not configured. The intention behind the error pointer is that it appears as a valid pointer to the caller, and so the caller continues inspite of debugfs not being available. Debugfs failure should only ever be checked with (!ptr) and not the IS_ERR*() functions. Signed-off-by: Russell King --- arch/arm/mach-omap2/pm-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index e2c291f52f92..548547e14796 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -219,7 +219,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) return 0; d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); - if (!(IS_ERR_OR_NULL(d))) + if (d) (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, (void *)pwrdm, &pwrdm_suspend_fops); @@ -263,8 +263,8 @@ static int __init pm_dbg_init(void) return 0; d = debugfs_create_dir("pm_debug", NULL); - if (IS_ERR_OR_NULL(d)) - return PTR_ERR(d); + if (!d) + return -EINVAL; (void) debugfs_create_file("count", S_IRUGO, d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); -- cgit v1.2.3 From 62f0f39b4aa2dce08f08797089e60d945448ca2b Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 24 Feb 2013 10:55:24 +0000 Subject: ARM: cleanup: pwrdm_can_ever_lose_context() checking pwrdm_can_ever_lose_context() is only ever called from the OMAP GPIO code, and only with a pointer returned from omap_hwmod_get_pwrdm(). omap_hwmod_get_pwrdm() only ever returns NULL on error, so using IS_ERR_OR_NULL() to validate the passed pointer is silly. Use a simpler !ptr check instead. Signed-off-by: Russell King --- arch/arm/mach-omap2/powerdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index dea62a9aad07..36a69189b083 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -1054,7 +1054,7 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) { int i; - if (IS_ERR_OR_NULL(pwrdm)) { + if (!pwrdm) { pr_debug("powerdomain: %s: invalid powerdomain pointer\n", __func__); return 1; -- cgit v1.2.3 From bca7a5a04933700a8bde4ea5798119607a8b0436 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 18 Apr 2013 18:15:44 +0100 Subject: ARM: cpu hotplug: remove majority of cache flushing from platforms Remove the majority of cache flushing calls from the individual platform files. This is now handled by the core code. Signed-off-by: Russell King --- arch/arm/mach-omap2/omap-hotplug.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c index e712d1725a8b..ceb30a59bf28 100644 --- a/arch/arm/mach-omap2/omap-hotplug.c +++ b/arch/arm/mach-omap2/omap-hotplug.c @@ -35,9 +35,6 @@ void __ref omap4_cpu_die(unsigned int cpu) unsigned int boot_cpu = 0; void __iomem *base = omap_get_wakeupgen_base(); - flush_cache_all(); - dsb(); - /* * we're ready for shutdown now, so do it */ -- cgit v1.2.3 From 857835c6d57aef101ac335a6da2149b54e7e0512 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 24 Feb 2013 10:56:59 +0000 Subject: ARM: cleanup: OMAP hwmod error checking omap_hwmod_lookup() only returns NULL on error, never an error pointer. Checking the returned pointer using IS_ERR_OR_NULL() is needless overhead. Use a simple !ptr check instead. OMAP devices (oh->od) always have a valid platform device attached (see omap_device_alloc()) so there's no point validating the platform device pointer (we will have already oopsed long before if this is not the case here.) Lastly, oh->od is only ever NULL or a valid omap device pointer - 'oh' comes from the statically declared hwmod tables, and the pointer is only filled in by omap_device_alloc() at a point where the omap device pointer must be valid. Signed-off-by: Russell King --- arch/arm/mach-omap2/omap_device.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index e065daa537c0..1bc16cdafdd6 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -1157,20 +1157,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name) } oh = omap_hwmod_lookup(oh_name); - if (IS_ERR_OR_NULL(oh)) { + if (!oh) { WARN(1, "%s: no hwmod for %s\n", __func__, oh_name); - return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV); + return ERR_PTR(-ENODEV); } - if (IS_ERR_OR_NULL(oh->od)) { + if (!oh->od) { WARN(1, "%s: no omap_device for %s\n", __func__, oh_name); - return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV); + return ERR_PTR(-ENODEV); } - if (IS_ERR_OR_NULL(oh->od->pdev)) - return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV); - return &oh->od->pdev->dev; } EXPORT_SYMBOL(omap_device_get_by_hwmod_name); -- cgit v1.2.3 From c48cd659892962f79bba4b4e0eedea8e5aa54c44 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 13 Mar 2013 20:44:21 +0000 Subject: ARM: OMAP: use consistent error checking Consistently check errors using the usual method used in the kernel for much of its history. For instance: int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t) { int div; div = gpmc_calc_divider(t->sync_clk); if (div < 0) return div; static int gpmc_set_async_mode(int cs, struct gpmc_timings *t) { ... return gpmc_cs_set_timings(cs, t); ..... ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); if (IS_ERR_VALUE(ret)) return ret; So, gpmc_cs_set_timings() thinks any negative return value is an error, but where we check that in higher levels, only a limited range are errors... There is only _one_ use of IS_ERR_VALUE() in arch/arm which is really appropriate, and that is in arch/arm/include/asm/syscall.h: static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { unsigned long error = regs->ARM_r0; return IS_ERR_VALUE(error) ? error : 0; } because this function really does have to differentiate between error return values and addresses which look like negative numbers (eg, from mmap()). So, here's a patch to remove them from OMAP, except for the above. Acked-by: Tony Lindgren Signed-off-by: Russell King --- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/clock.c | 2 +- arch/arm/mach-omap2/gpmc-onenand.c | 4 ++-- arch/arm/mach-omap2/gpmc.c | 8 ++++---- arch/arm/mach-omap2/omap_device.c | 2 +- arch/arm/mach-omap2/omap_hwmod.c | 4 ++-- arch/arm/mach-omap2/timer.c | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'arch/arm/mach-omap2') diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 22c483d5dfa8..1957426b96fe 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -457,7 +457,7 @@ static int __init beagle_opp_init(void) /* Initialize the omap3 opp table if not already created. */ r = omap3_opp_init(); - if (IS_ERR_VALUE(r) && (r != -EEXIST)) { + if (r < 0 && (r != -EEXIST)) { pr_err("%s: opp default init failed\n", __func__); return r; } diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index e4ec3a69ee2e..2191f25ad21b 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -596,7 +596,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name) return -ENOENT; r = clk_set_rate(mpurate_ck, mpurate); - if (IS_ERR_VALUE(r)) { + if (r < 0) { WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", mpurate_ck_name, mpurate, r); clk_put(mpurate_ck); diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 94a349e4dc96..7f369b4f3917 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c @@ -303,7 +303,7 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) t = omap2_onenand_calc_async_timings(); ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); - if (IS_ERR_VALUE(ret)) + if (ret < 0) return ret; omap2_onenand_set_async_mode(onenand_base); @@ -325,7 +325,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); - if (IS_ERR_VALUE(ret)) + if (ret < 0) return ret; set_onenand_cfg(onenand_base); diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 8033cb747c86..c0a2c26ed5a4 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -709,7 +709,7 @@ static int gpmc_setup_irq(void) return -EINVAL; gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); - if (IS_ERR_VALUE(gpmc_irq_start)) { + if (gpmc_irq_start < 0) { pr_err("irq_alloc_descs failed\n"); return gpmc_irq_start; } @@ -797,7 +797,7 @@ static int gpmc_mem_init(void) continue; gpmc_cs_get_memconf(cs, &base, &size); rc = gpmc_cs_insert_mem(cs, base, size); - if (IS_ERR_VALUE(rc)) { + if (rc < 0) { while (--cs >= 0) if (gpmc_cs_mem_enabled(cs)) gpmc_cs_delete_mem(cs); @@ -1164,14 +1164,14 @@ static int gpmc_probe(struct platform_device *pdev) GPMC_REVISION_MINOR(l)); rc = gpmc_mem_init(); - if (IS_ERR_VALUE(rc)) { + if (rc < 0) { clk_disable_unprepare(gpmc_l3_clk); clk_put(gpmc_l3_clk); dev_err(gpmc_dev, "failed to reserve memory\n"); return rc; } - if (IS_ERR_VALUE(gpmc_setup_irq())) + if (gpmc_setup_irq() < 0) dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); return 0; diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 1bc16cdafdd6..01839a0b5024 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -333,7 +333,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) int oh_cnt, i, ret = 0; oh_cnt = of_property_count_strings(node, "ti,hwmods"); - if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { + if (oh_cnt <= 0) { dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); return -ENODEV; } diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 4653efb87a27..b7c0a2d3f2c7 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1661,7 +1661,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) return -ENOSYS; ret = _lookup_hardreset(oh, name, &ohri); - if (IS_ERR_VALUE(ret)) + if (ret < 0) return ret; if (oh->clkdm) { @@ -2387,7 +2387,7 @@ static int __init _init(struct omap_hwmod *oh, void *data) _init_mpu_rt_base(oh, NULL); r = _init_clocks(oh, NULL); - if (IS_ERR_VALUE(r)) { + if (r < 0) { WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); return -EINVAL; } diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index b8ad6e632bb8..390c1b6e15bc 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c @@ -288,7 +288,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, r = -EINVAL; } else { r = clk_set_parent(timer->fclk, src); - if (IS_ERR_VALUE(r)) + if (r < 0) pr_warn("%s: %s cannot set source\n", __func__, oh->name); clk_put(src); -- cgit v1.2.3