linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fb.h: Provide alternate screen_base pointer
@ 2015-10-06  7:02 Lars Svensson
  2015-10-06  7:02 ` [PATCH 2/2] staging: fbtft: fix sparse warning in call to vfree() Lars Svensson
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Svensson @ 2015-10-06  7:02 UTC (permalink / raw)
  To: thomas.petazzoni, noralf, plagnioj, tomi.valkeinen
  Cc: linux-fbdev, gregkh, devel, linux-kernel, dan.carpenter,
	Lars Svensson

Some drivers use member screen_base of struct fb_info to store non-
__iomem pointers, creating the need for ugly __force typecasts to
avoid sparse warnings. This adds an alternate pointer without the
__iomem qualifyer for this use.

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
---
New version of my previous patch, reworked as suggested by Dan
Carpenter. For the name of the pointer, "screen_buffer" was the
best I could come up with. Other suggestions?

//Lars
---
 include/linux/fb.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/fb.h b/include/linux/fb.h
index bc9afa7..41a3b11 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -483,7 +483,10 @@ struct fb_info {
 #ifdef CONFIG_FB_TILEBLITTING
 	struct fb_tile_ops *tileops;    /* Tile Blitting */
 #endif
-	char __iomem *screen_base;	/* Virtual address */
+	union {
+		char __iomem *screen_base;	/* Virtual address */
+		char *screen_buffer;
+	};
 	unsigned long screen_size;	/* Amount of ioremapped VRAM or 0 */ 
 	void *pseudo_palette;		/* Fake palette of 16 colors */ 
 #define FBINFO_STATE_RUNNING	0
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] staging: fbtft: fix sparse warning in call to vfree()
  2015-10-06  7:02 [PATCH 1/2] fb.h: Provide alternate screen_base pointer Lars Svensson
@ 2015-10-06  7:02 ` Lars Svensson
  2015-10-06  7:18   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Svensson @ 2015-10-06  7:02 UTC (permalink / raw)
  To: thomas.petazzoni, noralf, plagnioj, tomi.valkeinen
  Cc: linux-fbdev, gregkh, devel, linux-kernel, dan.carpenter,
	Lars Svensson

Member screen_base in struct fb_info is declared __iomem causing
a sparse warning as below when passed to vfree(). Instead use non-
__iomem pointer screen_buffer to avoid the warning.

fbtft-core.c:922:39: warning: incorrect type in argument 1 \
(different address spaces)
fbtft-core.c:922:39:    expected void const *addr
fbtft-core.c:922:39:    got char [noderef] <asn:2>*screen_base

Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com>
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 7f5fa3d..a5fade2 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -779,7 +779,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
 	if (!info)
 		goto alloc_fail;
 
-	info->screen_base = (u8 __force __iomem *)vmem;
+	info->screen_buffer = vmem;
 	info->fbops = fbops;
 	info->fbdefio = fbdefio;
 
@@ -919,7 +919,7 @@ EXPORT_SYMBOL(fbtft_framebuffer_alloc);
 void fbtft_framebuffer_release(struct fb_info *info)
 {
 	fb_deferred_io_cleanup(info);
-	vfree(info->screen_base);
+	vfree(info->screen_buffer);
 	framebuffer_release(info);
 }
 EXPORT_SYMBOL(fbtft_framebuffer_release);
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] staging: fbtft: fix sparse warning in call to vfree()
  2015-10-06  7:02 ` [PATCH 2/2] staging: fbtft: fix sparse warning in call to vfree() Lars Svensson
@ 2015-10-06  7:18   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-10-06  7:18 UTC (permalink / raw)
  To: Lars Svensson
  Cc: thomas.petazzoni, noralf, plagnioj, tomi.valkeinen, linux-fbdev,
	gregkh, devel, linux-kernel

Could you update everything in that directory all at once instead?

grep screen_base drivers/staging/fbtft/*c

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-06  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06  7:02 [PATCH 1/2] fb.h: Provide alternate screen_base pointer Lars Svensson
2015-10-06  7:02 ` [PATCH 2/2] staging: fbtft: fix sparse warning in call to vfree() Lars Svensson
2015-10-06  7:18   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).