aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-isa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-isa.c')
-rw-r--r--drivers/i2c/busses/i2c-isa.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
index 5f33bc9c1e02..a2e75bc9178b 100644
--- a/drivers/i2c/busses/i2c-isa.c
+++ b/drivers/i2c/busses/i2c-isa.c
@@ -141,6 +141,7 @@ static int __init i2c_isa_init(void)
141 sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr); 141 sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr);
142 isa_adapter.dev.driver = &i2c_adapter_driver; 142 isa_adapter.dev.driver = &i2c_adapter_driver;
143 isa_adapter.dev.release = &i2c_adapter_dev_release; 143 isa_adapter.dev.release = &i2c_adapter_dev_release;
144 isa_adapter.dev.class = &i2c_adapter_class;
144 err = device_register(&isa_adapter.dev); 145 err = device_register(&isa_adapter.dev);
145 if (err) { 146 if (err) {
146 printk(KERN_ERR "i2c-isa: Failed to register device\n"); 147 printk(KERN_ERR "i2c-isa: Failed to register device\n");
@@ -152,24 +153,10 @@ static int __init i2c_isa_init(void)
152 goto exit_unregister; 153 goto exit_unregister;
153 } 154 }
154 155
155 /* Add this adapter to the i2c_adapter class */
156 memset(&isa_adapter.class_dev, 0x00, sizeof(struct class_device));
157 isa_adapter.class_dev.dev = &isa_adapter.dev;
158 isa_adapter.class_dev.class = &i2c_adapter_class;
159 strlcpy(isa_adapter.class_dev.class_id, isa_adapter.dev.bus_id,
160 BUS_ID_SIZE);
161 err = class_device_register(&isa_adapter.class_dev);
162 if (err) {
163 printk(KERN_ERR "i2c-isa: Failed to register class device\n");
164 goto exit_remove_name;
165 }
166
167 dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name); 156 dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name);
168 157
169 return 0; 158 return 0;
170 159
171exit_remove_name:
172 device_remove_file(&isa_adapter.dev, &dev_attr_name);
173exit_unregister: 160exit_unregister:
174 init_completion(&isa_adapter.dev_released); /* Needed? */ 161 init_completion(&isa_adapter.dev_released); /* Needed? */
175 device_unregister(&isa_adapter.dev); 162 device_unregister(&isa_adapter.dev);
@@ -201,15 +188,12 @@ static void __exit i2c_isa_exit(void)
201 /* Clean up the sysfs representation */ 188 /* Clean up the sysfs representation */
202 dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n"); 189 dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n");
203 init_completion(&isa_adapter.dev_released); 190 init_completion(&isa_adapter.dev_released);
204 init_completion(&isa_adapter.class_dev_released);
205 class_device_unregister(&isa_adapter.class_dev);
206 device_remove_file(&isa_adapter.dev, &dev_attr_name); 191 device_remove_file(&isa_adapter.dev, &dev_attr_name);
207 device_unregister(&isa_adapter.dev); 192 device_unregister(&isa_adapter.dev);
208 193
209 /* Wait for sysfs to drop all references */ 194 /* Wait for sysfs to drop all references */
210 dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n"); 195 dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n");
211 wait_for_completion(&isa_adapter.dev_released); 196 wait_for_completion(&isa_adapter.dev_released);
212 wait_for_completion(&isa_adapter.class_dev_released);
213 197
214 dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name); 198 dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name);
215} 199}