Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6

+362 -260
+2 -2
arch/arm/common/locomo.c
··· 1103 1103 struct bus_type locomo_bus_type = { 1104 1104 .name = "locomo-bus", 1105 1105 .match = locomo_match, 1106 + .probe = locomo_bus_probe, 1107 + .remove = locomo_bus_remove, 1106 1108 .suspend = locomo_bus_suspend, 1107 1109 .resume = locomo_bus_resume, 1108 1110 }; 1109 1111 1110 1112 int locomo_driver_register(struct locomo_driver *driver) 1111 1113 { 1112 - driver->drv.probe = locomo_bus_probe; 1113 - driver->drv.remove = locomo_bus_remove; 1114 1114 driver->drv.bus = &locomo_bus_type; 1115 1115 return driver_register(&driver->drv); 1116 1116 }
+2 -2
arch/arm/common/sa1111.c
··· 1247 1247 struct bus_type sa1111_bus_type = { 1248 1248 .name = "sa1111-rab", 1249 1249 .match = sa1111_match, 1250 + .probe = sa1111_bus_probe, 1251 + .remove = sa1111_bus_remove, 1250 1252 .suspend = sa1111_bus_suspend, 1251 1253 .resume = sa1111_bus_resume, 1252 1254 }; 1253 1255 1254 1256 int sa1111_driver_register(struct sa1111_driver *driver) 1255 1257 { 1256 - driver->drv.probe = sa1111_bus_probe; 1257 - driver->drv.remove = sa1111_bus_remove; 1258 1258 driver->drv.bus = &sa1111_bus_type; 1259 1259 return driver_register(&driver->drv); 1260 1260 }
+8 -6
arch/arm/kernel/ecard.c
··· 1147 1147 struct ecard_driver *drv = ECARD_DRV(dev->driver); 1148 1148 struct ecard_request req; 1149 1149 1150 - if (drv->shutdown) 1151 - drv->shutdown(ec); 1152 - ecard_release(ec); 1150 + if (dev->driver) { 1151 + if (drv->shutdown) 1152 + drv->shutdown(ec); 1153 + ecard_release(ec); 1154 + } 1153 1155 1154 1156 /* 1155 1157 * If this card has a loader, call the reset handler. ··· 1166 1164 int ecard_register_driver(struct ecard_driver *drv) 1167 1165 { 1168 1166 drv->drv.bus = &ecard_bus_type; 1169 - drv->drv.probe = ecard_drv_probe; 1170 - drv->drv.remove = ecard_drv_remove; 1171 - drv->drv.shutdown = ecard_drv_shutdown; 1172 1167 1173 1168 return driver_register(&drv->drv); 1174 1169 } ··· 1194 1195 .name = "ecard", 1195 1196 .dev_attrs = ecard_dev_attrs, 1196 1197 .match = ecard_match, 1198 + .probe = ecard_drv_probe, 1199 + .remove = ecard_drv_remove, 1200 + .shutdown = ecard_drv_shutdown, 1197 1201 }; 1198 1202 1199 1203 static int ecard_bus_init(void)
+18 -18
arch/arm/mach-integrator/lm.c
··· 22 22 return 1; 23 23 } 24 24 25 - static struct bus_type lm_bustype = { 26 - .name = "logicmodule", 27 - .match = lm_match, 28 - // .suspend = lm_suspend, 29 - // .resume = lm_resume, 30 - }; 31 - 32 - static int __init lm_init(void) 33 - { 34 - return bus_register(&lm_bustype); 35 - } 36 - 37 - postcore_initcall(lm_init); 38 - 39 25 static int lm_bus_probe(struct device *dev) 40 26 { 41 27 struct lm_device *lmdev = to_lm_device(dev); ··· 35 49 struct lm_device *lmdev = to_lm_device(dev); 36 50 struct lm_driver *lmdrv = to_lm_driver(dev->driver); 37 51 38 - lmdrv->remove(lmdev); 52 + if (lmdrv->remove) 53 + lmdrv->remove(lmdev); 39 54 return 0; 40 55 } 56 + 57 + static struct bus_type lm_bustype = { 58 + .name = "logicmodule", 59 + .match = lm_match, 60 + .probe = lm_bus_probe, 61 + .remove = lm_bus_remove, 62 + // .suspend = lm_bus_suspend, 63 + // .resume = lm_bus_resume, 64 + }; 65 + 66 + static int __init lm_init(void) 67 + { 68 + return bus_register(&lm_bustype); 69 + } 70 + 71 + postcore_initcall(lm_init); 41 72 42 73 int lm_driver_register(struct lm_driver *drv) 43 74 { 44 75 drv->drv.bus = &lm_bustype; 45 - drv->drv.probe = lm_bus_probe; 46 - drv->drv.remove = lm_bus_remove; 47 - 48 76 return driver_register(&drv->drv); 49 77 } 50 78
+8 -8
arch/ia64/sn/kernel/tiocx.c
··· 77 77 kfree(to_cx_dev(dev)); 78 78 } 79 79 80 - struct bus_type tiocx_bus_type = { 81 - .name = "tiocx", 82 - .match = tiocx_match, 83 - .uevent = tiocx_uevent, 84 - }; 85 - 86 80 /** 87 81 * cx_device_match - Find cx_device in the id table. 88 82 * @ids: id table from driver ··· 143 149 return 0; 144 150 } 145 151 152 + struct bus_type tiocx_bus_type = { 153 + .name = "tiocx", 154 + .match = tiocx_match, 155 + .uevent = tiocx_uevent, 156 + .probe = cx_device_probe, 157 + .remove = cx_driver_remove, 158 + }; 159 + 146 160 /** 147 161 * cx_driver_register - Register the driver. 148 162 * @cx_driver: driver table (cx_drv struct) from driver ··· 164 162 { 165 163 cx_driver->driver.name = cx_driver->name; 166 164 cx_driver->driver.bus = &tiocx_bus_type; 167 - cx_driver->driver.probe = cx_device_probe; 168 - cx_driver->driver.remove = cx_driver_remove; 169 165 170 166 return driver_register(&cx_driver->driver); 171 167 }
+2 -2
arch/parisc/kernel/drivers.c
··· 173 173 WARN_ON(driver->drv.probe != NULL); 174 174 WARN_ON(driver->drv.remove != NULL); 175 175 176 - driver->drv.probe = parisc_driver_probe; 177 - driver->drv.remove = parisc_driver_remove; 178 176 driver->drv.name = driver->name; 179 177 180 178 return driver_register(&driver->drv); ··· 573 575 .name = "parisc", 574 576 .match = parisc_generic_match, 575 577 .dev_attrs = parisc_device_attrs, 578 + .probe = parisc_driver_probe, 579 + .remove = parisc_driver_remove, 576 580 }; 577 581 578 582 /**
+2 -2
arch/powerpc/kernel/of_device.c
··· 132 132 struct bus_type of_platform_bus_type = { 133 133 .name = "of_platform", 134 134 .match = of_platform_bus_match, 135 + .probe = of_device_probe, 136 + .remove = of_device_remove, 135 137 .suspend = of_device_suspend, 136 138 .resume = of_device_resume, 137 139 }; ··· 152 150 /* initialize common driver fields */ 153 151 drv->driver.name = drv->name; 154 152 drv->driver.bus = &of_platform_bus_type; 155 - drv->driver.probe = of_device_probe; 156 - drv->driver.remove = of_device_remove; 157 153 158 154 /* register with core */ 159 155 count = driver_register(&drv->driver);
+4 -4
arch/powerpc/kernel/vio.c
··· 76 76 struct vio_dev *viodev = to_vio_dev(dev); 77 77 struct vio_driver *viodrv = to_vio_driver(dev->driver); 78 78 79 - if (viodrv->shutdown) 79 + if (dev->driver && viodrv->shutdown) 80 80 viodrv->shutdown(viodev); 81 81 } 82 82 ··· 91 91 92 92 /* fill in 'struct driver' fields */ 93 93 viodrv->driver.bus = &vio_bus_type; 94 - viodrv->driver.probe = vio_bus_probe; 95 - viodrv->driver.remove = vio_bus_remove; 96 - viodrv->driver.shutdown = vio_bus_shutdown; 97 94 98 95 return driver_register(&viodrv->driver); 99 96 } ··· 292 295 .name = "vio", 293 296 .uevent = vio_hotplug, 294 297 .match = vio_bus_match, 298 + .probe = vio_bus_probe, 299 + .remove = vio_bus_remove, 300 + .shutdown = vio_bus_shutdown, 295 301 };
+2 -2
arch/ppc/syslib/ocp.c
··· 189 189 struct bus_type ocp_bus_type = { 190 190 .name = "ocp", 191 191 .match = ocp_device_match, 192 + .probe = ocp_driver_probe, 193 + .remove = ocp_driver_remove, 192 194 .suspend = ocp_device_suspend, 193 195 .resume = ocp_device_resume, 194 196 }; ··· 212 210 /* initialize common driver fields */ 213 211 drv->driver.name = drv->name; 214 212 drv->driver.bus = &ocp_bus_type; 215 - drv->driver.probe = ocp_device_probe; 216 - drv->driver.remove = ocp_device_remove; 217 213 218 214 /* register with core */ 219 215 return driver_register(&drv->driver);
+17 -17
arch/sh/kernel/cpu/bus.c
··· 53 53 return 0; 54 54 } 55 55 56 - static struct device sh_bus_devices[SH_NR_BUSES] = { 57 - { 58 - .bus_id = SH_BUS_NAME_VIRT, 59 - }, 60 - }; 61 - 62 - struct bus_type sh_bus_types[SH_NR_BUSES] = { 63 - { 64 - .name = SH_BUS_NAME_VIRT, 65 - .match = sh_bus_match, 66 - .suspend = sh_bus_suspend, 67 - .resume = sh_bus_resume, 68 - }, 69 - }; 70 - 71 56 static int sh_device_probe(struct device *dev) 72 57 { 73 58 struct sh_dev *shdev = to_sh_dev(dev); ··· 74 89 75 90 return 0; 76 91 } 92 + 93 + static struct device sh_bus_devices[SH_NR_BUSES] = { 94 + { 95 + .bus_id = SH_BUS_NAME_VIRT, 96 + }, 97 + }; 98 + 99 + struct bus_type sh_bus_types[SH_NR_BUSES] = { 100 + { 101 + .name = SH_BUS_NAME_VIRT, 102 + .match = sh_bus_match, 103 + .probe = sh_bus_probe, 104 + .remove = sh_bus_remove, 105 + .suspend = sh_bus_suspend, 106 + .resume = sh_bus_resume, 107 + }, 108 + }; 77 109 78 110 int sh_device_register(struct sh_dev *dev) 79 111 { ··· 135 133 return -EINVAL; 136 134 } 137 135 138 - drv->drv.probe = sh_device_probe; 139 - drv->drv.remove = sh_device_remove; 140 136 drv->drv.bus = &sh_bus_types[drv->bus_id]; 141 137 142 138 return driver_register(&drv->drv);
+10 -2
drivers/base/dd.c
··· 78 78 pr_debug("%s: Matched Device %s with Driver %s\n", 79 79 drv->bus->name, dev->bus_id, drv->name); 80 80 dev->driver = drv; 81 - if (drv->probe) { 81 + if (dev->bus->probe) { 82 + ret = dev->bus->probe(dev); 83 + if (ret) { 84 + dev->driver = NULL; 85 + goto ProbeFailed; 86 + } 87 + } else if (drv->probe) { 82 88 ret = drv->probe(dev); 83 89 if (ret) { 84 90 dev->driver = NULL; ··· 209 203 sysfs_remove_link(&dev->kobj, "driver"); 210 204 klist_remove(&dev->knode_driver); 211 205 212 - if (drv->remove) 206 + if (dev->bus->remove) 207 + dev->bus->remove(dev); 208 + else if (drv->remove) 213 209 drv->remove(dev); 214 210 dev->driver = NULL; 215 211 put_driver(drv);
+5
drivers/base/driver.c
··· 171 171 */ 172 172 int driver_register(struct device_driver * drv) 173 173 { 174 + if ((drv->bus->probe && drv->probe) || 175 + (drv->bus->remove && drv->remove) || 176 + (drv->bus->shutdown && drv->shutdown)) { 177 + printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name); 178 + } 174 179 klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put); 175 180 init_completion(&drv->unloaded); 176 181 return bus_add_driver(drv);
+1 -1
drivers/base/platform.c
··· 327 327 * @pdev: platform device we're unregistering 328 328 * 329 329 * Unregistration is done in 2 steps. Fisrt we release all resources 330 - * and remove it from the sybsystem, then we drop reference count by 330 + * and remove it from the subsystem, then we drop reference count by 331 331 * calling platform_device_put(). 332 332 */ 333 333 void platform_device_unregister(struct platform_device * pdev)
+6 -3
drivers/base/power/shutdown.c
··· 35 35 */ 36 36 void device_shutdown(void) 37 37 { 38 - struct device * dev; 38 + struct device * dev, *devn; 39 39 40 40 down_write(&devices_subsys.rwsem); 41 - list_for_each_entry_reverse(dev, &devices_subsys.kset.list, 41 + list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, 42 42 kobj.entry) { 43 - if (dev->driver && dev->driver->shutdown) { 43 + if (dev->bus && dev->bus->shutdown) { 44 + dev_dbg(dev, "shutdown\n"); 45 + dev->bus->shutdown(dev); 46 + } else if (dev->driver && dev->driver->shutdown) { 44 47 dev_dbg(dev, "shutdown\n"); 45 48 dev->driver->shutdown(dev); 46 49 }
+2 -2
drivers/dio/dio-driver.c
··· 83 83 /* initialize common driver fields */ 84 84 drv->driver.name = drv->name; 85 85 drv->driver.bus = &dio_bus_type; 86 - drv->driver.probe = dio_device_probe; 87 86 88 87 /* register with core */ 89 88 count = driver_register(&drv->driver); ··· 144 145 145 146 struct bus_type dio_bus_type = { 146 147 .name = "dio", 147 - .match = dio_bus_match 148 + .match = dio_bus_match, 149 + .probe = dio_device_probe, 148 150 }; 149 151 150 152
+9 -11
drivers/i2c/i2c-core.c
··· 63 63 return rc; 64 64 } 65 65 66 - struct bus_type i2c_bus_type = { 67 - .name = "i2c", 68 - .match = i2c_device_match, 69 - .suspend = i2c_bus_suspend, 70 - .resume = i2c_bus_resume, 71 - }; 72 - 73 66 static int i2c_device_probe(struct device *dev) 74 67 { 75 68 return -ENODEV; ··· 72 79 { 73 80 return 0; 74 81 } 82 + 83 + struct bus_type i2c_bus_type = { 84 + .name = "i2c", 85 + .match = i2c_device_match, 86 + .probe = i2c_device_probe, 87 + .remove = i2c_device_remove, 88 + .suspend = i2c_bus_suspend, 89 + .resume = i2c_bus_resume, 90 + }; 75 91 76 92 void i2c_adapter_dev_release(struct device *dev) 77 93 { ··· 92 90 .owner = THIS_MODULE, 93 91 .name = "i2c_adapter", 94 92 .bus = &i2c_bus_type, 95 - .probe = i2c_device_probe, 96 - .remove = i2c_device_remove, 97 93 }; 98 94 99 95 static void i2c_adapter_class_dev_release(struct class_device *dev) ··· 294 294 /* add the driver to the list of i2c drivers in the driver core */ 295 295 driver->driver.owner = owner; 296 296 driver->driver.bus = &i2c_bus_type; 297 - driver->driver.probe = i2c_device_probe; 298 - driver->driver.remove = i2c_device_remove; 299 297 300 298 res = driver_register(&driver->driver); 301 299 if (res)
+5 -9
drivers/ide/ide-cd.c
··· 3256 3256 } 3257 3257 #endif 3258 3258 3259 - static int ide_cd_remove(struct device *dev) 3259 + static void ide_cd_remove(ide_drive_t *drive) 3260 3260 { 3261 - ide_drive_t *drive = to_ide_device(dev); 3262 3261 struct cdrom_info *info = drive->driver_data; 3263 3262 3264 3263 ide_unregister_subdriver(drive, info->driver); ··· 3265 3266 del_gendisk(info->disk); 3266 3267 3267 3268 ide_cd_put(info); 3268 - 3269 - return 0; 3270 3269 } 3271 3270 3272 3271 static void ide_cd_release(struct kref *kref) ··· 3288 3291 kfree(info); 3289 3292 } 3290 3293 3291 - static int ide_cd_probe(struct device *); 3294 + static int ide_cd_probe(ide_drive_t *); 3292 3295 3293 3296 #ifdef CONFIG_PROC_FS 3294 3297 static int proc_idecd_read_capacity ··· 3314 3317 .owner = THIS_MODULE, 3315 3318 .name = "ide-cdrom", 3316 3319 .bus = &ide_bus_type, 3317 - .probe = ide_cd_probe, 3318 - .remove = ide_cd_remove, 3319 3320 }, 3321 + .probe = ide_cd_probe, 3322 + .remove = ide_cd_remove, 3320 3323 .version = IDECD_VERSION, 3321 3324 .media = ide_cdrom, 3322 3325 .supports_dsc_overlap = 1, ··· 3410 3413 module_param(ignore, charp, 0400); 3411 3414 MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); 3412 3415 3413 - static int ide_cd_probe(struct device *dev) 3416 + static int ide_cd_probe(ide_drive_t *drive) 3414 3417 { 3415 - ide_drive_t *drive = to_ide_device(dev); 3416 3418 struct cdrom_info *info; 3417 3419 struct gendisk *g; 3418 3420 struct request_sense sense;
+8 -14
drivers/ide/ide-disk.c
··· 997 997 printk(KERN_INFO "%s: wcache flush failed!\n", drive->name); 998 998 } 999 999 1000 - static int ide_disk_remove(struct device *dev) 1000 + static void ide_disk_remove(ide_drive_t *drive) 1001 1001 { 1002 - ide_drive_t *drive = to_ide_device(dev); 1003 1002 struct ide_disk_obj *idkp = drive->driver_data; 1004 1003 struct gendisk *g = idkp->disk; 1005 1004 ··· 1009 1010 ide_cacheflush_p(drive); 1010 1011 1011 1012 ide_disk_put(idkp); 1012 - 1013 - return 0; 1014 1013 } 1015 1014 1016 1015 static void ide_disk_release(struct kref *kref) ··· 1024 1027 kfree(idkp); 1025 1028 } 1026 1029 1027 - static int ide_disk_probe(struct device *dev); 1030 + static int ide_disk_probe(ide_drive_t *drive); 1028 1031 1029 - static void ide_device_shutdown(struct device *dev) 1032 + static void ide_device_shutdown(ide_drive_t *drive) 1030 1033 { 1031 - ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); 1032 - 1033 1034 #ifdef CONFIG_ALPHA 1034 1035 /* On Alpha, halt(8) doesn't actually turn the machine off, 1035 1036 it puts you into the sort of firmware monitor. Typically, ··· 1049 1054 } 1050 1055 1051 1056 printk("Shutdown: %s\n", drive->name); 1052 - dev->bus->suspend(dev, PMSG_SUSPEND); 1057 + drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND); 1053 1058 } 1054 1059 1055 1060 static ide_driver_t idedisk_driver = { ··· 1057 1062 .owner = THIS_MODULE, 1058 1063 .name = "ide-disk", 1059 1064 .bus = &ide_bus_type, 1060 - .probe = ide_disk_probe, 1061 - .remove = ide_disk_remove, 1062 - .shutdown = ide_device_shutdown, 1063 1065 }, 1066 + .probe = ide_disk_probe, 1067 + .remove = ide_disk_remove, 1068 + .shutdown = ide_device_shutdown, 1064 1069 .version = IDEDISK_VERSION, 1065 1070 .media = ide_disk, 1066 1071 .supports_dsc_overlap = 0, ··· 1177 1182 1178 1183 MODULE_DESCRIPTION("ATA DISK Driver"); 1179 1184 1180 - static int ide_disk_probe(struct device *dev) 1185 + static int ide_disk_probe(ide_drive_t *drive) 1181 1186 { 1182 - ide_drive_t *drive = to_ide_device(dev); 1183 1187 struct ide_disk_obj *idkp; 1184 1188 struct gendisk *g; 1185 1189
+5 -9
drivers/ide/ide-floppy.c
··· 1871 1871 idefloppy_add_settings(drive); 1872 1872 } 1873 1873 1874 - static int ide_floppy_remove(struct device *dev) 1874 + static void ide_floppy_remove(ide_drive_t *drive) 1875 1875 { 1876 - ide_drive_t *drive = to_ide_device(dev); 1877 1876 idefloppy_floppy_t *floppy = drive->driver_data; 1878 1877 struct gendisk *g = floppy->disk; 1879 1878 ··· 1881 1882 del_gendisk(g); 1882 1883 1883 1884 ide_floppy_put(floppy); 1884 - 1885 - return 0; 1886 1885 } 1887 1886 1888 1887 static void ide_floppy_release(struct kref *kref) ··· 1919 1922 1920 1923 #endif /* CONFIG_PROC_FS */ 1921 1924 1922 - static int ide_floppy_probe(struct device *); 1925 + static int ide_floppy_probe(ide_drive_t *); 1923 1926 1924 1927 static ide_driver_t idefloppy_driver = { 1925 1928 .gen_driver = { 1926 1929 .owner = THIS_MODULE, 1927 1930 .name = "ide-floppy", 1928 1931 .bus = &ide_bus_type, 1929 - .probe = ide_floppy_probe, 1930 - .remove = ide_floppy_remove, 1931 1932 }, 1933 + .probe = ide_floppy_probe, 1934 + .remove = ide_floppy_remove, 1932 1935 .version = IDEFLOPPY_VERSION, 1933 1936 .media = ide_floppy, 1934 1937 .supports_dsc_overlap = 0, ··· 2133 2136 .revalidate_disk= idefloppy_revalidate_disk 2134 2137 }; 2135 2138 2136 - static int ide_floppy_probe(struct device *dev) 2139 + static int ide_floppy_probe(ide_drive_t *drive) 2137 2140 { 2138 - ide_drive_t *drive = to_ide_device(dev); 2139 2141 idefloppy_floppy_t *floppy; 2140 2142 struct gendisk *g; 2141 2143
+7 -11
drivers/ide/ide-tape.c
··· 4682 4682 idetape_add_settings(drive); 4683 4683 } 4684 4684 4685 - static int ide_tape_remove(struct device *dev) 4685 + static void ide_tape_remove(ide_drive_t *drive) 4686 4686 { 4687 - ide_drive_t *drive = to_ide_device(dev); 4688 4687 idetape_tape_t *tape = drive->driver_data; 4689 4688 4690 4689 ide_unregister_subdriver(drive, tape->driver); ··· 4691 4692 ide_unregister_region(tape->disk); 4692 4693 4693 4694 ide_tape_put(tape); 4694 - 4695 - return 0; 4696 4695 } 4697 4696 4698 4697 static void ide_tape_release(struct kref *kref) ··· 4742 4745 4743 4746 #endif 4744 4747 4745 - static int ide_tape_probe(struct device *); 4748 + static int ide_tape_probe(ide_drive_t *); 4746 4749 4747 4750 static ide_driver_t idetape_driver = { 4748 4751 .gen_driver = { 4749 4752 .owner = THIS_MODULE, 4750 4753 .name = "ide-tape", 4751 4754 .bus = &ide_bus_type, 4752 - .probe = ide_tape_probe, 4753 - .remove = ide_tape_remove, 4754 4755 }, 4756 + .probe = ide_tape_probe, 4757 + .remove = ide_tape_remove, 4755 4758 .version = IDETAPE_VERSION, 4756 4759 .media = ide_tape, 4757 4760 .supports_dsc_overlap = 1, ··· 4822 4825 .ioctl = idetape_ioctl, 4823 4826 }; 4824 4827 4825 - static int ide_tape_probe(struct device *dev) 4828 + static int ide_tape_probe(ide_drive_t *drive) 4826 4829 { 4827 - ide_drive_t *drive = to_ide_device(dev); 4828 4830 idetape_tape_t *tape; 4829 4831 struct gendisk *g; 4830 4832 int minor; ··· 4879 4883 idetape_setup(drive, tape, minor); 4880 4884 4881 4885 class_device_create(idetape_sysfs_class, NULL, 4882 - MKDEV(IDETAPE_MAJOR, minor), dev, "%s", tape->name); 4886 + MKDEV(IDETAPE_MAJOR, minor), &drive->gendev, "%s", tape->name); 4883 4887 class_device_create(idetape_sysfs_class, NULL, 4884 - MKDEV(IDETAPE_MAJOR, minor + 128), dev, "n%s", tape->name); 4888 + MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name); 4885 4889 4886 4890 devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor), 4887 4891 S_IFCHR | S_IRUGO | S_IWUGO,
+31
drivers/ide/ide.c
··· 1949 1949 return 0; 1950 1950 } 1951 1951 1952 + static int generic_ide_probe(struct device *dev) 1953 + { 1954 + ide_drive_t *drive = to_ide_device(dev); 1955 + ide_driver_t *drv = to_ide_driver(dev->driver); 1956 + 1957 + return drv->probe ? drv->probe(drive) : -ENODEV; 1958 + } 1959 + 1960 + static int generic_ide_remove(struct device *dev) 1961 + { 1962 + ide_drive_t *drive = to_ide_device(dev); 1963 + ide_driver_t *drv = to_ide_driver(dev->driver); 1964 + 1965 + if (drv->remove) 1966 + drv->remove(drive); 1967 + 1968 + return 0; 1969 + } 1970 + 1971 + static void generic_ide_shutdown(struct device *dev) 1972 + { 1973 + ide_drive_t *drive = to_ide_device(dev); 1974 + ide_driver_t *drv = to_ide_driver(dev->driver); 1975 + 1976 + if (dev->driver && drv->shutdown) 1977 + drv->shutdown(drive); 1978 + } 1979 + 1952 1980 struct bus_type ide_bus_type = { 1953 1981 .name = "ide", 1954 1982 .match = ide_bus_match, 1955 1983 .uevent = ide_uevent, 1984 + .probe = generic_ide_probe, 1985 + .remove = generic_ide_remove, 1986 + .shutdown = generic_ide_shutdown, 1956 1987 .dev_attrs = ide_dev_attrs, 1957 1988 .suspend = generic_ide_suspend, 1958 1989 .resume = generic_ide_resume,
+7 -5
drivers/input/gameport/gameport.c
··· 50 50 51 51 static LIST_HEAD(gameport_list); 52 52 53 - static struct bus_type gameport_bus = { 54 - .name = "gameport", 55 - }; 53 + static struct bus_type gameport_bus; 56 54 57 55 static void gameport_add_port(struct gameport *gameport); 58 56 static void gameport_destroy_port(struct gameport *gameport); ··· 701 703 return 0; 702 704 } 703 705 706 + static struct bus_type gameport_bus = { 707 + .name = "gameport", 708 + .probe = gameport_driver_probe, 709 + .remove = gameport_driver_remove, 710 + }; 711 + 704 712 void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) 705 713 { 706 714 drv->driver.bus = &gameport_bus; 707 - drv->driver.probe = gameport_driver_probe; 708 - drv->driver.remove = gameport_driver_remove; 709 715 gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); 710 716 } 711 717
+41 -22
drivers/input/input.c
··· 528 528 INPUT_DEV_STRING_ATTR_SHOW(phys); 529 529 INPUT_DEV_STRING_ATTR_SHOW(uniq); 530 530 531 - static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, 531 + static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr, 532 532 unsigned int min, unsigned int max) 533 533 { 534 534 int len, i; 535 535 536 - len = sprintf(buf, "%c", prefix); 536 + len = snprintf(buf, size, "%c", prefix); 537 537 for (i = min; i < max; i++) 538 538 if (arr[LONG(i)] & BIT(i)) 539 - len += sprintf(buf+len, "%X,", i); 539 + len += snprintf(buf + len, size - len, "%X,", i); 540 + return len; 541 + } 542 + 543 + static int print_modalias(char *buf, int size, struct input_dev *id) 544 + { 545 + int len; 546 + 547 + len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-", 548 + id->id.bustype, 549 + id->id.vendor, 550 + id->id.product, 551 + id->id.version); 552 + 553 + len += print_modalias_bits(buf + len, size - len, 'e', id->evbit, 554 + 0, EV_MAX); 555 + len += print_modalias_bits(buf + len, size - len, 'k', id->keybit, 556 + KEY_MIN_INTERESTING, KEY_MAX); 557 + len += print_modalias_bits(buf + len, size - len, 'r', id->relbit, 558 + 0, REL_MAX); 559 + len += print_modalias_bits(buf + len, size - len, 'a', id->absbit, 560 + 0, ABS_MAX); 561 + len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit, 562 + 0, MSC_MAX); 563 + len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit, 564 + 0, LED_MAX); 565 + len += print_modalias_bits(buf + len, size - len, 's', id->sndbit, 566 + 0, SND_MAX); 567 + len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit, 568 + 0, FF_MAX); 569 + len += print_modalias_bits(buf + len, size - len, 'w', id->swbit, 570 + 0, SW_MAX); 540 571 return len; 541 572 } 542 573 543 574 static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) 544 575 { 545 576 struct input_dev *id = to_input_dev(dev); 546 - ssize_t len = 0; 577 + ssize_t len; 547 578 548 - len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", 549 - id->id.bustype, 550 - id->id.vendor, 551 - id->id.product, 552 - id->id.version); 553 - 554 - len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); 555 - len += print_modalias_bits(buf+len, 'k', id->keybit, 556 - KEY_MIN_INTERESTING, KEY_MAX); 557 - len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); 558 - len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); 559 - len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); 560 - len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); 561 - len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); 562 - len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); 563 - len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); 564 - len += sprintf(buf+len, "\n"); 579 + len = print_modalias(buf, PAGE_SIZE, id); 580 + len += snprintf(buf + len, PAGE_SIZE-len, "\n"); 565 581 return len; 566 582 } 567 583 static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); ··· 744 728 if (test_bit(EV_SW, dev->evbit)) 745 729 INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); 746 730 747 - envp[i] = NULL; 731 + envp[i++] = buffer + len; 732 + len += snprintf(buffer + len, buffer_size - len, "MODALIAS="); 733 + len += print_modalias(buffer + len, buffer_size - len, dev) + 1; 748 734 735 + envp[i] = NULL; 749 736 return 0; 750 737 } 751 738
+7 -5
drivers/input/serio/serio.c
··· 59 59 60 60 static LIST_HEAD(serio_list); 61 61 62 - static struct bus_type serio_bus = { 63 - .name = "serio", 64 - }; 62 + static struct bus_type serio_bus; 65 63 66 64 static void serio_add_port(struct serio *serio); 67 65 static void serio_destroy_port(struct serio *serio); ··· 748 750 return 0; 749 751 } 750 752 753 + static struct bus_type serio_bus = { 754 + .name = "serio", 755 + .probe = serio_driver_probe, 756 + .remove = serio_driver_remove, 757 + }; 758 + 751 759 void __serio_register_driver(struct serio_driver *drv, struct module *owner) 752 760 { 753 761 drv->driver.bus = &serio_bus; 754 - drv->driver.probe = serio_driver_probe; 755 - drv->driver.remove = serio_driver_remove; 756 762 757 763 serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); 758 764 }
+3 -3
drivers/macintosh/macio_asic.c
··· 211 211 .name = "macio", 212 212 .match = macio_bus_match, 213 213 .uevent = macio_uevent, 214 + .probe = macio_device_probe, 215 + .remove = macio_device_remove, 216 + .shutdown = macio_device_shutdown, 214 217 .suspend = macio_device_suspend, 215 218 .resume = macio_device_resume, 216 219 .dev_attrs = macio_dev_attrs, ··· 531 528 /* initialize common driver fields */ 532 529 drv->driver.name = drv->name; 533 530 drv->driver.bus = &macio_bus_type; 534 - drv->driver.probe = macio_device_probe; 535 - drv->driver.remove = macio_device_remove; 536 - drv->driver.shutdown = macio_device_shutdown; 537 531 538 532 /* register with core */ 539 533 count = driver_register(&drv->driver);
+11 -12
drivers/media/dvb/bt8xx/dvb-bt8xx.c
··· 779 779 return 0; 780 780 } 781 781 782 - static int dvb_bt8xx_probe(struct device *dev) 782 + static int dvb_bt8xx_probe(struct bttv_sub_device *sub) 783 783 { 784 - struct bttv_sub_device *sub = to_bttv_sub_dev(dev); 785 784 struct dvb_bt8xx_card *card; 786 785 struct pci_dev* bttv_pci_dev; 787 786 int ret; ··· 889 890 return ret; 890 891 } 891 892 892 - dev_set_drvdata(dev, card); 893 + dev_set_drvdata(&sub->dev, card); 893 894 return 0; 894 895 } 895 896 896 - static int dvb_bt8xx_remove(struct device *dev) 897 + static int dvb_bt8xx_remove(struct bttv_sub_device *sub) 897 898 { 898 - struct dvb_bt8xx_card *card = dev_get_drvdata(dev); 899 + struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev); 899 900 900 901 dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr); 901 902 ··· 918 919 static struct bttv_sub_driver driver = { 919 920 .drv = { 920 921 .name = "dvb-bt8xx", 921 - .probe = dvb_bt8xx_probe, 922 - .remove = dvb_bt8xx_remove, 923 - /* FIXME: 924 - * .shutdown = dvb_bt8xx_shutdown, 925 - * .suspend = dvb_bt8xx_suspend, 926 - * .resume = dvb_bt8xx_resume, 927 - */ 928 922 }, 923 + .probe = dvb_bt8xx_probe, 924 + .remove = dvb_bt8xx_remove, 925 + /* FIXME: 926 + * .shutdown = dvb_bt8xx_shutdown, 927 + * .suspend = dvb_bt8xx_suspend, 928 + * .resume = dvb_bt8xx_resume, 929 + */ 929 930 }; 930 931 931 932 static int __init dvb_bt8xx_init(void)
+22 -2
drivers/media/video/bttv-gpio.c
··· 47 47 return 0; 48 48 } 49 49 50 + static int bttv_sub_probe(struct device *dev) 51 + { 52 + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); 53 + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); 54 + 55 + return sub->probe ? sub->probe(sdev) : -ENODEV; 56 + } 57 + 58 + static int bttv_sub_remove(struct device *dev) 59 + { 60 + struct bttv_sub_device *sdev = to_bttv_sub_dev(dev); 61 + struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver); 62 + 63 + if (sub->remove) 64 + sub->remove(sdev); 65 + return 0; 66 + } 67 + 50 68 struct bus_type bttv_sub_bus_type = { 51 - .name = "bttv-sub", 52 - .match = &bttv_sub_bus_match, 69 + .name = "bttv-sub", 70 + .match = &bttv_sub_bus_match, 71 + .probe = bttv_sub_probe, 72 + .remove = bttv_sub_remove, 53 73 }; 54 74 EXPORT_SYMBOL(bttv_sub_bus_type); 55 75
+2
drivers/media/video/bttv.h
··· 365 365 struct bttv_sub_driver { 366 366 struct device_driver drv; 367 367 char wanted[BUS_ID_SIZE]; 368 + int (*probe)(struct bttv_sub_device *sub); 369 + void (*remove)(struct bttv_sub_device *sub); 368 370 void (*gpio_irq)(struct bttv_sub_device *sub); 369 371 }; 370 372 #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)
+2 -2
drivers/mfd/mcp-core.c
··· 77 77 static struct bus_type mcp_bus_type = { 78 78 .name = "mcp", 79 79 .match = mcp_bus_match, 80 + .probe = mcp_bus_probe, 81 + .remove = mcp_bus_remove, 80 82 .suspend = mcp_bus_suspend, 81 83 .resume = mcp_bus_resume, 82 84 }; ··· 229 227 int mcp_driver_register(struct mcp_driver *mcpdrv) 230 228 { 231 229 mcpdrv->drv.bus = &mcp_bus_type; 232 - mcpdrv->drv.probe = mcp_bus_probe; 233 - mcpdrv->drv.remove = mcp_bus_remove; 234 230 return driver_register(&mcpdrv->drv); 235 231 } 236 232 EXPORT_SYMBOL(mcp_driver_register);
+12 -14
drivers/mmc/mmc_sysfs.c
··· 136 136 return ret; 137 137 } 138 138 139 - static struct bus_type mmc_bus_type = { 140 - .name = "mmc", 141 - .dev_attrs = mmc_dev_attrs, 142 - .match = mmc_bus_match, 143 - .uevent = mmc_bus_uevent, 144 - .suspend = mmc_bus_suspend, 145 - .resume = mmc_bus_resume, 146 - }; 147 - 148 - 149 - static int mmc_drv_probe(struct device *dev) 139 + static int mmc_bus_probe(struct device *dev) 150 140 { 151 141 struct mmc_driver *drv = to_mmc_driver(dev->driver); 152 142 struct mmc_card *card = dev_to_mmc_card(dev); ··· 144 154 return drv->probe(card); 145 155 } 146 156 147 - static int mmc_drv_remove(struct device *dev) 157 + static int mmc_bus_remove(struct device *dev) 148 158 { 149 159 struct mmc_driver *drv = to_mmc_driver(dev->driver); 150 160 struct mmc_card *card = dev_to_mmc_card(dev); ··· 154 164 return 0; 155 165 } 156 166 167 + static struct bus_type mmc_bus_type = { 168 + .name = "mmc", 169 + .dev_attrs = mmc_dev_attrs, 170 + .match = mmc_bus_match, 171 + .uevent = mmc_bus_uevent, 172 + .probe = mmc_bus_probe, 173 + .remove = mmc_bus_remove, 174 + .suspend = mmc_bus_suspend, 175 + .resume = mmc_bus_resume, 176 + }; 157 177 158 178 /** 159 179 * mmc_register_driver - register a media driver ··· 172 172 int mmc_register_driver(struct mmc_driver *drv) 173 173 { 174 174 drv->drv.bus = &mmc_bus_type; 175 - drv->drv.probe = mmc_drv_probe; 176 - drv->drv.remove = mmc_drv_remove; 177 175 return driver_register(&drv->drv); 178 176 } 179 177
+2 -2
drivers/pci/pci-driver.c
··· 380 380 /* initialize common driver fields */ 381 381 drv->driver.name = drv->name; 382 382 drv->driver.bus = &pci_bus_type; 383 - drv->driver.probe = pci_device_probe; 384 - drv->driver.remove = pci_device_remove; 385 383 /* FIXME, once all of the existing PCI drivers have been fixed to set 386 384 * the pci shutdown function, this test can go away. */ 387 385 if (!drv->driver.shutdown) ··· 511 513 .name = "pci", 512 514 .match = pci_bus_match, 513 515 .uevent = pci_uevent, 516 + .probe = pci_device_probe, 517 + .remove = pci_device_remove, 514 518 .suspend = pci_device_suspend, 515 519 .resume = pci_device_resume, 516 520 .dev_attrs = pci_dev_attrs,
+2 -2
drivers/pcmcia/ds.c
··· 311 311 /* initialize common fields */ 312 312 driver->drv.bus = &pcmcia_bus_type; 313 313 driver->drv.owner = driver->owner; 314 - driver->drv.probe = pcmcia_device_probe; 315 - driver->drv.remove = pcmcia_device_remove; 316 314 317 315 return driver_register(&driver->drv); 318 316 } ··· 1198 1200 .uevent = pcmcia_bus_uevent, 1199 1201 .match = pcmcia_bus_match, 1200 1202 .dev_attrs = pcmcia_dev_attrs, 1203 + .probe = pcmcia_device_probe, 1204 + .remove = pcmcia_device_remove, 1201 1205 .suspend = pcmcia_dev_suspend, 1202 1206 .resume = pcmcia_dev_resume, 1203 1207 };
+2 -2
drivers/pnp/driver.c
··· 195 195 struct bus_type pnp_bus_type = { 196 196 .name = "pnp", 197 197 .match = pnp_bus_match, 198 + .probe = pnp_device_probe, 199 + .remove = pnp_device_remove, 198 200 .suspend = pnp_bus_suspend, 199 201 .resume = pnp_bus_resume, 200 202 }; ··· 217 215 218 216 drv->driver.name = drv->name; 219 217 drv->driver.bus = &pnp_bus_type; 220 - drv->driver.probe = pnp_device_probe; 221 - drv->driver.remove = pnp_device_remove; 222 218 223 219 count = driver_register(&drv->driver); 224 220
+3 -3
drivers/rapidio/rio-driver.c
··· 147 147 /* initialize common driver fields */ 148 148 rdrv->driver.name = rdrv->name; 149 149 rdrv->driver.bus = &rio_bus_type; 150 - rdrv->driver.probe = rio_device_probe; 151 - rdrv->driver.remove = rio_device_remove; 152 150 153 151 /* register with core */ 154 152 return driver_register(&rdrv->driver); ··· 202 204 struct bus_type rio_bus_type = { 203 205 .name = "rapidio", 204 206 .match = rio_match_bus, 205 - .dev_attrs = rio_dev_attrs 207 + .dev_attrs = rio_dev_attrs, 208 + .probe = rio_device_probe, 209 + .remove = rio_device_remove, 206 210 }; 207 211 208 212 /**
+9 -7
drivers/s390/cio/ccwgroup.c
··· 52 52 return 0; 53 53 } 54 54 55 - static struct bus_type ccwgroup_bus_type = { 56 - .name = "ccwgroup", 57 - .match = ccwgroup_bus_match, 58 - .uevent = ccwgroup_uevent, 59 - }; 55 + static struct bus_type ccwgroup_bus_type; 60 56 61 57 static inline void 62 58 __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) ··· 385 389 return 0; 386 390 } 387 391 392 + static struct bus_type ccwgroup_bus_type = { 393 + .name = "ccwgroup", 394 + .match = ccwgroup_bus_match, 395 + .uevent = ccwgroup_uevent, 396 + .probe = ccwgroup_probe, 397 + .remove = ccwgroup_remove, 398 + }; 399 + 388 400 int 389 401 ccwgroup_driver_register (struct ccwgroup_driver *cdriver) 390 402 { ··· 400 396 cdriver->driver = (struct device_driver) { 401 397 .bus = &ccwgroup_bus_type, 402 398 .name = cdriver->name, 403 - .probe = ccwgroup_probe, 404 - .remove = ccwgroup_remove, 405 399 }; 406 400 407 401 return driver_register(&cdriver->driver);
+34 -2
drivers/s390/cio/css.c
··· 542 542 return 0; 543 543 } 544 544 545 + static int 546 + css_probe (struct device *dev) 547 + { 548 + struct subchannel *sch; 549 + 550 + sch = to_subchannel(dev); 551 + sch->driver = container_of (dev->driver, struct css_driver, drv); 552 + return (sch->driver->probe ? sch->driver->probe(sch) : 0); 553 + } 554 + 555 + static int 556 + css_remove (struct device *dev) 557 + { 558 + struct subchannel *sch; 559 + 560 + sch = to_subchannel(dev); 561 + return (sch->driver->remove ? sch->driver->remove(sch) : 0); 562 + } 563 + 564 + static void 565 + css_shutdown (struct device *dev) 566 + { 567 + struct subchannel *sch; 568 + 569 + sch = to_subchannel(dev); 570 + if (sch->driver->shutdown) 571 + sch->driver->shutdown(sch); 572 + } 573 + 545 574 struct bus_type css_bus_type = { 546 - .name = "css", 547 - .match = &css_bus_match, 575 + .name = "css", 576 + .match = css_bus_match, 577 + .probe = css_probe, 578 + .remove = css_remove, 579 + .shutdown = css_shutdown, 548 580 }; 549 581 550 582 subsys_initcall(init_channel_subsystem);
+4
drivers/s390/cio/css.h
··· 115 115 * Currently, we only care about I/O subchannels (type 0), these 116 116 * have a ccw_device connected to them. 117 117 */ 118 + struct subchannel; 118 119 struct css_driver { 119 120 unsigned int subchannel_type; 120 121 struct device_driver drv; ··· 123 122 int (*notify)(struct device *, int); 124 123 void (*verify)(struct device *); 125 124 void (*termination)(struct device *); 125 + int (*probe)(struct subchannel *); 126 + int (*remove)(struct subchannel *); 127 + void (*shutdown)(struct subchannel *); 126 128 }; 127 129 128 130 /*
+24 -26
drivers/s390/cio/device.c
··· 107 107 return 0; 108 108 } 109 109 110 - struct bus_type ccw_bus_type = { 111 - .name = "ccw", 112 - .match = &ccw_bus_match, 113 - .uevent = &ccw_uevent, 114 - }; 110 + struct bus_type ccw_bus_type; 115 111 116 - static int io_subchannel_probe (struct device *); 117 - static int io_subchannel_remove (struct device *); 112 + static int io_subchannel_probe (struct subchannel *); 113 + static int io_subchannel_remove (struct subchannel *); 118 114 void io_subchannel_irq (struct device *); 119 115 static int io_subchannel_notify(struct device *, int); 120 116 static void io_subchannel_verify(struct device *); 121 117 static void io_subchannel_ioterm(struct device *); 122 - static void io_subchannel_shutdown(struct device *); 118 + static void io_subchannel_shutdown(struct subchannel *); 123 119 124 120 struct css_driver io_subchannel_driver = { 125 121 .subchannel_type = SUBCHANNEL_TYPE_IO, 126 122 .drv = { 127 123 .name = "io_subchannel", 128 124 .bus = &css_bus_type, 129 - .probe = &io_subchannel_probe, 130 - .remove = &io_subchannel_remove, 131 - .shutdown = &io_subchannel_shutdown, 132 125 }, 133 126 .irq = io_subchannel_irq, 134 127 .notify = io_subchannel_notify, 135 128 .verify = io_subchannel_verify, 136 129 .termination = io_subchannel_ioterm, 130 + .probe = io_subchannel_probe, 131 + .remove = io_subchannel_remove, 132 + .shutdown = io_subchannel_shutdown, 137 133 }; 138 134 139 135 struct workqueue_struct *ccw_device_work; ··· 799 803 } 800 804 801 805 static int 802 - io_subchannel_probe (struct device *pdev) 806 + io_subchannel_probe (struct subchannel *sch) 803 807 { 804 - struct subchannel *sch; 805 808 struct ccw_device *cdev; 806 809 int rc; 807 810 unsigned long flags; 808 811 809 - sch = to_subchannel(pdev); 810 812 if (sch->dev.driver_data) { 811 813 /* 812 814 * This subchannel already has an associated ccw_device. ··· 840 846 memset(cdev->private, 0, sizeof(struct ccw_device_private)); 841 847 atomic_set(&cdev->private->onoff, 0); 842 848 cdev->dev = (struct device) { 843 - .parent = pdev, 849 + .parent = &sch->dev, 844 850 .release = ccw_device_release, 845 851 }; 846 852 INIT_LIST_HEAD(&cdev->private->kick_work.entry); ··· 853 859 return -ENODEV; 854 860 } 855 861 856 - rc = io_subchannel_recog(cdev, to_subchannel(pdev)); 862 + rc = io_subchannel_recog(cdev, sch); 857 863 if (rc) { 858 864 spin_lock_irqsave(&sch->lock, flags); 859 865 sch->dev.driver_data = NULL; ··· 877 883 } 878 884 879 885 static int 880 - io_subchannel_remove (struct device *dev) 886 + io_subchannel_remove (struct subchannel *sch) 881 887 { 882 888 struct ccw_device *cdev; 883 889 unsigned long flags; 884 890 885 - if (!dev->driver_data) 891 + if (!sch->dev.driver_data) 886 892 return 0; 887 - cdev = dev->driver_data; 893 + cdev = sch->dev.driver_data; 888 894 /* Set ccw device to not operational and drop reference. */ 889 895 spin_lock_irqsave(cdev->ccwlock, flags); 890 - dev->driver_data = NULL; 896 + sch->dev.driver_data = NULL; 891 897 cdev->private->state = DEV_STATE_NOT_OPER; 892 898 spin_unlock_irqrestore(cdev->ccwlock, flags); 893 899 /* ··· 942 948 } 943 949 944 950 static void 945 - io_subchannel_shutdown(struct device *dev) 951 + io_subchannel_shutdown(struct subchannel *sch) 946 952 { 947 - struct subchannel *sch; 948 953 struct ccw_device *cdev; 949 954 int ret; 950 955 951 - sch = to_subchannel(dev); 952 - cdev = dev->driver_data; 956 + cdev = sch->dev.driver_data; 953 957 954 958 if (cio_is_console(sch->schid)) 955 959 return; ··· 1121 1129 return 0; 1122 1130 } 1123 1131 1132 + struct bus_type ccw_bus_type = { 1133 + .name = "ccw", 1134 + .match = ccw_bus_match, 1135 + .uevent = ccw_uevent, 1136 + .probe = ccw_device_probe, 1137 + .remove = ccw_device_remove, 1138 + }; 1139 + 1124 1140 int 1125 1141 ccw_driver_register (struct ccw_driver *cdriver) 1126 1142 { ··· 1136 1136 1137 1137 drv->bus = &ccw_bus_type; 1138 1138 drv->name = cdriver->name; 1139 - drv->probe = ccw_device_probe; 1140 - drv->remove = ccw_device_remove; 1141 1139 1142 1140 return driver_register(drv); 1143 1141 }
+2 -2
drivers/scsi/scsi_debug.c
··· 221 221 static struct device_driver sdebug_driverfs_driver = { 222 222 .name = sdebug_proc_name, 223 223 .bus = &pseudo_lld_bus, 224 - .probe = sdebug_driver_probe, 225 - .remove = sdebug_driver_remove, 226 224 }; 227 225 228 226 static const int check_condition_result = ··· 1794 1796 static struct bus_type pseudo_lld_bus = { 1795 1797 .name = "pseudo", 1796 1798 .match = pseudo_lld_bus_match, 1799 + .probe = sdebug_driver_probe, 1800 + .remove = sdebug_driver_remove, 1797 1801 }; 1798 1802 1799 1803 static void sdebug_release_adapter(struct device * dev)
+2 -2
drivers/sh/superhyway/superhyway.c
··· 175 175 { 176 176 drv->drv.name = drv->name; 177 177 drv->drv.bus = &superhyway_bus_type; 178 - drv->drv.probe = superhyway_device_probe; 179 - drv->drv.remove = superhyway_device_remove; 180 178 181 179 return driver_register(&drv->drv); 182 180 } ··· 211 213 #ifdef CONFIG_SYSFS 212 214 .dev_attrs = superhyway_dev_attrs, 213 215 #endif 216 + .probe = superhyway_device_probe, 217 + .remove = superhyway_device_remove, 214 218 }; 215 219 216 220 static int __init superhyway_bus_init(void)
-3
drivers/usb/gadget/ether.c
··· 2534 2534 .driver = { 2535 2535 .name = (char *) shortname, 2536 2536 .owner = THIS_MODULE, 2537 - // .shutdown = ... 2538 - // .suspend = ... 2539 - // .resume = ... 2540 2537 }, 2541 2538 }; 2542 2539
-3
drivers/usb/gadget/inode.c
··· 1738 1738 1739 1739 .driver = { 1740 1740 .name = (char *) shortname, 1741 - // .shutdown = ... 1742 - // .suspend = ... 1743 - // .resume = ... 1744 1741 }, 1745 1742 }; 1746 1743
-3
drivers/usb/gadget/serial.c
··· 374 374 .disconnect = gs_disconnect, 375 375 .driver = { 376 376 .name = GS_SHORT_NAME, 377 - /* .shutdown = ... */ 378 - /* .suspend = ... */ 379 - /* .resume = ... */ 380 377 }, 381 378 }; 382 379
-3
drivers/usb/gadget/zero.c
··· 1303 1303 .driver = { 1304 1304 .name = (char *) shortname, 1305 1305 .owner = THIS_MODULE, 1306 - // .shutdown = ... 1307 - // .suspend = ... 1308 - // .resume = ... 1309 1306 }, 1310 1307 }; 1311 1308
+7 -8
drivers/usb/serial/bus.c
··· 37 37 return 0; 38 38 } 39 39 40 - struct bus_type usb_serial_bus_type = { 41 - .name = "usb-serial", 42 - .match = usb_serial_device_match, 43 - }; 44 - 45 40 static int usb_serial_device_probe (struct device *dev) 46 41 { 47 42 struct usb_serial_driver *driver; ··· 104 109 return retval; 105 110 } 106 111 112 + struct bus_type usb_serial_bus_type = { 113 + .name = "usb-serial", 114 + .match = usb_serial_device_match, 115 + .probe = usb_serial_device_probe, 116 + .remove = usb_serial_device_remove, 117 + }; 118 + 107 119 int usb_serial_bus_register(struct usb_serial_driver *driver) 108 120 { 109 121 int retval; 110 122 111 123 driver->driver.bus = &usb_serial_bus_type; 112 - driver->driver.probe = usb_serial_device_probe; 113 - driver->driver.remove = usb_serial_device_remove; 114 - 115 124 retval = driver_register(&driver->driver); 116 125 117 126 return retval;
+2 -2
drivers/zorro/zorro-driver.c
··· 77 77 /* initialize common driver fields */ 78 78 drv->driver.name = drv->name; 79 79 drv->driver.bus = &zorro_bus_type; 80 - drv->driver.probe = zorro_device_probe; 81 80 82 81 /* register with core */ 83 82 count = driver_register(&drv->driver); ··· 131 132 132 133 struct bus_type zorro_bus_type = { 133 134 .name = "zorro", 134 - .match = zorro_bus_match 135 + .match = zorro_bus_match, 136 + .probe = zorro_device_probe, 135 137 }; 136 138 137 139
+3
include/linux/device.h
··· 49 49 int (*match)(struct device * dev, struct device_driver * drv); 50 50 int (*uevent)(struct device *dev, char **envp, 51 51 int num_envp, char *buffer, int buffer_size); 52 + int (*probe)(struct device * dev); 53 + int (*remove)(struct device * dev); 54 + void (*shutdown)(struct device * dev); 52 55 int (*suspend)(struct device * dev, pm_message_t state); 53 56 int (*resume)(struct device * dev); 54 57 };
+5
include/linux/ide.h
··· 983 983 ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); 984 984 ide_proc_entry_t *proc; 985 985 struct device_driver gen_driver; 986 + int (*probe)(ide_drive_t *); 987 + void (*remove)(ide_drive_t *); 988 + void (*shutdown)(ide_drive_t *); 986 989 } ide_driver_t; 990 + 991 + #define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 987 992 988 993 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 989 994