staging: sm750fb: Fix sparse warning
PATCH 1/1 staging: sm750fb: Fix sparse warning
This patch fixes the following sparse warning:-
drivers/staging/sm750fb/ddk750_help.c: warning: incorrect type in assignment (different address spaces)
--- drivers/staging/sm750fb/ddk750_chip.h | 4 +++- drivers/staging/sm750fb/ddk750_help.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/sm750fb/ddk750_chip.h +3 -1
@@ -3,6 +3,8 @@#define DEFAULT_INPUT_CLOCK 14318181/* Default reference clock */ #define SM750LE_REVISION_ID (char)0xfe +#include <asm/io.h> +/* This is all the chips recognized by this library */ typedef enum _logical_chip_type_t {
@@ -70,7 +72,7 @@ logical_chip_type_t getChipType(void);unsigned int calcPllValue (unsigned int request,pll_value_t *pll);unsigned int calcPllValue2 (unsigned int ,pll_value_t *);unsigned int formatPllReg (pll_value_t *pPLL); -void ddk750_set_mmio (volatile unsigned char *,unsigned short ,char ); +void ddk750_set_mmio (volatile unsigned char __iomem *,unsigned short ,char );unsigned int ddk750_getVMSize (void );int ddk750_initHw (initchip_param_t *);unsigned int getPllValue (clock_type_t clockType,pll_value_t *pPLL);
drivers/staging/sm750fb/ddk750_help.c +1 -1
@@ -7,7 +7,7 @@ char revId750 = 0;unsigned short devId750 =0 ;/* after driver mapped io registers, use this function first */ -void ddk750_set_mmio (volatile unsigned char * addr,unsigned short devId,char revId) +void ddk750_set_mmio (volatile unsigned char __iomem * addr,unsigned short devId,char revId) { mmio750 = addr; devId750 = devId;
Signature · 1 line
2.3.2
Quoted 24 lines · Lorenzo Stoakes
This patch fixes the following sparse warning:-
drivers/staging/sm750fb/ddk750_help.c: warning: incorrect type in assignment (different address spaces)Signed-off-by Lorenzo Stoakes <[email protected]>--- drivers/staging/sm750fb/ddk750_chip.h | 4 +++- drivers/staging/sm750fb/ddk750_help.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/staging/sm750fb/ddk750_chip.h +2
-0@@ -3,6 +3,8 @@#define DEFAULT_INPUT_CLOCK 14318181/* Default reference clock */ #define SM750LE_REVISION_ID (char)0xfe +#include <asm/io.h> +/* This is all the chips recognized by this library */ typedef enum _logical_chip_type_t {
drivers/staging/sm750fb/ddk750_chip.h logical_chip_type_t getChipType(void); · line 75
Quoted 5 lines
drivers/staging/sm750fb/ddk750_chip.h +1
-1@@ -70,7 +72,7 @@ logical_chip_type_t getChipType(void);unsigned int calcPllValue (unsigned int request,pll_value_t *pll);unsigned int calcPllValue2 (unsigned int ,pll_value_t *);unsigned int formatPllReg (pll_value_t *pPLL); -void ddk750_set_mmio (volatile unsigned char *,unsigned short ,char ); +void ddk750_set_mmio (volatile unsigned char __iomem *,unsigned short ,char );
No need for the volatile. Really mmio750 should be a "void __iomem *" it is declared as "unsigned char __iomem *" but it's not a char pointer that's only to make the pointer math work. It would work just as well as a void and we could remove some ugly casting.
regards,
dan carpenter
Quoted 1 line · Dan Carpenter
No need for the volatile.
Will remove.
Quoted 4 lines
Really mmio750 should be a "void
__iomem*"
it is declared as "unsigned char__iomem*" but it's not a char pointer that's only to make the pointer math work. It would work just as well as a void and we could remove some ugly casting.
I'm thinking the change to "void __iomem *" from "unsigned char __iomem *" ought to be a separate patch in order to keep this cleanly focused on solving the sparse warning? Am more than happy to do this and make the appropriate changes to the macros in ddk750_help.h.
Signature · 2 lines
Lorenzo Stoakes https:/ljs.io
Quoted 11 lines · Lorenzo Stoakes
Quoted 1 line · Dan Carpenter
No need for the volatile.
Will remove.
Quoted 4 lines
Really mmio750 should be a "void
__iomem*"
it is declared as "unsigned char__iomem*" but it's not a char pointer that's only to make the pointer math work. It would work just as well as a void and we could remove some ugly casting.
Quoted 5 lines
I'm thinking the change to "void
__iomem*" from "unsigned char__iomem*" ought to be a separate patch in order to keep this cleanly focused on solving the sparse warning? Am more than happy to do this and make the appropriate changes to the macros inddk750_help.h.
The patch is:
[patch] cleanup the type of mmio750
silencing a Sparse warning is just a side benifit of using correct data types. The "one thing per patch" rule also means that you should fix a whole problem instead of half a thing per patch.
regards,
dan carpenter
Quoted 12 lines · Dan Carpenter
The patch is:
[patch] cleanup the type of mmio750
silencing a Sparse warning is just a side benifit of using correct data types. The "one thing per patch" rule also means that you should fix a whole problem instead of half a thing per patch.
regards,
dan carpenter
Sure, sorry saw the patch as purely a sparse fixup, will adapt to be an overall mmio750 cleanup and resubmit!
Best,
Signature · 2 lines
Lorenzo Stoakes https:/ljs.io
Sudip Mukherjee
maintainerdrivers/staging/sm750fb/ddk750_chip.h line 7
Quoted 3 lines · Lorenzo Stoakes
drivers/staging/sm750fb/ddk750_chip.h +2
-0+#include <asm/io.h> +
apart from what Dan Carpenter has said,
this is introducing one checkpatch warning, better to use #include <linux/io.h> checkpatch is also giving warning about your patch subject
only one concern - if Greg first applies the patches i sent yesterday then this patch will not apply, and if this one is applied first then my series will not apply ...
regards
sudip
Quoted 6 lines
/* This is all the chips recognized by this library */
drivers/staging/sm750fb/ddk750_help.c +0
-0mmio750 = addr; devId750 = devId;Signature · 1 line
2.3.2
Quoted 1 line · Sudip Mukherjee
only one concern - if Greg first applies the patches i sent yesterday then this patch will not apply, and if this one is applied first then my series will not apply ...
Indeed, I am more than happy to adapt the patch as required if your patch series is applied first, I will keep an eye out for this, additionally if you ping me if this occurs I will fix it right away.
Best,
Signature · 2 lines
Lorenzo Stoakes https:/ljs.io