Re: [PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings

2015-02-23 Thread Andrey Utkin
2015-02-23 21:27 GMT+02:00 Noralf Trønnes nor...@tronnes.org:
 Yes, it's best to leave this alone for now.
 I'm working on a proposal to provide better layering and minimal coupling
 to fbdev. This will hopefully lead to screen_base eventually being used
 only twice in the fbtft module and nowhere else.

Ok, staying away and looking for sparse warnings for other staging drivers.
Thanks to all for comments.

-- 
Andrey Utkin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings

2015-02-21 Thread Dan Carpenter
On Fri, Feb 20, 2015 at 11:34:09PM +0200, Andrey Utkin wrote:
 See below how sparse output changed with these changes.
 In few words:
 - fixed printf specifiers for size_t;
 - trying to fix address space specifiers issues, not sure what's correct 
 approach, ASKING FOR COMMENTS AND HELP;

Send two separate patches.  You can't fix sparse warnings.  You can
only fix bugs.  The rest is add annotation, doing cleanups or possibly
silencing warnings.

 - didn't touch was not declared. Should it be static? yet.
 
 -drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_register_framebuffer’:

[ millions of lines of warnings snipped.  ]

  drivers/staging/fbtft/fbtft_device.c:32:19: warning: symbol 'spi_device' was 
 not declared. Should it be static?
  drivers/staging/fbtft/fbtft_device.c:33:24: warning: symbol 'p_device' was 
 not declared. Should it be static?

This changelog is a bit rubbish because it's just copy and pasted
warnings for things that didn't change.

 
 This is for Eudyptulla challenge. If you want me to help with any other 
 staging driver, I am open.

Don't put this in the changelog.

 diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
 b/drivers/staging/fbtft/fb_agm1264k-fl.c
 index 9cc7d25..9114239 100644
 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c
 +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
 @@ -273,7 +273,7 @@ construct_line_bitmap(struct fbtft_par *par, u8 *dest, 
 signed short *src,
  
  static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
  {
 - u16 *vmem16 = (u16 *)par-info-screen_base;
 + u16 __iomem *vmem16 = (u16 __iomem *)par-info-screen_base;

I haven't looked.  What is the type for -screen_base and why can't it
be declared as __iomem type?

   u8 *buf = par-txbuf.buf;
   int x, y;
   int ret = 0;
 @@ -287,7 +287,7 @@ static int write_vmem(struct fbtft_par *par, size_t 
 offset, size_t len)
   /* converting to grayscale16 */
   for (x = 0; x  par-info-var.xres; ++x)
   for (y = 0; y  par-info-var.yres; ++y) {
 - u16 pixel = vmem16[y *  par-info-var.xres + x];
 + u16 pixel = ioread16(vmem16 + y *  par-info-var.xres 
 + x);

You're saying this is a bug in the original code.  Are you positive?
The changelog should have explained your thinking here.  Same for all
the iomem changes.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [RFC] drivers/staging/fbtft: fix sparse warnings

2015-02-20 Thread Andrey Utkin
See below how sparse output changed with these changes.
In few words:
- fixed printf specifiers for size_t;
- trying to fix address space specifiers issues, not sure what's correct 
approach, ASKING FOR COMMENTS AND HELP;
- didn't touch was not declared. Should it be static? yet.

-drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_register_framebuffer’:
-drivers/staging/fbtft/fbtft-core.c:1004:4: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat=]
-drivers/staging/fbtft/fbtft-io.c: In function ‘fbtft_write_spi_emulate_9’:
-drivers/staging/fbtft/fbtft-io.c:63:4: warning: format ‘%d’ expects argument 
of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=]
-drivers/staging/fbtft/fbtft-io.c: In function ‘fbtft_read_spi’:
-drivers/staging/fbtft/fbtft-io.c:110:5: warning: format ‘%d’ expects argument 
of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=]
-drivers/staging/fbtft/fbtft-core.c:928:19: warning: incorrect type in argument 
1 (different address spaces)
-drivers/staging/fbtft/fbtft-core.c:928:19:expected void const *addr
-drivers/staging/fbtft/fbtft-core.c:928:19:got char [noderef] 
asn:2*screen_base
 drivers/staging/fbtft/fbtft-sysfs.c:24:5: warning: symbol 
'fbtft_gamma_parse_str' was not declared. Should it be static?
 drivers/staging/fbtft/fbtft-sysfs.c:154:6: warning: symbol 
'fbtft_expand_debug_value' was not declared. Should it be static?
 drivers/staging/fbtft/fbtft-sysfs.c:210:6: warning: symbol 'fbtft_sysfs_init' 
was not declared. Should it be static?
 drivers/staging/fbtft/fbtft-sysfs.c:217:6: warning: symbol 'fbtft_sysfs_exit' 
was not declared. Should it be static?
-drivers/staging/fbtft/fbtft-bus.c:145:19: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fbtft-bus.c:204:15: warning: incorrect type in 
assignment (different address spaces)
-drivers/staging/fbtft/fbtft-bus.c:204:15:expected unsigned char [usertype] 
*vmem8
-drivers/staging/fbtft/fbtft-bus.c:204:15:got char [noderef] asn:2*
-drivers/staging/fbtft/fbtft-bus.c:248:19: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_agm1264k-fl.c:276:24: warning: cast removes address 
space of expression
+drivers/staging/fbtft/fbtft-bus.c:152:49: warning: incorrect type in argument 
2 (different address spaces)
+drivers/staging/fbtft/fbtft-bus.c:152:49:expected void *buf
+drivers/staging/fbtft/fbtft-bus.c:152:49:got unsigned short [noderef] 
[usertype] asn:2*[assigned] vmem16
+drivers/staging/fbtft/fbtft-bus.c:254:41: warning: incorrect type in argument 
2 (different address spaces)
+drivers/staging/fbtft/fbtft-bus.c:254:41:expected void *buf
+drivers/staging/fbtft/fbtft-bus.c:254:41:got unsigned short [noderef] 
[usertype] asn:2*[assigned] vmem16
+drivers/staging/fbtft/fbtft-core.c:928:16: warning: cast removes address space 
of expression
 drivers/staging/fbtft/fb_hx8340bn.c:111:6: warning: symbol 'set_addr_win' was 
not declared. Should it be static?
-drivers/staging/fbtft/fb_pcd8544.c:113:24: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_ra8875.c:286:19: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_ssd1306.c:175:24: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_tls8204.c:102:24: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_uc1701.c:153:24: warning: cast removes address space 
of expression
-drivers/staging/fbtft/fb_watterott.c:76:24: warning: cast removes address 
space of expression
+drivers/staging/fbtft/fb_uc1701.c:153:32: warning: cast removes address space 
of expression
+drivers/staging/fbtft/fb_uc1701.c:153:32: warning: incorrect type in 
initializer (different address spaces)
+drivers/staging/fbtft/fb_uc1701.c:153:32:expected unsigned short [noderef] 
[usertype] asn:2*vmem16
+drivers/staging/fbtft/fb_uc1701.c:153:32:got unsigned short [usertype] 
*noident
+drivers/staging/fbtft/fb_watterott.c:76:32: warning: cast removes address 
space of expression
+drivers/staging/fbtft/fb_watterott.c:76:32: warning: incorrect type in 
initializer (different address spaces)
+drivers/staging/fbtft/fb_watterott.c:76:32:expected unsigned short 
[noderef] [usertype] asn:2*vmem16
+drivers/staging/fbtft/fb_watterott.c:76:32:got unsigned short [usertype] 
*noident
 drivers/staging/fbtft/fb_watterott.c:115:24: warning: cast removes address 
space of expression
 drivers/staging/fbtft/fbtft_device.c:32:19: warning: symbol 'spi_device' was 
not declared. Should it be static?
 drivers/staging/fbtft/fbtft_device.c:33:24: warning: symbol 'p_device' was not 
declared. Should it be static?

This is for Eudyptulla challenge. If you want me to help with any other staging 
driver, I am open.

Signed-off-by: Andrey Utkin andrey.krieger.ut...@gmail.com
---
 drivers/staging/fbtft/fb_agm1264k-fl.c |  4 ++--
 drivers/staging/fbtft/fb_pcd8544.c |  4 ++--