Commit 392e687b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] i2c: register the i2c_adapter_driver so things link up properly in sysfs

parent 0d08e838
...@@ -55,8 +55,8 @@ int i2c_device_remove(struct device *dev) ...@@ -55,8 +55,8 @@ int i2c_device_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver i2c_generic_driver = { static struct device_driver i2c_adapter_driver = {
.name = "i2c", .name = "i2c_adapter",
.bus = &i2c_bus_type, .bus = &i2c_bus_type,
.probe = i2c_device_probe, .probe = i2c_device_probe,
.remove = i2c_device_remove, .remove = i2c_device_remove,
...@@ -98,7 +98,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) ...@@ -98,7 +98,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
if (adap->dev.parent == NULL) if (adap->dev.parent == NULL)
adap->dev.parent = &legacy_bus; adap->dev.parent = &legacy_bus;
sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); sprintf(adap->dev.bus_id, "i2c-%d", adap->nr);
adap->dev.driver = &i2c_generic_driver; adap->dev.driver = &i2c_adapter_driver;
device_register(&adap->dev); device_register(&adap->dev);
/* Add this adapter to the i2c_adapter class */ /* Add this adapter to the i2c_adapter class */
...@@ -460,6 +460,9 @@ static int __init i2c_init(void) ...@@ -460,6 +460,9 @@ static int __init i2c_init(void)
int retval; int retval;
retval = bus_register(&i2c_bus_type); retval = bus_register(&i2c_bus_type);
if (retval)
return retval;
retval = driver_register(&i2c_adapter_driver);
if (retval) if (retval)
return retval; return retval;
return class_register(&i2c_adapter_class); return class_register(&i2c_adapter_class);
...@@ -468,6 +471,7 @@ static int __init i2c_init(void) ...@@ -468,6 +471,7 @@ static int __init i2c_init(void)
static void __exit i2c_exit(void) static void __exit i2c_exit(void)
{ {
class_unregister(&i2c_adapter_class); class_unregister(&i2c_adapter_class);
driver_unregister(&i2c_adapter_driver);
bus_unregister(&i2c_bus_type); bus_unregister(&i2c_bus_type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment