Message ID | 1407914239-12054-2-git-send-email-libv@skynet.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi On Wed, Aug 13, 2014 at 9:17 AM, Luc Verhaegen <libv@skynet.be> wrote: > Signed-off-by: Luc Verhaegen <libv@skynet.be> > --- > drivers/video/fbdev/simplefb.c | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c > index 210f3a0..32be590 100644 > --- a/drivers/video/fbdev/simplefb.c > +++ b/drivers/video/fbdev/simplefb.c > @@ -41,6 +41,8 @@ static struct fb_var_screeninfo simplefb_var = { > .vmode = FB_VMODE_NONINTERLACED, > }; > > +#define PSEUDO_PALETTE_SIZE 16 > + > static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, > u_int transp, struct fb_info *info) > { > @@ -50,7 +52,7 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, > u32 cb = blue >> (16 - info->var.blue.length); > u32 value; > > - if (regno >= 16) > + if (regno >= PSEUDO_PALETTE_SIZE) > return -EINVAL; > > value = (cr << info->var.red.offset) | > @@ -163,11 +165,16 @@ static int simplefb_parse_pd(struct platform_device *pdev, > return 0; > } > > +struct simplefb_par { > + u32 palette[PSEUDO_PALETTE_SIZE]; > +}; > + I'd move that definition to the top of the file. > static int simplefb_probe(struct platform_device *pdev) > { > int ret; > struct simplefb_params params; > struct fb_info *info; > + struct simplefb_par *par; > struct resource *mem; > > if (fb_get_options("simplefb", NULL)) > @@ -188,11 +195,13 @@ static int simplefb_probe(struct platform_device *pdev) > return -EINVAL; > } > > - info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev); > + info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); > if (!info) > return -ENOMEM; > platform_set_drvdata(pdev, info); > > + par = info->par; > + > info->fix = simplefb_fix; > info->fix.smem_start = mem->start; > info->fix.smem_len = resource_size(mem); > @@ -225,7 +234,7 @@ static int simplefb_probe(struct platform_device *pdev) > framebuffer_release(info); > return -ENODEV; > } > - info->pseudo_palette = (void *)(info + 1); > + info->pseudo_palette = (void *) par->palette; I think coding-style is this (i.e., no whitespace): info->pseudo_palette = (void*)par->palette; Patch is fine with me: Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Thanks David > > dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", > info->fix.smem_start, info->fix.smem_len, > -- > 1.7.7 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 13, 2014 at 9:25 AM, David Herrmann <dh.herrmann@gmail.com> wrote: >> @@ -225,7 +234,7 @@ static int simplefb_probe(struct platform_device *pdev) >> framebuffer_release(info); >> return -ENODEV; >> } >> - info->pseudo_palette = (void *)(info + 1); >> + info->pseudo_palette = (void *) par->palette; > > I think coding-style is this (i.e., no whitespace): > info->pseudo_palette = (void*)par->palette; <casts-are-evil> Is this cast even needed? </casts-are-evil> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi On Wed, Aug 13, 2014 at 10:46 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Wed, Aug 13, 2014 at 9:25 AM, David Herrmann <dh.herrmann@gmail.com> wrote: >>> @@ -225,7 +234,7 @@ static int simplefb_probe(struct platform_device *pdev) >>> framebuffer_release(info); >>> return -ENODEV; >>> } >>> - info->pseudo_palette = (void *)(info + 1); >>> + info->pseudo_palette = (void *) par->palette; >> >> I think coding-style is this (i.e., no whitespace): >> info->pseudo_palette = (void*)par->palette; > > <casts-are-evil> > Is this cast even needed? > </casts-are-evil> "pseudo_palette" is "void*", so not at all. Thanks David -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 08/13/2014 01:17 AM, Luc Verhaegen wrote: > Signed-off-by: Luc Verhaegen <libv@skynet.be> Patch description? Assuming any comments anyone else had are addressed, patches 1 and 2 both, Acked-by: Stephen Warren <swarren@nvidia.com> -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 210f3a0..32be590 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -41,6 +41,8 @@ static struct fb_var_screeninfo simplefb_var = { .vmode = FB_VMODE_NONINTERLACED, }; +#define PSEUDO_PALETTE_SIZE 16 + static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) { @@ -50,7 +52,7 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u32 cb = blue >> (16 - info->var.blue.length); u32 value; - if (regno >= 16) + if (regno >= PSEUDO_PALETTE_SIZE) return -EINVAL; value = (cr << info->var.red.offset) | @@ -163,11 +165,16 @@ static int simplefb_parse_pd(struct platform_device *pdev, return 0; } +struct simplefb_par { + u32 palette[PSEUDO_PALETTE_SIZE]; +}; + static int simplefb_probe(struct platform_device *pdev) { int ret; struct simplefb_params params; struct fb_info *info; + struct simplefb_par *par; struct resource *mem; if (fb_get_options("simplefb", NULL)) @@ -188,11 +195,13 @@ static int simplefb_probe(struct platform_device *pdev) return -EINVAL; } - info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev); + info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); if (!info) return -ENOMEM; platform_set_drvdata(pdev, info); + par = info->par; + info->fix = simplefb_fix; info->fix.smem_start = mem->start; info->fix.smem_len = resource_size(mem); @@ -225,7 +234,7 @@ static int simplefb_probe(struct platform_device *pdev) framebuffer_release(info); return -ENODEV; } - info->pseudo_palette = (void *)(info + 1); + info->pseudo_palette = (void *) par->palette; dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", info->fix.smem_start, info->fix.smem_len,
Signed-off-by: Luc Verhaegen <libv@skynet.be> --- drivers/video/fbdev/simplefb.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)