public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Masahiro Yamada <masahiroy@kernel.org>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kbuild@vger.kernel.org, Richard Weinberger <richard@nod.at>,
	Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-mtd@lists.infradead.org,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vignesh Raghavendra <vigneshr@ti.com>
Subject: Re: [PATCH 01/20] mtd: rawnand: txx9ndfmc: Mark driver struct with __refdata to prevent section mismatch warning
Date: Mon, 9 Oct 2023 14:46:10 +0200	[thread overview]
Message-ID: <20231009144610.4ff82afa@xps-13> (raw)
In-Reply-To: <20231009103037.j44gkzqv7cpn4zpu@pengutronix.de>

Hello,

u.kleine-koenig@pengutronix.de wrote on Mon, 9 Oct 2023 12:30:37 +0200:

> Hello,
> 
> [Changed email address for David Woodhouse from intel to infradead]
> 
> On Mon, Oct 09, 2023 at 10:43:46AM +0200, Arnd Bergmann wrote:
> > On Mon, Oct 9, 2023, at 09:22, Masahiro Yamada wrote:  
> > > On Mon, Oct 9, 2023 at 5:02 AM Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:  
> > >>
> > >> As described in the added code comment, a reference to .exit.text is ok
> > >> for drivers registered via module_platform_driver_probe(). Make this
> > >> explicit to prevent a section mismatch warning with  
> >   
> > >
> > > We have thousands of module_platform_drivers.
> > > I would be scared if they started to add __refdata.
> > >
> > > I am not sure if this is the right direction.  
> > 
> > For a normal module_platform_driver(), this would indeed be
> > wrong, but as Uwe said above there is a special case for
> > module_platform_driver_probe(), which implicitly sets the
> > drv->driver.suppress_bind_attrs=true flag.
> >   
> > > In my understanding of the current DT overlay,
> > > there is no way to create/remove a platform device dynamically.
> > > I do not know if that will happen in the future.  
> > 
> > For drivers without suppress_bind_attrs, you can manually
> > unbind the device from a driver, which in case of a loadable
> > module ends up calling the .remove callback (this is fine),
> > but in a built-in driver this would use a NULL pointer for
> > .remove and cause unexpected behavior.  
> 
> only a slight correction: As not having a remove callback can be fine
> and platform_remove() only calls .remove (or .remove_new) when non-NULL
> we're not hitting a NULL pointer dereference in the presence of
> 
> 	.remove = __exit_p(somefunc),
> 
> But a problem can arise later if some resource isn't properly freed and
> so it might be used at a later point in time which then most likely
> oopses.
> 
> I didn't double check Arnd's list, but otherwise I agree to his
> analysis.

Can we instead question the use of module_platform_driver_probe()?
I don't have the history in mind, but why not just switch to regular
module_platform_driver() registration instead? It seems like the
original authors just did not care about the remove path and were
happy to skip its implementation.

On mtd devices one can argue that the flash underlying stores the
rootfs and thus cannot be removed, but I believe today this is a
questionable (software) design.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2023-10-09 12:46 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-08 20:01 [PATCH 00/20] mtd: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-08 20:01 ` [PATCH 01/20] mtd: rawnand: txx9ndfmc: Mark driver struct with __refdata to prevent section mismatch warning Uwe Kleine-König
2023-10-09  7:22   ` Masahiro Yamada
2023-10-09  8:43     ` Arnd Bergmann
2023-10-09 10:30       ` Uwe Kleine-König
2023-10-09 12:46         ` Miquel Raynal [this message]
2023-10-09 13:01           ` Arnd Bergmann
2023-10-09 13:37             ` Miquel Raynal
2023-10-16  8:57               ` Miquel Raynal
2023-10-16  9:25         ` Arnd Bergmann
2023-10-16 10:21           ` Uwe Kleine-König
2023-10-17 10:20             ` Masahiro Yamada
2023-10-17 13:20               ` Uwe Kleine-König
2023-10-17 13:45                 ` Greg Kroah-Hartman
2023-10-08 20:01 ` [PATCH 02/20] mtd: rawnand: txx9ndfmc: Drop if block with always false condition Uwe Kleine-König
2023-10-08 20:01 ` [PATCH 03/20] mtd: bcm47xxsflash: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 04/20] mtd: docg3: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 05/20] mtd: phram: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 06/20] mtd: powernv_flash: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 07/20] mtd: spear_smi: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 08/20] mtd: st_spi_fsm: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 09/20] mtd: hyperbus: hbmc-am654: " Uwe Kleine-König
2023-10-16  9:28   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 10/20] mtd: hyperbus: rpc-if: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 11/20] mtd: lpddr2_nvm: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 12/20] mtd: maps: lantiq-flash: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 13/20] mtd: maps: physmap-core: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 14/20] mtd: maps: plat-ram: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 15/20] mtd: maps: pxa2xx-flash: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 16/20] mtd: maps: sa1100-flash: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 17/20] mtd: maps: sun_uflash: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 18/20] mtd: rawnand: txx9ndfmc: " Uwe Kleine-König
2023-10-08 20:01 ` [PATCH 19/20] mtd: spi-nor: hisi-sfc: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-08 20:01 ` [PATCH 20/20] mtd: spi-nor: nxp-spifi: " Uwe Kleine-König
2023-10-16  9:27   ` Miquel Raynal
2023-10-09  6:07 ` [PATCH 00/20] mtd: " Tudor Ambarus

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=20231009144610.4ff82afa@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=akpm@linux-foundation.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=arnd@arndb.de \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=masahiroy@kernel.org \
    --cc=richard@nod.at \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vigneshr@ti.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox