i2c: Legacy i2c drivers shouldn't issue uevents
authorDavid Brownell <david-b@pacbell.net>
Tue, 22 May 2007 17:49:16 +0000 (19:49 +0200)
committerJean Delvare <khali@hyperion.delvare>
Tue, 22 May 2007 17:49:16 +0000 (19:49 +0200)
Prevent legacy drivers from issuing uevents for device creation/removal,
so that userspace can't cause modprobing loops for them.  This became a
problem for some legacy PC drivers.  I can't easily see it becoming an
issue with I2C legacy drivers, but consistency-in-paranoia seems likely
to be a good thing here.  For usable i2c-level driver model uevents, just
switch to a new-style driver.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/i2c/i2c-core.c

index 64f8e56d300ec7046ab3389ff4c53198d775b12e..435925eba437df0e3cf9cdc9896c3ca6fc97abe4 100644 (file)
@@ -697,9 +697,10 @@ int i2c_attach_client(struct i2c_client *client)
        if (client->driver)
                client->dev.driver = &client->driver->driver;
 
-       if (client->driver && !is_newstyle_driver(client->driver))
+       if (client->driver && !is_newstyle_driver(client->driver)) {
                client->dev.release = i2c_client_release;
-       else
+               client->dev.uevent_suppress = 1;
+       } else
                client->dev.release = i2c_client_dev_release;
 
        snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),