Re: [PATCH 02/22] fb: atmel_lcdfb: Stop using platform_driver_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Helge,

On Thu, Nov 09, 2023 at 10:55:41AM +0100, Helge Deller wrote:
> On 11/9/23 07:24, Uwe Kleine-König wrote:
> > Hello,
> > 
> > On Wed, Nov 08, 2023 at 10:57:00PM +0100, Helge Deller wrote:
> > > On 11/8/23 22:52, Uwe Kleine-König wrote:
> > > > But info and so info->fix live longer than the probe function, don't
> > > > they?
> > > 
> > > Yes, they do.
> > > But AFAICS info->fix contains a *copy* of the initial atmel_lcdfb_fix struct
> > > (and not a pointer to it). So that should be ok.
> > 
> > If you say so that's good. I grepped a bit around and didn't find a
> > place where a copy is made. But that's probably me and I'll consider the
> > case closed.
> 
> It's not directly obvious, but the copy happens in the line you pointed
> out previously.
> 
> In include/linux/fb.h:
> 
> struct fb_info {
> ...
>         struct fb_var_screeninfo var;   /* Current var */
>         struct fb_fix_screeninfo fix;   /* Current fix */
> 
> so, "fb_info.fix" is a struct, and not a pointer.
> 
> In drivers/video/fbdev/atmel_lcdfb.c:
> static int atmel_lcdfb_probe(struct platform_device *pdev)
> {
> ...
>         info->fix = atmel_lcdfb_fix;  //  (line 1065)
> 
> this becomes effectively a:
> 	memcpy(&info->fix, &atmel_lcdfb_fix, sizeof(struct fb_fix_screeninfo));

Ah right. Thanks for that hint. I didn't spot this and grepped for
memcpy and memdup.

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux