[i2c] [patch 1/5] i2c stack can probe()

David Brownell david-b at pacbell.net
Fri Mar 2 21:24:46 CET 2007


On Friday 02 March 2007 12:02 pm, Jean Delvare wrote:

> > > > +/* uevent helps with hotplug: modprobe -q $(MODALIAS) */
> > > > +static int i2c_device_uevent(struct device *dev, char **envp, int num_envp,
> > > > +		      char *buffer, int buffer_size)
> > > > +{
> > > > +	struct i2c_client	*client = to_i2c_client(dev);
> > > > +	int			i = 0, length = 0;
> > > > +
> > > > +	if (!dev)
> > > > +		return -ENODEV;
> > > 
> > > Can this realistically happen? I fail to see how.
> > 
> > No, and in fact that's the only change I made in my local copy of
> > these patches:  replacing that test with one to return early for legacy
> > drivers, since they can't hotplug:
> > 
> > 	if (dev->driver)
> > 		return 0;
> 
> You really mean if (!dev->driver)?

No; until the driver core gets a flag saying "legacy, beware!" the
only way we could possibly know that we don't need to kick in the
MODALIAS environment variable stuff -- for the load-a-driver part
of hotplugging -- is to notice that the device was created with a
driver already bound to it.  (If the legacy paths don't do that yet,
we can make them do that.)

- Dave



More information about the i2c mailing list