sparse, checkpatch cleanup in mach-omap2
Subsystems (8)
Paul Walmsley
maintainercover sparse, checkpatch cleanup in mach-omap2
It's springtime in the Northern Hemisphere; time for plants to flower, students to graduate, or not, and Linux hackers to generate cleanup patches against the source tree...
These patches fix all of the sparse warnings against the arch/arm/mach-omap2 directory, and fix some of the checkpatch.pl warnings also. The individual patch descriptions discuss the main changes involved. sparse did find a few stinkers - I think the worst was a shadowed variable in clock.c.
There are a few other minor changes involved. The main one was that the unlikely() and likely() branch predictor hints got removed.
The sparse fixes do have one downside: some additional uglification, caused by the addition of __force to pointer->integer and integer->pointer casts. The rest of the kernel seems to have accepted this tradeoff.
Compile-tested with OSK5912, N800, 2430SDP, and 3430SDP configs; boot-tested on 3430SDP ES2.
- Paul
---
diffstat:
arch/arm/mach-omap2/clock.c | 107 ++++++++++++++--------------- arch/arm/mach-omap2/clock.h | 4 + arch/arm/mach-omap2/clock24xx.c | 23 +++--- arch/arm/mach-omap2/clockdomain.c | 5 + arch/arm/mach-omap2/cm.h | 4 + arch/arm/mach-omap2/control.c | 13 ++-- arch/arm/mach-omap2/devices.c | 10 +-- arch/arm/mach-omap2/gpmc.c | 42 ++++++----- arch/arm/mach-omap2/id.c | 9 +- arch/arm/mach-omap2/io.c | 15 ++-- arch/arm/mach-omap2/irq.c | 58 ++++++++++------ arch/arm/mach-omap2/memory.h | 7 ++ arch/arm/mach-omap2/mux.c | 14 ++-- arch/arm/mach-omap2/pm.c | 37 ++++++---- arch/arm/mach-omap2/powerdomain.c | 2 - arch/arm/mach-omap2/prcm.c | 12 ++- arch/arm/mach-omap2/prm.h | 6 +- arch/arm/mach-omap2/sdrc.h | 4 + arch/arm/mach-omap2/serial.c | 21 +++--- arch/arm/mach-omap2/usb-ehci.c | 2 - include/asm-arm/arch-omap/board-3430sdp.h | 1 include/asm-arm/arch-omap/board.h | 6 +- include/asm-arm/arch-omap/clock.h | 7 +- include/asm-arm/arch-omap/control.h | 16 ++-- include/asm-arm/arch-omap/cpu.h | 6 +- include/asm-arm/arch-omap/mmc.h | 4 + include/asm-arm/arch-omap/omap24xx.h | 1 include/asm-arm/arch-omap/omapfb.h | 1 include/asm-arm/arch-omap/powerdomain.h | 1 include/asm-arm/arch-omap/prcm.h | 5 + include/asm-arm/arch-omap/sram.h | 1 include/asm-arm/arch-omap/system.h | 4 + include/asm-arm/arch-omap/timex.h | 2 + include/asm-arm/arch-omap/usb.h | 3 + 34 files changed, 247 insertions(+), 206 deletions(-)
size:
text data bss dec hex filename
3271533 155216 101256 3528005 35d545 vmlinux.3430sdp.orig 3271501 155216 101256 3527973 35d525 vmlinux.3430sdp.patched
Paul Walmsley
maintainerPATCH 1/5 fix sparse, checkpatch warnings in OMAP2/3 PRCM/PM code
Fix sparse & checkpatch warnings in OMAP2/3 PRCM & PM code. This mostly consists of:
- converting pointer comparisons to integers in form similar to (ptr == 0) to the standard idiom (!ptr)
- labeling a few non-static private functions as static
- tagging appropriate integer<->pointer casts with __force
- adding prototypes for *_init() functions in the appropriate header files, and getting rid of the corresponding open-coded extern prototypes in other C files
- renaming the variable 'sclk' in mach-omap2/clock.c:omap2_get_apll_clkin to avoid shadowing an earlier declaration
Clean up checkpatch issues. This mostly involves:
- converting some asm/ includes to linux/ includes
- cleaning up some whitespace
- getting rid of braces for conditionals with single following statements
Also take care of a few odds and ends, including:
- getting rid of unlikely() and likely() - none of this code is particularly fast-path code, so the performance impact seems slim; and some of those likely() and unlikely() indicators are probably not as accurate as the ARM's branch predictor
- removing some superfluous casts
---
arch/arm/mach-omap2/clock.c | 107 +++++++++++++++---------------- arch/arm/mach-omap2/clock.h | 4 + arch/arm/mach-omap2/clock24xx.c | 23 +++---- arch/arm/mach-omap2/clockdomain.c | 5 + arch/arm/mach-omap2/cm.h | 4 + arch/arm/mach-omap2/pm.c | 37 ++++++----- arch/arm/mach-omap2/powerdomain.c | 2 - arch/arm/mach-omap2/prcm.c | 12 ++- arch/arm/mach-omap2/prm.h | 6 +- include/asm-arm/arch-omap/clock.h | 7 +- include/asm-arm/arch-omap/powerdomain.h | 1 include/asm-arm/arch-omap/prcm.h | 5 + 12 files changed, 110 insertions(+), 103 deletions(-)
arch/arm/mach-omap2/clock.c +52 -55
@@ -21,11 +21,11 @@#include <linux/errno.h> #include <linux/delay.h> #include <linux/clk.h> -#include <asm/bitops.h> - -#include <asm/io.h> +#include <linux/bitops.h> +#include <linux/io.h> #include <asm/arch/clock.h> +#include <asm/arch/clockdomain.h> #include <asm/arch/sram.h> #include <asm/arch/cpu.h> #include <asm/div64.h>
@@ -190,11 +190,10 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)* 24xx uses 0 to indicate not ready, and 1 to indicate ready. * 34xx reverses this, just to keep us on our toes */ -if (cpu_mask & (RATE_IN_242X |RATE_IN_243X )) { +if (cpu_mask & (RATE_IN_242X |RATE_IN_243X )) ena = mask; - }else if (cpu_mask &RATE_IN_343X ) { +else if (cpu_mask &RATE_IN_343X ) ena =0 ; - }/* Wait for lock */ while (((__raw_readl(reg) & mask) != ena) &&
@@ -217,29 +216,26 @@ int omap2_wait_clock_ready(void __iomem *reg, u32 mask, const char *name)* Note: We don't need special code here for INVERT_ENABLE * for the time being since INVERT_ENABLE only applies to clocks enabled by * CM_CLKEN_PLL +* +* REVISIT: This code is ugly and does not belong here. */ static void omap2_clk_wait_ready (struct clk *clk) { -void __iomem *reg, *other_reg, *st_reg; -u32 bit; - -/* -* REVISIT: This code is pretty ugly. It would be nice to generalize -* it and pull it into struct clk itself somehow. -*/ - reg = clk->enable_reg; -if ((((u32 )reg &0xff ) >=CM_FCLKEN1 ) && - (((u32 )reg &0xff ) <=OMAP24XX_CM_FCLKEN2 )) - other_reg = (void __iomem *)(((u32 )reg & ~0xf0 ) |0x10 );/* CM_ICLKEN* */ -else if ((((u32 )reg &0xff ) >=CM_ICLKEN1 ) && - (((u32 )reg &0xff ) <=OMAP24XX_CM_ICLKEN4 )) - other_reg = (void __iomem *)(((u32 )reg & ~0xf0 ) |0x00 );/* CM_FCLKEN* */ +u32 bit, reg, other_reg, st_reg; + + reg = (__force u32 )clk->enable_reg; +if (((reg &0xff ) >=CM_FCLKEN1 ) && + ((reg &0xff ) <=OMAP24XX_CM_FCLKEN2 )) + other_reg = ((reg & ~0xf0 ) |0x10 );/* CM_ICLKEN* */ +else if (((reg &0xff ) >=CM_ICLKEN1 ) && + ((reg &0xff ) <=OMAP24XX_CM_ICLKEN4 )) + other_reg = ((reg & ~0xf0 ) |0x00 );/* CM_FCLKEN* */ else return ;/* REVISIT: What are the appropriate exclusions for 34XX? */ /* No check for DSS or cam clocks */ -if (cpu_is_omap24xx () && ((u32 )reg &0x0f ) ==0 ) {/* CM_{F,I}CLKEN1 */ +if (cpu_is_omap24xx () && (reg &0x0f ) ==0 ) {/* CM_{F,I}CLKEN1 */ if (clk->enable_bit ==OMAP24XX_EN_DSS2_SHIFT || clk->enable_bit ==OMAP24XX_EN_DSS1_SHIFT || clk->enable_bit ==OMAP24XX_EN_CAM_SHIFT )
@@ -249,25 +245,25 @@ static void omap2_clk_wait_ready(struct clk *clk)/* REVISIT: What are the appropriate exclusions for 34XX? */ /* OMAP3: ignore DSS-mod clocks */ if (cpu_is_omap34xx () && - (((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || - ((((u32 )reg & ~0xff ) == (u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && - clk->enable_bit ==OMAP3430_EN_SSI_SHIFT ))) + ((reg & ~0xff ) == (__force u32 )OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,0 ) || + (((reg & ~0xff ) == (__force u32 )OMAP_CM_REGADDR (CORE_MOD ,0 )) && + clk->enable_bit ==OMAP3430_EN_SSI_SHIFT )))return ;/* Check if both functional and interface clocks * are running. */ bit =1 << clk->enable_bit; -if (!(__raw_readl (other_reg) & bit)) +if (!(__raw_readl ((__force void __iomem *)other_reg) & bit))return ; - st_reg = (void __iomem *)(((u32 )other_reg & ~0xf0 ) |0x20 );/* CM_IDLEST* */ + st_reg = ((other_reg & ~0xf0 ) |0x20 );/* CM_IDLEST* */ -omap2_wait_clock_ready (st_reg, bit, clk->name); +omap2_wait_clock_ready ((__force void __iomem *)st_reg, bit, clk->name); }/* Enables clock without considering parent dependencies or use count * REVISIT: Maybe change this to use clk->enable like on omap1? */ -int _omap2_clk_enable (struct clk *clk) +static int _omap2_clk_enable (struct clk *clk) {u32 regval32;
@@ -277,7 +273,7 @@ int _omap2_clk_enable(struct clk *clk)if (clk->enable)return clk->enable (clk); -if (unlikely (clk->enable_reg ==0 )) { +if (!clk->enable_reg) {printk (KERN_ERR "clock.c: Enable for %s without enable code\n" , clk->name);return 0 ;/* REVISIT: -EINVAL */
@@ -297,7 +293,7 @@ int _omap2_clk_enable(struct clk *clk) }/* Disables clock without considering parent dependencies or use count */ -void _omap2_clk_disable (struct clk *clk) +static void _omap2_clk_disable (struct clk *clk) {u32 regval32;
@@ -309,7 +305,7 @@ void _omap2_clk_disable(struct clk *clk)return ; } -if (clk->enable_reg ==0 ) { +if (!clk->enable_reg) {/* * 'Independent' here refers to a clock which is not * controlled by its parent.
@@ -332,7 +328,7 @@ void omap2_clk_disable(struct clk *clk) {if (clk->usecount >0 && !(--clk->usecount)) {_omap2_clk_disable (clk); -if (likely ((u32 )clk->parent)) +if (clk->parent)omap2_clk_disable (clk->parent);if (clk->clkdm)omap2_clkdm_clk_disable (clk->clkdm, clk);
@@ -345,10 +341,10 @@ int omap2_clk_enable(struct clk *clk)int ret =0 ;if (clk->usecount++ ==0 ) { -if (likely ((u32 )clk->parent)) +if (clk->parent) ret =omap2_clk_enable (clk->parent); -if (unlikely (ret !=0 )) { +if (ret !=0 ) { clk->usecount--;return ret; }
@@ -358,7 +354,7 @@ int omap2_clk_enable(struct clk *clk) ret =_omap2_clk_enable (clk); -if (unlikely (ret !=0 )) { +if (ret !=0 ) {if (clk->clkdm)omap2_clkdm_clk_disable (clk->clkdm, clk);
@@ -386,13 +382,13 @@ void omap2_clksel_recalc(struct clk *clk)if (div ==0 )return ; -if (unlikely (clk->rate == clk->parent->rate / div)) +if (clk->rate == (clk->parent->rate / div))return ; clk->rate = clk->parent->rate / div;pr_debug ("clock: new clock rate is %ld (div %d)\n" , clk->rate, div); -if (unlikely (clk->flags &RATE_PROPAGATES )) +if (clk->flags &RATE_PROPAGATES )propagate_rate (clk); }
@@ -405,8 +401,8 @@ void omap2_clksel_recalc(struct clk *clk)* the element associated with the supplied parent clock address. * Returns a pointer to the struct clksel on success or NULL on error. */ -const struct clksel *omap2_get_clksel_by_parent (struct clk *clk, -struct clk *src_clk) +static const struct clksel *omap2_get_clksel_by_parent (struct clk *clk, +struct clk *src_clk) {const struct clksel *clks;
@@ -455,7 +451,7 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, *new_div =1 ; clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return ~0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -514,7 +510,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)/* Given a clock and a rate apply a clock specific rounding function */ long omap2_clk_round_rate (struct clk *clk,unsigned long rate) { -if (clk->round_rate !=0 ) +if (clk->round_rate)return clk->round_rate (clk, rate);if (clk->flags &RATE_FIXED )
@@ -540,7 +536,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val)const struct clksel_rate *clkr; clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -576,7 +572,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)WARN_ON (div ==0 ); clks =omap2_get_clksel_by_parent (clk, clk->parent); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -601,9 +597,9 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)* * Returns the address of the clksel register upon success or NULL on error. */ -void __iomem *omap2_get_clksel (struct clk *clk,u32 *field_mask) +static void __iomem *omap2_get_clksel (struct clk *clk,u32 *field_mask) { -if (unlikely ((clk->clksel_reg ==0 ) || (clk->clksel_mask ==0 ))) +if (!clk->clksel_reg || (clk->clksel_mask ==0 ))return NULL ; *field_mask = clk->clksel_mask;
@@ -623,7 +619,7 @@ u32 omap2_clksel_get_divisor(struct clk *clk)void __iomem *div_addr; div_addr =omap2_get_clksel (clk, &field_mask); -if (div_addr ==0 ) +if (!div_addr)return 0 ; field_val =__raw_readl (div_addr) & field_mask;
@@ -642,7 +638,7 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)return -EINVAL ; div_addr =omap2_get_clksel (clk, &field_mask); -if (div_addr ==0 ) +if (!div_addr)return -EINVAL ; field_val =omap2_divisor_to_clksel (clk, new_div);
@@ -677,10 +673,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)return -EINVAL ;/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ -if (clk->set_rate !=0 ) +if (clk->set_rate) ret = clk->set_rate (clk, rate); -if (unlikely (ret ==0 && (clk->flags &RATE_PROPAGATES ))) +if (ret ==0 && (clk->flags &RATE_PROPAGATES ))propagate_rate (clk);return ret;
@@ -698,10 +694,10 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr,const struct clksel_rate *clkr; *parent_div =0 ; - *src_addr =0 ; + *src_addr =NULL ; clks =omap2_get_clksel_by_parent (clk, src_clk); -if (clks ==NULL ) +if (!clks)return 0 ;for (clkr = clks->rates; clkr->div; clkr++) {
@@ -731,7 +727,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)void __iomem *src_addr;u32 field_val, field_mask, reg_val, parent_div; -if (unlikely (clk->flags &CONFIG_PARTICIPANT )) +if (clk->flags &CONFIG_PARTICIPANT )return -EINVAL ;if (!clk->clksel)
@@ -739,7 +735,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) field_val =omap2_clksel_get_src_field (&src_addr, new_parent, &field_mask, clk, &parent_div); -if (src_addr ==0 ) +if (!src_addr)return -EINVAL ;if (clk->usecount >0 )
@@ -771,7 +767,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)pr_debug ("clock: set parent of %s to %s (new rate %ld)\n" , clk->name, clk->parent->name, clk->rate); -if (unlikely (clk->flags &RATE_PROPAGATES )) +if (clk->flags &RATE_PROPAGATES )propagate_rate (clk);return 0 ;
@@ -803,7 +799,8 @@ int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance)return 0 ; } -static unsigned long _dpll_compute_new_rate (unsigned long parent_rate,unsigned int m,unsigned int n) +static unsigned long _dpll_compute_new_rate (unsigned long parent_rate, +unsigned int m,unsigned int n) {unsigned long long num;
arch/arm/mach-omap2/clock.h +3 -1
@@ -21,12 +21,13 @@/* The maximum error between a target DPLL rate and the rounded rate in Hz */ #define DEFAULT_DPLL_RATE_TOLERANCE 50000 +int omap2_clk_init (void );int omap2_clk_enable (struct clk *clk);void omap2_clk_disable (struct clk *clk);long omap2_clk_round_rate (struct clk *clk,unsigned long rate);int omap2_clk_set_rate (struct clk *clk,unsigned long rate);int omap2_clk_set_parent (struct clk *clk,struct clk *new_parent); -int omap2_dpll_rate_tolerance_set (struct clk *clk,unsigned int tolerance); +int omap2_dpll_set_rate_tolerance (struct clk *clk,unsigned int tolerance);long omap2_dpll_round_rate (struct clk *clk,unsigned long target_rate);#ifdef CONFIG_OMAP_RESET_CLOCKS
@@ -48,6 +49,7 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);int omap2_clksel_set_rate (struct clk *clk,unsigned long rate);u32 omap2_get_dpll_rate (struct clk *clk);int omap2_wait_clock_ready (void __iomem *reg,u32 cval,const char *name); +void omap2_clk_prepare_for_reboot (void );extern u8 cpu_mask;
arch/arm/mach-omap2/clock24xx.c +12 -11
@@ -24,14 +24,13 @@#include <linux/errno.h> #include <linux/delay.h> #include <linux/clk.h> - +#include <linux/bitops.h> #include <linux/io.h> #include <linux/cpufreq.h> #include <asm/arch/clock.h> #include <asm/arch/sram.h> #include <asm/div64.h> -#include <asm/bitops.h> #include "memory.h" #include "clock.h"
@@ -135,7 +134,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)* Uses the current prcm set to tell if a rate is valid. * You can go slower, but not faster within a given rate set. */ -long omap2_dpllcore_round_rate (unsigned long target_rate) +static long omap2_dpllcore_round_rate (unsigned long target_rate) {u32 high, low, core_clk_src;
@@ -348,7 +347,9 @@ static int omap2_select_table_rate(struct clk *clk, unsigned long rate)/* Major subsystem dividers */ tmp =cm_read_mod_reg (CORE_MOD ,CM_CLKSEL1 ) &OMAP24XX_CLKSEL_DSS2_MASK ; -cm_write_mod_reg (prcm->cm_clksel1_core | tmp,CORE_MOD ,CM_CLKSEL1 ); +cm_write_mod_reg (prcm->cm_clksel1_core | tmp,CORE_MOD , +CM_CLKSEL1 ); +if (cpu_is_omap2430 ())cm_write_mod_reg (prcm->cm_clksel_mdm,OMAP2430_MDM_MOD ,CM_CLKSEL );
@@ -396,8 +397,8 @@ void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) }if (i ==0 ) { -printk (KERN_WARNING "%s: failed to initialize frequency table\n" , - __FUNCTION__); +printk (KERN_WARNING "%s: failed to initialize frequency " +"table\n" , __func__);return ; }
@@ -422,20 +423,20 @@ static struct clk_functions omap2_clk_functions = {static u32 omap2_get_apll_clkin (void ) { -u32 aplls, sclk =0 ; +u32 aplls, srate =0 ; aplls =cm_read_mod_reg (PLL_MOD ,CM_CLKSEL1 ); aplls &=OMAP24XX_APLLS_CLKIN_MASK ; aplls >>=OMAP24XX_APLLS_CLKIN_SHIFT ;if (aplls ==APLLS_CLKIN_19_2MHZ ) - sclk =19200000 ; + srate =19200000 ;else if (aplls ==APLLS_CLKIN_13MHZ ) - sclk =13000000 ; + srate =13000000 ;else if (aplls ==APLLS_CLKIN_12MHZ ) - sclk =12000000 ; + srate =12000000 ; -return sclk; +return srate; }static u32 omap2_get_sysclkdiv (void )
arch/arm/mach-omap2/clockdomain.c +3 -2
@@ -134,7 +134,7 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm) } -struct clockdomain *_clkdm_lookup (const char *name) +static struct clockdomain *_clkdm_lookup (const char *name) {struct clockdomain *clkdm, *temp_clkdm;
@@ -167,7 +167,8 @@ struct clockdomain *_clkdm_lookup(const char *name)* pointer to an array of clockdomain-powerdomain autodependencies was * provided, register those. No return value. */ -void clkdm_init (struct clockdomain **clkdms,struct clkdm_pwrdm_autodep *init_autodeps) +void clkdm_init (struct clockdomain **clkdms, +struct clkdm_pwrdm_autodep *init_autodeps) {struct clockdomain **c =NULL ;struct clkdm_pwrdm_autodep *autodep =NULL ;
arch/arm/mach-omap2/cm.h +2 -2
@@ -14,13 +14,13 @@* published by the Free Software Foundation. */ -#include <asm/io.h> +#include <linux/io.h> #include "prcm-common.h" #ifndef __ASSEMBLER__#define OMAP_CM_REGADDR (module, reg) \ - (void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg)) + (__force void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg))#else #define OMAP2420_CM_REGADDR (module, reg) \ IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
arch/arm/mach-omap2/pm.c +21 -16
@@ -28,9 +28,9 @@#include <linux/module.h> #include <linux/delay.h> #include <linux/clk.h> +#include <linux/io.h> +#include <linux/irq.h> -#include <asm/io.h> -#include <asm/irq.h> #include <asm/atomic.h> #include <asm/mach/time.h> #include <asm/mach/irq.h>
@@ -62,7 +62,7 @@ static void (*saved_idle)(void);static u32 omap2_read_32k_sync_counter (void ) { -return omap_readl (OMAP2_32KSYNCT_BASE +0x0010 ); +return omap_readl (OMAP2_32KSYNCT_BASE +0x0010 ); }#ifdef CONFIG_PM_DEBUG
@@ -121,7 +121,8 @@ static void serial_console_sleep(int enable)BUG_ON (serial_console_clock_disabled);if (clk_get_usecount (console_fclk) ==0 )return ; -if ((int ) serial_console_next_disable - (int )omap2_read_32k_sync_counter () >=0 ) +if ((int ) serial_console_next_disable - + (int )omap2_read_32k_sync_counter () >=0 )return ;serial_wait_tx ();clk_disable (console_iclk);
@@ -190,7 +191,8 @@ static void pm_init_serial_console(void)prm_set_mod_reg_bits (OMAP24XX_ST_UART2 ,CORE_MOD ,PM_WKEN1 );break ;case 3 : -prm_set_mod_reg_bits (OMAP24XX_ST_UART3 ,CORE_MOD ,OMAP24XX_PM_WKEN2 ); +prm_set_mod_reg_bits (OMAP24XX_ST_UART3 ,CORE_MOD , +OMAP24XX_PM_WKEN2 );break ; } }
@@ -290,16 +292,19 @@ static void omap2_pm_dump(int mode, int resume, unsigned int us) if (!resume)#if defined(CONFIG_NO_IDLE_HZ ) || defined(CONFIG_NO_HZ ) -printk ("--- Going to %s %s (next timer after %u ms)\n" , s1, s2, -jiffies_to_msecs (get_next_timer_interrupt (jiffies) - - jiffies)); +pr_debug ("--- Going to %s %s (next timer after %u ms)\n" , s1, + s2, +jiffies_to_msecs (get_next_timer_interrupt (jiffies) - + jiffies));#else -printk ("--- Going to %s %s\n" , s1, s2); +pr_debug ("--- Going to %s %s\n" , s1, s2);#endif else - printk("--- Woke up (slept for %u.%03u ms)\n", us / 1000, us % 1000); + pr_debug("--- Woke up (slept for %u.%03u ms)\n", us / 1000, + us % 1000); +for (i =0 ; i < reg_count; i++) - printk("%-20s: 0x%08x\n", regs[i].name, regs[i].val); + pr_debug("%-20s: 0x%08x\n", regs[i].name, regs[i].val); }#else
@@ -321,7 +326,7 @@ static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, }static ssize_t idle_store (struct kobject *kobj,struct kobj_attribute *attr, -const char * buf,size_t n) +const char *buf,size_t n) {unsigned short value; if (sscanf(buf, "%hu", &value) != 1 ||
@@ -352,11 +357,11 @@ static int omap2_fclks_active(void)static int omap2_irq_pending (void ) { -u32 pending_reg =IO_ADDRESS (0x480fe098 ); +u32 pending_reg =0x480fe098 ;int i;for (i =0 ; i <4 ; i++) { -if (__raw_readl (pending_reg)) +if (omap_readl (pending_reg))return 1 ; pending_reg +=0x20 ; }
@@ -498,7 +503,7 @@ static void omap2_enter_mpu_retention(void)/* The peripherals seem not to be able to wake up the MPU when * it is in retention mode. */ if (omap2_allow_mpu_retention ()) { -/* REVISIT: These write to reserved bits? */ +/* REVISIT: These write to reserved bits? */ prm_write_mod_reg (0xffffffff ,CORE_MOD ,PM_WKST1 );prm_write_mod_reg (0xffffffff ,CORE_MOD ,OMAP24XX_PM_WKST2 );prm_write_mod_reg (0xffffffff ,WKUP_MOD ,PM_WKST );
@@ -770,7 +775,7 @@ static void __init prcm_setup_regs(void) WKUP_MOD, PM_WKEN); } -int __init omap2_pm_init (void ) +static int __init omap2_pm_init (void ) {u32 l;int error;
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -53,7 +53,7 @@ static u32 prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)return v; } -struct powerdomain *_pwrdm_lookup (const char *name) +static struct powerdomain *_pwrdm_lookup (const char *name) {struct powerdomain *pwrdm, *temp_pwrdm;
arch/arm/mach-omap2/prcm.c +6 -6
@@ -18,11 +18,12 @@#include <linux/clk.h> #include <linux/io.h> +#include <asm/arch/prcm.h> + +#include "clock.h" #include "prm.h" #include "prm-regbits-24xx.h" -extern void omap2_clk_prepare_for_reboot (void ); -u32 omap_prcm_get_reset_sources (void ) {/* XXX This presumably needs modification for 34XX */
@@ -36,13 +37,12 @@ void omap_prcm_arch_reset(char mode)s16 prcm_offs;omap2_clk_prepare_for_reboot (); -if (cpu_is_omap24xx ()) { +if (cpu_is_omap24xx ()) prcm_offs =WKUP_MOD ; - }else if (cpu_is_omap34xx ()) { +else if (cpu_is_omap34xx ()) prcm_offs =OMAP3430_GR_MOD ; - }else { +else WARN_ON (1 ); - }prm_set_mod_reg_bits (OMAP_RST_DPLL3 , prcm_offs,RM_RSTCTRL ); }
arch/arm/mach-omap2/prm.h +3 -3
@@ -14,14 +14,14 @@* published by the Free Software Foundation. */ -#include <asm/io.h> -#include <asm/bitops.h> +#include <linux/io.h> +#include <linux/bitops.h> #include "prcm-common.h" #ifndef __ASSEMBLER__#define OMAP_PRM_REGADDR (module, reg) \ - (void __iomem *)IO_ADDRESS(OMAP2_PRM_BASE + (module) + (reg)) + (__force void __iomem *)IO_ADDRESS(OMAP2_PRM_BASE + (module) + (reg))#else #define OMAP2420_PRM_REGADDR (module, reg) \ IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
include/asm-arm/arch-omap/clock.h +3 -4
@@ -15,10 +15,9 @@#ifndef __ARCH_ARM_OMAP_CLOCK_H#define __ARCH_ARM_OMAP_CLOCK_H -#include <asm/arch/clockdomain.h> -struct module ;struct clk ; +struct clockdomain ;#if defined(CONFIG_ARCH_OMAP2 ) || defined(CONFIG_ARCH_OMAP3 )
@@ -112,12 +111,12 @@ struct clk_functions {extern unsigned int mpurate; -extern int clk_init (struct clk_functions * custom_clocks); +extern int clk_init (struct clk_functions *custom_clocks);extern int clk_register (struct clk *clk);extern void clk_unregister (struct clk *clk);extern void propagate_rate (struct clk *clk);extern void recalculate_root_clocks (void ); -extern void followparent_recalc (struct clk * clk); +extern void followparent_recalc (struct clk *clk);extern void clk_allow_idle (struct clk *clk);extern void clk_deny_idle (struct clk *clk);extern int clk_get_usecount (struct clk *clk);
include/asm-arm/arch-omap/powerdomain.h +1 -0
@@ -136,6 +136,7 @@ int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2);int pwrdm_set_next_pwrst (struct powerdomain *pwrdm,u8 pwrst);int pwrdm_read_next_pwrst (struct powerdomain *pwrdm); +int pwrdm_read_pwrst (struct powerdomain *pwrdm);int pwrdm_read_prev_pwrst (struct powerdomain *pwrdm);int pwrdm_clear_all_prev_pwrst (struct powerdomain *pwrdm);
include/asm-arm/arch-omap/prcm.h +3 -2
@@ -20,10 +20,11 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __ASM_ARM_ARCH_DPM_PRCM_H -#define __ASM_ARM_ARCH_DPM_PRCM_H +#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H +#define __ASM_ARM_ARCH_OMAP_PRCM_Hu32 omap_prcm_get_reset_sources (void ); +void omap_prcm_arch_reset (char mode);#endif
Paul Walmsley
maintainerPATCH 2/5 fix sparse, checkpatch warnings in OMAP2/3 SMS/GPMC/SRAM code
In reply to Paul WalmsleyFix sparse warnings in SMS, GPMC, SRAM code involving arch/arm/mach-omap2/. These fixes mostly consist of:
- tagging appropriate integer<->pointer casts with __force
- marking private structures and functions as static; adding function prototypes in .h files for public functions
- assigning NULL to pointers in structure initializers, not 0
- adding prototypes for *_init() functions in the appropriate header files, and getting rid of the corresponding open-coded extern prototypes in other C files
Also clean up some checkpatch issues by converting some asm/ includes to linux/ includes.
---
arch/arm/mach-omap2/gpmc.c | 42 +++++++++++++++++----------------- arch/arm/mach-omap2/io.c | 12 +++++----- arch/arm/mach-omap2/memory.h | 7 ++++++ arch/arm/mach-omap2/sdrc.h | 4 ++- include/asm-arm/arch-omap/omap24xx.h | 1 + include/asm-arm/arch-omap/sram.h | 1 + 6 files changed, 38 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/gpmc.c +21 -21
@@ -9,6 +9,8 @@* it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#undef DEBUG +#include <linux/kernel.h> #include <linux/init.h> #include <linux/err.h>
@@ -16,19 +18,14 @@#include <linux/ioport.h> #include <linux/spinlock.h> #include <linux/module.h> +#include <linux/io.h> -#include <asm/io.h> #include <asm/mach-types.h> #include <asm/arch/gpmc.h> -#undef DEBUG - -#if defined(CONFIG_ARCH_OMAP2420 ) -#define GPMC_BASE 0x6800a000 -#elif defined(CONFIG_ARCH_OMAP2430 ) || defined(CONFIG_ARCH_OMAP34XX ) -#define GPMC_BASE 0x6e000000 -#endif +#include "memory.h" +/* GPMC register offsets */ #define GPMC_REVISION 0x00#define GPMC_SYSCONFIG 0x10#define GPMC_SYSSTATUS 0x14
@@ -62,34 +59,31 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM];static DEFINE_SPINLOCK (gpmc_mem_lock);static unsigned gpmc_cs_map; -static void __iomem *gpmc_base = - (void __iomem *)IO_ADDRESS (GPMC_BASE ); -static void __iomem *gpmc_cs_base = - (void __iomem *)IO_ADDRESS (GPMC_BASE ) +GPMC_CS0 ; +static u32 gpmc_base;static struct clk *gpmc_l3_clk;static void gpmc_write_reg (int idx,u32 val) { -__raw_writel (val, gpmc_base + idx); +omap_writel (val, gpmc_base + idx); }static u32 gpmc_read_reg (int idx) { -return __raw_readl (gpmc_base + idx); +return omap_readl (gpmc_base + idx); }void gpmc_cs_write_reg (int cs,int idx,u32 val) { -void __iomem *reg_addr; +u32 reg_addr; - reg_addr = gpmc_cs_base + (cs *GPMC_CS_SIZE ) + idx; -__raw_writel (val, reg_addr); + reg_addr = gpmc_base +GPMC_CS0 + (cs *GPMC_CS_SIZE ) + idx; +omap_writel (val, reg_addr); }u32 gpmc_cs_read_reg (int cs,int idx) { -return __raw_readl (gpmc_cs_base + (cs *GPMC_CS_SIZE ) + idx); +return omap_readl (gpmc_base +GPMC_CS0 + (cs *GPMC_CS_SIZE ) + idx); }/* TODO: Add support for gpmc_fck to clock framework and use it */
@@ -381,7 +375,7 @@ void gpmc_cs_free(int cs) }EXPORT_SYMBOL (gpmc_cs_free); -void __init gpmc_mem_init (void ) +static void __init gpmc_mem_init (void ) {int cs;unsigned long boot_rom_space =0 ;
@@ -412,10 +406,16 @@ void __init gpmc_init(void) {u32 l; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { gpmc_l3_clk =clk_get (NULL ,"core_l3_ck" ); -else if (cpu_is_omap34xx ()) +if (cpu_is_omap2420 ()) + gpmc_base =OMAP2420_GPMC_BASE ; +else if (cpu_is_omap2430 ()) + gpmc_base =OMAP243X_GPMC_BASE ; + }else if (cpu_is_omap34xx ()) { gpmc_l3_clk =clk_get (NULL ,"gpmc_fck" ); + gpmc_base =OMAP34XX_GPMC_BASE ; + }BUG_ON (IS_ERR (gpmc_l3_clk));
arch/arm/mach-omap2/io.c +6 -6
@@ -18,14 +18,18 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> +#include <linux/io.h> #include <asm/tlb.h> -#include <asm/io.h> #include <asm/mach/map.h> -#include <asm/arch/mux.h> #include <asm/arch/omapfb.h> +#include <asm/arch/sram.h> + +#include "memory.h" + +#include "clock.h" #include <asm/arch/powerdomain.h>
@@ -34,11 +38,7 @@#include <asm/arch/clockdomain.h> #include "clockdomains.h" -extern void omap_sram_init (void ); -extern int omap2_clk_init (void );extern void omap2_check_revision (void ); -extern void omap2_init_memory (void ); -extern void gpmc_init (void );extern void omapfb_reserve_sdram (void );/*
arch/arm/mach-omap2/memory.h +7 -0
@@ -14,6 +14,9 @@* published by the Free Software Foundation. */ +#ifndef ARCH_ARM_MACH_OMAP2_MEMORY_H +#define ARCH_ARM_MACH_OMAP2_MEMORY_H +/* Memory timings */ #define M_DDR 1#define M_LOCK_CTRL (1 << 2)
@@ -34,3 +37,7 @@ extern u32 omap2_memory_get_fast_dll_ctrl(void);extern u32 omap2_memory_get_type (void );u32 omap2_dll_force_needed (void );u32 omap2_reprogram_sdrc (u32 level,u32 force); +void __init omap2_init_memory (void ); +void __init gpmc_init (void ); + +#endif
arch/arm/mach-omap2/sdrc.h +2 -2
@@ -31,7 +31,7 @@ extern unsigned long omap2_sms_base;static void __attribute__((unused))sdrc_write_reg (u32 val,u16 reg) {pr_debug ("sdrc_write_reg: writing 0x%0x to 0x%0x\n" , val, - (u32 )OMAP_SDRC_REGADDR (reg)); + (__force u32 )OMAP_SDRC_REGADDR (reg));__raw_writel (val,OMAP_SDRC_REGADDR (reg)); }
@@ -46,7 +46,7 @@ static u32 __attribute__((unused)) sdrc_read_reg(u16 reg)static void __attribute__((unused))sms_write_reg (u32 val,u16 reg) {pr_debug ("sms_write_reg: writing 0x%0x to 0x%0x\n" , val, - (u32 )OMAP_SMS_REGADDR (reg)); + (__force u32 )OMAP_SMS_REGADDR (reg));__raw_writel (val,OMAP_SMS_REGADDR (reg)); }
include/asm-arm/arch-omap/omap24xx.h +1 -0
@@ -48,6 +48,7 @@#define OMAP2420_PRM_BASE OMAP2420_CM_BASE#define OMAP2420_SDRC_BASE (L3_24XX_BASE + 0x9000)#define OMAP2420_SMS_BASE 0x68008000 +#define OMAP2420_GPMC_BASE 0x6800a000#define OMAP2430_32KSYNCT_BASE (L4_WK_243X_BASE + 0x20000)#define OMAP2430_PRCM_BASE (L4_WK_243X_BASE + 0x6000)
include/asm-arm/arch-omap/sram.h +1 -0
@@ -13,6 +13,7 @@#include <linux/poison.h> /* for SRAM_VA_MAGIC */ +extern int __init omap_sram_init (void );extern void *omap_sram_push (void * start,unsigned long size);extern int omap_sram_patch_va (void *srcfn,void *srcd,void *sramfn,void __iomem *d);extern void omap_sram_reprogram_clock (u32 dpllctl,u32 ckctl);
Paul Walmsley
maintainerPATCH 3/5 fix sparse, checkpatch warnings in OMAP2/3 IRQ code
In reply to Paul WalmsleyFix sparse warnings in mach-omap2/irq.c. Fix by defining intc_bank_write_reg() and intc_bank_read_reg(), and convert INTC module register access to use them rather than __raw_{read,write}l.
Also clear up some checkpatch warnings involving includes from asm/ rather than linux/.
---
arch/arm/mach-omap2/irq.c | 58 ++++++++++++++++++++++++++++----------------- 1 files changed, 36 insertions(+), 22 deletions(-)
arch/arm/mach-omap2/irq.c +36 -22
@@ -15,8 +15,10 @@#include <linux/interrupt.h> #include <asm/hardware.h> #include <asm/mach/irq.h> -#include <asm/irq.h> -#include <asm/io.h> +#include <linux/irq.h> +#include <linux/io.h> + +/* selected INTC register offsets */ #define INTC_REVISION 0x0000#define INTC_SYSCONFIG 0x0010
@@ -42,36 +44,49 @@ static struct omap_irq_bank { }, }; +/* INTC bank register get/set */ + +static void intc_bank_write_reg (u32 val,struct omap_irq_bank *bank,u16 reg) +{ +pr_debug ("intc_write_reg: writing 0x%0x to 0x%0x\n" , val, + (__force u32)(bank->base_reg + reg)); + +omap_writel (val, bank->base_reg + reg); +} + +static u32 intc_bank_read_reg (struct omap_irq_bank *bank,u16 reg) +{ +return omap_readl (bank->base_reg + reg); +} +/* XXX: FIQ and additional INTC support (only MPU at the moment) */ static void omap_ack_irq (unsigned int irq) { -__raw_writel (0x1 , irq_banks[0 ].base_reg +INTC_CONTROL ); +intc_bank_write_reg (0x1 , &irq_banks[0 ],INTC_CONTROL ); }static void omap_mask_irq (unsigned int irq) {int offset = (irq >>5 ) <<5 ; -if (irq >=64 ) { +if (irq >=64 ) irq %=64 ; - }else if (irq >=32 ) { +else if (irq >=32 ) irq %=32 ; - } -__raw_writel (1 << irq, irq_banks[0 ].base_reg +INTC_MIR_SET0 + offset); +intc_bank_write_reg (1 << irq, &irq_banks[0 ],INTC_MIR_SET0 + offset); }static void omap_unmask_irq (unsigned int irq) {int offset = (irq >>5 ) <<5 ; -if (irq >=64 ) { +if (irq >=64 ) irq %=64 ; - }else if (irq >=32 ) { +else if (irq >=32 ) irq %=32 ; - } -__raw_writel (1 << irq, irq_banks[0 ].base_reg +INTC_MIR_CLEAR0 + offset); +intc_bank_write_reg (1 << irq, &irq_banks[0 ],INTC_MIR_CLEAR0 + offset); }static void omap_mask_ack_irq (unsigned int irq)
@@ -91,20 +106,20 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) {unsigned long tmp; - tmp =__raw_readl (bank->base_reg +INTC_REVISION ) &0xff ; + tmp =intc_bank_read_reg (bank,INTC_REVISION ) &0xff ;printk (KERN_INFO "IRQ: Found an INTC at 0x%08lx " "(revision %ld.%ld) with %d interrupts\n" , bank->base_reg, tmp >>4 , tmp &0xf , bank->nr_irqs); - tmp =__raw_readl (bank->base_reg +INTC_SYSCONFIG ); + tmp =intc_bank_read_reg (bank,INTC_SYSCONFIG ); tmp |=1 <<1 ;/* soft reset */ -__raw_writel (tmp, bank->base_reg +INTC_SYSCONFIG ); +intc_bank_write_reg (tmp, bank,INTC_SYSCONFIG ); -while (!(__raw_readl (bank->base_reg +INTC_SYSSTATUS ) &0x1 )) +while (!(intc_bank_read_reg (bank,INTC_SYSSTATUS ) &0x1 ))/* Wait for reset to complete */ ;/* Enable autoidle */ -__raw_writel (1 <<0 , bank->base_reg +INTC_SYSCONFIG ); +intc_bank_write_reg (1 <<0 , bank,INTC_SYSCONFIG ); }void __init omap_init_irq (void )
@@ -116,12 +131,11 @@ void __init omap_init_irq(void)for (i =0 ; i <ARRAY_SIZE (irq_banks); i++) {struct omap_irq_bank *bank = irq_banks + i; -if (cpu_is_omap24xx ()) { - bank->base_reg =IO_ADDRESS (OMAP24XX_IC_BASE ); - } -if (cpu_is_omap34xx ()) { - bank->base_reg =IO_ADDRESS (OMAP34XX_IC_BASE ); - } +if (cpu_is_omap24xx ()) + bank->base_reg =OMAP24XX_IC_BASE ; +else if (cpu_is_omap34xx ()) + bank->base_reg =OMAP34XX_IC_BASE ; +omap_irq_bank_init_one (bank); nr_irqs += bank->nr_irqs;
Paul Walmsley
maintainerPATCH 4/5 fix sparse, checkpatch warnings in OMAP2/3 SCM code
In reply to Paul WalmsleyFix sparse warnings with the OMAP2 SCM code. Involves tagging appropriate pointer<->integer type conversions with __force. Also fix a checkpatch warning re: conversion of asm/ includes to linux/.
---
arch/arm/mach-omap2/control.c | 13 ++++++------- include/asm-arm/arch-omap/control.h | 16 ++++++++-------- 2 files changed, 14 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/control.c +6 -7
@@ -13,15 +13,14 @@#undef DEBUG#include <linux/kernel.h> - -#include <asm/io.h> +#include <linux/io.h> #include <asm/arch/control.h> static u32 omap2_ctrl_base; -#define OMAP_CTRL_REGADDR (reg) (void __iomem *)IO_ADDRESS(omap2_ctrl_base \ - + (reg)) +#define OMAP_CTRL_REGADDR (reg) \ + (__force void __iomem *)IO_ADDRESS(omap2_ctrl_base + (reg))void omap_ctrl_base_set (u32 base) {
@@ -51,7 +50,7 @@ u32 omap_ctrl_readl(u16 offset)void omap_ctrl_writeb (u8 val,u16 offset) {pr_debug ("omap_ctrl_writeb: writing 0x%0x to 0x%0x\n" , val, - (u32 )OMAP_CTRL_REGADDR (offset)); + (__force u32 )OMAP_CTRL_REGADDR (offset));__raw_writeb (val,OMAP_CTRL_REGADDR (offset)); }
@@ -59,7 +58,7 @@ void omap_ctrl_writeb(u8 val, u16 offset)void omap_ctrl_writew (u16 val,u16 offset) {pr_debug ("omap_ctrl_writew: writing 0x%0x to 0x%0x\n" , val, - (u32 )OMAP_CTRL_REGADDR (offset)); + (__force u32 )OMAP_CTRL_REGADDR (offset));__raw_writew (val,OMAP_CTRL_REGADDR (offset)); }
@@ -67,7 +66,7 @@ void omap_ctrl_writew(u16 val, u16 offset)void omap_ctrl_writel (u32 val,u16 offset) {pr_debug ("omap_ctrl_writel: writing 0x%0x to 0x%0x\n" , val, - (u32 )OMAP_CTRL_REGADDR (offset)); + (__force u32 )OMAP_CTRL_REGADDR (offset));__raw_writel (val,OMAP_CTRL_REGADDR (offset)); }
include/asm-arm/arch-omap/control.h +8 -8
@@ -1,13 +1,10 @@ -#ifndef __ASM_ARCH_CONTROL_H -#define __ASM_ARCH_CONTROL_H -/* * include/asm-arm/arch-omap/control.h * * OMAP2/3 System Control Module definitions * -* Copyright (C) 2007 Texas Instruments, Inc. -* Copyright (C) 2007 Nokia Corporation +* Copyright (C) 2007-2008 Texas Instruments, Inc. +* Copyright (C) 2007-2008 Nokia Corporation * * Written by Paul Walmsley *
@@ -16,14 +13,17 @@* the Free Software Foundation. */ +#ifndef __ASM_ARCH_CONTROL_H +#define __ASM_ARCH_CONTROL_H +#include <asm/arch/io.h> #define OMAP242X_CTRL_REGADDR (reg) \ - (void __iomem *)IO_ADDRESS(OMAP242X_CTRL_BASE + (reg)) + (__force void __iomem *)IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))#define OMAP243X_CTRL_REGADDR (reg) \ - (void __iomem *)IO_ADDRESS(OMAP243X_CTRL_BASE + (reg)) + (__force void __iomem *)IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))#define OMAP343X_CTRL_REGADDR (reg) \ - (void __iomem *)IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) + (__force void __iomem *)IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))/* * As elsewhere, the "OMAP2_" prefix indicates that the macro is valid for
Paul Walmsley
maintainerPATCH 5/5 Fix remaining sparse warnings in arch/arm/mach-omap2
In reply to Paul WalmsleyFix remaining sparse warnings in arch/arm/mach-omap2/. These fixes
mostly consist of:
- tagging appropriate integer<->pointer casts with __force
- marking private structures and functions as static; adding function prototypes in .h files for public functions
- assigning NULL to pointers, not 0
- adding prototypes for *_init() functions in the appropriate header files, and getting rid of the corresponding open-coded extern prototypes in other C files
Also clean up checkpatch issues - this mostly involves converting some asm/ includes to linux/ includes.
While here, shrink some bitfields in struct omap_pwm_led_platform_data down to the smallest possible type.
---
arch/arm/mach-omap2/devices.c | 10 +++++----- arch/arm/mach-omap2/id.c | 9 ++++----- arch/arm/mach-omap2/io.c | 3 --- arch/arm/mach-omap2/mux.c | 14 ++++++-------- arch/arm/mach-omap2/serial.c | 21 ++++++++++++--------- arch/arm/mach-omap2/usb-ehci.c | 2 +- include/asm-arm/arch-omap/board-3430sdp.h | 1 + include/asm-arm/arch-omap/board.h | 6 +++--- include/asm-arm/arch-omap/cpu.h | 6 +++++- include/asm-arm/arch-omap/mmc.h | 4 ++++ include/asm-arm/arch-omap/omapfb.h | 1 + include/asm-arm/arch-omap/system.h | 4 ++-- include/asm-arm/arch-omap/timex.h | 2 ++ include/asm-arm/arch-omap/usb.h | 3 +++ 14 files changed, 49 insertions(+), 37 deletions(-)
arch/arm/mach-omap2/devices.c +5 -5
@@ -13,9 +13,9 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> +#include <linux/io.h> #include <asm/hardware.h> -#include <asm/io.h> #include <asm/mach-types.h> #include <asm/mach/map.h>
@@ -149,7 +149,7 @@ static struct resource omap2_mcspi1_resources[] = { }, }; -struct platform_device omap2_mcspi1 = { +static struct platform_device omap2_mcspi1 = { .name ="omap2_mcspi" , .id =1 , .num_resources =ARRAY_SIZE (omap2_mcspi1_resources),
@@ -171,7 +171,7 @@ static struct resource omap2_mcspi2_resources[] = { }, }; -struct platform_device omap2_mcspi2 = { +static struct platform_device omap2_mcspi2 = { .name ="omap2_mcspi" , .id =2 , .num_resources =ARRAY_SIZE (omap2_mcspi2_resources),
@@ -194,7 +194,7 @@ static struct resource omap2_mcspi3_resources[] = { }, }; -struct platform_device omap2_mcspi3 = { +static struct platform_device omap2_mcspi3 = { .name ="omap2_mcspi" , .id =3 , .num_resources =ARRAY_SIZE (omap2_mcspi3_resources),
@@ -218,7 +218,7 @@ static struct resource omap2_mcspi4_resources[] = { }, }; -struct platform_device omap2_mcspi4 = { +static struct platform_device omap2_mcspi4 = { .name ="omap2_mcspi" , .id =4 , .num_resources =ARRAY_SIZE (omap2_mcspi4_resources),
arch/arm/mach-omap2/id.c +4 -5
@@ -14,18 +14,17 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> - -#include <asm/io.h> +#include <linux/io.h> #include <asm/arch/control.h> #include <asm/arch/cpu.h> #if defined(CONFIG_ARCH_OMAP2420 ) -#define TAP_BASE io_p2v(0x48014000) +#define TAP_BASE (__force void __iomem *)io_p2v(0x48014000)#elif defined(CONFIG_ARCH_OMAP2430 ) -#define TAP_BASE io_p2v(0x4900A000) +#define TAP_BASE (__force void __iomem *)io_p2v(0x4900A000)#elif defined(CONFIG_ARCH_OMAP34XX ) -#define TAP_BASE io_p2v(0x4830A000) +#define TAP_BASE (__force void __iomem *)io_p2v(0x4830A000)#endif #define OMAP_TAP_IDCODE 0x0204
arch/arm/mach-omap2/io.c +0 -3
@@ -38,9 +38,6 @@#include <asm/arch/clockdomain.h> #include "clockdomains.h" -extern void omap2_check_revision (void ); -extern void omapfb_reserve_sdram (void ); -/* * The machine specific code may provide the extra mapping besides the * default mapping provided here.
arch/arm/mach-omap2/mux.c +6 -8
@@ -26,7 +26,7 @@#include <linux/module.h> #include <linux/init.h> #include <asm/system.h> -#include <asm/io.h> +#include <linux/io.h> #include <linux/spinlock.h> #include <asm/arch/control.h>
@@ -365,7 +365,7 @@ MUX_CFG_34XX("AA12_3430_USB3HS_TLL_D7", 0x172,#endif /* CONFIG_ARCH_OMAP34XX */ #if defined(CONFIG_OMAP_MUX_DEBUG ) || defined(CONFIG_OMAP_MUX_WARNINGS ) -void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 reg) +static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 reg) {u16 orig;u8 warn =0 , debug =0 ;
@@ -409,11 +409,11 @@ int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)return 0 ; }#else -#define omap24xx_cfg_reg 0 +#define omap24xx_cfg_reg NULL#endif #ifdef CONFIG_ARCH_OMAP34XX -int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) +static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) {static DEFINE_SPINLOCK (mux_spin_lock);unsigned long flags;
@@ -428,7 +428,7 @@ int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) return 0; }#else -#define omap34xx_cfg_reg 0 +#define omap34xx_cfg_reg NULL#endif int __init omap2_mux_init (void )
@@ -437,9 +437,7 @@ int __init omap2_mux_init(void) arch_mux_cfg.pins = omap24xx_pins; arch_mux_cfg.size =OMAP24XX_PINS_SZ ; arch_mux_cfg.cfg_reg = omap24xx_cfg_reg; - } - -if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) { arch_mux_cfg.pins = omap34xx_pins; arch_mux_cfg.size =OMAP34XX_PINS_SZ ; arch_mux_cfg.cfg_reg = omap34xx_cfg_reg;
arch/arm/mach-omap2/serial.c +12 -9
@@ -28,7 +28,7 @@ static struct clk *uart_fck[OMAP_MAX_NR_PORTS];static struct plat_serial8250_port serial_platform_data[] = { { - .membase = (char *)IO_ADDRESS (OMAP_UART1_BASE ), + .membase = (__force void __iomem *)IO_ADDRESS (OMAP_UART1_BASE ), .mapbase = (unsigned long )OMAP_UART1_BASE , .irq =72 , .flags =UPF_BOOT_AUTOCONF ,
@@ -36,7 +36,7 @@ static struct plat_serial8250_port serial_platform_data[] = { .regshift = 2, .uartclk = OMAP24XX_BASE_BAUD * 16, }, { - .membase = (char *)IO_ADDRESS(OMAP_UART2_BASE), + .membase = (__force void __iomem *)IO_ADDRESS(OMAP_UART2_BASE), .mapbase = (unsigned long)OMAP_UART2_BASE, .irq = 73, .flags = UPF_BOOT_AUTOCONF,
@@ -44,7 +44,7 @@ static struct plat_serial8250_port serial_platform_data[] = { .regshift = 2, .uartclk = OMAP24XX_BASE_BAUD * 16, }, { - .membase = (char *)IO_ADDRESS(OMAP_UART3_BASE), + .membase = (__force void __iomem *)IO_ADDRESS(OMAP_UART3_BASE), .mapbase = (unsigned long)OMAP_UART3_BASE, .irq = 74, .flags = UPF_BOOT_AUTOCONF,
@@ -67,7 +67,7 @@ static inline void serial_write_reg(struct plat_serial8250_port *p, int offset, int value) { offset <<= p->regshift; -__raw_writeb (value, (unsigned long )(p->membase + offset)); +__raw_writeb (value, p->membase + offset); }/*
@@ -87,12 +87,15 @@ void omap_serial_enable_clocks(int enable) {int i;for (i =0 ; i <OMAP_MAX_NR_PORTS ; i++) { -if (uart_ick[i]) - enable ?clk_enable (uart_ick[i]) : +if (uart_ick[i] && uart_fck[i]) { +if (enable) { +clk_enable (uart_ick[i]); +clk_enable (uart_fck[i]); + }else {clk_disable (uart_ick[i]); -if (uart_fck[i]) - enable ?clk_enable (uart_fck[i]) :clk_disable (uart_fck[i]); + } + } } }
@@ -117,7 +120,7 @@ void __init omap_serial_init(void)struct plat_serial8250_port *p = serial_platform_data + i;if (!(info->enabled_uarts & (1 << i))) { - p->membase =0 ; + p->membase =NULL ; p->mapbase =0 ;continue ; }
arch/arm/mach-omap2/usb-ehci.c +1 -1
@@ -48,7 +48,7 @@ static struct platform_device ehci_device = { .dev = { .dma_mask = &ehci_dmamask, .coherent_dma_mask = 0xffffffff, - .platform_data = 0x0, + .platform_data = NULL, }, .num_resources = ARRAY_SIZE(ehci_resources), .resource = ehci_resources,
include/asm-arm/arch-omap/board-3430sdp.h +1 -0
@@ -30,6 +30,7 @@#define __ASM_ARCH_OMAP_3430SDP_Hextern void sdp3430_usb_init (void ); +extern void sdp3430_flash_init (void );#define DEBUG_BASE 0x08000000/* debug board */
include/asm-arm/arch-omap/board.h +3 -3
@@ -128,9 +128,9 @@ struct omap_pwm_led_platform_data {struct omap_gpio_switch_config {char name[12 ];u16 gpio; -int flags:4 ; -int type:4 ; -int key_code:24 ;/* Linux key code */ +u8 flags:4 ; +u8 type:4 ; +unsigned int key_code:24 ;/* Linux key code */ };struct omap_uart_config {
include/asm-arm/arch-omap/cpu.h +5 -1
@@ -26,6 +26,8 @@#ifndef __ASM_ARCH_OMAP_CPU_H#define __ASM_ARCH_OMAP_CPU_H +#include <linux/init.h> +struct omap_chip_id {u8 oc; };
@@ -395,6 +397,8 @@ int omap_chip_is(struct omap_chip_id oci);#define is_device_type_gp () (get_device_type() == DEVICE_TYPE_GP)#define is_device_type_bad () (get_device_type() == DEVICE_TYPE_BAD) -#endif +void __init omap2_check_revision (void ); + +#endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */ #endif
include/asm-arm/arch-omap/mmc.h +4 -0
@@ -71,4 +71,8 @@ extern void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *inf/* called from board-specific card detection service routine */ extern void omap_mmc_notify_cover_event (struct device *dev,int slot,int is_closed); +#if defined(CONFIG_MMC_OMAP_HS ) || defined(CONFIG_MMC_OMAP_HS_MODULE ) +void __init hsmmc_init (void ); +#endif +#endif
include/asm-arm/arch-omap/omapfb.h +1 -0
@@ -376,6 +376,7 @@ extern struct lcd_ctrl omap1_lcd_ctrl;extern struct lcd_ctrl omap2_disp_ctrl;#endif +extern void omapfb_reserve_sdram (void );extern void omapfb_register_panel (struct lcd_panel *panel);extern void omapfb_write_first_pixel (struct omapfb_device *fbdev,u16 pixval); extern void omapfb_notify_clients(struct omapfb_device *fbdev,
include/asm-arm/arch-omap/system.h +2 -2
@@ -9,12 +9,12 @@#include <asm/mach-types.h> #include <asm/hardware.h> +#include <asm/arch/prcm.h> +#ifndef CONFIG_MACH_VOICEBLUE #define voiceblue_reset () do {} while (0)#endif -extern void omap_prcm_arch_reset (char mode); -static inline void arch_idle (void ) {cpu_do_idle ();
include/asm-arm/arch-omap/timex.h +2 -0
@@ -38,4 +38,6 @@#define CLOCK_TICK_RATE (HZ * 100000UL)#endif +extern struct sys_timer omap_timer; +#endif /* __ASM_ARCH_OMAP_TIMEX_H */
include/asm-arm/arch-omap/usb.h +3 -0
@@ -27,6 +27,9 @@#define UDC_BASE OMAP2_UDC_BASE#define OMAP_OHCI_BASE OMAP2_OHCI_BASE +void __init usb_musb_init (void ); +void __init usb_ehci_init (void ); +#endif /*-------------------------------------------------------------------------*/
Tony Lindgren
maintainerQuoted 13 lines · Paul Walmsley
It's springtime in the Northern Hemisphere; time for plants to flower, students to graduate, or not, and Linux hackers to generate cleanup patches against the source tree...
These patches fix all of the sparse warnings against the
arch/arm/mach-omap2directory, and fix some of the checkpatch.pl warnings also. The individual patch descriptions discuss the main changes involved. sparse did find a few stinkers - I think the worst was a shadowed variable inclock.c.There are a few other minor changes involved. The main one was that the
unlikely()andlikely()branch predictor hints got removed.
Quoted 6 lines
The sparse fixes do have one downside: some additional uglification, caused by the addition of
__forcetopointer->integerandinteger->pointercasts. The rest of the kernel seems to have accepted this tradeoff.Compile-tested with OSK5912, N800, 2430SDP, and 3430SDP configs; boot-tested on 3430SDP ES2.
Pushing today.
Tony
Quoted 52 lines
- Paul
---
diffstat:
arch/arm/mach-omap2/clock.c | 107 ++++++++++++++--------------- arch/arm/mach-omap2/clock.h | 4 + arch/arm/mach-omap2/clock24xx.c | 23 +++--- arch/arm/mach-omap2/clockdomain.c | 5 + arch/arm/mach-omap2/cm.h | 4 + arch/arm/mach-omap2/control.c | 13 ++-- arch/arm/mach-omap2/devices.c | 10 +-- arch/arm/mach-omap2/gpmc.c | 42 ++++++----- arch/arm/mach-omap2/id.c | 9 +- arch/arm/mach-omap2/io.c | 15 ++-- arch/arm/mach-omap2/irq.c | 58 ++++++++++------ arch/arm/mach-omap2/memory.h | 7 ++ arch/arm/mach-omap2/mux.c | 14 ++-- arch/arm/mach-omap2/pm.c | 37 ++++++---- arch/arm/mach-omap2/powerdomain.c | 2 - arch/arm/mach-omap2/prcm.c | 12 ++- arch/arm/mach-omap2/prm.h | 6 +- arch/arm/mach-omap2/sdrc.h | 4 + arch/arm/mach-omap2/serial.c | 21 +++--- arch/arm/mach-omap2/usb-ehci.c | 2 - include/asm-arm/arch-omap/board-3430sdp.h | 1 include/asm-arm/arch-omap/board.h | 6 +- include/asm-arm/arch-omap/clock.h | 7 +- include/asm-arm/arch-omap/control.h | 16 ++-- include/asm-arm/arch-omap/cpu.h | 6 +- include/asm-arm/arch-omap/mmc.h | 4 + include/asm-arm/arch-omap/omap24xx.h | 1 include/asm-arm/arch-omap/omapfb.h | 1 include/asm-arm/arch-omap/powerdomain.h | 1 include/asm-arm/arch-omap/prcm.h | 5 + include/asm-arm/arch-omap/sram.h | 1 include/asm-arm/arch-omap/system.h | 4 + include/asm-arm/arch-omap/timex.h | 2 + include/asm-arm/arch-omap/usb.h | 3 + 34 files changed, 247 insertions(+), 206 deletions(-)size:
text data bss dec hex filename3271533 155216 101256 3528005 35d545 vmlinux.3430sdp.orig 3271501 155216 101256 3527973 35d525 vmlinux.3430sdp.patched--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html