* [PATCH] Staging: fbtft: Fix iomem dereference
@ 2015-08-18 6:46 Ronit Halder
2015-08-18 8:57 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Ronit Halder @ 2015-08-18 6:46 UTC (permalink / raw)
To: thomas.petazzoni; +Cc: noralf, gregkh, devel, linux-kernel, Ronit Halder
This patch fixes the warning generated by sparse
"cast removes address space of expression" by using ioread16
function insted of directly dereferencing I/O memory.
Signed-off-by: Ronit halder <ronit.crj@gmail.com>
---
drivers/staging/fbtft/fb_agm1264k-fl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
index 94dd49c..59826a4 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;
+ void __iomem *vmem16 = (u16 __iomem *)par->info->screen_base;
u8 *buf = par->txbuf.buf;
int x, y;
int ret = 0;
@@ -290,7 +290,8 @@ 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);
u16 b = pixel & 0x1f;
u16 g = (pixel & (0x3f << 5)) >> 5;
u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
--
2.4.0.GIT
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Staging: fbtft: Fix iomem dereference
2015-08-18 6:46 [PATCH] Staging: fbtft: Fix iomem dereference Ronit Halder
@ 2015-08-18 8:57 ` Dan Carpenter
2015-08-18 13:38 ` Ronit Halder
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-08-18 8:57 UTC (permalink / raw)
To: Ronit Halder; +Cc: thomas.petazzoni, devel, gregkh, noralf, linux-kernel
On Tue, Aug 18, 2015 at 12:16:57PM +0530, Ronit Halder wrote:
> This patch fixes the warning generated by sparse
> "cast removes address space of expression" by using ioread16
> function insted of directly dereferencing I/O memory.
>
> Signed-off-by: Ronit halder <ronit.crj@gmail.com>
Are these really iomem pointers? A lot of drivers use a fake
screen_base which is just a buffer of normal memory.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Staging: fbtft: Fix iomem dereference
2015-08-18 8:57 ` Dan Carpenter
@ 2015-08-18 13:38 ` Ronit Halder
0 siblings, 0 replies; 3+ messages in thread
From: Ronit Halder @ 2015-08-18 13:38 UTC (permalink / raw)
To: Dan Carpenter
Yes, it is not I/O memory address. I was wrong on that.
But it makes sparse happy.
Is here any side effect of using ioread16() ?
regards,
ronit
On Tue, Aug 18, 2015 at 2:27 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Tue, Aug 18, 2015 at 12:16:57PM +0530, Ronit Halder wrote:
>> This patch fixes the warning generated by sparse
>> "cast removes address space of expression" by using ioread16
>> function insted of directly dereferencing I/O memory.
>>
>> Signed-off-by: Ronit halder <ronit.crj@gmail.com>
>
> Are these really iomem pointers? A lot of drivers use a fake
> screen_base which is just a buffer of normal memory.
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-18 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-18 6:46 [PATCH] Staging: fbtft: Fix iomem dereference Ronit Halder
2015-08-18 8:57 ` Dan Carpenter
2015-08-18 13:38 ` Ronit Halder
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).