Re: [PATCH 00/13] Discover and probe dependencies
From: Russell King - ARM Linux
Date: Thu Jun 18 2015 - 05:58:43 EST
On Thu, Jun 18, 2015 at 11:42:01AM +0200, Andrzej Hajda wrote:
> 2. Provider create/register their resources only during probe.
> It is not always the case - for example componentized drivers in
> probe often
> calls only component_add, the real initialization is performed in
> bind callback.
bind is called in _a_ probe callback, but it may not be the probe callback
associated with the device. (It'll be the final component's callback.)
I'm willing to be less critical of componentised drivers claiming their
resources in ->probe _iff_ they separate their data structures, like:
struct foo_priv {
void *base;
struct clk *clk;
struct dma_chan *chan;
... other resource data ...;
struct foo_runtime {
... runtime data ...
} rt;
};
and then, in their bind callback, they memset the foo_runtime structure
to zero, to ensure that the driver always re-binds in the same state as
the first bind.
I've seen too many lax drivers over the years that this is a point I'm
very insistant on: either componentised drivers don't do any resource
claiming in their probe function, or they take steps to ensure non-
resource struct members are properly separated such that they can
guarantee that they aren't going to accidentally use something from a
previous binding.
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/