From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Markus Pargmann <mpa@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: dev->of_node overwrite can cause device loading with different driver
Date: Sat, 14 Sep 2013 05:17:29 -0700 [thread overview]
Message-ID: <20130914121729.GA7823@kroah.com> (raw)
In-Reply-To: <20130914071653.GA26512@pengutronix.de>
On Sat, Sep 14, 2013 at 09:16:53AM +0200, Markus Pargmann wrote:
> > Ok, so what do you suggest we do for stuff like this? Fix up the musb
> > driver? Or something else?
>
> I think there are three options to solve this:
>
> 1. Break out of the driver list iteration loop as soon as a driver probe
> function fails. This way there is no possibility for another driver
> to be probed with a device struct that was changed by the first
> driver. But it would remove the support to fall back to
> another driver for a device. I am not aware of any device that is
> supported by multiple drivers.
No, that's not ok, lots of drivers say "I support all devices, send them
to me!" and then fail their probe function when they realize they don't
really support a specific device that was sent to them. So that
wouldn't work at all, as you would break all of those situations.
> 2. We could restore the device struct completely or partially (only
> of_node) after a probe failure. This would avoid driver probes with
> unclean device structs, but introduces some overhead.
Overhead isn't an issue here, this is not "performance critical" code
paths. But it would be messy.
> 3. We could fix up all drivers that change the of_node. But there are
> ARM DT frameworks that require a device struct as parameter instead
> of a device_node parameter (e.g. soc-generic-dmaengine-pcm). So a
> driver core, initialized by a glue driver with DT bindings, has to
> set dev->of_node to use those frameworks. I think it is strange to
> have such DT framework interfaces if a driver is not supposed to
> overwrite dev->of_node permanently.
How about any driver that does muck with this structure, restore it
properly if their probe() function fails? Yes, you show that this is
going to be tricky in some places (i.e. musb), but it makes sense that
the burden of fixing this issue would rest on them, as they are the ones
causing this problem, right?
thanks,
greg k-h
next prev parent reply other threads:[~2013-09-14 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 15:53 dev->of_node overwrite can cause device loading with different driver Markus Pargmann
2013-09-13 17:10 ` Greg Kroah-Hartman
2013-09-14 7:16 ` Markus Pargmann
2013-09-14 11:20 ` Russell King - ARM Linux
2013-09-18 8:43 ` Markus Pargmann
2013-09-14 12:17 ` Greg Kroah-Hartman [this message]
2013-09-14 12:28 ` Russell King - ARM Linux
2013-09-18 8:31 ` Markus Pargmann
2013-09-18 8:49 ` Lothar Waßmann
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=20130914121729.GA7823@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox