All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-fbdev@vger.kernel.org, llvm@lists.linux.dev,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	dri-devel@lists.freedesktop.org,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Nathan Chancellor <nathan@kernel.org>,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	Nicolas Ferre <nicolas.ferre@microchip.com>
Subject: Re: [PATCH 02/22] fb: atmel_lcdfb: Stop using platform_driver_probe()
Date: Thu, 9 Nov 2023 10:55:41 +0100	[thread overview]
Message-ID: <57de52b3-201b-4599-83ba-b0a7cc8db350@gmx.de> (raw)
In-Reply-To: <20231109062459.5hk7vb54t4iy5kp6@pengutronix.de>

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));

so, the compiler copies the "__initconst" data over to the info->fix struct.

Helge

WARNING: multiple messages have this Message-ID (diff)
From: Helge Deller <deller@gmx.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-fbdev@vger.kernel.org, llvm@lists.linux.dev,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	dri-devel@lists.freedesktop.org,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Nathan Chancellor <nathan@kernel.org>,
	kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 02/22] fb: atmel_lcdfb: Stop using platform_driver_probe()
Date: Thu, 9 Nov 2023 10:55:41 +0100	[thread overview]
Message-ID: <57de52b3-201b-4599-83ba-b0a7cc8db350@gmx.de> (raw)
In-Reply-To: <20231109062459.5hk7vb54t4iy5kp6@pengutronix.de>

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));

so, the compiler copies the "__initconst" data over to the info->fix struct.

Helge

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-11-09  9:56 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  9:17 [PATCH 00/22] fb: handle remove callbacks in .exit.text and convert to .remove_new Uwe Kleine-König
2023-11-07  9:17 ` Uwe Kleine-König
2023-11-07  9:17 ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 01/22] fb: amifb: Stop using platform_driver_probe() Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-08 21:06   ` Geert Uytterhoeven
2023-11-08 21:06     ` Geert Uytterhoeven
2023-11-08 21:32     ` Helge Deller
2023-11-08 21:32       ` Helge Deller
2023-11-08 21:34       ` Geert Uytterhoeven
2023-11-08 21:34         ` Geert Uytterhoeven
2023-11-09 20:31         ` Helge Deller
2023-11-09 20:31           ` Helge Deller
2023-11-07  9:17 ` [PATCH 02/22] fb: atmel_lcdfb: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07 19:20   ` kernel test robot
2023-11-07 20:01   ` Uwe Kleine-König
2023-11-07 20:01     ` Uwe Kleine-König
2023-11-07 20:01     ` Uwe Kleine-König
2023-11-07 20:37     ` Helge Deller
2023-11-07 20:37       ` Helge Deller
2023-11-07 20:37       ` Helge Deller
2023-11-08 18:48   ` Nathan Chancellor
2023-11-08 18:48     ` Nathan Chancellor
2023-11-08 18:48     ` Nathan Chancellor
2023-11-08 20:27     ` Helge Deller
2023-11-08 20:27       ` Helge Deller
2023-11-08 20:27       ` Helge Deller
2023-11-08 21:00     ` Uwe Kleine-König
2023-11-08 21:00       ` Uwe Kleine-König
2023-11-08 21:24       ` Helge Deller
2023-11-08 21:24         ` Helge Deller
2023-11-08 21:24         ` Helge Deller
2023-11-08 21:52         ` Uwe Kleine-König
2023-11-08 21:52           ` Uwe Kleine-König
2023-11-08 21:52           ` Uwe Kleine-König
2023-11-08 21:57           ` Helge Deller
2023-11-08 21:57             ` Helge Deller
2023-11-08 21:57             ` Helge Deller
2023-11-09  6:24             ` Uwe Kleine-König
2023-11-09  6:24               ` Uwe Kleine-König
2023-11-09  9:55               ` Helge Deller [this message]
2023-11-09  9:55                 ` Helge Deller
2023-11-09 10:20                 ` Nicolas Ferre
2023-11-09 10:20                   ` Nicolas Ferre
2023-11-09 10:20                   ` Nicolas Ferre
2023-11-09 10:32                 ` Uwe Kleine-König
2023-11-09 10:32                   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 03/22] fb: omapfb/analog-tv: Don't put .remove() in .exit.text and drop suppress_bind_attrs Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 04/22] fb: omapfb/dpi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 05/22] fb: omapfb/dsi-cm: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 06/22] fb: omapfb/dvi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 07/22] fb: omapfb/hdmi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 08/22] fb: omapfb/opa362: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 09/22] fb: omapfb/sharp-ls037v7dw01: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 10/22] fb: omapfb/tfp410: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 11/22] fb: omapfb/tpd12s015: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 12/22] fb: amifb: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 13/22] fb: atmel_lcdfb: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 14/22] fb: omapfb/analog-tv: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 15/22] fb: omapfb/dpi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 16/22] fb: omapfb/dsi-cm: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 17/22] fb: omapfb/dvi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 18/22] fb: omapfb/hdmi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 19/22] fb: omapfb/opa362: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 20/22] fb: omapfb/sharp-ls037v7dw01: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 21/22] fb: omapfb/tfp410: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 22/22] fb: omapfb/tpd12s015: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07 13:57 ` [PATCH 00/22] fb: handle remove callbacks in .exit.text and convert to .remove_new Helge Deller
2023-11-07 13:57   ` Helge Deller
2023-11-07 13:57   ` Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57de52b3-201b-4599-83ba-b0a7cc8db350@gmx.de \
    --to=deller@gmx.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.