aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 14:17:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 14:17:04 -0400
commit0c93ea4064a209cdc36de8a9a3003d43d08f46f7 (patch)
treeff19952407c523a1349ef56c05993416dd28437e /drivers
parentbc2fd381d8f9dbeb181f82286cdca1567e3d0def (diff)
parente6e66b02e11563abdb7f69dcb7a2efbd8d577e77 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (61 commits) Dynamic debug: fix pr_fmt() build error Dynamic debug: allow simple quoting of words dynamic debug: update docs dynamic debug: combine dprintk and dynamic printk sysfs: fix some bin_vm_ops errors kobject: don't block for each kobject_uevent sysfs: only allow one scheduled removal callback per kobj Driver core: Fix device_move() vs. dpm list ordering, v2 Driver core: some cleanup on drivers/base/sys.c Driver core: implement uevent suppress in kobject vcs: hook sysfs devices into object lifetime instead of "binding" driver core: fix passing platform_data driver core: move platform_data into platform_device sysfs: don't block indefinitely for unmapped files. driver core: move knode_bus into private structure driver core: move knode_driver into private structure driver core: move klist_children into private structure driver core: create a private portion of struct device driver core: remove polling for driver_probe_done(v5) sysfs: reference sysfs_dirent from sysfs inodes ... Fixed conflicts in drivers/sh/maple/maple.c manually
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/dock.c2
-rw-r--r--drivers/amba/bus.c4
-rw-r--r--drivers/base/base.h31
-rw-r--r--drivers/base/bus.c44
-rw-r--r--drivers/base/core.c108
-rw-r--r--drivers/base/dd.c40
-rw-r--r--drivers/base/driver.c15
-rw-r--r--drivers/base/firmware_class.c4
-rw-r--r--drivers/base/platform.c60
-rw-r--r--drivers/base/power/main.c44
-rw-r--r--drivers/base/power/power.h8
-rw-r--r--drivers/base/sys.c54
-rw-r--r--drivers/block/floppy.c3
-rw-r--r--drivers/char/tpm/tpm_atmel.c28
-rw-r--r--drivers/char/tpm/tpm_tis.c28
-rw-r--r--drivers/char/vc_screen.c16
-rw-r--r--drivers/char/vt.c5
-rw-r--r--drivers/dio/dio.c4
-rw-r--r--drivers/dma/dw_dmac.c2
-rw-r--r--drivers/edac/cell_edac.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c2
-rw-r--r--drivers/edac/mv64x60_edac.c8
-rw-r--r--drivers/eisa/eisa-bus.c4
-rw-r--r--drivers/gpio/bt8xxgpio.c2
-rw-r--r--drivers/gpu/drm/drm_sysfs.c4
-rw-r--r--drivers/i2c/i2c-core.c2
-rw-r--r--drivers/ide/au1xxx-ide.c36
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c3
-rw-r--r--drivers/mca/mca-bus.c4
-rw-r--r--drivers/media/radio/radio-tea5764.c3
-rw-r--r--drivers/media/video/v4l2-device.c2
-rw-r--r--drivers/mfd/mcp-core.c2
-rw-r--r--drivers/mfd/ucb1x00-core.c2
-rw-r--r--drivers/mmc/host/atmel-mci.c2
-rw-r--r--drivers/mmc/host/of_mmc_spi.c2
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c37
-rw-r--r--drivers/mtd/nand/excite_nandflash.c25
-rw-r--r--drivers/mtd/nand/ndfc.c2
-rw-r--r--drivers/mtd/onenand/generic.c26
-rw-r--r--drivers/net/arm/ks8695net.c2
-rw-r--r--drivers/net/au1000_eth.c8
-rw-r--r--drivers/net/bfin_mac.c12
-rw-r--r--drivers/net/bmac.c2
-rw-r--r--drivers/net/cpmac.c2
-rw-r--r--drivers/net/declance.c6
-rw-r--r--drivers/net/depca.c6
-rw-r--r--drivers/net/ehea/ehea_main.c2
-rw-r--r--drivers/net/jazzsonic.c6
-rw-r--r--drivers/net/macb.c10
-rw-r--r--drivers/net/macsonic.c15
-rw-r--r--drivers/net/mipsnet.c26
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/sb1250-mac.c10
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/smsc911x.c7
-rw-r--r--drivers/net/smsc9420.c4
-rw-r--r--drivers/net/tc35815.c4
-rw-r--r--drivers/net/wimax/i2400m/driver.c2
-rw-r--r--drivers/net/wimax/i2400m/usb-notif.c2
-rw-r--r--drivers/net/xtsonic.c2
-rw-r--r--drivers/pci/hotplug/cpqphp_sysfs.c3
-rw-r--r--drivers/pcmcia/au1000_generic.c37
-rw-r--r--drivers/pcmcia/i82365.c28
-rw-r--r--drivers/pcmcia/m32r_cfc.c30
-rw-r--r--drivers/pcmcia/m32r_pcc.c30
-rw-r--r--drivers/pcmcia/rsrc_mgr.c2
-rw-r--r--drivers/pcmcia/sa1100_generic.c38
-rw-r--r--drivers/pcmcia/tcic.c30
-rw-r--r--drivers/pcmcia/vrc4171_card.c34
-rw-r--r--drivers/rapidio/rio-driver.c2
-rw-r--r--drivers/rtc/rtc-at91sam9.c4
-rw-r--r--drivers/rtc/rtc-omap.c4
-rw-r--r--drivers/rtc/rtc-twl4030.c2
-rw-r--r--drivers/s390/cio/ccwgroup.c5
-rw-r--r--drivers/s390/cio/chsc_sch.c4
-rw-r--r--drivers/s390/cio/css.c4
-rw-r--r--drivers/s390/cio/device.c13
-rw-r--r--drivers/s390/net/qeth_l3_main.c2
-rw-r--r--drivers/scsi/a4000t.c29
-rw-r--r--drivers/scsi/bvme6000_scsi.c29
-rw-r--r--drivers/scsi/mvme16x_scsi.c29
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/sh/maple/maple.c1
-rw-r--r--drivers/spi/atmel_spi.c8
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c2
-rw-r--r--drivers/spi/omap2_mcspi.c2
-rw-r--r--drivers/spi/omap_uwire.c12
-rw-r--r--drivers/spi/orion_spi.c2
-rw-r--r--drivers/spi/pxa2xx_spi.c4
-rw-r--r--drivers/spi/spi_bfin5xx.c4
-rw-r--r--drivers/spi/spi_gpio.c2
-rw-r--r--drivers/spi/spi_imx.c5
-rw-r--r--drivers/spi/spi_mpc83xx.c4
-rw-r--r--drivers/spi/spi_txx9.c3
-rw-r--r--drivers/tc/tc.c8
-rw-r--r--drivers/uio/Kconfig18
-rw-r--r--drivers/uio/Makefile1
-rw-r--r--drivers/uio/uio.c25
-rw-r--r--drivers/uio/uio_aec.c175
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c2
-rw-r--r--drivers/usb/gadget/imx_udc.c4
-rw-r--r--drivers/usb/host/fhci-dbg.c2
-rw-r--r--drivers/usb/host/fhci-hcd.c4
-rw-r--r--drivers/video/au1100fb.c31
-rw-r--r--drivers/video/au1200fb.c25
-rw-r--r--drivers/video/pmag-ba-fb.c17
-rw-r--r--drivers/video/pmagb-b-fb.c17
-rw-r--r--drivers/video/ps3fb.c2
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c2
-rw-r--r--drivers/video/tmiofb.c2
-rw-r--r--drivers/watchdog/rm9k_wdt.c27
-rw-r--r--drivers/zorro/zorro.c4
113 files changed, 1052 insertions, 530 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 35094f230b1..7af7db1ba8c 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -977,7 +977,7 @@ static int dock_add(acpi_handle handle)
977 sizeof(struct dock_station *)); 977 sizeof(struct dock_station *));
978 978
979 /* we want the dock device to send uevents */ 979 /* we want the dock device to send uevents */
980 dock_device->dev.uevent_suppress = 0; 980 dev_set_uevent_suppress(&dock_device->dev, 0);
981 981
982 if (is_dock(handle)) 982 if (is_dock(handle))
983 dock_station->flags |= DOCK_IS_DOCK; 983 dock_station->flags |= DOCK_IS_DOCK;
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 00c46e0b40e..3d763fdf99b 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -210,7 +210,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent)
210 dev->dev.release = amba_device_release; 210 dev->dev.release = amba_device_release;
211 dev->dev.bus = &amba_bustype; 211 dev->dev.bus = &amba_bustype;
212 dev->dev.dma_mask = &dev->dma_mask; 212 dev->dev.dma_mask = &dev->dma_mask;
213 dev->res.name = dev->dev.bus_id; 213 dev->res.name = dev_name(&dev->dev);
214 214
215 if (!dev->dev.coherent_dma_mask && dev->dma_mask) 215 if (!dev->dev.coherent_dma_mask && dev->dma_mask)
216 dev_warn(&dev->dev, "coherent dma mask is unset\n"); 216 dev_warn(&dev->dev, "coherent dma mask is unset\n");
@@ -294,7 +294,7 @@ static int amba_find_match(struct device *dev, void *data)
294 if (d->parent) 294 if (d->parent)
295 r &= d->parent == dev->parent; 295 r &= d->parent == dev->parent;
296 if (d->busid) 296 if (d->busid)
297 r &= strcmp(dev->bus_id, d->busid) == 0; 297 r &= strcmp(dev_name(dev), d->busid) == 0;
298 298
299 if (r) { 299 if (r) {
300 get_device(dev); 300 get_device(dev);
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 9f50f1b545d..ddc97496db4 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -63,6 +63,32 @@ struct class_private {
63#define to_class(obj) \ 63#define to_class(obj) \
64 container_of(obj, struct class_private, class_subsys.kobj) 64 container_of(obj, struct class_private, class_subsys.kobj)
65 65
66/**
67 * struct device_private - structure to hold the private to the driver core portions of the device structure.
68 *
69 * @klist_children - klist containing all children of this device
70 * @knode_parent - node in sibling list
71 * @knode_driver - node in driver list
72 * @knode_bus - node in bus list
73 * @device - pointer back to the struct class that this structure is
74 * associated with.
75 *
76 * Nothing outside of the driver core should ever touch these fields.
77 */
78struct device_private {
79 struct klist klist_children;
80 struct klist_node knode_parent;
81 struct klist_node knode_driver;
82 struct klist_node knode_bus;
83 struct device *device;
84};
85#define to_device_private_parent(obj) \
86 container_of(obj, struct device_private, knode_parent)
87#define to_device_private_driver(obj) \
88 container_of(obj, struct device_private, knode_driver)
89#define to_device_private_bus(obj) \
90 container_of(obj, struct device_private, knode_bus)
91
66/* initialisation functions */ 92/* initialisation functions */
67extern int devices_init(void); 93extern int devices_init(void);
68extern int buses_init(void); 94extern int buses_init(void);
@@ -86,6 +112,11 @@ extern void bus_remove_driver(struct device_driver *drv);
86 112
87extern void driver_detach(struct device_driver *drv); 113extern void driver_detach(struct device_driver *drv);
88extern int driver_probe_device(struct device_driver *drv, struct device *dev); 114extern int driver_probe_device(struct device_driver *drv, struct device *dev);
115static inline int driver_match_device(struct device_driver *drv,
116 struct device *dev)
117{
118 return drv->bus->match && drv->bus->match(dev, drv);
119}
89 120
90extern void sysdev_shutdown(void); 121extern void sysdev_shutdown(void);
91 122
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 83f32b891fa..dc030f1f00f 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -198,7 +198,7 @@ static ssize_t driver_bind(struct device_driver *drv,
198 int err = -ENODEV; 198 int err = -ENODEV;
199 199
200 dev = bus_find_device_by_name(bus, NULL, buf); 200 dev = bus_find_device_by_name(bus, NULL, buf);
201 if (dev && dev->driver == NULL) { 201 if (dev && dev->driver == NULL && driver_match_device(drv, dev)) {
202 if (dev->parent) /* Needed for USB */ 202 if (dev->parent) /* Needed for USB */
203 down(&dev->parent->sem); 203 down(&dev->parent->sem);
204 down(&dev->sem); 204 down(&dev->sem);
@@ -253,7 +253,14 @@ static ssize_t store_drivers_probe(struct bus_type *bus,
253static struct device *next_device(struct klist_iter *i) 253static struct device *next_device(struct klist_iter *i)
254{ 254{
255 struct klist_node *n = klist_next(i); 255 struct klist_node *n = klist_next(i);
256 return n ? container_of(n, struct device, knode_bus) : NULL; 256 struct device *dev = NULL;
257 struct device_private *dev_prv;
258
259 if (n) {
260 dev_prv = to_device_private_bus(n);
261 dev = dev_prv->device;
262 }
263 return dev;
257} 264}
258 265
259/** 266/**
@@ -286,7 +293,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
286 return -EINVAL; 293 return -EINVAL;
287 294
288 klist_iter_init_node(&bus->p->klist_devices, &i, 295 klist_iter_init_node(&bus->p->klist_devices, &i,
289 (start ? &start->knode_bus : NULL)); 296 (start ? &start->p->knode_bus : NULL));
290 while ((dev = next_device(&i)) && !error) 297 while ((dev = next_device(&i)) && !error)
291 error = fn(dev, data); 298 error = fn(dev, data);
292 klist_iter_exit(&i); 299 klist_iter_exit(&i);
@@ -320,7 +327,7 @@ struct device *bus_find_device(struct bus_type *bus,
320 return NULL; 327 return NULL;
321 328
322 klist_iter_init_node(&bus->p->klist_devices, &i, 329 klist_iter_init_node(&bus->p->klist_devices, &i,
323 (start ? &start->knode_bus : NULL)); 330 (start ? &start->p->knode_bus : NULL));
324 while ((dev = next_device(&i))) 331 while ((dev = next_device(&i)))
325 if (match(dev, data) && get_device(dev)) 332 if (match(dev, data) && get_device(dev))
326 break; 333 break;
@@ -507,7 +514,8 @@ void bus_attach_device(struct device *dev)
507 ret = device_attach(dev); 514 ret = device_attach(dev);
508 WARN_ON(ret < 0); 515 WARN_ON(ret < 0);
509 if (ret >= 0) 516 if (ret >= 0)
510 klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); 517 klist_add_tail(&dev->p->knode_bus,
518 &bus->p->klist_devices);
511 } 519 }
512} 520}
513 521
@@ -528,8 +536,8 @@ void bus_remove_device(struct device *dev)
528 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, 536 sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
529 dev_name(dev)); 537 dev_name(dev));
530 device_remove_attrs(dev->bus, dev); 538 device_remove_attrs(dev->bus, dev);
531 if (klist_node_attached(&dev->knode_bus)) 539 if (klist_node_attached(&dev->p->knode_bus))
532 klist_del(&dev->knode_bus); 540 klist_del(&dev->p->knode_bus);
533 541
534 pr_debug("bus: '%s': remove device %s\n", 542 pr_debug("bus: '%s': remove device %s\n",
535 dev->bus->name, dev_name(dev)); 543 dev->bus->name, dev_name(dev));
@@ -831,14 +839,16 @@ static void bus_remove_attrs(struct bus_type *bus)
831 839
832static void klist_devices_get(struct klist_node *n) 840static void klist_devices_get(struct klist_node *n)
833{ 841{
834 struct device *dev = container_of(n, struct device, knode_bus); 842 struct device_private *dev_prv = to_device_private_bus(n);
843 struct device *dev = dev_prv->device;
835 844
836 get_device(dev); 845 get_device(dev);
837} 846}
838 847
839static void klist_devices_put(struct klist_node *n) 848static void klist_devices_put(struct klist_node *n)
840{ 849{
841 struct device *dev = container_of(n, struct device, knode_bus); 850 struct device_private *dev_prv = to_device_private_bus(n);
851 struct device *dev = dev_prv->device;
842 852
843 put_device(dev); 853 put_device(dev);
844} 854}
@@ -932,6 +942,7 @@ bus_uevent_fail:
932 kset_unregister(&bus->p->subsys); 942 kset_unregister(&bus->p->subsys);
933 kfree(bus->p); 943 kfree(bus->p);
934out: 944out:
945 bus->p = NULL;
935 return retval; 946 return retval;
936} 947}
937EXPORT_SYMBOL_GPL(bus_register); 948EXPORT_SYMBOL_GPL(bus_register);
@@ -953,6 +964,7 @@ void bus_unregister(struct bus_type *bus)
953 bus_remove_file(bus, &bus_attr_uevent); 964 bus_remove_file(bus, &bus_attr_uevent);
954 kset_unregister(&bus->p->subsys); 965 kset_unregister(&bus->p->subsys);
955 kfree(bus->p); 966 kfree(bus->p);
967 bus->p = NULL;
956} 968}
957EXPORT_SYMBOL_GPL(bus_unregister); 969EXPORT_SYMBOL_GPL(bus_unregister);
958 970
@@ -993,18 +1005,20 @@ static void device_insertion_sort_klist(struct device *a, struct list_head *list
993{ 1005{
994 struct list_head *pos; 1006 struct list_head *pos;
995 struct klist_node *n; 1007 struct klist_node *n;
1008 struct device_private *dev_prv;
996 struct device *b; 1009 struct device *b;
997 1010
998 list_for_each(pos, list) { 1011 list_for_each(pos, list) {
999 n = container_of(pos, struct klist_node, n_node); 1012 n = container_of(pos, struct klist_node, n_node);
1000 b = container_of(n, struct device, knode_bus); 1013 dev_prv = to_device_private_bus(n);
1014 b = dev_prv->device;
1001 if (compare(a, b) <= 0) { 1015 if (compare(a, b) <= 0) {
1002 list_move_tail(&a->knode_bus.n_node, 1016 list_move_tail(&a->p->knode_bus.n_node,
1003 &b->knode_bus.n_node); 1017 &b->p->knode_bus.n_node);
1004 return; 1018 return;
1005 } 1019 }
1006 } 1020 }
1007 list_move_tail(&a->knode_bus.n_node, list); 1021 list_move_tail(&a->p->knode_bus.n_node, list);
1008} 1022}
1009 1023
1010void bus_sort_breadthfirst(struct bus_type *bus, 1024void bus_sort_breadthfirst(struct bus_type *bus,
@@ -1014,6 +1028,7 @@ void bus_sort_breadthfirst(struct bus_type *bus,
1014 LIST_HEAD(sorted_devices); 1028 LIST_HEAD(sorted_devices);
1015 struct list_head *pos, *tmp; 1029 struct list_head *pos, *tmp;
1016 struct klist_node *n; 1030 struct klist_node *n;
1031 struct device_private *dev_prv;
1017 struct device *dev; 1032 struct device *dev;
1018 struct klist *device_klist; 1033 struct klist *device_klist;
1019 1034
@@ -1022,7 +1037,8 @@ void bus_sort_breadthfirst(struct bus_type *bus,
1022 spin_lock(&device_klist->k_lock); 1037 spin_lock(&device_klist->k_lock);
1023 list_for_each_safe(pos, tmp, &device_klist->k_list) { 1038 list_for_each_safe(pos, tmp, &device_klist->k_list) {
1024 n = container_of(pos, struct klist_node, n_node); 1039 n = container_of(pos, struct klist_node, n_node);
1025 dev = container_of(n, struct device, knode_bus); 1040 dev_prv = to_device_private_bus(n);
1041 dev = dev_prv->device;
1026 device_insertion_sort_klist(dev, &sorted_devices, compare); 1042 device_insertion_sort_klist(dev, &sorted_devices, compare);
1027 } 1043 }
1028 list_splice(&sorted_devices, &device_klist->k_list); 1044 list_splice(&sorted_devices, &device_klist->k_list);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f3eae630e58..e73c92d13a2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -109,6 +109,7 @@ static struct sysfs_ops dev_sysfs_ops = {
109static void device_release(struct kobject *kobj) 109static void device_release(struct kobject *kobj)
110{ 110{
111 struct device *dev = to_dev(kobj); 111 struct device *dev = to_dev(kobj);
112 struct device_private *p = dev->p;
112 113
113 if (dev->release) 114 if (dev->release)
114 dev->release(dev); 115 dev->release(dev);
@@ -120,6 +121,7 @@ static void device_release(struct kobject *kobj)
120 WARN(1, KERN_ERR "Device '%s' does not have a release() " 121 WARN(1, KERN_ERR "Device '%s' does not have a release() "
121 "function, it is broken and must be fixed.\n", 122 "function, it is broken and must be fixed.\n",
122 dev_name(dev)); 123 dev_name(dev));
124 kfree(p);
123} 125}
124 126
125static struct kobj_type device_ktype = { 127static struct kobj_type device_ktype = {
@@ -134,8 +136,6 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
134 136
135 if (ktype == &device_ktype) { 137 if (ktype == &device_ktype) {
136 struct device *dev = to_dev(kobj); 138 struct device *dev = to_dev(kobj);
137 if (dev->uevent_suppress)
138 return 0;
139 if (dev->bus) 139 if (dev->bus)
140 return 1; 140 return 1;
141 if (dev->class) 141 if (dev->class)
@@ -507,14 +507,16 @@ EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
507 507
508static void klist_children_get(struct klist_node *n) 508static void klist_children_get(struct klist_node *n)
509{ 509{
510 struct device *dev = container_of(n, struct device, knode_parent); 510 struct device_private *p = to_device_private_parent(n);
511 struct device *dev = p->device;
511 512
512 get_device(dev); 513 get_device(dev);
513} 514}
514 515
515static void klist_children_put(struct klist_node *n) 516static void klist_children_put(struct klist_node *n)
516{ 517{
517 struct device *dev = container_of(n, struct device, knode_parent); 518 struct device_private *p = to_device_private_parent(n);
519 struct device *dev = p->device;
518 520
519 put_device(dev); 521 put_device(dev);
520} 522}
@@ -538,8 +540,6 @@ void device_initialize(struct device *dev)
538{ 540{
539 dev->kobj.kset = devices_kset; 541 dev->kobj.kset = devices_kset;
540 kobject_init(&dev->kobj, &device_ktype); 542 kobject_init(&dev->kobj, &device_ktype);
541 klist_init(&dev->klist_children, klist_children_get,
542 klist_children_put);
543 INIT_LIST_HEAD(&dev->dma_pools); 543 INIT_LIST_HEAD(&dev->dma_pools);
544 init_MUTEX(&dev->sem); 544 init_MUTEX(&dev->sem);
545 spin_lock_init(&dev->devres_lock); 545 spin_lock_init(&dev->devres_lock);
@@ -777,17 +777,12 @@ static void device_remove_class_symlinks(struct device *dev)
777int dev_set_name(struct device *dev, const char *fmt, ...) 777int dev_set_name(struct device *dev, const char *fmt, ...)
778{ 778{
779 va_list vargs; 779 va_list vargs;
780 char *s; 780 int err;
781 781
782 va_start(vargs, fmt); 782 va_start(vargs, fmt);
783 vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); 783 err = kobject_set_name_vargs(&dev->kobj, fmt, vargs);
784 va_end(vargs); 784 va_end(vargs);
785 785 return err;
786 /* ewww... some of these buggers have / in the name... */
787 while ((s = strchr(dev->bus_id, '/')))
788 *s = '!';
789
790 return 0;
791} 786}
792EXPORT_SYMBOL_GPL(dev_set_name); 787EXPORT_SYMBOL_GPL(dev_set_name);
793 788
@@ -864,12 +859,26 @@ int device_add(struct device *dev)
864 if (!dev) 859 if (!dev)
865 goto done; 860 goto done;
866 861
867 /* Temporarily support init_name if it is set. 862 dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL);
868 * It will override bus_id for now */ 863 if (!dev->p) {
869 if (dev->init_name) 864 error = -ENOMEM;
870 dev_set_name(dev, "%s", dev->init_name); 865 goto done;
866 }
867 dev->p->device = dev;
868 klist_init(&dev->p->klist_children, klist_children_get,
869 klist_children_put);
870
871 /*
872 * for statically allocated devices, which should all be converted
873 * some day, we need to initialize the name. We prevent reading back
874 * the name, and force the use of dev_name()
875 */
876 if (dev->init_name) {
877 dev_set_name(dev, dev->init_name);
878 dev->init_name = NULL;
879 }
871 880
872 if (!strlen(dev->bus_id)) 881 if (!dev_name(dev))
873 goto done; 882 goto done;
874 883
875 pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 884 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
@@ -928,7 +937,8 @@ int device_add(struct device *dev)
928 kobject_uevent(&dev->kobj, KOBJ_ADD); 937 kobject_uevent(&dev->kobj, KOBJ_ADD);
929 bus_attach_device(dev); 938 bus_attach_device(dev);
930 if (parent) 939 if (parent)
931 klist_add_tail(&dev->knode_parent, &parent->klist_children); 940 klist_add_tail(&dev->p->knode_parent,
941 &parent->p->klist_children);
932 942
933 if (dev->class) { 943 if (dev->class) {
934 mutex_lock(&dev->class->p->class_mutex); 944 mutex_lock(&dev->class->p->class_mutex);
@@ -1042,7 +1052,7 @@ void device_del(struct device *dev)
1042 device_pm_remove(dev); 1052 device_pm_remove(dev);
1043 dpm_sysfs_remove(dev); 1053 dpm_sysfs_remove(dev);
1044 if (parent) 1054 if (parent)
1045 klist_del(&dev->knode_parent); 1055 klist_del(&dev->p->knode_parent);
1046 if (MAJOR(dev->devt)) { 1056 if (MAJOR(dev->devt)) {
1047 device_remove_sys_dev_entry(dev); 1057 device_remove_sys_dev_entry(dev);
1048 device_remove_file(dev, &devt_attr); 1058 device_remove_file(dev, &devt_attr);
@@ -1103,7 +1113,14 @@ void device_unregister(struct device *dev)
1103static struct device *next_device(struct klist_iter *i) 1113static struct device *next_device(struct klist_iter *i)
1104{ 1114{
1105 struct klist_node *n = klist_next(i); 1115 struct klist_node *n = klist_next(i);
1106 return n ? container_of(n, struct device, knode_parent) : NULL; 1116 struct device *dev = NULL;
1117 struct device_private *p;
1118
1119 if (n) {
1120 p = to_device_private_parent(n);
1121 dev = p->device;
1122 }
1123 return dev;
1107} 1124}
1108 1125
1109/** 1126/**
@@ -1125,7 +1142,7 @@ int device_for_each_child(struct device *parent, void *data,
1125 struct device *child; 1142 struct device *child;
1126 int error = 0; 1143 int error = 0;
1127 1144
1128 klist_iter_init(&parent->klist_children, &i); 1145 klist_iter_init(&parent->p->klist_children, &i);
1129 while ((child = next_device(&i)) && !error) 1146 while ((child = next_device(&i)) && !error)
1130 error = fn(child, data); 1147 error = fn(child, data);
1131 klist_iter_exit(&i); 1148 klist_iter_exit(&i);
@@ -1156,7 +1173,7 @@ struct device *device_find_child(struct device *parent, void *data,
1156 if (!parent) 1173 if (!parent)
1157 return NULL; 1174 return NULL;
1158 1175
1159 klist_iter_init(&parent->klist_children, &i); 1176 klist_iter_init(&parent->p->klist_children, &i);
1160 while ((child = next_device(&i))) 1177 while ((child = next_device(&i)))
1161 if (match(child, data) && get_device(child)) 1178 if (match(child, data) && get_device(child))
1162 break; 1179 break;
@@ -1348,7 +1365,10 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
1348 dev->release = device_create_release; 1365 dev->release = device_create_release;
1349 dev_set_drvdata(dev, drvdata); 1366 dev_set_drvdata(dev, drvdata);
1350 1367
1351 vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); 1368 retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
1369 if (retval)
1370 goto error;
1371
1352 retval = device_register(dev); 1372 retval = device_register(dev);
1353 if (retval) 1373 if (retval)
1354 goto error; 1374 goto error;
@@ -1452,19 +1472,15 @@ int device_rename(struct device *dev, char *new_name)
1452 old_class_name = make_class_name(dev->class->name, &dev->kobj); 1472 old_class_name = make_class_name(dev->class->name, &dev->kobj);
1453#endif 1473#endif
1454 1474
1455 old_device_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL); 1475 old_device_name = kstrdup(dev_name(dev), GFP_KERNEL);
1456 if (!old_device_name) { 1476 if (!old_device_name) {
1457 error = -ENOMEM; 1477 error = -ENOMEM;
1458 goto out; 1478 goto out;
1459 } 1479 }
1460 strlcpy(old_device_name, dev->bus_id, BUS_ID_SIZE);
1461 strlcpy(dev->bus_id, new_name, BUS_ID_SIZE);
1462 1480
1463 error = kobject_rename(&dev->kobj, new_name); 1481 error = kobject_rename(&dev->kobj, new_name);
1464 if (error) { 1482 if (error)
1465 strlcpy(dev->bus_id, old_device_name, BUS_ID_SIZE);
1466 goto out; 1483 goto out;
1467 }
1468 1484
1469#ifdef CONFIG_SYSFS_DEPRECATED 1485#ifdef CONFIG_SYSFS_DEPRECATED
1470 if (old_class_name) { 1486 if (old_class_name) {
@@ -1545,8 +1561,10 @@ out:
1545 * device_move - moves a device to a new parent 1561 * device_move - moves a device to a new parent
1546 * @dev: the pointer to the struct device to be moved 1562 * @dev: the pointer to the struct device to be moved
1547 * @new_parent: the new parent of the device (can by NULL) 1563 * @new_parent: the new parent of the device (can by NULL)
1564 * @dpm_order: how to reorder the dpm_list
1548 */ 1565 */
1549int device_move(struct device *dev, struct device *new_parent) 1566int device_move(struct device *dev, struct device *new_parent,
1567 enum dpm_order dpm_order)
1550{ 1568{
1551 int error; 1569 int error;
1552 struct device *old_parent; 1570 struct device *old_parent;
@@ -1556,6 +1574,7 @@ int device_move(struct device *dev, struct device *new_parent)
1556 if (!dev) 1574 if (!dev)
1557 return -EINVAL; 1575 return -EINVAL;
1558 1576
1577 device_pm_lock();
1559 new_parent = get_device(new_parent); 1578 new_parent = get_device(new_parent);
1560 new_parent_kobj = get_device_parent(dev, new_parent); 1579 new_parent_kobj = get_device_parent(dev, new_parent);
1561 1580
@@ -1570,9 +1589,10 @@ int device_move(struct device *dev, struct device *new_parent)
1570 old_parent = dev->parent; 1589 old_parent = dev->parent;
1571 dev->parent = new_parent; 1590 dev->parent = new_parent;
1572 if (old_parent) 1591 if (old_parent)
1573 klist_remove(&dev->knode_parent); 1592 klist_remove(&dev->p->knode_parent);
1574 if (new_parent) { 1593 if (new_parent) {
1575 klist_add_tail(&dev->knode_parent, &new_parent->klist_children); 1594 klist_add_tail(&dev->p->knode_parent,
1595 &new_parent->p->klist_children);
1576 set_dev_node(dev, dev_to_node(new_parent)); 1596 set_dev_node(dev, dev_to_node(new_parent));
1577 } 1597 }
1578 1598
@@ -1584,11 +1604,11 @@ int device_move(struct device *dev, struct device *new_parent)
1584 device_move_class_links(dev, new_parent, old_parent); 1604 device_move_class_links(dev, new_parent, old_parent);
1585 if (!kobject_move(&dev->kobj, &old_parent->kobj)) { 1605 if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
1586 if (new_parent) 1606 if (new_parent)
1587 klist_remove(&dev->knode_parent); 1607 klist_remove(&dev->p->knode_parent);
1588 dev->parent = old_parent; 1608 dev->parent = old_parent;
1589 if (old_parent) { 1609 if (old_parent) {
1590 klist_add_tail(&dev->knode_parent, 1610 klist_add_tail(&dev->p->knode_parent,
1591 &old_parent->klist_children); 1611 &old_parent->p->klist_children);
1592 set_dev_node(dev, dev_to_node(old_parent)); 1612 set_dev_node(dev, dev_to_node(old_parent));
1593 } 1613 }
1594 } 1614 }
@@ -1596,9 +1616,23 @@ int device_move(struct device *dev, struct device *new_parent)
1596 put_device(new_parent); 1616 put_device(new_parent);
1597 goto out; 1617 goto out;
1598 } 1618 }
1619 switch (dpm_order) {
1620 case DPM_ORDER_NONE:
1621 break;
1622 case DPM_ORDER_DEV_AFTER_PARENT:
1623 device_pm_move_after(dev, new_parent);
1624 break;
1625 case DPM_ORDER_PARENT_BEFORE_DEV:
1626 device_pm_move_before(new_parent, dev);
1627 break;
1628 case DPM_ORDER_DEV_LAST:
1629 device_pm_move_last(dev);
1630 break;
1631 }
1599out_put: 1632out_put:
1600 put_device(old_parent); 1633 put_device(old_parent);
1601out: 1634out:
1635 device_pm_unlock();
1602 put_device(dev); 1636 put_device(dev);
1603 return error; 1637 return error;
1604} 1638}
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 13523123910..f17c3266a0e 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -30,7 +30,7 @@
30 30
31static void driver_bound(struct device *dev) 31static void driver_bound(struct device *dev)
32{ 32{
33 if (klist_node_attached(&dev->knode_driver)) { 33 if (klist_node_attached(&dev->p->knode_driver)) {
34 printk(KERN_WARNING "%s: device %s already bound\n", 34 printk(KERN_WARNING "%s: device %s already bound\n",
35 __func__, kobject_name(&dev->kobj)); 35 __func__, kobject_name(&dev->kobj));
36 return; 36 return;
@@ -43,7 +43,7 @@ static void driver_bound(struct device *dev)
43 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 43 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
44 BUS_NOTIFY_BOUND_DRIVER, dev); 44 BUS_NOTIFY_BOUND_DRIVER, dev);
45 45
46 klist_add_tail(&dev->knode_driver, &dev->driver->p->klist_devices); 46 klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
47} 47}
48 48
49static int driver_sysfs_add(struct device *dev) 49static int driver_sysfs_add(struct device *dev)
@@ -172,16 +172,12 @@ int driver_probe_done(void)
172/** 172/**
173 * wait_for_device_probe 173 * wait_for_device_probe
174 * Wait for device probing to be completed. 174 * Wait for device probing to be completed.
175 *
176 * Note: this function polls at 100 msec intervals.
177 */ 175 */
178int wait_for_device_probe(void) 176void wait_for_device_probe(void)
179{ 177{
180 /* wait for the known devices to complete their probing */ 178 /* wait for the known devices to complete their probing */
181 while (driver_probe_done() != 0) 179 wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
182 msleep(100);
183 async_synchronize_full(); 180 async_synchronize_full();
184 return 0;
185} 181}
186 182
187/** 183/**
@@ -189,14 +185,8 @@ int wait_for_device_probe(void)
189 * @drv: driver to bind a device to 185 * @drv: driver to bind a device to
190 * @dev: device to try to bind to the driver 186 * @dev: device to try to bind to the driver
191 * 187 *
192 * First, we call the bus's match function, if one present, which should 188 * This function returns -ENODEV if the device is not registered,
193 * compare the device IDs the driver supports with the device IDs of the 189 * 1 if the device is bound sucessfully and 0 otherwise.
194 * device. Note we don't do this ourselves because we don't know the
195 * format of the ID structures, nor what is to be considered a match and
196 * what is not.
197 *
198 * This function returns 1 if a match is found, -ENODEV if the device is
199 * not registered, and 0 otherwise.
200 * 190 *
201 * This function must be called with @dev->sem held. When called for a 191 * This function must be called with @dev->sem held. When called for a
202 * USB interface, @dev->parent->sem must be held as well. 192 * USB interface, @dev->parent->sem must be held as well.
@@ -207,21 +197,22 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
207 197
208 if (!device_is_registered(dev)) 198 if (!device_is_registered(dev))
209 return -ENODEV; 199 return -ENODEV;
210 if (drv->bus->match && !drv->bus->match(dev, drv))
211 goto done;
212 200
213 pr_debug("bus: '%s': %s: matched device %s with driver %s\n", 201 pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
214 drv->bus->name, __func__, dev_name(dev), drv->name); 202 drv->bus->name, __func__, dev_name(dev), drv->name);
215 203
216 ret = really_probe(dev, drv); 204 ret = really_probe(dev, drv);
217 205
218done:
219 return ret; 206 return ret;
220} 207}
221 208
222static int __device_attach(struct device_driver *drv, void *data) 209static int __device_attach(struct device_driver *drv, void *data)
223{ 210{
224 struct device *dev = data; 211 struct device *dev = data;
212
213 if (!driver_match_device(drv, dev))
214 return 0;
215
225 return driver_probe_device(drv, dev); 216 return driver_probe_device(drv, dev);
226} 217}
227 218
@@ -274,7 +265,7 @@ static int __driver_attach(struct device *dev, void *data)
274 * is an error. 265 * is an error.
275 */ 266 */
276 267
277 if (drv->bus->match && !drv->bus->match(dev, drv)) 268 if (!driver_match_device(drv, dev))
278 return 0; 269 return 0;
279 270
280 if (dev->parent) /* Needed for USB */ 271 if (dev->parent) /* Needed for USB */
@@ -327,7 +318,7 @@ static void __device_release_driver(struct device *dev)
327 drv->remove(dev); 318 drv->remove(dev);
328 devres_release_all(dev); 319 devres_release_all(dev);
329 dev->driver = NULL; 320 dev->driver = NULL;
330 klist_remove(&dev->knode_driver); 321 klist_remove(&dev->p->knode_driver);
331 } 322 }
332} 323}
333 324
@@ -357,6 +348,7 @@ EXPORT_SYMBOL_GPL(device_release_driver);
357 */ 348 */
358void driver_detach(struct device_driver *drv) 349void driver_detach(struct device_driver *drv)
359{ 350{
351 struct device_private *dev_prv;
360 struct device *dev; 352 struct device *dev;
361 353
362 for (;;) { 354 for (;;) {
@@ -365,8 +357,10 @@ void driver_detach(struct device_driver *drv)
365 spin_unlock(&drv->p->klist_devices.k_lock); 357 spin_unlock(&drv->p->klist_devices.k_lock);
366 break; 358 break;
367 } 359 }
368 dev = list_entry(drv->p->klist_devices.k_list.prev, 360 dev_prv = list_entry(drv->p->klist_devices.k_list.prev,
369 struct device, knode_driver.n_node); 361 struct device_private,
362 knode_driver.n_node);
363 dev = dev_prv->device;
370 get_device(dev); 364 get_device(dev);
371 spin_unlock(&drv->p->klist_devices.k_lock); 365 spin_unlock(&drv->p->klist_devices.k_lock);
372 366
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1e2bda780e4..c51f11bb29a 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -19,7 +19,14 @@
19static struct device *next_device(struct klist_iter *i) 19static struct device *next_device(struct klist_iter *i)
20{ 20{
21 struct klist_node *n = klist_next(i); 21 struct klist_node *n = klist_next(i);
22 return n ? container_of(n, struct device, knode_driver) : NULL; 22 struct device *dev = NULL;
23 struct device_private *dev_prv;
24
25 if (n) {
26 dev_prv = to_device_private_driver(n);
27 dev = dev_prv->device;
28 }
29 return dev;
23} 30}
24 31
25/** 32/**
@@ -42,7 +49,7 @@ int driver_for_each_device(struct device_driver *drv, struct device *start,
42 return -EINVAL; 49 return -EINVAL;
43 50
44 klist_iter_init_node(&drv->p->klist_devices, &i, 51 klist_iter_init_node(&drv->p->klist_devices, &i,
45 start ? &start->knode_driver : NULL); 52 start ? &start->p->knode_driver : NULL);
46 while ((dev = next_device(&i)) && !error) 53 while ((dev = next_device(&i)) && !error)
47 error = fn(dev, data); 54 error = fn(dev, data);
48 klist_iter_exit(&i); 55 klist_iter_exit(&i);
@@ -76,7 +83,7 @@ struct device *driver_find_device(struct device_driver *drv,
76 return NULL; 83 return NULL;
77 84
78 klist_iter_init_node(&drv->p->klist_devices, &i, 85 klist_iter_init_node(&drv->p->klist_devices, &i,
79 (start ? &start->knode_driver : NULL)); 86 (start ? &start->p->knode_driver : NULL));
80 while ((dev = next_device(&i))) 87 while ((dev = next_device(&i)))
81 if (match(dev, data) && get_device(dev)) 88 if (match(dev, data) && get_device(dev))
82 break; 89 break;
@@ -216,6 +223,8 @@ int driver_register(struct device_driver *drv)
216 int ret; 223 int ret;
217 struct device_driver *other; 224 struct device_driver *other;
218 225
226 BUG_ON(!drv->bus->p);
227
219 if ((drv->bus->probe && drv->probe) || 228 if ((drv->bus->probe && drv->probe) ||
220 (drv->bus->remove && drv->remove) || 229 (drv->bus->remove && drv->remove) ||
221 (drv->bus->shutdown && drv->shutdown)) 230 (drv->bus->shutdown && drv->shutdown))
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 44699d9dd85..d3a59c688fe 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -319,7 +319,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
319 f_dev->parent = device; 319 f_dev->parent = device;
320 f_dev->class = &firmware_class; 320 f_dev->class = &firmware_class;
321 dev_set_drvdata(f_dev, fw_priv); 321 dev_set_drvdata(f_dev, fw_priv);
322 f_dev->uevent_suppress = 1; 322 dev_set_uevent_suppress(f_dev, 1);
323 retval = device_register(f_dev); 323 retval = device_register(f_dev);
324 if (retval) { 324 if (retval) {
325 dev_err(device, "%s: device_register failed\n", __func__); 325 dev_err(device, "%s: device_register failed\n", __func__);
@@ -366,7 +366,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
366 } 366 }
367 367
368 if (uevent) 368 if (uevent)
369 f_dev->uevent_suppress = 0; 369 dev_set_uevent_suppress(f_dev, 0);
370 *dev_p = f_dev; 370 *dev_p = f_dev;
371 goto out; 371 goto out;
372 372
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 349a1013603..d2198f64ad4 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -217,6 +217,7 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
217 if (d) { 217 if (d) {
218 memcpy(d, data, size); 218 memcpy(d, data, size);
219 pdev->dev.platform_data = d; 219 pdev->dev.platform_data = d;
220 pdev->platform_data = d;
220 } 221 }
221 return d ? 0 : -ENOMEM; 222 return d ? 0 : -ENOMEM;
222} 223}
@@ -246,6 +247,21 @@ int platform_device_add(struct platform_device *pdev)
246 else 247 else
247 dev_set_name(&pdev->dev, pdev->name); 248 dev_set_name(&pdev->dev, pdev->name);
248 249
250 /* We will remove platform_data field from struct device
251 * if all platform devices pass its platform specific data
252 * from platform_device. The conversion is going to be a
253 * long time, so we allow the two cases coexist to make
254 * this kind of fix more easily*/
255 if (pdev->platform_data && pdev->dev.platform_data) {
256 printk(KERN_ERR
257 "%s: use which platform_data?\n",
258 dev_name(&pdev->dev));
259 } else if (pdev->platform_data) {
260 pdev->dev.platform_data = pdev->platform_data;
261 } else if (pdev->dev.platform_data) {
262 pdev->platform_data = pdev->dev.platform_data;
263 }
264
249 for (i = 0; i < pdev->num_resources; i++) { 265 for (i = 0; i < pdev->num_resources; i++) {
250 struct resource *p, *r = &pdev->resource[i]; 266 struct resource *p, *r = &pdev->resource[i];
251 267
@@ -584,10 +600,25 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
584{ 600{
585 struct platform_device *pdev = to_platform_device(dev); 601 struct platform_device *pdev = to_platform_device(dev);
586 602
587 add_uevent_var(env, "MODALIAS=platform:%s", pdev->name); 603 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
604 (pdev->id_entry) ? pdev->id_entry->name : pdev->name);
588 return 0; 605 return 0;
589} 606}
590 607
608static const struct platform_device_id *platform_match_id(
609 struct platform_device_id *id,
610 struct platform_device *pdev)
611{
612 while (id->name[0]) {
613 if (strcmp(pdev->name, id->name) == 0) {
614 pdev->id_entry = id;
615 return id;
616 }
617 id++;
618 }
619 return NULL;
620}
621
591/** 622/**
592 * platform_match - bind platform device to platform driver. 623 * platform_match - bind platform device to platform driver.
593 * @dev: device. 624 * @dev: device.
@@ -603,9 +634,14 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
603 */ 634 */
604static int platform_match(struct device *dev, struct device_driver *drv) 635static int platform_match(struct device *dev, struct device_driver *drv)
605{ 636{
606 struct platform_device *pdev; 637 struct platform_device *pdev = to_platform_device(dev);
638 struct platform_driver *pdrv = to_platform_driver(drv);
607 639
608 pdev = container_of(dev, struct platform_device, dev); 640 /* match against the id table first */
641 if (pdrv->id_table)
642 return platform_match_id(pdrv->id_table, pdev) != NULL;
643
644 /* fall-back to driver name match */
609 return (strcmp(pdev->name, drv->name) == 0); 645 return (strcmp(pdev->name, drv->name) == 0);
610} 646}
611 647
@@ -623,26 +659,24 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
623 659
624static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg) 660static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
625{ 661{
626 struct platform_driver *drv = to_platform_driver(dev->driver); 662 struct platform_driver *pdrv = to_platform_driver(dev->driver);
627 struct platform_device *pdev; 663 struct platform_device *pdev = to_platform_device(dev);
628 int ret = 0; 664 int ret = 0;
629 665
630 pdev = container_of(dev, struct platform_device, dev); 666 if (dev->driver && pdrv->suspend_late)
631 if (dev->driver && drv->suspend_late) 667 ret = pdrv->suspend_late(pdev, mesg);
632 ret = drv->suspend_late(pdev, mesg);
633 668
634 return ret; 669 return ret;
635} 670}
636 671
637static int platform_legacy_resume_early(struct device *dev) 672static int platform_legacy_resume_early(struct device *dev)
638{ 673{
639 struct platform_driver *drv = to_platform_driver(dev->driver); 674 struct platform_driver *pdrv = to_platform_driver(dev->driver);
640 struct platform_device *pdev; 675 struct platform_device *pdev = to_platform_device(dev);
641 int ret = 0; 676 int ret = 0;
642 677
643 pdev = container_of(dev, struct platform_device, dev); 678 if (dev->driver && pdrv->resume_early)
644 if (dev->driver && drv->resume_early) 679 ret = pdrv->resume_early(pdev);
645 ret = drv->resume_early(pdev);
646 680
647 return ret; 681 return ret;
648} 682}
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 2d14f4ae6c0..e255341682c 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -107,6 +107,50 @@ void device_pm_remove(struct device *dev)
107} 107}
108 108
109/** 109/**
110 * device_pm_move_before - move device in dpm_list
111 * @deva: Device to move in dpm_list
112 * @devb: Device @deva should come before
113 */
114void device_pm_move_before(struct device *deva, struct device *devb)
115{
116 pr_debug("PM: Moving %s:%s before %s:%s\n",
117 deva->bus ? deva->bus->name : "No Bus",
118 kobject_name(&deva->kobj),
119 devb->bus ? devb->bus->name : "No Bus",
120 kobject_name(&devb->kobj));
121 /* Delete deva from dpm_list and reinsert before devb. */
122 list_move_tail(&deva->power.entry, &devb->power.entry);
123}
124
125/**
126 * device_pm_move_after - move device in dpm_list
127 * @deva: Device to move in dpm_list
128 * @devb: Device @deva should come after
129 */
130void device_pm_move_after(struct device *deva, struct device *devb)
131{
132 pr_debug("PM: Moving %s:%s after %s:%s\n",
133 deva->bus ? deva->bus->name : "No Bus",
134 kobject_name(&deva->kobj),
135 devb->bus ? devb->bus->name : "No Bus",
136 kobject_name(&devb->kobj));
137 /* Delete deva from dpm_list and reinsert after devb. */
138 list_move(&deva->power.entry, &devb->power.entry);
139}
140
141/**
142 * device_pm_move_last - move device to end of dpm_list
143 * @dev: Device to move in dpm_list
144 */
145void device_pm_move_last(struct device *dev)
146{
147 pr_debug("PM: Moving %s:%s to end of list\n",
148 dev->bus ? dev->bus->name : "No Bus",
149 kobject_name(&dev->kobj));
150 list_move_tail(&dev->power.entry, &dpm_list);
151}
152
153/**
110 * pm_op - execute the PM operation appropiate for given PM event 154 * pm_op - execute the PM operation appropiate for given PM event
111 * @dev: Device. 155 * @dev: Device.
112 * @ops: PM operations to choose from. 156 * @ops: PM operations to choose from.
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 41f51fae042..c7cb4fc3735 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -18,11 +18,19 @@ static inline struct device *to_device(struct list_head *entry)
18 18
19extern void device_pm_add(struct device *); 19extern void device_pm_add(struct device *);
20extern void device_pm_remove(struct device *); 20extern void device_pm_remove(struct device *);
21extern void device_pm_move_before(struct device *, struct device *);
22extern void device_pm_move_after(struct device *, struct device *);
23extern void device_pm_move_last(struct device *);
21 24
22#else /* CONFIG_PM_SLEEP */ 25#else /* CONFIG_PM_SLEEP */
23 26
24static inline void device_pm_add(struct device *dev) {} 27static inline void device_pm_add(struct device *dev) {}
25static inline void device_pm_remove(struct device *dev) {} 28static inline void device_pm_remove(struct device *dev) {}
29static inline void device_pm_move_before(struct device *deva,
30 struct device *devb) {}
31static inline void device_pm_move_after(struct device *deva,
32 struct device *devb) {}
33static inline void device_pm_move_last(struct device *dev) {}
26 34
27#endif 35#endif
28 36
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index b428c8c4bc6..cbd36cf59a0 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -30,10 +30,10 @@
30 30
31 31
32static ssize_t 32static ssize_t
33sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) 33sysdev_show(struct kobject *kobj, struct attribute *attr, char *buffer)
34{ 34{
35 struct sys_device * sysdev = to_sysdev(kobj); 35 struct sys_device *sysdev = to_sysdev(kobj);
36 struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); 36 struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr);
37 37
38 if (sysdev_attr->show) 38 if (sysdev_attr->show)
39 return sysdev_attr->show(sysdev, sysdev_attr, buffer); 39 return sysdev_attr->show(sysdev, sysdev_attr, buffer);
@@ -42,11 +42,11 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer)
42 42
43 43
44static ssize_t 44static ssize_t
45sysdev_store(struct kobject * kobj, struct attribute * attr, 45sysdev_store(struct kobject *kobj, struct attribute *attr,
46 const char * buffer, size_t count) 46 const char *buffer, size_t count)
47{ 47{
48 struct sys_device * sysdev = to_sysdev(kobj); 48 struct sys_device *sysdev = to_sysdev(kobj);
49 struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); 49 struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr);
50 50
51 if (sysdev_attr->store) 51 if (sysdev_attr->store)
52 return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); 52 return sysdev_attr->store(sysdev, sysdev_attr, buffer, count);
@@ -63,13 +63,13 @@ static struct kobj_type ktype_sysdev = {
63}; 63};
64 64
65 65
66int sysdev_create_file(struct sys_device * s, struct sysdev_attribute * a) 66int sysdev_create_file(struct sys_device *s, struct sysdev_attribute *a)
67{ 67{
68 return sysfs_create_file(&s->kobj, &a->attr); 68 return sysfs_create_file(&s->kobj, &a->attr);
69} 69}
70 70
71 71
72void sysdev_remove_file(struct sys_device * s, struct sysdev_attribute * a) 72void sysdev_remove_file(struct sys_device *s, struct sysdev_attribute *a)
73{ 73{
74 sysfs_remove_file(&s->kobj, &a->attr); 74 sysfs_remove_file(&s->kobj, &a->attr);
75} 75}
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(sysdev_remove_file);
84static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, 84static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
85 char *buffer) 85 char *buffer)
86{ 86{
87 struct sysdev_class * class = to_sysdev_class(kobj); 87 struct sysdev_class *class = to_sysdev_class(kobj);
88 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); 88 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
89 89
90 if (class_attr->show) 90 if (class_attr->show)
@@ -95,8 +95,8 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
95static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, 95static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
96 const char *buffer, size_t count) 96 const char *buffer, size_t count)
97{ 97{
98 struct sysdev_class * class = to_sysdev_class(kobj); 98 struct sysdev_class *class = to_sysdev_class(kobj);
99 struct sysdev_class_attribute * class_attr = to_sysdev_class_attr(attr); 99 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
100 100
101 if (class_attr->store) 101 if (class_attr->store)
102 return class_attr->store(class, buffer, count); 102 return class_attr->store(class, buffer, count);
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
128 128
129static struct kset *system_kset; 129static struct kset *system_kset;
130 130
131int sysdev_class_register(struct sysdev_class * cls) 131int sysdev_class_register(struct sysdev_class *cls)
132{ 132{
133 pr_debug("Registering sysdev class '%s'\n", cls->name); 133 pr_debug("Registering sysdev class '%s'\n", cls->name);
134 134
@@ -141,7 +141,7 @@ int sysdev_class_register(struct sysdev_class * cls)
141 return kset_register(&cls->kset); 141 return kset_register(&cls->kset);
142} 142}
143 143
144void sysdev_class_unregister(struct sysdev_class * cls) 144void sysdev_class_unregister(struct sysdev_class *cls)
145{ 145{
146 pr_debug("Unregistering sysdev class '%s'\n", 146 pr_debug("Unregistering sysdev class '%s'\n",
147 kobject_name(&cls->kset.kobj)); 147 kobject_name(&cls->kset.kobj));
@@ -203,8 +203,8 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
203 * @cls: Class driver belongs to. 203 * @cls: Class driver belongs to.
204 * @drv: Driver. 204 * @drv: Driver.
205 */ 205 */
206void sysdev_driver_unregister(struct sysdev_class * cls, 206void sysdev_driver_unregister(struct sysdev_class *cls,
207 struct sysdev_driver * drv) 207 struct sysdev_driver *drv)
208{ 208{
209 mutex_lock(&sysdev_drivers_lock); 209 mutex_lock(&sysdev_drivers_lock);
210 list_del_init(&drv->entry); 210 list_del_init(&drv->entry);
@@ -229,10 +229,10 @@ EXPORT_SYMBOL_GPL(sysdev_driver_unregister);
229 * @sysdev: device in question 229 * @sysdev: device in question
230 * 230 *
231 */ 231 */
232int sysdev_register(struct sys_device * sysdev) 232int sysdev_register(struct sys_device *sysdev)
233{ 233{
234 int error; 234 int error;
235 struct sysdev_class * cls = sysdev->cls; 235 struct sysdev_class *cls = sysdev->cls;
236 236
237 if (!cls) 237 if (!cls)
238 return -EINVAL; 238 return -EINVAL;
@@ -252,7 +252,7 @@ int sysdev_register(struct sys_device * sysdev)
252 sysdev->id); 252 sysdev->id);
253 253
254 if (!error) { 254 if (!error) {
255 struct sysdev_driver * drv; 255 struct sysdev_driver *drv;
256 256
257 pr_debug("Registering sys device '%s'\n", 257 pr_debug("Registering sys device '%s'\n",
258 kobject_name(&sysdev->kobj)); 258 kobject_name(&sysdev->kobj));
@@ -274,9 +274,9 @@ int sysdev_register(struct sys_device * sysdev)
274 return error; 274 return error;
275} 275}
276 276
277void sysdev_unregister(struct sys_device * sysdev) 277void sysdev_unregister(struct sys_device *sysdev)
278{ 278{
279 struct sysdev_driver * drv; 279 struct sysdev_driver *drv;
280 280
281 mutex_lock(&sysdev_drivers_lock); 281 mutex_lock(&sysdev_drivers_lock);
282 list_for_each_entry(drv, &sysdev->cls->drivers, entry) { 282 list_for_each_entry(drv, &sysdev->cls->drivers, entry) {
@@ -305,19 +305,19 @@ void sysdev_unregister(struct sys_device * sysdev)
305 */ 305 */
306void sysdev_shutdown(void) 306void sysdev_shutdown(void)
307{ 307{
308 struct sysdev_class * cls; 308 struct sysdev_class *cls;
309 309
310 pr_debug("Shutting Down System Devices\n"); 310 pr_debug("Shutting Down System Devices\n");
311 311
312 mutex_lock(&sysdev_drivers_lock); 312 mutex_lock(&sysdev_drivers_lock);
313 list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) { 313 list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
314 struct sys_device * sysdev; 314 struct sys_device *sysdev;
315 315
316 pr_debug("Shutting down type '%s':\n", 316 pr_debug("Shutting down type '%s':\n",
317 kobject_name(&cls->kset.kobj)); 317 kobject_name(&cls->kset.kobj));
318 318
319 list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) { 319 list_for_each_entry(sysdev, &cls->kset.list, kobj.entry) {
320 struct sysdev_driver * drv; 320 struct sysdev_driver *drv;
321 pr_debug(" %s\n", kobject_name(&sysdev->kobj)); 321 pr_debug(" %s\n", kobject_name(&sysdev->kobj));
322 322
323 /* Call auxillary drivers first */ 323 /* Call auxillary drivers first */
@@ -364,7 +364,7 @@ static void __sysdev_resume(struct sys_device *dev)
364 */ 364 */
365int sysdev_suspend(pm_message_t state) 365int sysdev_suspend(pm_message_t state)
366{ 366{
367 struct sysdev_class * cls; 367 struct sysdev_class *cls;
368 struct sys_device *sysdev, *err_dev; 368 struct sys_device *sysdev, *err_dev;
369 struct sysdev_driver *drv, *err_drv; 369 struct sysdev_driver *drv, *err_drv;
370 int ret; 370 int ret;
@@ -442,12 +442,12 @@ EXPORT_SYMBOL_GPL(sysdev_suspend);
442 */ 442 */
443int sysdev_resume(void) 443int sysdev_resume(void)
444{ 444{
445 struct sysdev_class * cls; 445 struct sysdev_class *cls;
446 446
447 pr_debug("Resuming System Devices\n"); 447 pr_debug("Resuming System Devices\n");
448 448
449 list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) { 449 list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) {
450 struct sys_device * sysdev; 450 struct sys_device *sysdev;
451 451
452 pr_debug("Resuming type '%s':\n", 452 pr_debug("Resuming type '%s':\n",
453 kobject_name(&cls->kset.kobj)); 453 kobject_name(&cls->kset.kobj));
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 83d8ed39433..c2c95e61450 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4135,10 +4135,9 @@ static int have_no_fdc = -ENODEV;
4135static ssize_t floppy_cmos_show(struct device *dev, 4135static ssize_t floppy_cmos_show(struct device *dev,
4136 struct device_attribute *attr, char *buf) 4136 struct device_attribute *attr, char *buf)
4137{ 4137{
4138 struct platform_device *p; 4138 struct platform_device *p = to_platform_device(dev);
4139 int drive; 4139 int drive;
4140 4140
4141 p = container_of(dev, struct platform_device,dev);
4142 drive = p->id; 4141 drive = p->id;
4143 return sprintf(buf, "%X\n", UDP->cmos); 4142 return sprintf(buf, "%X\n", UDP->cmos);
4144} 4143}
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index d0e7926eb48..c64a1bc6534 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -168,12 +168,22 @@ static void atml_plat_remove(void)
168 } 168 }
169} 169}
170 170
171static struct device_driver atml_drv = { 171static int tpm_atml_suspend(struct platform_device *dev, pm_message_t msg)
172 .name = "tpm_atmel", 172{
173 .bus = &platform_bus_type, 173 return tpm_pm_suspend(&dev->dev, msg);
174 .owner = THIS_MODULE, 174}
175 .suspend = tpm_pm_suspend, 175
176 .resume = tpm_pm_resume, 176static int tpm_atml_resume(struct platform_device *dev)
177{
178 return tpm_pm_resume(&dev->dev);
179}
180static struct platform_driver atml_drv = {
181 .driver = {
182 .name = "tpm_atmel",
183 .owner = THIS_MODULE,
184 },
185 .suspend = tpm_atml_suspend,
186 .resume = tpm_atml_resume,
177}; 187};
178 188
179static int __init init_atmel(void) 189static int __init init_atmel(void)
@@ -184,7 +194,7 @@ static int __init init_atmel(void)
184 unsigned long base; 194 unsigned long base;
185 struct tpm_chip *chip; 195 struct tpm_chip *chip;
186 196
187 rc = driver_register(&atml_drv); 197 rc = platform_driver_register(&atml_drv);
188 if (rc) 198 if (rc)
189 return rc; 199 return rc;
190 200
@@ -223,13 +233,13 @@ err_rel_reg:
223 atmel_release_region(base, 233 atmel_release_region(base,
224 region_size); 234 region_size);
225err_unreg_drv: 235err_unreg_drv:
226 driver_unregister(&atml_drv); 236 platform_driver_unregister(&atml_drv);
227 return rc; 237 return rc;
228} 238}
229 239
230static void __exit cleanup_atmel(void) 240static void __exit cleanup_atmel(void)
231{ 241{
232 driver_unregister(&atml_drv); 242 platform_driver_unregister(&atml_drv);
233 atml_plat_remove(); 243 atml_plat_remove();
234} 244}
235 245
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 717af7ad1bd..aec1931608a 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -654,12 +654,22 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
654 sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); 654 sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
655MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); 655MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
656 656
657static struct device_driver tis_drv = { 657static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg)
658 .name = "tpm_tis", 658{
659 .bus = &platform_bus_type, 659 return tpm_pm_suspend(&dev->dev, msg);
660 .owner = THIS_MODULE, 660}
661 .suspend = tpm_pm_suspend, 661
662 .resume = tpm_pm_resume, 662static int tpm_tis_resume(struct platform_device *dev)
663{
664 return tpm_pm_resume(&dev->dev);
665}
666static struct platform_driver tis_drv = {
667 .driver = {
668 .name = "tpm_tis",
669 .owner = THIS_MODULE,
670 },
671 .suspend = tpm_tis_suspend,
672 .resume = tpm_tis_resume,
663}; 673};
664 674
665static struct platform_device *pdev; 675static struct platform_device *pdev;
@@ -672,14 +682,14 @@ static int __init init_tis(void)
672 int rc; 682 int rc;
673 683
674 if (force) { 684 if (force) {
675 rc = driver_register(&tis_drv); 685 rc = platform_driver_register(&tis_drv);
676 if (rc < 0) 686 if (rc < 0)
677 return rc; 687 return rc;
678 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) 688 if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0)))
679 return PTR_ERR(pdev); 689 return PTR_ERR(pdev);
680 if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { 690 if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) {
681 platform_device_unregister(pdev); 691 platform_device_unregister(pdev);
682 driver_unregister(&tis_drv); 692 platform_driver_unregister(&tis_drv);
683 } 693 }
684 return rc; 694 return rc;
685 } 695 }
@@ -711,7 +721,7 @@ static void __exit cleanup_tis(void)
711 721
712 if (force) { 722 if (force) {
713 platform_device_unregister(pdev); 723 platform_device_unregister(pdev);
714 driver_unregister(&tis_drv); 724 platform_driver_unregister(&tis_drv);
715 } else 725 } else
716 pnp_unregister_driver(&tis_pnp_driver); 726 pnp_unregister_driver(&tis_pnp_driver);
717} 727}
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 4f3b3f95fc4..d94d25c12aa 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -479,18 +479,18 @@ static const struct file_operations vcs_fops = {
479 479
480static struct class *vc_class; 480static struct class *vc_class;
481 481
482void vcs_make_sysfs(struct tty_struct *tty) 482void vcs_make_sysfs(int index)
483{ 483{
484 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), NULL, 484 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL,
485 "vcs%u", tty->index + 1); 485 "vcs%u", index + 1);
486 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), NULL, 486 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL,
487 "vcsa%u", tty->index + 1); 487 "vcsa%u", index + 1);
488} 488}
489 489
490void vcs_remove_sysfs(struct tty_struct *tty) 490void vcs_remove_sysfs(int index)
491{ 491{
492 device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); 492 device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 1));
493 device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); 493 device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 129));
494} 494}
495 495
496int __init vcs_init(void) 496int __init vcs_init(void)
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 7900bd63b36..2c1d133819b 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -778,6 +778,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
778 } 778 }
779 vc->vc_kmalloced = 1; 779 vc->vc_kmalloced = 1;
780 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); 780 vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
781 vcs_make_sysfs(currcons);
781 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param); 782 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
782 } 783 }
783 return 0; 784 return 0;
@@ -987,7 +988,9 @@ void vc_deallocate(unsigned int currcons)
987 if (vc_cons_allocated(currcons)) { 988 if (vc_cons_allocated(currcons)) {
988 struct vc_data *vc = vc_cons[currcons].d; 989 struct vc_data *vc = vc_cons[currcons].d;
989 struct vt_notifier_param param = { .vc = vc }; 990 struct vt_notifier_param param = { .vc = vc };
991
990 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param); 992 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
993 vcs_remove_sysfs(currcons);
991 vc->vc_sw->con_deinit(vc); 994 vc->vc_sw->con_deinit(vc);
992 put_pid(vc->vt_pid); 995 put_pid(vc->vt_pid);
993 module_put(vc->vc_sw->owner); 996 module_put(vc->vc_sw->owner);
@@ -2775,7 +2778,6 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2775 tty->termios->c_iflag |= IUTF8; 2778 tty->termios->c_iflag |= IUTF8;
2776 else 2779 else
2777 tty->termios->c_iflag &= ~IUTF8; 2780 tty->termios->c_iflag &= ~IUTF8;
2778 vcs_make_sysfs(tty);
2779 release_console_sem(); 2781 release_console_sem();
2780 return ret; 2782 return ret;
2781 } 2783 }
@@ -2795,7 +2797,6 @@ static void con_shutdown(struct tty_struct *tty)
2795 BUG_ON(vc == NULL); 2797 BUG_ON(vc == NULL);
2796 acquire_console_sem(); 2798 acquire_console_sem();
2797 vc->vc_tty = NULL; 2799 vc->vc_tty = NULL;
2798 vcs_remove_sysfs(tty);
2799 release_console_sem(); 2800 release_console_sem();
2800 tty_shutdown(tty); 2801 tty_shutdown(tty);
2801} 2802}
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c
index 10c3c498358..55dd88d82d6 100644
--- a/drivers/dio/dio.c
+++ b/drivers/dio/dio.c
@@ -182,7 +182,7 @@ static int __init dio_init(void)
182 182
183 /* Initialize the DIO bus */ 183 /* Initialize the DIO bus */
184 INIT_LIST_HEAD(&dio_bus.devices); 184 INIT_LIST_HEAD(&dio_bus.devices);
185 strcpy(dio_bus.dev.bus_id, "dio"); 185 dev_set_name(&dio_bus.dev, "dio");
186 error = device_register(&dio_bus.dev); 186 error = device_register(&dio_bus.dev);
187 if (error) { 187 if (error) {
188 pr_err("DIO: Error registering dio_bus\n"); 188 pr_err("DIO: Error registering dio_bus\n");
@@ -237,7 +237,7 @@ static int __init dio_init(void)
237 dev->scode = scode; 237 dev->scode = scode;
238 dev->resource.start = pa; 238 dev->resource.start = pa;
239 dev->resource.end = pa + DIO_SIZE(scode, va); 239 dev->resource.end = pa + DIO_SIZE(scode, va);
240 sprintf(dev->dev.bus_id,"%02x", scode); 240 dev_set_name(&dev->dev, "%02x", scode);
241 241
242 /* read the ID byte(s) and encode if necessary. */ 242 /* read the ID byte(s) and encode if necessary. */
243 prid = DIO_ID(va); 243 prid = DIO_ID(va);
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index a97c07eef7e..20ad3d26bec 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1011,7 +1011,7 @@ static int __init dw_probe(struct platform_device *pdev)
1011 dma_writel(dw, CFG, DW_CFG_DMA_EN); 1011 dma_writel(dw, CFG, DW_CFG_DMA_EN);
1012 1012
1013 printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n", 1013 printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n",
1014 pdev->dev.bus_id, dw->dma.chancnt); 1014 dev_name(&pdev->dev), dw->dma.chancnt);
1015 1015
1016 dma_async_device_register(&dw->dma); 1016 dma_async_device_register(&dw->dma);
1017 1017
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index 24f3ca85152..cb0f639f049 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -198,7 +198,7 @@ static int __devinit cell_edac_probe(struct platform_device *pdev)
198 mci->edac_cap = EDAC_FLAG_EC | EDAC_FLAG_SECDED; 198 mci->edac_cap = EDAC_FLAG_EC | EDAC_FLAG_SECDED;
199 mci->mod_name = "cell_edac"; 199 mci->mod_name = "cell_edac";
200 mci->ctl_name = "MIC"; 200 mci->ctl_name = "MIC";
201 mci->dev_name = pdev->dev.bus_id; 201 mci->dev_name = dev_name(&pdev->dev);
202 mci->edac_check = cell_edac_check; 202 mci->edac_check = cell_edac_check;
203 cell_edac_init_csrows(mci); 203 cell_edac_init_csrows(mci);
204 204
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 853ef37ec00..4637a4a757d 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -218,7 +218,7 @@ static int __devinit mpc85xx_pci_err_probe(struct of_device *op,
218 pci->dev = &op->dev; 218 pci->dev = &op->dev;
219 pci->mod_name = EDAC_MOD_STR; 219 pci->mod_name = EDAC_MOD_STR;
220 pci->ctl_name = pdata->name; 220 pci->ctl_name = pdata->name;
221 pci->dev_name = op->dev.bus_id; 221 pci->dev_name = dev_name(&op->dev);
222 222
223 if (edac_op_state == EDAC_OPSTATE_POLL) 223 if (edac_op_state == EDAC_OPSTATE_POLL)
224 pci->edac_check = mpc85xx_pci_check; 224 pci->edac_check = mpc85xx_pci_check;
diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
index 083ce8d0c63..5131aaae8e0 100644
--- a/drivers/edac/mv64x60_edac.c
+++ b/drivers/edac/mv64x60_edac.c
@@ -121,7 +121,7 @@ static int __devinit mv64x60_pci_err_probe(struct platform_device *pdev)
121 pdata->irq = NO_IRQ; 121 pdata->irq = NO_IRQ;
122 platform_set_drvdata(pdev, pci); 122 platform_set_drvdata(pdev, pci);
123 pci->dev = &pdev->dev; 123 pci->dev = &pdev->dev;
124 pci->dev_name = pdev->dev.bus_id; 124 pci->dev_name = dev_name(&pdev->dev);
125 pci->mod_name = EDAC_MOD_STR; 125 pci->mod_name = EDAC_MOD_STR;
126 pci->ctl_name = pdata->name; 126 pci->ctl_name = pdata->name;
127 127
@@ -294,7 +294,7 @@ static int __devinit mv64x60_sram_err_probe(struct platform_device *pdev)
294 pdata->irq = NO_IRQ; 294 pdata->irq = NO_IRQ;
295 edac_dev->dev = &pdev->dev; 295 edac_dev->dev = &pdev->dev;
296 platform_set_drvdata(pdev, edac_dev); 296 platform_set_drvdata(pdev, edac_dev);
297 edac_dev->dev_name = pdev->dev.bus_id; 297 edac_dev->dev_name = dev_name(&pdev->dev);
298 298
299 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 299 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
300 if (!r) { 300 if (!r) {
@@ -462,7 +462,7 @@ static int __devinit mv64x60_cpu_err_probe(struct platform_device *pdev)
462 pdata->irq = NO_IRQ; 462 pdata->irq = NO_IRQ;
463 edac_dev->dev = &pdev->dev; 463 edac_dev->dev = &pdev->dev;
464 platform_set_drvdata(pdev, edac_dev); 464 platform_set_drvdata(pdev, edac_dev);
465 edac_dev->dev_name = pdev->dev.bus_id; 465 edac_dev->dev_name = dev_name(&pdev->dev);
466 466
467 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 467 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
468 if (!r) { 468 if (!r) {
@@ -713,7 +713,7 @@ static int __devinit mv64x60_mc_err_probe(struct platform_device *pdev)
713 platform_set_drvdata(pdev, mci); 713 platform_set_drvdata(pdev, mci);
714 pdata->name = "mv64x60_mc_err"; 714 pdata->name = "mv64x60_mc_err";
715 pdata->irq = NO_IRQ; 715 pdata->irq = NO_IRQ;
716 mci->dev_name = pdev->dev.bus_id; 716 mci->dev_name = dev_name(&pdev->dev);
717 pdata->edac_idx = edac_mc_idx++; 717 pdata->edac_idx = edac_mc_idx++;
718 718
719 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 719 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c
index c950bf8606d..66958b3f10b 100644
--- a/drivers/eisa/eisa-bus.c
+++ b/drivers/eisa/eisa-bus.c
@@ -200,7 +200,7 @@ static int __init eisa_init_device (struct eisa_root_device *root,
200 edev->dev.bus = &eisa_bus_type; 200 edev->dev.bus = &eisa_bus_type;
201 edev->dev.dma_mask = &edev->dma_mask; 201 edev->dev.dma_mask = &edev->dma_mask;
202 edev->dev.coherent_dma_mask = edev->dma_mask; 202 edev->dev.coherent_dma_mask = edev->dma_mask;
203 sprintf (edev->dev.bus_id, "%02X:%02X", root->bus_nr, slot); 203 dev_set_name(&edev->dev, "%02X:%02X", root->bus_nr, slot);
204 204
205 for (i = 0; i < EISA_MAX_RESOURCES; i++) { 205 for (i = 0; i < EISA_MAX_RESOURCES; i++) {
206#ifdef CONFIG_EISA_NAMES 206#ifdef CONFIG_EISA_NAMES
@@ -301,7 +301,7 @@ static int __init eisa_probe (struct eisa_root_device *root)
301 struct eisa_device *edev; 301 struct eisa_device *edev;
302 302
303 printk (KERN_INFO "EISA: Probing bus %d at %s\n", 303 printk (KERN_INFO "EISA: Probing bus %d at %s\n",
304 root->bus_nr, root->dev->bus_id); 304 root->bus_nr, dev_name(root->dev));
305 305
306 /* First try to get hold of slot 0. If there is no device 306 /* First try to get hold of slot 0. If there is no device
307 * here, simply fail, unless root->force_probe is set. */ 307 * here, simply fail, unless root->force_probe is set. */
diff --git a/drivers/gpio/bt8xxgpio.c b/drivers/gpio/bt8xxgpio.c
index 7a1168249dd..984b587f0f9 100644
--- a/drivers/gpio/bt8xxgpio.c
+++ b/drivers/gpio/bt8xxgpio.c
@@ -160,7 +160,7 @@ static void bt8xxgpio_gpio_setup(struct bt8xxgpio *bg)
160{ 160{
161 struct gpio_chip *c = &bg->gpio; 161 struct gpio_chip *c = &bg->gpio;
162 162
163 c->label = bg->pdev->dev.bus_id; 163 c->label = dev_name(&bg->pdev->dev);
164 c->owner = THIS_MODULE; 164 c->owner = THIS_MODULE;
165 c->direction_input = bt8xxgpio_gpio_direction_input; 165 c->direction_input = bt8xxgpio_gpio_direction_input;
166 c->get = bt8xxgpio_gpio_get; 166 c->get = bt8xxgpio_gpio_get;
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 5aa6780652a..186d08159d4 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -359,8 +359,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
359 DRM_DEBUG("adding \"%s\" to sysfs\n", 359 DRM_DEBUG("adding \"%s\" to sysfs\n",
360 drm_get_connector_name(connector)); 360 drm_get_connector_name(connector));
361 361
362 snprintf(connector->kdev.bus_id, BUS_ID_SIZE, "card%d-%s", 362 dev_set_name(&connector->kdev, "card%d-%s",
363 dev->primary->index, drm_get_connector_name(connector)); 363 dev->primary->index, drm_get_connector_name(connector));
364 ret = device_register(&connector->kdev); 364 ret = device_register(&connector->kdev);
365 365
366 if (ret) { 366 if (ret) {
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e7d984866de..fbb9030b68a 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -841,7 +841,7 @@ int i2c_attach_client(struct i2c_client *client)
841 841
842 if (client->driver && !is_newstyle_driver(client->driver)) { 842 if (client->driver && !is_newstyle_driver(client->driver)) {
843 client->dev.release = i2c_client_release; 843 client->dev.release = i2c_client_release;
844 client->dev.uevent_suppress = 1; 844 dev_set_uevent_suppress(&client->dev, 1);
845 } else 845 } else
846 client->dev.release = i2c_client_dev_release; 846 client->dev.release = i2c_client_dev_release;
847 847
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 79a2dfed8eb..154ec2cf734 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -536,9 +536,8 @@ static const struct ide_port_info au1xxx_port_info = {
536#endif 536#endif
537}; 537};
538 538
539static int au_ide_probe(struct device *dev) 539static int au_ide_probe(struct platform_device *dev)
540{ 540{
541 struct platform_device *pdev = to_platform_device(dev);
542 _auide_hwif *ahwif = &auide_hwif; 541 _auide_hwif *ahwif = &auide_hwif;
543 struct resource *res; 542 struct resource *res;
544 struct ide_host *host; 543 struct ide_host *host;
@@ -552,23 +551,23 @@ static int au_ide_probe(struct device *dev)
552#endif 551#endif
553 552
554 memset(&auide_hwif, 0, sizeof(_auide_hwif)); 553 memset(&auide_hwif, 0, sizeof(_auide_hwif));
555 ahwif->irq = platform_get_irq(pdev, 0); 554 ahwif->irq = platform_get_irq(dev, 0);
556 555
557 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 556 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
558 557
559 if (res == NULL) { 558 if (res == NULL) {
560 pr_debug("%s %d: no base address\n", DRV_NAME, pdev->id); 559 pr_debug("%s %d: no base address\n", DRV_NAME, dev->id);
561 ret = -ENODEV; 560 ret = -ENODEV;
562 goto out; 561 goto out;
563 } 562 }
564 if (ahwif->irq < 0) { 563 if (ahwif->irq < 0) {
565 pr_debug("%s %d: no IRQ\n", DRV_NAME, pdev->id); 564 pr_debug("%s %d: no IRQ\n", DRV_NAME, dev->id);
566 ret = -ENODEV; 565 ret = -ENODEV;
567 goto out; 566 goto out;
568 } 567 }
569 568
570 if (!request_mem_region(res->start, res->end - res->start + 1, 569 if (!request_mem_region(res->start, res->end - res->start + 1,
571 pdev->name)) { 570 dev->name)) {
572 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 571 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
573 ret = -EBUSY; 572 ret = -EBUSY;
574 goto out; 573 goto out;
@@ -583,7 +582,7 @@ static int au_ide_probe(struct device *dev)
583 memset(&hw, 0, sizeof(hw)); 582 memset(&hw, 0, sizeof(hw));
584 auide_setup_ports(&hw, ahwif); 583 auide_setup_ports(&hw, ahwif);
585 hw.irq = ahwif->irq; 584 hw.irq = ahwif->irq;
586 hw.dev = dev; 585 hw.dev = &dev->dev;
587 hw.chipset = ide_au1xxx; 586 hw.chipset = ide_au1xxx;
588 587
589 ret = ide_host_add(&au1xxx_port_info, hws, &host); 588 ret = ide_host_add(&au1xxx_port_info, hws, &host);
@@ -592,7 +591,7 @@ static int au_ide_probe(struct device *dev)
592 591
593 auide_hwif.hwif = host->ports[0]; 592 auide_hwif.hwif = host->ports[0];
594 593
595 dev_set_drvdata(dev, host); 594 platform_set_drvdata(dev, host);
596 595
597 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); 596 printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode );
598 597
@@ -600,38 +599,39 @@ static int au_ide_probe(struct device *dev)
600 return ret; 599 return ret;
601} 600}
602 601
603static int au_ide_remove(struct device *dev) 602static int au_ide_remove(struct platform_device *dev)
604{ 603{
605 struct platform_device *pdev = to_platform_device(dev);
606 struct resource *res; 604 struct resource *res;
607 struct ide_host *host = dev_get_drvdata(dev); 605 struct ide_host *host = platform_get_drvdata(dev);
608 _auide_hwif *ahwif = &auide_hwif; 606 _auide_hwif *ahwif = &auide_hwif;
609 607
610 ide_host_remove(host); 608 ide_host_remove(host);
611 609
612 iounmap((void *)ahwif->regbase); 610 iounmap((void *)ahwif->regbase);
613 611
614 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 612 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
615 release_mem_region(res->start, res->end - res->start + 1); 613 release_mem_region(res->start, res->end - res->start + 1);
616 614
617 return 0; 615 return 0;
618} 616}
619 617
620static struct device_driver au1200_ide_driver = { 618static struct platform_driver au1200_ide_driver = {
621 .name = "au1200-ide", 619 .driver = {
622 .bus = &platform_bus_type, 620 .name = "au1200-ide",
621 .owner = THIS_MODULE,
622 },
623 .probe = au_ide_probe, 623 .probe = au_ide_probe,
624 .remove = au_ide_remove, 624 .remove = au_ide_remove,
625}; 625};
626 626
627static int __init au_ide_init(void) 627static int __init au_ide_init(void)
628{ 628{
629 return driver_register(&au1200_ide_driver); 629 return platform_driver_register(&au1200_ide_driver);
630} 630}
631 631
632static void __exit au_ide_exit(void) 632static void __exit au_ide_exit(void)
633{ 633{
634 driver_unregister(&au1200_ide_driver); 634 platform_driver_unregister(&au1200_ide_driver);
635} 635}
636 636
637MODULE_LICENSE("GPL"); 637MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index ac245e7e96a..3071a52467e 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -389,8 +389,7 @@ static void gigaset_freecshw(struct cardstate *cs)
389 389
390static void gigaset_device_release(struct device *dev) 390static void gigaset_device_release(struct device *dev)
391{ 391{
392 struct platform_device *pdev = 392 struct platform_device *pdev = to_platform_device(dev);
393 container_of(dev, struct platform_device, dev);
394 393
395 /* adapted from platform_device_release() in drivers/base/platform.c */ 394 /* adapted from platform_device_release() in drivers/base/platform.c */
396 //FIXME is this actually necessary? 395 //FIXME is this actually necessary?
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c
index ef2dbfe7471..ada5ebbaa25 100644
--- a/drivers/mca/mca-bus.c
+++ b/drivers/mca/mca-bus.c
@@ -110,7 +110,7 @@ int __init mca_register_device(int bus, struct mca_device *mca_dev)
110 110
111 mca_dev->dev.parent = &mca_bus->dev; 111 mca_dev->dev.parent = &mca_bus->dev;
112 mca_dev->dev.bus = &mca_bus_type; 112 mca_dev->dev.bus = &mca_bus_type;
113 sprintf (mca_dev->dev.bus_id, "%02d:%02X", bus, mca_dev->slot); 113 dev_set_name(&mca_dev->dev, "%02d:%02X", bus, mca_dev->slot);
114 mca_dev->dma_mask = mca_bus->default_dma_mask; 114 mca_dev->dma_mask = mca_bus->default_dma_mask;
115 mca_dev->dev.dma_mask = &mca_dev->dma_mask; 115 mca_dev->dev.dma_mask = &mca_dev->dma_mask;
116 mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask; 116 mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask;
@@ -151,7 +151,7 @@ struct mca_bus * __devinit mca_attach_bus(int bus)
151 if (!mca_bus) 151 if (!mca_bus)
152 return NULL; 152 return NULL;
153 153
154 sprintf(mca_bus->dev.bus_id,"mca%d",bus); 154 dev_set_name(&mca_bus->dev, "mca%d", bus);
155 sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary"); 155 sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary");
156 if (device_register(&mca_bus->dev)) { 156 if (device_register(&mca_bus->dev)) {
157 kfree(mca_bus); 157 kfree(mca_bus);
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c
index 4d35308fc1f..393623818ad 100644
--- a/drivers/media/radio/radio-tea5764.c
+++ b/drivers/media/radio/radio-tea5764.c
@@ -298,7 +298,8 @@ static int vidioc_querycap(struct file *file, void *priv,
298 298
299 strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver)); 299 strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver));
300 strlcpy(v->card, dev->name, sizeof(v->card)); 300 strlcpy(v->card, dev->name, sizeof(v->card));
301 snprintf(v->bus_info, sizeof(v->bus_info), "I2C:%s", dev->dev.bus_id); 301 snprintf(v->bus_info, sizeof(v->bus_info),
302 "I2C:%s", dev_name(&dev->dev));
302 v->version = RADIO_VERSION; 303 v->version = RADIO_VERSION;
303 v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; 304 v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
304 return 0; 305 return 0;
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index cf9d4c7f571..8a4b74f3129 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -34,7 +34,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
34 spin_lock_init(&v4l2_dev->lock); 34 spin_lock_init(&v4l2_dev->lock);
35 v4l2_dev->dev = dev; 35 v4l2_dev->dev = dev;
36 snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s", 36 snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s",
37 dev->driver->name, dev->bus_id); 37 dev->driver->name, dev_name(dev));
38 dev_set_drvdata(dev, v4l2_dev); 38 dev_set_drvdata(dev, v4l2_dev);
39 return 0; 39 return 0;
40} 40}
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
index 6063dc2b52e..57271cb3b31 100644
--- a/drivers/mfd/mcp-core.c
+++ b/drivers/mfd/mcp-core.c
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(mcp_host_alloc);
214 214
215int mcp_host_register(struct mcp *mcp) 215int mcp_host_register(struct mcp *mcp)
216{ 216{
217 strcpy(mcp->attached_device.bus_id, "mcp0"); 217 dev_set_name(&mcp->attached_device, "mcp0");
218 return device_register(&mcp->attached_device); 218 return device_register(&mcp->attached_device);
219} 219}
220EXPORT_SYMBOL(mcp_host_register); 220EXPORT_SYMBOL(mcp_host_register);
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 6860c924f36..fea9085fe52 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -492,7 +492,7 @@ static int ucb1x00_probe(struct mcp *mcp)
492 492
493 ucb->dev.class = &ucb1x00_class; 493 ucb->dev.class = &ucb1x00_class;
494 ucb->dev.parent = &mcp->attached_device; 494 ucb->dev.parent = &mcp->attached_device;
495 strlcpy(ucb->dev.bus_id, "ucb1x00", sizeof(ucb->dev.bus_id)); 495 dev_set_name(&ucb->dev, "ucb1x00");
496 496
497 spin_lock_init(&ucb->lock); 497 spin_lock_init(&ucb->lock);
498 spin_lock_init(&ucb->io_lock); 498 spin_lock_init(&ucb->io_lock);
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 2b1196e6142..e94e92001e7 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -1603,7 +1603,7 @@ static int __init atmci_probe(struct platform_device *pdev)
1603 1603
1604 tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host); 1604 tasklet_init(&host->tasklet, atmci_tasklet_func, (unsigned long)host);
1605 1605
1606 ret = request_irq(irq, atmci_interrupt, 0, pdev->dev.bus_id, host); 1606 ret = request_irq(irq, atmci_interrupt, 0, dev_name(&pdev->dev), host);
1607 if (ret) 1607 if (ret)
1608 goto err_request_irq; 1608 goto err_request_irq;
1609 1609
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index fb2921f8099..0c44d560bf1 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -103,7 +103,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
103 if (!gpio_is_valid(oms->gpios[i])) 103 if (!gpio_is_valid(oms->gpios[i]))
104 continue; 104 continue;
105 105
106 ret = gpio_request(oms->gpios[i], dev->bus_id); 106 ret = gpio_request(oms->gpios[i], dev_name(dev));
107 if (ret < 0) { 107 if (ret < 0) {
108 oms->gpios[i] = -EINVAL; 108 oms->gpios[i] = -EINVAL;
109 continue; 109 continue;
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 771139c5bf8..e9026cb1c5b 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -41,9 +41,8 @@ struct pxa2xx_flash_info {
41static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 41static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
42 42
43 43
44static int __init pxa2xx_flash_probe(struct device *dev) 44static int __init pxa2xx_flash_probe(struct platform_device *pdev)
45{ 45{
46 struct platform_device *pdev = to_platform_device(dev);
47 struct flash_platform_data *flash = pdev->dev.platform_data; 46 struct flash_platform_data *flash = pdev->dev.platform_data;
48 struct pxa2xx_flash_info *info; 47 struct pxa2xx_flash_info *info;
49 struct mtd_partition *parts; 48 struct mtd_partition *parts;
@@ -114,15 +113,15 @@ static int __init pxa2xx_flash_probe(struct device *dev)
114 add_mtd_device(info->mtd); 113 add_mtd_device(info->mtd);
115 } 114 }
116 115
117 dev_set_drvdata(dev, info); 116 platform_set_drvdata(pdev, info);
118 return 0; 117 return 0;
119} 118}
120 119
121static int __exit pxa2xx_flash_remove(struct device *dev) 120static int __exit pxa2xx_flash_remove(struct platform_device *dev)
122{ 121{
123 struct pxa2xx_flash_info *info = dev_get_drvdata(dev); 122 struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
124 123
125 dev_set_drvdata(dev, NULL); 124 platform_set_drvdata(dev, NULL);
126 125
127#ifdef CONFIG_MTD_PARTITIONS 126#ifdef CONFIG_MTD_PARTITIONS
128 if (info->nr_parts) 127 if (info->nr_parts)
@@ -141,9 +140,9 @@ static int __exit pxa2xx_flash_remove(struct device *dev)
141} 140}
142 141
143#ifdef CONFIG_PM 142#ifdef CONFIG_PM
144static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) 143static int pxa2xx_flash_suspend(struct platform_device *dev, pm_message_t state)
145{ 144{
146 struct pxa2xx_flash_info *info = dev_get_drvdata(dev); 145 struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
147 int ret = 0; 146 int ret = 0;
148 147
149 if (info->mtd && info->mtd->suspend) 148 if (info->mtd && info->mtd->suspend)
@@ -151,17 +150,17 @@ static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state)
151 return ret; 150 return ret;
152} 151}
153 152
154static int pxa2xx_flash_resume(struct device *dev) 153static int pxa2xx_flash_resume(struct platform_device *dev)
155{ 154{
156 struct pxa2xx_flash_info *info = dev_get_drvdata(dev); 155 struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
157 156
158 if (info->mtd && info->mtd->resume) 157 if (info->mtd && info->mtd->resume)
159 info->mtd->resume(info->mtd); 158 info->mtd->resume(info->mtd);
160 return 0; 159 return 0;
161} 160}
162static void pxa2xx_flash_shutdown(struct device *dev) 161static void pxa2xx_flash_shutdown(struct platform_device *dev)
163{ 162{
164 struct pxa2xx_flash_info *info = dev_get_drvdata(dev); 163 struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
165 164
166 if (info && info->mtd->suspend(info->mtd) == 0) 165 if (info && info->mtd->suspend(info->mtd) == 0)
167 info->mtd->resume(info->mtd); 166 info->mtd->resume(info->mtd);
@@ -172,11 +171,13 @@ static void pxa2xx_flash_shutdown(struct device *dev)
172#define pxa2xx_flash_shutdown NULL 171#define pxa2xx_flash_shutdown NULL
173#endif 172#endif
174 173
175static struct device_driver pxa2xx_flash_driver = { 174static struct platform_driver pxa2xx_flash_driver = {
176 .name = "pxa2xx-flash", 175 .driver = {
177 .bus = &platform_bus_type, 176 .name = "pxa2xx-flash",
177 .owner = THIS_MODULE,
178 },
178 .probe = pxa2xx_flash_probe, 179 .probe = pxa2xx_flash_probe,
179 .remove = __exit_p(pxa2xx_flash_remove), 180 .remove = __devexit_p(pxa2xx_flash_remove),
180 .suspend = pxa2xx_flash_suspend, 181 .suspend = pxa2xx_flash_suspend,
181 .resume = pxa2xx_flash_resume, 182 .resume = pxa2xx_flash_resume,
182 .shutdown = pxa2xx_flash_shutdown, 183 .shutdown = pxa2xx_flash_shutdown,
@@ -184,12 +185,12 @@ static struct device_driver pxa2xx_flash_driver = {
184 185
185static int __init init_pxa2xx_flash(void) 186static int __init init_pxa2xx_flash(void)
186{ 187{
187 return driver_register(&pxa2xx_flash_driver); 188 return platform_driver_register(&pxa2xx_flash_driver);
188} 189}
189 190
190static void __exit cleanup_pxa2xx_flash(void) 191static void __exit cleanup_pxa2xx_flash(void)
191{ 192{
192 driver_unregister(&pxa2xx_flash_driver); 193 platform_driver_unregister(&pxa2xx_flash_driver);
193} 194}
194 195
195module_init(init_pxa2xx_flash); 196module_init(init_pxa2xx_flash);
diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c
index ced14b5294d..72446fb48d4 100644
--- a/drivers/mtd/nand/excite_nandflash.c
+++ b/drivers/mtd/nand/excite_nandflash.c
@@ -128,11 +128,11 @@ static int excite_nand_devready(struct mtd_info *mtd)
128 * The binding to the mtd and all allocated 128 * The binding to the mtd and all allocated
129 * resources are released. 129 * resources are released.
130 */ 130 */
131static int __exit excite_nand_remove(struct device *dev) 131static int __exit excite_nand_remove(struct platform_device *dev)
132{ 132{
133 struct excite_nand_drvdata * const this = dev_get_drvdata(dev); 133 struct excite_nand_drvdata * const this = platform_get_drvdata(dev);
134 134
135 dev_set_drvdata(dev, NULL); 135 platform_set_drvdata(dev, NULL);
136 136
137 if (unlikely(!this)) { 137 if (unlikely(!this)) {
138 printk(KERN_ERR "%s: called %s without private data!!", 138 printk(KERN_ERR "%s: called %s without private data!!",
@@ -159,9 +159,8 @@ static int __exit excite_nand_remove(struct device *dev)
159 * it can allocate all necessary resources then calls the 159 * it can allocate all necessary resources then calls the
160 * nand layer to look for devices. 160 * nand layer to look for devices.
161*/ 161*/
162static int __init excite_nand_probe(struct device *dev) 162static int __init excite_nand_probe(struct platform_device *pdev)
163{ 163{
164 struct platform_device * const pdev = to_platform_device(dev);
165 struct excite_nand_drvdata *drvdata; /* private driver data */ 164 struct excite_nand_drvdata *drvdata; /* private driver data */
166 struct nand_chip *board_chip; /* private flash chip data */ 165 struct nand_chip *board_chip; /* private flash chip data */
167 struct mtd_info *board_mtd; /* mtd info for this board */ 166 struct mtd_info *board_mtd; /* mtd info for this board */
@@ -175,7 +174,7 @@ static int __init excite_nand_probe(struct device *dev)
175 } 174 }
176 175
177 /* bind private data into driver */ 176 /* bind private data into driver */
178 dev_set_drvdata(dev, drvdata); 177 platform_set_drvdata(pdev, drvdata);
179 178
180 /* allocate and map the resource */ 179 /* allocate and map the resource */
181 drvdata->regs = 180 drvdata->regs =
@@ -219,23 +218,25 @@ static int __init excite_nand_probe(struct device *dev)
219 return 0; 218 return 0;
220} 219}
221 220
222static struct device_driver excite_nand_driver = { 221static struct platform_driver excite_nand_driver = {
223 .name = "excite_nand", 222 .driver = {
224 .bus = &platform_bus_type, 223 .name = "excite_nand",
224 .owner = THIS_MODULE,
225 },
225 .probe = excite_nand_probe, 226 .probe = excite_nand_probe,
226 .remove = __exit_p(excite_nand_remove) 227 .remove = __devexit_p(excite_nand_remove)
227}; 228};
228 229
229static int __init excite_nand_init(void) 230static int __init excite_nand_init(void)
230{ 231{
231 pr_info("Basler eXcite nand flash driver Version " 232 pr_info("Basler eXcite nand flash driver Version "
232 EXCITE_NANDFLASH_VERSION "\n"); 233 EXCITE_NANDFLASH_VERSION "\n");
233 return driver_register(&excite_nand_driver); 234 return platform_driver_register(&excite_nand_driver);
234} 235}
235 236
236static void __exit excite_nand_exit(void) 237static void __exit excite_nand_exit(void)
237{ 238{
238 driver_unregister(&excite_nand_driver); 239 platform_driver_unregister(&excite_nand_driver);
239} 240}
240 241
241module_init(excite_nand_init); 242module_init(excite_nand_init);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 582cf80f555..89bf85af642 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -187,7 +187,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
187 return -ENODEV; 187 return -ENODEV;
188 188
189 ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", 189 ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s",
190 ndfc->ofdev->dev.bus_id, flash_np->name); 190 dev_name(&ndfc->ofdev->dev), flash_np->name);
191 if (!ndfc->mtd.name) { 191 if (!ndfc->mtd.name) {
192 ret = -ENOMEM; 192 ret = -ENOMEM;
193 goto err; 193 goto err;
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c
index 5b69e7773c6..3a496c33fb5 100644
--- a/drivers/mtd/onenand/generic.c
+++ b/drivers/mtd/onenand/generic.c
@@ -36,10 +36,9 @@ struct onenand_info {
36 struct onenand_chip onenand; 36 struct onenand_chip onenand;
37}; 37};
38 38
39static int __devinit generic_onenand_probe(struct device *dev) 39static int __devinit generic_onenand_probe(struct platform_device *pdev)
40{ 40{
41 struct onenand_info *info; 41 struct onenand_info *info;
42 struct platform_device *pdev = to_platform_device(dev);
43 struct flash_platform_data *pdata = pdev->dev.platform_data; 42 struct flash_platform_data *pdata = pdev->dev.platform_data;
44 struct resource *res = pdev->resource; 43 struct resource *res = pdev->resource;
45 unsigned long size = res->end - res->start + 1; 44 unsigned long size = res->end - res->start + 1;
@@ -49,7 +48,7 @@ static int __devinit generic_onenand_probe(struct device *dev)
49 if (!info) 48 if (!info)
50 return -ENOMEM; 49 return -ENOMEM;
51 50
52 if (!request_mem_region(res->start, size, dev->driver->name)) { 51 if (!request_mem_region(res->start, size, pdev->dev.driver->name)) {
53 err = -EBUSY; 52 err = -EBUSY;
54 goto out_free_info; 53 goto out_free_info;
55 } 54 }
@@ -82,7 +81,7 @@ static int __devinit generic_onenand_probe(struct device *dev)
82#endif 81#endif
83 err = add_mtd_device(&info->mtd); 82 err = add_mtd_device(&info->mtd);
84 83
85 dev_set_drvdata(&pdev->dev, info); 84 platform_set_drvdata(pdev, info);
86 85
87 return 0; 86 return 0;
88 87
@@ -96,14 +95,13 @@ out_free_info:
96 return err; 95 return err;
97} 96}
98 97
99static int __devexit generic_onenand_remove(struct device *dev) 98static int __devexit generic_onenand_remove(struct platform_device *pdev)
100{ 99{
101 struct platform_device *pdev = to_platform_device(dev); 100 struct onenand_info *info = platform_get_drvdata(pdev);
102 struct onenand_info *info = dev_get_drvdata(&pdev->dev);
103 struct resource *res = pdev->resource; 101 struct resource *res = pdev->resource;
104 unsigned long size = res->end - res->start + 1; 102 unsigned long size = res->end - res->start + 1;
105 103
106 dev_set_drvdata(&pdev->dev, NULL); 104 platform_set_drvdata(pdev, NULL);
107 105
108 if (info) { 106 if (info) {
109 if (info->parts) 107 if (info->parts)
@@ -120,9 +118,11 @@ static int __devexit generic_onenand_remove(struct device *dev)
120 return 0; 118 return 0;
121} 119}
122 120
123static struct device_driver generic_onenand_driver = { 121static struct platform_driver generic_onenand_driver = {
124 .name = DRIVER_NAME, 122 .driver = {
125 .bus = &platform_bus_type, 123 .name = DRIVER_NAME,
124 .owner = THIS_MODULE,
125 },
126 .probe = generic_onenand_probe, 126 .probe = generic_onenand_probe,
127 .remove = __devexit_p(generic_onenand_remove), 127 .remove = __devexit_p(generic_onenand_remove),
128}; 128};
@@ -131,12 +131,12 @@ MODULE_ALIAS(DRIVER_NAME);
131 131
132static int __init generic_onenand_init(void) 132static int __init generic_onenand_init(void)
133{ 133{
134 return driver_register(&generic_onenand_driver); 134 return platform_driver_register(&generic_onenand_driver);
135} 135}
136 136
137static void __exit generic_onenand_exit(void) 137static void __exit generic_onenand_exit(void)
138{ 138{
139 driver_unregister(&generic_onenand_driver); 139 platform_driver_unregister(&generic_onenand_driver);
140} 140}
141 141
142module_init(generic_onenand_init); 142module_init(generic_onenand_init);
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index f3a12743489..35cd264abae 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -1059,7 +1059,7 @@ ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
1059{ 1059{
1060 strlcpy(info->driver, MODULENAME, sizeof(info->driver)); 1060 strlcpy(info->driver, MODULENAME, sizeof(info->driver));
1061 strlcpy(info->version, MODULEVERSION, sizeof(info->version)); 1061 strlcpy(info->version, MODULEVERSION, sizeof(info->version));
1062 strlcpy(info->bus_info, ndev->dev.parent->bus_id, 1062 strlcpy(info->bus_info, dev_name(ndev->dev.parent),
1063 sizeof(info->bus_info)); 1063 sizeof(info->bus_info));
1064} 1064}
1065 1065
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 9c875bb3f76..79aec32c6ad 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -355,8 +355,8 @@ static int mii_probe (struct net_device *dev)
355 /* now we are supposed to have a proper phydev, to attach to... */ 355 /* now we are supposed to have a proper phydev, to attach to... */
356 BUG_ON(phydev->attached_dev); 356 BUG_ON(phydev->attached_dev);
357 357
358 phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0, 358 phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link,
359 PHY_INTERFACE_MODE_MII); 359 0, PHY_INTERFACE_MODE_MII);
360 360
361 if (IS_ERR(phydev)) { 361 if (IS_ERR(phydev)) {
362 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 362 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
@@ -381,8 +381,8 @@ static int mii_probe (struct net_device *dev)
381 aup->phy_dev = phydev; 381 aup->phy_dev = phydev;
382 382
383 printk(KERN_INFO "%s: attached PHY driver [%s] " 383 printk(KERN_INFO "%s: attached PHY driver [%s] "
384 "(mii_bus:phy_addr=%s, irq=%d)\n", 384 "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
385 dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); 385 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
386 386
387 return 0; 387 return 0;
388} 388}
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 78e31aa861e..9afe8092dfc 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -415,11 +415,11 @@ static int mii_probe(struct net_device *dev)
415 } 415 }
416 416
417#if defined(CONFIG_BFIN_MAC_RMII) 417#if defined(CONFIG_BFIN_MAC_RMII)
418 phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0, 418 phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
419 PHY_INTERFACE_MODE_RMII); 419 0, PHY_INTERFACE_MODE_RMII);
420#else 420#else
421 phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0, 421 phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
422 PHY_INTERFACE_MODE_MII); 422 0, PHY_INTERFACE_MODE_MII);
423#endif 423#endif
424 424
425 if (IS_ERR(phydev)) { 425 if (IS_ERR(phydev)) {
@@ -447,7 +447,7 @@ static int mii_probe(struct net_device *dev)
447 printk(KERN_INFO "%s: attached PHY driver [%s] " 447 printk(KERN_INFO "%s: attached PHY driver [%s] "
448 "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)" 448 "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
449 "@sclk=%dMHz)\n", 449 "@sclk=%dMHz)\n",
450 DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq, 450 DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
451 MDC_CLK, mdc_div, sclk/1000000); 451 MDC_CLK, mdc_div, sclk/1000000);
452 452
453 return 0; 453 return 0;
@@ -488,7 +488,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
488 strcpy(info->driver, DRV_NAME); 488 strcpy(info->driver, DRV_NAME);
489 strcpy(info->version, DRV_VERSION); 489 strcpy(info->version, DRV_VERSION);
490 strcpy(info->fw_version, "N/A"); 490 strcpy(info->fw_version, "N/A");
491 strcpy(info->bus_info, dev->dev.bus_id); 491 strcpy(info->bus_info, dev_name(&dev->dev));
492} 492}
493 493
494static struct ethtool_ops bfin_mac_ethtool_ops = { 494static struct ethtool_ops bfin_mac_ethtool_ops = {
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 8a546a33d58..1ab58375d06 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1240,7 +1240,7 @@ static void bmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *inf
1240{ 1240{
1241 struct bmac_data *bp = netdev_priv(dev); 1241 struct bmac_data *bp = netdev_priv(dev);
1242 strcpy(info->driver, "bmac"); 1242 strcpy(info->driver, "bmac");
1243 strcpy(info->bus_info, bp->mdev->ofdev.dev.bus_id); 1243 strcpy(info->bus_info, dev_name(&bp->mdev->ofdev.dev));
1244} 1244}
1245 1245
1246static const struct ethtool_ops bmac_ethtool_ops = { 1246static const struct ethtool_ops bmac_ethtool_ops = {
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index f66548751c3..79741c5f9fe 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -1161,7 +1161,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1161 priv->msg_enable = netif_msg_init(debug_level, 0xff); 1161 priv->msg_enable = netif_msg_init(debug_level, 0xff);
1162 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); 1162 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
1163 1163
1164 priv->phy = phy_connect(dev, cpmac_mii->phy_map[phy_id]->dev.bus_id, 1164 priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev),
1165 &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); 1165 &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII);
1166 if (IS_ERR(priv->phy)) { 1166 if (IS_ERR(priv->phy)) {
1167 if (netif_msg_drv(priv)) 1167 if (netif_msg_drv(priv))
diff --git a/drivers/net/declance.c b/drivers/net/declance.c
index 7ce3053530f..861c867fca8 100644
--- a/drivers/net/declance.c
+++ b/drivers/net/declance.c
@@ -1027,7 +1027,7 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
1027 printk(version); 1027 printk(version);
1028 1028
1029 if (bdev) 1029 if (bdev)
1030 snprintf(name, sizeof(name), "%s", bdev->bus_id); 1030 snprintf(name, sizeof(name), "%s", dev_name(bdev));
1031 else { 1031 else {
1032 i = 0; 1032 i = 0;
1033 dev = root_lance_dev; 1033 dev = root_lance_dev;
@@ -1105,10 +1105,10 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
1105 1105
1106 start = to_tc_dev(bdev)->resource.start; 1106 start = to_tc_dev(bdev)->resource.start;
1107 len = to_tc_dev(bdev)->resource.end - start + 1; 1107 len = to_tc_dev(bdev)->resource.end - start + 1;
1108 if (!request_mem_region(start, len, bdev->bus_id)) { 1108 if (!request_mem_region(start, len, dev_name(bdev))) {
1109 printk(KERN_ERR 1109 printk(KERN_ERR
1110 "%s: Unable to reserve MMIO resource\n", 1110 "%s: Unable to reserve MMIO resource\n",
1111 bdev->bus_id); 1111 dev_name(bdev));
1112 ret = -EBUSY; 1112 ret = -EBUSY;
1113 goto err_out_dev; 1113 goto err_out_dev;
1114 } 1114 }
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index e4cef491dc7..55625dbbae5 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -606,8 +606,8 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
606 if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown) 606 if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown)
607 return -ENXIO; 607 return -ENXIO;
608 608
609 printk ("%s: %s at 0x%04lx", 609 printk("%s: %s at 0x%04lx",
610 device->bus_id, depca_signature[lp->adapter], ioaddr); 610 dev_name(device), depca_signature[lp->adapter], ioaddr);
611 611
612 switch (lp->depca_bus) { 612 switch (lp->depca_bus) {
613#ifdef CONFIG_MCA 613#ifdef CONFIG_MCA
@@ -669,7 +669,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
669 669
670 spin_lock_init(&lp->lock); 670 spin_lock_init(&lp->lock);
671 sprintf(lp->adapter_name, "%s (%s)", 671 sprintf(lp->adapter_name, "%s (%s)",
672 depca_signature[lp->adapter], device->bus_id); 672 depca_signature[lp->adapter], dev_name(device));
673 status = -EBUSY; 673 status = -EBUSY;
674 674
675 /* Initialisation Block */ 675 /* Initialisation Block */
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index dfe92264e82..8e7c16535ad 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -3040,7 +3040,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
3040 port->ofdev.dev.parent = &port->adapter->ofdev->dev; 3040 port->ofdev.dev.parent = &port->adapter->ofdev->dev;
3041 port->ofdev.dev.bus = &ibmebus_bus_type; 3041 port->ofdev.dev.bus = &ibmebus_bus_type;
3042 3042
3043 sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); 3043 dev_set_name(&port->ofdev.dev, "port%d", port_name_cnt++);
3044 port->ofdev.dev.release = logical_port_release; 3044 port->ofdev.dev.release = logical_port_release;
3045 3045
3046 ret = of_device_register(&port->ofdev); 3046 ret = of_device_register(&port->ofdev);
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index 334ff9e12cd..14248cfc3df 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -131,7 +131,8 @@ static int __init sonic_probe1(struct net_device *dev)
131 if (sonic_debug && version_printed++ == 0) 131 if (sonic_debug && version_printed++ == 0)
132 printk(version); 132 printk(version);
133 133
134 printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", lp->device->bus_id, dev->base_addr); 134 printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ",
135 dev_name(lp->device), dev->base_addr);
135 136
136 /* 137 /*
137 * Put the sonic into software reset, then 138 * Put the sonic into software reset, then
@@ -156,7 +157,8 @@ static int __init sonic_probe1(struct net_device *dev)
156 if ((lp->descriptors = dma_alloc_coherent(lp->device, 157 if ((lp->descriptors = dma_alloc_coherent(lp->device,
157 SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 158 SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
158 &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { 159 &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
159 printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id); 160 printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n",
161 dev_name(lp->device));
160 goto out; 162 goto out;
161 } 163 }
162 164
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index f6c4936e2fa..f4086542c35 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -211,10 +211,10 @@ static int macb_mii_probe(struct net_device *dev)
211 211
212 /* attach the mac to the phy */ 212 /* attach the mac to the phy */
213 if (pdata && pdata->is_rmii) { 213 if (pdata && pdata->is_rmii) {
214 phydev = phy_connect(dev, phydev->dev.bus_id, 214 phydev = phy_connect(dev, dev_name(&phydev->dev),
215 &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII); 215 &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII);
216 } else { 216 } else {
217 phydev = phy_connect(dev, phydev->dev.bus_id, 217 phydev = phy_connect(dev, dev_name(&phydev->dev),
218 &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII); 218 &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII);
219 } 219 }
220 220
@@ -1077,7 +1077,7 @@ static void macb_get_drvinfo(struct net_device *dev,
1077 1077
1078 strcpy(info->driver, bp->pdev->dev.driver->name); 1078 strcpy(info->driver, bp->pdev->dev.driver->name);
1079 strcpy(info->version, "$Revision: 1.14 $"); 1079 strcpy(info->version, "$Revision: 1.14 $");
1080 strcpy(info->bus_info, bp->pdev->dev.bus_id); 1080 strcpy(info->bus_info, dev_name(&bp->pdev->dev));
1081} 1081}
1082 1082
1083static struct ethtool_ops macb_ethtool_ops = { 1083static struct ethtool_ops macb_ethtool_ops = {
@@ -1234,8 +1234,8 @@ static int __init macb_probe(struct platform_device *pdev)
1234 1234
1235 phydev = bp->phy_dev; 1235 phydev = bp->phy_dev;
1236 printk(KERN_INFO "%s: attached PHY driver [%s] " 1236 printk(KERN_INFO "%s: attached PHY driver [%s] "
1237 "(mii_bus:phy_addr=%s, irq=%d)\n", 1237 "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
1238 dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); 1238 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
1239 1239
1240 return 0; 1240 return 0;
1241 1241
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 205bb05c25d..527166e35d5 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -176,7 +176,8 @@ static int __init macsonic_init(struct net_device *dev)
176 if ((lp->descriptors = dma_alloc_coherent(lp->device, 176 if ((lp->descriptors = dma_alloc_coherent(lp->device,
177 SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 177 SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
178 &lp->descriptors_laddr, GFP_KERNEL)) == NULL) { 178 &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
179 printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id); 179 printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n",
180 dev_name(lp->device));
180 return -ENOMEM; 181 return -ENOMEM;
181 } 182 }
182 183
@@ -337,7 +338,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)
337 sonic_version_printed = 1; 338 sonic_version_printed = 1;
338 } 339 }
339 printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n", 340 printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n",
340 lp->device->bus_id, dev->base_addr); 341 dev_name(lp->device), dev->base_addr);
341 342
342 /* The PowerBook's SONIC is 16 bit always. */ 343 /* The PowerBook's SONIC is 16 bit always. */
343 if (macintosh_config->ident == MAC_MODEL_PB520) { 344 if (macintosh_config->ident == MAC_MODEL_PB520) {
@@ -370,10 +371,10 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)
370 } 371 }
371 printk(KERN_INFO 372 printk(KERN_INFO
372 "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", 373 "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
373 lp->device->bus_id, sr, lp->dma_bitmode?32:16, lp->reg_offset); 374 dev_name(lp->device), sr, lp->dma_bitmode?32:16, lp->reg_offset);
374 375
375#if 0 /* This is sometimes useful to find out how MacOS configured the card. */ 376#if 0 /* This is sometimes useful to find out how MacOS configured the card. */
376 printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id, 377 printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device),
377 SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); 378 SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
378#endif 379#endif
379 380
@@ -525,12 +526,12 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev)
525 sonic_version_printed = 1; 526 sonic_version_printed = 1;
526 } 527 }
527 printk(KERN_INFO "%s: %s in slot %X\n", 528 printk(KERN_INFO "%s: %s in slot %X\n",
528 lp->device->bus_id, ndev->board->name, ndev->board->slot); 529 dev_name(lp->device), ndev->board->name, ndev->board->slot);
529 printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n", 530 printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
530 lp->device->bus_id, SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset); 531 dev_name(lp->device), SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset);
531 532
532#if 0 /* This is sometimes useful to find out how MacOS configured the card. */ 533#if 0 /* This is sometimes useful to find out how MacOS configured the card. */
533 printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id, 534 printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device),
534 SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff); 535 SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
535#endif 536#endif
536 537
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 4e7a5faf035..664835b822f 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -237,7 +237,7 @@ static void mipsnet_set_mclist(struct net_device *dev)
237{ 237{
238} 238}
239 239
240static int __init mipsnet_probe(struct device *dev) 240static int __init mipsnet_probe(struct platform_device *dev)
241{ 241{
242 struct net_device *netdev; 242 struct net_device *netdev;
243 int err; 243 int err;
@@ -248,7 +248,7 @@ static int __init mipsnet_probe(struct device *dev)
248 goto out; 248 goto out;
249 } 249 }
250 250
251 dev_set_drvdata(dev, netdev); 251 platform_set_drvdata(dev, netdev);
252 252
253 netdev->open = mipsnet_open; 253 netdev->open = mipsnet_open;
254 netdev->stop = mipsnet_close; 254 netdev->stop = mipsnet_close;
@@ -293,23 +293,25 @@ out:
293 return err; 293 return err;
294} 294}
295 295
296static int __devexit mipsnet_device_remove(struct device *device) 296static int __devexit mipsnet_device_remove(struct platform_device *device)
297{ 297{
298 struct net_device *dev = dev_get_drvdata(device); 298 struct net_device *dev = platform_get_drvdata(device);
299 299
300 unregister_netdev(dev); 300 unregister_netdev(dev);
301 release_region(dev->base_addr, sizeof(struct mipsnet_regs)); 301 release_region(dev->base_addr, sizeof(struct mipsnet_regs));
302 free_netdev(dev); 302 free_netdev(dev);
303 dev_set_drvdata(device, NULL); 303 platform_set_drvdata(device, NULL);
304 304
305 return 0; 305 return 0;
306} 306}
307 307
308static struct device_driver mipsnet_driver = { 308static struct platform_driver mipsnet_driver = {
309 .name = mipsnet_string, 309 .driver = {
310 .bus = &platform_bus_type, 310 .name = mipsnet_string,
311 .probe = mipsnet_probe, 311 .owner = THIS_MODULE,
312 .remove = __devexit_p(mipsnet_device_remove), 312 },
313 .probe = mipsnet_probe,
314 .remove = __devexit_p(mipsnet_device_remove),
313}; 315};
314 316
315static int __init mipsnet_init_module(void) 317static int __init mipsnet_init_module(void)
@@ -319,7 +321,7 @@ static int __init mipsnet_init_module(void)
319 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " 321 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
320 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); 322 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
321 323
322 err = driver_register(&mipsnet_driver); 324 err = platform_driver_register(&mipsnet_driver);
323 if (err) 325 if (err)
324 printk(KERN_ERR "Driver registration failed\n"); 326 printk(KERN_ERR "Driver registration failed\n");
325 327
@@ -328,7 +330,7 @@ static int __init mipsnet_init_module(void)
328 330
329static void __exit mipsnet_exit_module(void) 331static void __exit mipsnet_exit_module(void)
330{ 332{
331 driver_unregister(&mipsnet_driver); 333 platform_driver_unregister(&mipsnet_driver);
332} 334}
333 335
334module_init(mipsnet_init_module); 336module_init(mipsnet_init_module);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index b0bc3bc18e9..fe4e158c893 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2588,7 +2588,7 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)
2588 2588
2589 phy_reset(mp); 2589 phy_reset(mp);
2590 2590
2591 phy_attach(mp->dev, phy->dev.bus_id, 0, PHY_INTERFACE_MODE_GMII); 2591 phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII);
2592 2592
2593 if (speed == 0) { 2593 if (speed == 0) {
2594 phy->autoneg = AUTONEG_ENABLE; 2594 phy->autoneg = AUTONEG_ENABLE;
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 31e38fae017..845431c186a 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2478,7 +2478,7 @@ static int sbmac_mii_probe(struct net_device *dev)
2478 return -ENXIO; 2478 return -ENXIO;
2479 } 2479 }
2480 2480
2481 phy_dev = phy_connect(dev, phy_dev->dev.bus_id, &sbmac_mii_poll, 0, 2481 phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll, 0,
2482 PHY_INTERFACE_MODE_GMII); 2482 PHY_INTERFACE_MODE_GMII);
2483 if (IS_ERR(phy_dev)) { 2483 if (IS_ERR(phy_dev)) {
2484 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); 2484 printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
@@ -2500,7 +2500,7 @@ static int sbmac_mii_probe(struct net_device *dev)
2500 2500
2501 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", 2501 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
2502 dev->name, phy_dev->drv->name, 2502 dev->name, phy_dev->drv->name,
2503 phy_dev->dev.bus_id, phy_dev->irq); 2503 dev_name(&phy_dev->dev), phy_dev->irq);
2504 2504
2505 sc->phy_dev = phy_dev; 2505 sc->phy_dev = phy_dev;
2506 2506
@@ -2697,7 +2697,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
2697 sbm_base = ioremap_nocache(res->start, res->end - res->start + 1); 2697 sbm_base = ioremap_nocache(res->start, res->end - res->start + 1);
2698 if (!sbm_base) { 2698 if (!sbm_base) {
2699 printk(KERN_ERR "%s: unable to map device registers\n", 2699 printk(KERN_ERR "%s: unable to map device registers\n",
2700 pldev->dev.bus_id); 2700 dev_name(&pldev->dev));
2701 err = -ENOMEM; 2701 err = -ENOMEM;
2702 goto out_out; 2702 goto out_out;
2703 } 2703 }
@@ -2708,7 +2708,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
2708 * If we find a zero, skip this MAC. 2708 * If we find a zero, skip this MAC.
2709 */ 2709 */
2710 sbmac_orig_hwaddr = __raw_readq(sbm_base + R_MAC_ETHERNET_ADDR); 2710 sbmac_orig_hwaddr = __raw_readq(sbm_base + R_MAC_ETHERNET_ADDR);
2711 pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", pldev->dev.bus_id, 2711 pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", dev_name(&pldev->dev),
2712 sbmac_orig_hwaddr ? "" : "not ", (long long)res->start); 2712 sbmac_orig_hwaddr ? "" : "not ", (long long)res->start);
2713 if (sbmac_orig_hwaddr == 0) { 2713 if (sbmac_orig_hwaddr == 0) {
2714 err = 0; 2714 err = 0;
@@ -2721,7 +2721,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
2721 dev = alloc_etherdev(sizeof(struct sbmac_softc)); 2721 dev = alloc_etherdev(sizeof(struct sbmac_softc));
2722 if (!dev) { 2722 if (!dev) {
2723 printk(KERN_ERR "%s: unable to allocate etherdev\n", 2723 printk(KERN_ERR "%s: unable to allocate etherdev\n",
2724 pldev->dev.bus_id); 2724 dev_name(&pldev->dev));
2725 err = -ENOMEM; 2725 err = -ENOMEM;
2726 goto out_unmap; 2726 goto out_unmap;
2727 } 2727 }
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 223cde0d43b..293610334a7 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1545,7 +1545,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1545{ 1545{
1546 strncpy(info->driver, CARDNAME, sizeof(info->driver)); 1546 strncpy(info->driver, CARDNAME, sizeof(info->driver));
1547 strncpy(info->version, version, sizeof(info->version)); 1547 strncpy(info->version, version, sizeof(info->version));
1548 strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); 1548 strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
1549} 1549}
1550 1550
1551static int smc911x_ethtool_nwayreset(struct net_device *dev) 1551static int smc911x_ethtool_nwayreset(struct net_device *dev)
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index b215a8d85e6..0b6da950144 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1614,7 +1614,7 @@ smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1614{ 1614{
1615 strncpy(info->driver, CARDNAME, sizeof(info->driver)); 1615 strncpy(info->driver, CARDNAME, sizeof(info->driver));
1616 strncpy(info->version, version, sizeof(info->version)); 1616 strncpy(info->version, version, sizeof(info->version));
1617 strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); 1617 strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
1618} 1618}
1619 1619
1620static int smc_ethtool_nwayreset(struct net_device *dev) 1620static int smc_ethtool_nwayreset(struct net_device *dev)
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index d1590ac55e4..ab18ee0f60f 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -769,7 +769,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
769 return -ENODEV; 769 return -ENODEV;
770 } 770 }
771 771
772 phydev = phy_connect(dev, phydev->dev.bus_id, 772 phydev = phy_connect(dev, dev_name(&phydev->dev),
773 &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface); 773 &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface);
774 774
775 if (IS_ERR(phydev)) { 775 if (IS_ERR(phydev)) {
@@ -778,7 +778,8 @@ static int smsc911x_mii_probe(struct net_device *dev)
778 } 778 }
779 779
780 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", 780 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
781 dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); 781 dev->name, phydev->drv->name,
782 dev_name(&phydev->dev), phydev->irq);
782 783
783 /* mask with MAC supported features */ 784 /* mask with MAC supported features */
784 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | 785 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
@@ -1549,7 +1550,7 @@ static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
1549{ 1550{
1550 strlcpy(info->driver, SMSC_CHIPNAME, sizeof(info->driver)); 1551 strlcpy(info->driver, SMSC_CHIPNAME, sizeof(info->driver));
1551 strlcpy(info->version, SMSC_DRV_VERSION, sizeof(info->version)); 1552 strlcpy(info->version, SMSC_DRV_VERSION, sizeof(info->version));
1552 strlcpy(info->bus_info, dev->dev.parent->bus_id, 1553 strlcpy(info->bus_info, dev_name(dev->dev.parent),
1553 sizeof(info->bus_info)); 1554 sizeof(info->bus_info));
1554} 1555}
1555 1556
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c
index 4e15ae068b3..72f1348eb80 100644
--- a/drivers/net/smsc9420.c
+++ b/drivers/net/smsc9420.c
@@ -1160,7 +1160,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
1160 smsc_info(PROBE, "PHY addr %d, phy_id 0x%08X", phydev->addr, 1160 smsc_info(PROBE, "PHY addr %d, phy_id 0x%08X", phydev->addr,
1161 phydev->phy_id); 1161 phydev->phy_id);
1162 1162
1163 phydev = phy_connect(dev, phydev->dev.bus_id, 1163 phydev = phy_connect(dev, dev_name(&phydev->dev),
1164 &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII); 1164 &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII);
1165 1165
1166 if (IS_ERR(phydev)) { 1166 if (IS_ERR(phydev)) {
@@ -1169,7 +1169,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
1169 } 1169 }
1170 1170
1171 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", 1171 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
1172 dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq); 1172 dev->name, phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
1173 1173
1174 /* mask with MAC supported features */ 1174 /* mask with MAC supported features */
1175 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | 1175 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index bcd0e60cbda..e1f8eb96a45 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -725,7 +725,7 @@ static int tc_mii_probe(struct net_device *dev)
725 } 725 }
726 726
727 /* attach the mac to the phy */ 727 /* attach the mac to the phy */
728 phydev = phy_connect(dev, phydev->dev.bus_id, 728 phydev = phy_connect(dev, dev_name(&phydev->dev),
729 &tc_handle_link_change, 0, 729 &tc_handle_link_change, 0,
730 lp->chiptype == TC35815_TX4939 ? 730 lp->chiptype == TC35815_TX4939 ?
731 PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII); 731 PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
@@ -735,7 +735,7 @@ static int tc_mii_probe(struct net_device *dev)
735 } 735 }
736 printk(KERN_INFO "%s: attached PHY driver [%s] " 736 printk(KERN_INFO "%s: attached PHY driver [%s] "
737 "(mii_bus:phy_addr=%s, id=%x)\n", 737 "(mii_bus:phy_addr=%s, id=%x)\n",
738 dev->name, phydev->drv->name, phydev->dev.bus_id, 738 dev->name, phydev->drv->name, dev_name(&phydev->dev),
739 phydev->phy_id); 739 phydev->phy_id);
740 740
741 /* mask with MAC supported features */ 741 /* mask with MAC supported features */
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c
index e80a0b65a75..d58b971faa6 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -613,7 +613,7 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags)
613 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); 613 d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
614 614
615 snprintf(wimax_dev->name, sizeof(wimax_dev->name), 615 snprintf(wimax_dev->name, sizeof(wimax_dev->name),
616 "i2400m-%s:%s", dev->bus->name, dev->bus_id); 616 "i2400m-%s:%s", dev->bus->name, dev_name(dev));
617 617
618 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); 618 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL);
619 if (i2400m->bm_cmd_buf == NULL) { 619 if (i2400m->bm_cmd_buf == NULL) {
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c
index 9702c22b249..0528879f6d3 100644
--- a/drivers/net/wimax/i2400m/usb-notif.c
+++ b/drivers/net/wimax/i2400m/usb-notif.c
@@ -102,7 +102,7 @@ int i2400mu_notification_grok(struct i2400mu *i2400mu, const void *buf,
102 dev_err(dev, "HW BUG? Unknown/unexpected data in notification " 102 dev_err(dev, "HW BUG? Unknown/unexpected data in notification "
103 "message (%zu bytes)\n", buf_len); 103 "message (%zu bytes)\n", buf_len);
104 snprintf(prefix, sizeof(prefix), "%s %s: ", 104 snprintf(prefix, sizeof(prefix), "%s %s: ",
105 dev_driver_string(dev) , dev->bus_id); 105 dev_driver_string(dev) , dev_name(dev));
106 if (buf_len > 64) { 106 if (buf_len > 64) {
107 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, 107 print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET,
108 8, 4, buf, 64, 0); 108 8, 4, buf, 64, 0);
diff --git a/drivers/net/xtsonic.c b/drivers/net/xtsonic.c
index 03a3f34e903..a12a7211c98 100644
--- a/drivers/net/xtsonic.c
+++ b/drivers/net/xtsonic.c
@@ -183,7 +183,7 @@ static int __init sonic_probe1(struct net_device *dev)
183 183
184 if (lp->descriptors == NULL) { 184 if (lp->descriptors == NULL) {
185 printk(KERN_ERR "%s: couldn't alloc DMA memory for " 185 printk(KERN_ERR "%s: couldn't alloc DMA memory for "
186 " descriptors.\n", lp->device->bus_id); 186 " descriptors.\n", dev_name(lp->device));
187 goto out; 187 goto out;
188 } 188 }
189 189
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c
index a13abf55d78..8450f4a6568 100644
--- a/drivers/pci/hotplug/cpqphp_sysfs.c
+++ b/drivers/pci/hotplug/cpqphp_sysfs.c
@@ -225,7 +225,8 @@ void cpqhp_shutdown_debugfs(void)
225 225
226void cpqhp_create_debugfs_files(struct controller *ctrl) 226void cpqhp_create_debugfs_files(struct controller *ctrl)
227{ 227{
228 ctrl->dentry = debugfs_create_file(ctrl->pci_dev->dev.bus_id, S_IRUGO, root, ctrl, &debug_ops); 228 ctrl->dentry = debugfs_create_file(dev_name(&ctrl->pci_dev->dev),
229 S_IRUGO, root, ctrl, &debug_ops);
229} 230}
230 231
231void cpqhp_remove_debugfs_files(struct controller *ctrl) 232void cpqhp_remove_debugfs_files(struct controller *ctrl)
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index fc1de46fd20..90013341cd5 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -468,13 +468,13 @@ out:
468 return ret; 468 return ret;
469} 469}
470 470
471int au1x00_drv_pcmcia_remove(struct device *dev) 471int au1x00_drv_pcmcia_remove(struct platform_device *dev)
472{ 472{
473 struct skt_dev_info *sinfo = dev_get_drvdata(dev); 473 struct skt_dev_info *sinfo = platform_get_drvdata(dev);
474 int i; 474 int i;
475 475
476 mutex_lock(&pcmcia_sockets_lock); 476 mutex_lock(&pcmcia_sockets_lock);
477 dev_set_drvdata(dev, NULL); 477 platform_set_drvdata(dev, NULL);
478 478
479 for (i = 0; i < sinfo->nskt; i++) { 479 for (i = 0; i < sinfo->nskt; i++) {
480 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 480 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
@@ -498,13 +498,13 @@ int au1x00_drv_pcmcia_remove(struct device *dev)
498 * PCMCIA "Driver" API 498 * PCMCIA "Driver" API
499 */ 499 */
500 500
501static int au1x00_drv_pcmcia_probe(struct device *dev) 501static int au1x00_drv_pcmcia_probe(struct platform_device *dev)
502{ 502{
503 int i, ret = -ENODEV; 503 int i, ret = -ENODEV;
504 504
505 mutex_lock(&pcmcia_sockets_lock); 505 mutex_lock(&pcmcia_sockets_lock);
506 for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { 506 for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) {
507 ret = au1x00_pcmcia_hw_init[i](dev); 507 ret = au1x00_pcmcia_hw_init[i](&dev->dev);
508 if (ret == 0) 508 if (ret == 0)
509 break; 509 break;
510 } 510 }
@@ -512,14 +512,26 @@ static int au1x00_drv_pcmcia_probe(struct device *dev)
512 return ret; 512 return ret;
513} 513}
514 514
515static int au1x00_drv_pcmcia_suspend(struct platform_device *dev,
516 pm_message_t state)
517{
518 return pcmcia_socket_dev_suspend(&dev->dev, state);
519}
520
521static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
522{
523 return pcmcia_socket_dev_resume(&dev->dev);
524}
515 525
516static struct device_driver au1x00_pcmcia_driver = { 526static struct platform_driver au1x00_pcmcia_driver = {
527 .driver = {
528 .name = "au1x00-pcmcia",
529 .owner = THIS_MODULE,
530 },
517 .probe = au1x00_drv_pcmcia_probe, 531 .probe = au1x00_drv_pcmcia_probe,
518 .remove = au1x00_drv_pcmcia_remove, 532 .remove = au1x00_drv_pcmcia_remove,
519 .name = "au1x00-pcmcia", 533 .suspend = au1x00_drv_pcmcia_suspend,
520 .bus = &platform_bus_type, 534 .resume = au1x00_drv_pcmcia_resume,
521 .suspend = pcmcia_socket_dev_suspend,
522 .resume = pcmcia_socket_dev_resume,
523}; 535};
524 536
525 537
@@ -533,8 +545,7 @@ static struct device_driver au1x00_pcmcia_driver = {
533static int __init au1x00_pcmcia_init(void) 545static int __init au1x00_pcmcia_init(void)
534{ 546{
535 int error = 0; 547 int error = 0;
536 if ((error = driver_register(&au1x00_pcmcia_driver))) 548 error = platform_driver_register(&au1x00_pcmcia_driver);
537 return error;
538 return error; 549 return error;
539} 550}
540 551
@@ -544,7 +555,7 @@ static int __init au1x00_pcmcia_init(void)
544 */ 555 */
545static void __exit au1x00_pcmcia_exit(void) 556static void __exit au1x00_pcmcia_exit(void)
546{ 557{
547 driver_unregister(&au1x00_pcmcia_driver); 558 platform_driver_unregister(&au1x00_pcmcia_driver);
548} 559}
549 560
550module_init(au1x00_pcmcia_init); 561module_init(au1x00_pcmcia_init);
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index 71653ab8489..40d4953e4b1 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -1238,6 +1238,16 @@ static int pcic_init(struct pcmcia_socket *s)
1238 return 0; 1238 return 0;
1239} 1239}
1240 1240
1241static int i82365_drv_pcmcia_suspend(struct platform_device *dev,
1242 pm_message_t state)
1243{
1244 return pcmcia_socket_dev_suspend(&dev->dev, state);
1245}
1246
1247static int i82365_drv_pcmcia_resume(struct platform_device *dev)
1248{
1249 return pcmcia_socket_dev_resume(&dev->dev);
1250}
1241static struct pccard_operations pcic_operations = { 1251static struct pccard_operations pcic_operations = {
1242 .init = pcic_init, 1252 .init = pcic_init,
1243 .get_status = pcic_get_status, 1253 .get_status = pcic_get_status,
@@ -1248,11 +1258,13 @@ static struct pccard_operations pcic_operations = {
1248 1258
1249/*====================================================================*/ 1259/*====================================================================*/
1250 1260
1251static struct device_driver i82365_driver = { 1261static struct platform_driver i82365_driver = {
1252 .name = "i82365", 1262 .driver = {
1253 .bus = &platform_bus_type, 1263 .name = "i82365",
1254 .suspend = pcmcia_socket_dev_suspend, 1264 .owner = THIS_MODULE,
1255 .resume = pcmcia_socket_dev_resume, 1265 },
1266 .suspend = i82365_drv_pcmcia_suspend,
1267 .resume = i82365_drv_pcmcia_resume,
1256}; 1268};
1257 1269
1258static struct platform_device *i82365_device; 1270static struct platform_device *i82365_device;
@@ -1261,7 +1273,7 @@ static int __init init_i82365(void)
1261{ 1273{
1262 int i, ret; 1274 int i, ret;
1263 1275
1264 ret = driver_register(&i82365_driver); 1276 ret = platform_driver_register(&i82365_driver);
1265 if (ret) 1277 if (ret)
1266 goto err_out; 1278 goto err_out;
1267 1279
@@ -1337,7 +1349,7 @@ err_dev_unregister:
1337 pnp_disable_dev(i82365_pnpdev); 1349 pnp_disable_dev(i82365_pnpdev);
1338#endif 1350#endif
1339err_driver_unregister: 1351err_driver_unregister:
1340 driver_unregister(&i82365_driver); 1352 platform_driver_unregister(&i82365_driver);
1341err_out: 1353err_out:
1342 return ret; 1354 return ret;
1343} /* init_i82365 */ 1355} /* init_i82365 */
@@ -1365,7 +1377,7 @@ static void __exit exit_i82365(void)
1365 if (i82365_pnpdev) 1377 if (i82365_pnpdev)
1366 pnp_disable_dev(i82365_pnpdev); 1378 pnp_disable_dev(i82365_pnpdev);
1367#endif 1379#endif
1368 driver_unregister(&i82365_driver); 1380 platform_driver_unregister(&i82365_driver);
1369} /* exit_i82365 */ 1381} /* exit_i82365 */
1370 1382
1371module_init(init_i82365); 1383module_init(init_i82365);
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 2ab4f22c21d..62b4ecc97c4 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -696,13 +696,25 @@ static struct pccard_operations pcc_operations = {
696 .set_mem_map = pcc_set_mem_map, 696 .set_mem_map = pcc_set_mem_map,
697}; 697};
698 698
699static int cfc_drv_pcmcia_suspend(struct platform_device *dev,
700 pm_message_t state)
701{
702 return pcmcia_socket_dev_suspend(&dev->dev, state);
703}
704
705static int cfc_drv_pcmcia_resume(struct platform_device *dev)
706{
707 return pcmcia_socket_dev_resume(&dev->dev);
708}
699/*====================================================================*/ 709/*====================================================================*/
700 710
701static struct device_driver pcc_driver = { 711static struct platform_driver pcc_driver = {
702 .name = "cfc", 712 .driver = {
703 .bus = &platform_bus_type, 713 .name = "cfc",
704 .suspend = pcmcia_socket_dev_suspend, 714 .owner = THIS_MODULE,
705 .resume = pcmcia_socket_dev_resume, 715 },
716 .suspend = cfc_drv_pcmcia_suspend,
717 .resume = cfc_drv_pcmcia_resume,
706}; 718};
707 719
708static struct platform_device pcc_device = { 720static struct platform_device pcc_device = {
@@ -716,13 +728,13 @@ static int __init init_m32r_pcc(void)
716{ 728{
717 int i, ret; 729 int i, ret;
718 730
719 ret = driver_register(&pcc_driver); 731 ret = platform_driver_register(&pcc_driver);
720 if (ret) 732 if (ret)
721 return ret; 733 return ret;
722 734
723 ret = platform_device_register(&pcc_device); 735 ret = platform_device_register(&pcc_device);
724 if (ret){ 736 if (ret){
725 driver_unregister(&pcc_driver); 737 platform_driver_unregister(&pcc_driver);
726 return ret; 738 return ret;
727 } 739 }
728 740
@@ -754,7 +766,7 @@ static int __init init_m32r_pcc(void)
754 if (pcc_sockets == 0) { 766 if (pcc_sockets == 0) {
755 printk("socket is not found.\n"); 767 printk("socket is not found.\n");
756 platform_device_unregister(&pcc_device); 768 platform_device_unregister(&pcc_device);
757 driver_unregister(&pcc_driver); 769 platform_driver_unregister(&pcc_driver);
758 return -ENODEV; 770 return -ENODEV;
759 } 771 }
760 772
@@ -802,7 +814,7 @@ static void __exit exit_m32r_pcc(void)
802 if (poll_interval != 0) 814 if (poll_interval != 0)
803 del_timer_sync(&poll_timer); 815 del_timer_sync(&poll_timer);
804 816
805 driver_unregister(&pcc_driver); 817 platform_driver_unregister(&pcc_driver);
806} /* exit_m32r_pcc */ 818} /* exit_m32r_pcc */
807 819
808module_init(init_m32r_pcc); 820module_init(init_m32r_pcc);
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 2f108c23dbd..12034b41d19 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -672,13 +672,25 @@ static struct pccard_operations pcc_operations = {
672 .set_mem_map = pcc_set_mem_map, 672 .set_mem_map = pcc_set_mem_map,
673}; 673};
674 674
675static int pcc_drv_pcmcia_suspend(struct platform_device *dev,
676 pm_message_t state)
677{
678 return pcmcia_socket_dev_suspend(&dev->dev, state);
679}
680
681static int pcc_drv_pcmcia_resume(struct platform_device *dev)
682{
683 return pcmcia_socket_dev_resume(&dev->dev);
684}
675/*====================================================================*/ 685/*====================================================================*/
676 686
677static struct device_driver pcc_driver = { 687static struct platform_driver pcc_driver = {
678 .name = "pcc", 688 .driver = {
679 .bus = &platform_bus_type, 689 .name = "pcc",
680 .suspend = pcmcia_socket_dev_suspend, 690 .owner = THIS_MODULE,
681 .resume = pcmcia_socket_dev_resume, 691 },
692 .suspend = pcc_drv_pcmcia_suspend,
693 .resume = pcc_drv_pcmcia_resume,
682}; 694};
683 695
684static struct platform_device pcc_device = { 696static struct platform_device pcc_device = {
@@ -692,13 +704,13 @@ static int __init init_m32r_pcc(void)
692{ 704{
693 int i, ret; 705 int i, ret;
694 706
695 ret = driver_register(&pcc_driver); 707 ret = platform_driver_register(&pcc_driver);
696 if (ret) 708 if (ret)
697 return ret; 709 return ret;
698 710
699 ret = platform_device_register(&pcc_device); 711 ret = platform_device_register(&pcc_device);
700 if (ret){ 712 if (ret){
701 driver_unregister(&pcc_driver); 713 platform_driver_unregister(&pcc_driver);
702 return ret; 714 return ret;
703 } 715 }
704 716
@@ -715,7 +727,7 @@ static int __init init_m32r_pcc(void)
715 if (pcc_sockets == 0) { 727 if (pcc_sockets == 0) {
716 printk("socket is not found.\n"); 728 printk("socket is not found.\n");
717 platform_device_unregister(&pcc_device); 729 platform_device_unregister(&pcc_device);
718 driver_unregister(&pcc_driver); 730 platform_driver_unregister(&pcc_driver);
719 return -ENODEV; 731 return -ENODEV;
720 } 732 }
721 733
@@ -763,7 +775,7 @@ static void __exit exit_m32r_pcc(void)
763 if (poll_interval != 0) 775 if (poll_interval != 0)
764 del_timer_sync(&poll_timer); 776 del_timer_sync(&poll_timer);
765 777
766 driver_unregister(&pcc_driver); 778 platform_driver_unregister(&pcc_driver);
767} /* exit_m32r_pcc */ 779} /* exit_m32r_pcc */
768 780
769module_init(init_m32r_pcc); 781module_init(init_m32r_pcc);
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index c0e2afc79e3..e592e0e0d7e 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -153,7 +153,7 @@ static struct resource *iodyn_find_io_region(unsigned long base, int num,
153 unsigned long align, struct pcmcia_socket *s) 153 unsigned long align, struct pcmcia_socket *s)
154{ 154{
155 struct resource *res = make_resource(0, num, IORESOURCE_IO, 155 struct resource *res = make_resource(0, num, IORESOURCE_IO,
156 s->dev.bus_id); 156 dev_name(&s->dev));
157 struct pcmcia_align_data data; 157 struct pcmcia_align_data data;
158 unsigned long min = base; 158 unsigned long min = base;
159 int ret; 159 int ret;
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index c5b2a44b4c3..d8da5ac844e 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -65,7 +65,7 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
65#endif 65#endif
66}; 66};
67 67
68static int sa11x0_drv_pcmcia_probe(struct device *dev) 68static int sa11x0_drv_pcmcia_probe(struct platform_device *dev)
69{ 69{
70 int i, ret = -ENODEV; 70 int i, ret = -ENODEV;
71 71
@@ -73,7 +73,7 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev)
73 * Initialise any "on-board" PCMCIA sockets. 73 * Initialise any "on-board" PCMCIA sockets.
74 */ 74 */
75 for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) { 75 for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) {
76 ret = sa11x0_pcmcia_hw_init[i](dev); 76 ret = sa11x0_pcmcia_hw_init[i](&dev->dev);
77 if (ret == 0) 77 if (ret == 0)
78 break; 78 break;
79 } 79 }
@@ -81,13 +81,31 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev)
81 return ret; 81 return ret;
82} 82}
83 83
84static struct device_driver sa11x0_pcmcia_driver = { 84static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
85{
86 return soc_common_drv_pcmcia_remove(&dev->dev);
87}
88
89static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev,
90 pm_message_t state)
91{
92 return pcmcia_socket_dev_suspend(&dev->dev, state);
93}
94
95static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
96{
97 return pcmcia_socket_dev_resume(&dev->dev);
98}
99
100static struct platform_driver sa11x0_pcmcia_driver = {
101 .driver = {
102 .name = "sa11x0-pcmcia",
103 .owner = THIS_MODULE,
104 },
85 .probe = sa11x0_drv_pcmcia_probe, 105 .probe = sa11x0_drv_pcmcia_probe,
86 .remove = soc_common_drv_pcmcia_remove, 106 .remove = sa11x0_drv_pcmcia_remove,
87 .name = "sa11x0-pcmcia", 107 .suspend = sa11x0_drv_pcmcia_suspend,
88 .bus = &platform_bus_type, 108 .resume = sa11x0_drv_pcmcia_resume,
89 .suspend = pcmcia_socket_dev_suspend,
90 .resume = pcmcia_socket_dev_resume,
91}; 109};
92 110
93/* sa11x0_pcmcia_init() 111/* sa11x0_pcmcia_init()
@@ -100,7 +118,7 @@ static struct device_driver sa11x0_pcmcia_driver = {
100 */ 118 */
101static int __init sa11x0_pcmcia_init(void) 119static int __init sa11x0_pcmcia_init(void)
102{ 120{
103 return driver_register(&sa11x0_pcmcia_driver); 121 return platform_driver_register(&sa11x0_pcmcia_driver);
104} 122}
105 123
106/* sa11x0_pcmcia_exit() 124/* sa11x0_pcmcia_exit()
@@ -110,7 +128,7 @@ static int __init sa11x0_pcmcia_init(void)
110 */ 128 */
111static void __exit sa11x0_pcmcia_exit(void) 129static void __exit sa11x0_pcmcia_exit(void)
112{ 130{
113 driver_unregister(&sa11x0_pcmcia_driver); 131 platform_driver_unregister(&sa11x0_pcmcia_driver);
114} 132}
115 133
116MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); 134MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 2a613e920fd..9ad97ea836e 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -363,13 +363,25 @@ static int __init get_tcic_id(void)
363 return id; 363 return id;
364} 364}
365 365
366static int tcic_drv_pcmcia_suspend(struct platform_device *dev,
367 pm_message_t state)
368{
369 return pcmcia_socket_dev_suspend(&dev->dev, state);
370}
371
372static int tcic_drv_pcmcia_resume(struct platform_device *dev)
373{
374 return pcmcia_socket_dev_resume(&dev->dev);
375}
366/*====================================================================*/ 376/*====================================================================*/
367 377
368static struct device_driver tcic_driver = { 378static struct platform_driver tcic_driver = {
369 .name = "tcic-pcmcia", 379 .driver = {
370 .bus = &platform_bus_type, 380 .name = "tcic-pcmcia",
371 .suspend = pcmcia_socket_dev_suspend, 381 .owner = THIS_MODULE,
372 .resume = pcmcia_socket_dev_resume, 382 },
383 .suspend = tcic_drv_pcmcia_suspend,
384 .resume = tcic_drv_pcmcia_resume,
373}; 385};
374 386
375static struct platform_device tcic_device = { 387static struct platform_device tcic_device = {
@@ -383,7 +395,7 @@ static int __init init_tcic(void)
383 int i, sock, ret = 0; 395 int i, sock, ret = 0;
384 u_int mask, scan; 396 u_int mask, scan;
385 397
386 if (driver_register(&tcic_driver)) 398 if (platform_driver_register(&tcic_driver))
387 return -1; 399 return -1;
388 400
389 printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); 401 printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: ");
@@ -391,7 +403,7 @@ static int __init init_tcic(void)
391 403
392 if (!request_region(tcic_base, 16, "tcic-2")) { 404 if (!request_region(tcic_base, 16, "tcic-2")) {
393 printk("could not allocate ports,\n "); 405 printk("could not allocate ports,\n ");
394 driver_unregister(&tcic_driver); 406 platform_driver_unregister(&tcic_driver);
395 return -ENODEV; 407 return -ENODEV;
396 } 408 }
397 else { 409 else {
@@ -414,7 +426,7 @@ static int __init init_tcic(void)
414 if (sock == 0) { 426 if (sock == 0) {
415 printk("not found.\n"); 427 printk("not found.\n");
416 release_region(tcic_base, 16); 428 release_region(tcic_base, 16);
417 driver_unregister(&tcic_driver); 429 platform_driver_unregister(&tcic_driver);
418 return -ENODEV; 430 return -ENODEV;
419 } 431 }
420 432
@@ -542,7 +554,7 @@ static void __exit exit_tcic(void)
542 } 554 }
543 555
544 platform_device_unregister(&tcic_device); 556 platform_device_unregister(&tcic_device);
545 driver_unregister(&tcic_driver); 557 platform_driver_unregister(&tcic_driver);
546} /* exit_tcic */ 558} /* exit_tcic */
547 559
548/*====================================================================*/ 560/*====================================================================*/
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index b2c41241905..659421d0ca4 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -704,24 +704,37 @@ static int __devinit vrc4171_card_setup(char *options)
704 704
705__setup("vrc4171_card=", vrc4171_card_setup); 705__setup("vrc4171_card=", vrc4171_card_setup);
706 706
707static struct device_driver vrc4171_card_driver = { 707static int vrc4171_card_suspend(struct platform_device *dev,
708 .name = vrc4171_card_name, 708 pm_message_t state)
709 .bus = &platform_bus_type, 709{
710 .suspend = pcmcia_socket_dev_suspend, 710 return pcmcia_socket_dev_suspend(&dev->dev, state);
711 .resume = pcmcia_socket_dev_resume, 711}
712
713static int vrc4171_card_resume(struct platform_device *dev)
714{
715 return pcmcia_socket_dev_resume(&dev->dev);
716}
717
718static struct platform_driver vrc4171_card_driver = {
719 .driver = {
720 .name = vrc4171_card_name,
721 .owner = THIS_MODULE,
722 },
723 .suspend = vrc4171_card_suspend,
724 .resume = vrc4171_card_resume,
712}; 725};
713 726
714static int __devinit vrc4171_card_init(void) 727static int __devinit vrc4171_card_init(void)
715{ 728{
716 int retval; 729 int retval;
717 730
718 retval = driver_register(&vrc4171_card_driver); 731 retval = platform_driver_register(&vrc4171_card_driver);
719 if (retval < 0) 732 if (retval < 0)
720 return retval; 733 return retval;
721 734
722 retval = platform_device_register(&vrc4171_card_device); 735 retval = platform_device_register(&vrc4171_card_device);
723 if (retval < 0) { 736 if (retval < 0) {
724 driver_unregister(&vrc4171_card_driver); 737 platform_driver_unregister(&vrc4171_card_driver);
725 return retval; 738 return retval;
726 } 739 }
727 740
@@ -735,11 +748,12 @@ static int __devinit vrc4171_card_init(void)
735 if (retval < 0) { 748 if (retval < 0) {
736 vrc4171_remove_sockets(); 749 vrc4171_remove_sockets();
737 platform_device_unregister(&vrc4171_card_device); 750 platform_device_unregister(&vrc4171_card_device);
738 driver_unregister(&vrc4171_card_driver); 751 platform_driver_unregister(&vrc4171_card_driver);
739 return retval; 752 return retval;
740 } 753 }
741 754
742 printk(KERN_INFO "%s, connected to IRQ %d\n", vrc4171_card_driver.name, vrc4171_irq); 755 printk(KERN_INFO "%s, connected to IRQ %d\n",
756 vrc4171_card_driver.driver.name, vrc4171_irq);
743 757
744 return 0; 758 return 0;
745} 759}
@@ -749,7 +763,7 @@ static void __devexit vrc4171_card_exit(void)
749 free_irq(vrc4171_irq, vrc4171_sockets); 763 free_irq(vrc4171_irq, vrc4171_sockets);
750 vrc4171_remove_sockets(); 764 vrc4171_remove_sockets();
751 platform_device_unregister(&vrc4171_card_device); 765 platform_device_unregister(&vrc4171_card_device);
752 driver_unregister(&vrc4171_card_driver); 766 platform_driver_unregister(&vrc4171_card_driver);
753} 767}
754 768
755module_init(vrc4171_card_init); 769module_init(vrc4171_card_init);
diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index addb87cf44d..3222fa3c808 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -193,7 +193,7 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv)
193} 193}
194 194
195static struct device rio_bus = { 195static struct device rio_bus = {
196 .bus_id = "rapidio", 196 .init_name = "rapidio",
197}; 197};
198 198
199struct bus_type rio_bus_type = { 199struct bus_type rio_bus_type = {
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index d5e4e637dde..86c61f14351 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -351,7 +351,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
351 /* register irq handler after we know what name we'll use */ 351 /* register irq handler after we know what name we'll use */
352 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, 352 ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
353 IRQF_DISABLED | IRQF_SHARED, 353 IRQF_DISABLED | IRQF_SHARED,
354 rtc->rtcdev->dev.bus_id, rtc); 354 dev_name(&rtc->rtcdev->dev), rtc);
355 if (ret) { 355 if (ret) {
356 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); 356 dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS);
357 rtc_device_unregister(rtc->rtcdev); 357 rtc_device_unregister(rtc->rtcdev);
@@ -366,7 +366,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
366 366
367 if (gpbr_readl(rtc) == 0) 367 if (gpbr_readl(rtc) == 0)
368 dev_warn(&pdev->dev, "%s: SET TIME!\n", 368 dev_warn(&pdev->dev, "%s: SET TIME!\n",
369 rtc->rtcdev->dev.bus_id); 369 dev_name(&rtc->rtcdev->dev));
370 370
371 return 0; 371 return 0;
372 372
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 2cbeb0794f1..bd1ce8e2bc1 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -377,13 +377,13 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
377 377
378 /* handle periodic and alarm irqs */ 378 /* handle periodic and alarm irqs */
379 if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED, 379 if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED,
380 rtc->dev.bus_id, rtc)) { 380 dev_name(&rtc->dev), rtc)) {
381 pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", 381 pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n",
382 pdev->name, omap_rtc_timer); 382 pdev->name, omap_rtc_timer);
383 goto fail0; 383 goto fail0;
384 } 384 }
385 if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED, 385 if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED,
386 rtc->dev.bus_id, rtc)) { 386 dev_name(&rtc->dev), rtc)) {
387 pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", 387 pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n",
388 pdev->name, omap_rtc_alarm); 388 pdev->name, omap_rtc_alarm);
389 goto fail1; 389 goto fail1;
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index ad35f76c46b..a6341e4f9a0 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -426,7 +426,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
426 426
427 ret = request_irq(irq, twl4030_rtc_interrupt, 427 ret = request_irq(irq, twl4030_rtc_interrupt,
428 IRQF_TRIGGER_RISING, 428 IRQF_TRIGGER_RISING,
429 rtc->dev.bus_id, rtc); 429 dev_name(&rtc->dev), rtc);
430 if (ret < 0) { 430 if (ret < 0) {
431 dev_err(&pdev->dev, "IRQ is not free.\n"); 431 dev_err(&pdev->dev, "IRQ is not free.\n");
432 goto out1; 432 goto out1;
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 918e6fce257..b91c1719b07 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -104,8 +104,9 @@ ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const
104 rc = device_schedule_callback(dev, ccwgroup_ungroup_callback); 104 rc = device_schedule_callback(dev, ccwgroup_ungroup_callback);
105out: 105out:
106 if (rc) { 106 if (rc) {
107 /* Release onoff "lock" when ungrouping failed. */ 107 if (rc != -EAGAIN)
108 atomic_set(&gdev->onoff, 0); 108 /* Release onoff "lock" when ungrouping failed. */
109 atomic_set(&gdev->onoff, 0);
109 return rc; 110 return rc;
110 } 111 }
111 return count; 112 return count;
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 0a2f2edafc0..93eca1731b8 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -84,8 +84,8 @@ static int chsc_subchannel_probe(struct subchannel *sch)
84 kfree(private); 84 kfree(private);
85 } else { 85 } else {
86 sch->private = private; 86 sch->private = private;
87 if (sch->dev.uevent_suppress) { 87 if (dev_get_uevent_suppress(&sch->dev)) {
88 sch->dev.uevent_suppress = 0; 88 dev_set_uevent_suppress(&sch->dev, 0);
89 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 89 kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
90 } 90 }
91 } 91 }
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 8019288bc6d..427d11d8806 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -272,7 +272,7 @@ static int css_register_subchannel(struct subchannel *sch)
272 * the subchannel driver can decide itself when it wants to inform 272 * the subchannel driver can decide itself when it wants to inform
273 * userspace of its existence. 273 * userspace of its existence.
274 */ 274 */
275 sch->dev.uevent_suppress = 1; 275 dev_set_uevent_suppress(&sch->dev, 1);
276 css_update_ssd_info(sch); 276 css_update_ssd_info(sch);
277 /* make it known to the system */ 277 /* make it known to the system */
278 ret = css_sch_device_register(sch); 278 ret = css_sch_device_register(sch);
@@ -287,7 +287,7 @@ static int css_register_subchannel(struct subchannel *sch)
287 * a fitting driver module may be loaded based on the 287 * a fitting driver module may be loaded based on the
288 * modalias. 288 * modalias.
289 */ 289 */
290 sch->dev.uevent_suppress = 0; 290 dev_set_uevent_suppress(&sch->dev, 0);
291 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 291 kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
292 } 292 }
293 return ret; 293 return ret;
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 23d5752349b..e28f8ae5345 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -799,7 +799,7 @@ static void sch_attach_disconnected_device(struct subchannel *sch,
799 return; 799 return;
800 other_sch = to_subchannel(cdev->dev.parent); 800 other_sch = to_subchannel(cdev->dev.parent);
801 /* Note: device_move() changes cdev->dev.parent */ 801 /* Note: device_move() changes cdev->dev.parent */
802 ret = device_move(&cdev->dev, &sch->dev); 802 ret = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV);
803 if (ret) { 803 if (ret) {
804 CIO_MSG_EVENT(0, "Moving disconnected device 0.%x.%04x failed " 804 CIO_MSG_EVENT(0, "Moving disconnected device 0.%x.%04x failed "
805 "(ret=%d)!\n", cdev->private->dev_id.ssid, 805 "(ret=%d)!\n", cdev->private->dev_id.ssid,
@@ -830,7 +830,7 @@ static void sch_attach_orphaned_device(struct subchannel *sch,
830 * Try to move the ccw device to its new subchannel. 830 * Try to move the ccw device to its new subchannel.
831 * Note: device_move() changes cdev->dev.parent 831 * Note: device_move() changes cdev->dev.parent
832 */ 832 */
833 ret = device_move(&cdev->dev, &sch->dev); 833 ret = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV);
834 if (ret) { 834 if (ret) {
835 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x from orphanage " 835 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x from orphanage "
836 "failed (ret=%d)!\n", 836 "failed (ret=%d)!\n",
@@ -897,7 +897,8 @@ void ccw_device_move_to_orphanage(struct work_struct *work)
897 * ccw device can take its place on the subchannel. 897 * ccw device can take its place on the subchannel.
898 * Note: device_move() changes cdev->dev.parent 898 * Note: device_move() changes cdev->dev.parent
899 */ 899 */
900 ret = device_move(&cdev->dev, &css->pseudo_subchannel->dev); 900 ret = device_move(&cdev->dev, &css->pseudo_subchannel->dev,
901 DPM_ORDER_NONE);
901 if (ret) { 902 if (ret) {
902 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to orphanage failed " 903 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to orphanage failed "
903 "(ret=%d)!\n", cdev->private->dev_id.ssid, 904 "(ret=%d)!\n", cdev->private->dev_id.ssid,
@@ -981,7 +982,7 @@ io_subchannel_register(struct work_struct *work)
981 * Now we know this subchannel will stay, we can throw 982 * Now we know this subchannel will stay, we can throw
982 * our delayed uevent. 983 * our delayed uevent.
983 */ 984 */
984 sch->dev.uevent_suppress = 0; 985 dev_set_uevent_suppress(&sch->dev, 0);
985 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 986 kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
986 /* make it known to the system */ 987 /* make it known to the system */
987 ret = ccw_device_register(cdev); 988 ret = ccw_device_register(cdev);
@@ -1129,7 +1130,7 @@ static void ccw_device_move_to_sch(struct work_struct *work)
1129 * Try to move the ccw device to its new subchannel. 1130 * Try to move the ccw device to its new subchannel.
1130 * Note: device_move() changes cdev->dev.parent 1131 * Note: device_move() changes cdev->dev.parent
1131 */ 1132 */
1132 rc = device_move(&cdev->dev, &sch->dev); 1133 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV);
1133 mutex_unlock(&sch->reg_mutex); 1134 mutex_unlock(&sch->reg_mutex);
1134 if (rc) { 1135 if (rc) {
1135 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to subchannel " 1136 CIO_MSG_EVENT(0, "Moving device 0.%x.%04x to subchannel "
@@ -1243,7 +1244,7 @@ static int io_subchannel_probe(struct subchannel *sch)
1243 * the ccw_device and exit. This happens for all early 1244 * the ccw_device and exit. This happens for all early
1244 * devices, e.g. the console. 1245 * devices, e.g. the console.
1245 */ 1246 */
1246 sch->dev.uevent_suppress = 0; 1247 dev_set_uevent_suppress(&sch->dev, 0);
1247 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); 1248 kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
1248 cdev->dev.groups = ccwdev_attr_groups; 1249 cdev->dev.groups = ccwdev_attr_groups;
1249 device_initialize(&cdev->dev); 1250 device_initialize(&cdev->dev);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 3d04920b9bb..0dcc036d34a 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1038,7 +1038,7 @@ static int qeth_l3_setadapter_parms(struct qeth_card *card)
1038 rc = qeth_query_setadapterparms(card); 1038 rc = qeth_query_setadapterparms(card);
1039 if (rc) { 1039 if (rc) {
1040 QETH_DBF_MESSAGE(2, "%s couldn't set adapter parameters: " 1040 QETH_DBF_MESSAGE(2, "%s couldn't set adapter parameters: "
1041 "0x%x\n", card->gdev->dev.bus_id, rc); 1041 "0x%x\n", dev_name(&card->gdev->dev), rc);
1042 return rc; 1042 return rc;
1043 } 1043 }
1044 if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { 1044 if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) {
diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c
index d4bda201774..61af3d91ac8 100644
--- a/drivers/scsi/a4000t.c
+++ b/drivers/scsi/a4000t.c
@@ -35,7 +35,7 @@ static struct platform_device *a4000t_scsi_device;
35 35
36#define A4000T_SCSI_ADDR 0xdd0040 36#define A4000T_SCSI_ADDR 0xdd0040
37 37
38static int __devinit a4000t_probe(struct device *dev) 38static int __devinit a4000t_probe(struct platform_device *dev)
39{ 39{
40 struct Scsi_Host *host; 40 struct Scsi_Host *host;
41 struct NCR_700_Host_Parameters *hostdata; 41 struct NCR_700_Host_Parameters *hostdata;
@@ -61,7 +61,8 @@ static int __devinit a4000t_probe(struct device *dev)
61 hostdata->dcntl_extra = EA_710; 61 hostdata->dcntl_extra = EA_710;
62 62
63 /* and register the chip */ 63 /* and register the chip */
64 host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata, dev); 64 host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata,
65 &dev->dev);
65 if (!host) { 66 if (!host) {
66 printk(KERN_ERR "a4000t-scsi: No host detected; " 67 printk(KERN_ERR "a4000t-scsi: No host detected; "
67 "board configuration problem?\n"); 68 "board configuration problem?\n");
@@ -78,7 +79,7 @@ static int __devinit a4000t_probe(struct device *dev)
78 goto out_put_host; 79 goto out_put_host;
79 } 80 }
80 81
81 dev_set_drvdata(dev, host); 82 platform_set_drvdata(dev, host);
82 scsi_scan_host(host); 83 scsi_scan_host(host);
83 84
84 return 0; 85 return 0;
@@ -93,9 +94,9 @@ static int __devinit a4000t_probe(struct device *dev)
93 return -ENODEV; 94 return -ENODEV;
94} 95}
95 96
96static __devexit int a4000t_device_remove(struct device *dev) 97static __devexit int a4000t_device_remove(struct platform_device *dev)
97{ 98{
98 struct Scsi_Host *host = dev_get_drvdata(dev); 99 struct Scsi_Host *host = platform_get_drvdata(dev);
99 struct NCR_700_Host_Parameters *hostdata = shost_priv(host); 100 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
100 101
101 scsi_remove_host(host); 102 scsi_remove_host(host);
@@ -108,25 +109,27 @@ static __devexit int a4000t_device_remove(struct device *dev)
108 return 0; 109 return 0;
109} 110}
110 111
111static struct device_driver a4000t_scsi_driver = { 112static struct platform_driver a4000t_scsi_driver = {
112 .name = "a4000t-scsi", 113 .driver = {
113 .bus = &platform_bus_type, 114 .name = "a4000t-scsi",
114 .probe = a4000t_probe, 115 .owner = THIS_MODULE,
115 .remove = __devexit_p(a4000t_device_remove), 116 },
117 .probe = a4000t_probe,
118 .remove = __devexit_p(a4000t_device_remove),
116}; 119};
117 120
118static int __init a4000t_scsi_init(void) 121static int __init a4000t_scsi_init(void)
119{ 122{
120 int err; 123 int err;
121 124
122 err = driver_register(&a4000t_scsi_driver); 125 err = platform_driver_register(&a4000t_scsi_driver);
123 if (err) 126 if (err)
124 return err; 127 return err;
125 128
126 a4000t_scsi_device = platform_device_register_simple("a4000t-scsi", 129 a4000t_scsi_device = platform_device_register_simple("a4000t-scsi",
127 -1, NULL, 0); 130 -1, NULL, 0);
128 if (IS_ERR(a4000t_scsi_device)) { 131 if (IS_ERR(a4000t_scsi_device)) {
129 driver_unregister(&a4000t_scsi_driver); 132 platform_driver_register(&a4000t_scsi_driver);
130 return PTR_ERR(a4000t_scsi_device); 133 return PTR_ERR(a4000t_scsi_device);
131 } 134 }
132 135
@@ -136,7 +139,7 @@ static int __init a4000t_scsi_init(void)
136static void __exit a4000t_scsi_exit(void) 139static void __exit a4000t_scsi_exit(void)
137{ 140{
138 platform_device_unregister(a4000t_scsi_device); 141 platform_device_unregister(a4000t_scsi_device);
139 driver_unregister(&a4000t_scsi_driver); 142 platform_driver_unregister(&a4000t_scsi_driver);
140} 143}
141 144
142module_init(a4000t_scsi_init); 145module_init(a4000t_scsi_init);
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
index d858f3d4127..5799cb5cba6 100644
--- a/drivers/scsi/bvme6000_scsi.c
+++ b/drivers/scsi/bvme6000_scsi.c
@@ -34,7 +34,7 @@ static struct scsi_host_template bvme6000_scsi_driver_template = {
34static struct platform_device *bvme6000_scsi_device; 34static struct platform_device *bvme6000_scsi_device;
35 35
36static __devinit int 36static __devinit int
37bvme6000_probe(struct device *dev) 37bvme6000_probe(struct platform_device *dev)
38{ 38{
39 struct Scsi_Host *host; 39 struct Scsi_Host *host;
40 struct NCR_700_Host_Parameters *hostdata; 40 struct NCR_700_Host_Parameters *hostdata;
@@ -58,7 +58,8 @@ bvme6000_probe(struct device *dev)
58 hostdata->ctest7_extra = CTEST7_TT1; 58 hostdata->ctest7_extra = CTEST7_TT1;
59 59
60 /* and register the chip */ 60 /* and register the chip */
61 host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata, dev); 61 host = NCR_700_detect(&bvme6000_scsi_driver_template, hostdata,
62 &dev->dev);
62 if (!host) { 63 if (!host) {
63 printk(KERN_ERR "bvme6000-scsi: No host detected; " 64 printk(KERN_ERR "bvme6000-scsi: No host detected; "
64 "board configuration problem?\n"); 65 "board configuration problem?\n");
@@ -73,7 +74,7 @@ bvme6000_probe(struct device *dev)
73 goto out_put_host; 74 goto out_put_host;
74 } 75 }
75 76
76 dev_set_drvdata(dev, host); 77 platform_set_drvdata(dev, host);
77 scsi_scan_host(host); 78 scsi_scan_host(host);
78 79
79 return 0; 80 return 0;
@@ -87,9 +88,9 @@ bvme6000_probe(struct device *dev)
87} 88}
88 89
89static __devexit int 90static __devexit int
90bvme6000_device_remove(struct device *dev) 91bvme6000_device_remove(struct platform_device *dev)
91{ 92{
92 struct Scsi_Host *host = dev_get_drvdata(dev); 93 struct Scsi_Host *host = platform_get_drvdata(dev);
93 struct NCR_700_Host_Parameters *hostdata = shost_priv(host); 94 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
94 95
95 scsi_remove_host(host); 96 scsi_remove_host(host);
@@ -100,25 +101,27 @@ bvme6000_device_remove(struct device *dev)
100 return 0; 101 return 0;
101} 102}
102 103
103static struct device_driver bvme6000_scsi_driver = { 104static struct platform_driver bvme6000_scsi_driver = {
104 .name = "bvme6000-scsi", 105 .driver = {
105 .bus = &platform_bus_type, 106 .name = "bvme6000-scsi",
106 .probe = bvme6000_probe, 107 .owner = THIS_MODULE,
107 .remove = __devexit_p(bvme6000_device_remove), 108 },
109 .probe = bvme6000_probe,
110 .remove = __devexit_p(bvme6000_device_remove),
108}; 111};
109 112
110static int __init bvme6000_scsi_init(void) 113static int __init bvme6000_scsi_init(void)
111{ 114{
112 int err; 115 int err;
113 116
114 err = driver_register(&bvme6000_scsi_driver); 117 err = platform_driver_register(&bvme6000_scsi_driver);
115 if (err) 118 if (err)
116 return err; 119 return err;
117 120
118 bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", 121 bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi",
119 -1, NULL, 0); 122 -1, NULL, 0);
120 if (IS_ERR(bvme6000_scsi_device)) { 123 if (IS_ERR(bvme6000_scsi_device)) {
121 driver_unregister(&bvme6000_scsi_driver); 124 platform_driver_unregister(&bvme6000_scsi_driver);
122 return PTR_ERR(bvme6000_scsi_device); 125 return PTR_ERR(bvme6000_scsi_device);
123 } 126 }
124 127
@@ -128,7 +131,7 @@ static int __init bvme6000_scsi_init(void)
128static void __exit bvme6000_scsi_exit(void) 131static void __exit bvme6000_scsi_exit(void)
129{ 132{
130 platform_device_unregister(bvme6000_scsi_device); 133 platform_device_unregister(bvme6000_scsi_device);
131 driver_unregister(&bvme6000_scsi_driver); 134 platform_driver_unregister(&bvme6000_scsi_driver);
132} 135}
133 136
134module_init(bvme6000_scsi_init); 137module_init(bvme6000_scsi_init);
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c
index b264b499d98..b5fbfd6ce87 100644
--- a/drivers/scsi/mvme16x_scsi.c
+++ b/drivers/scsi/mvme16x_scsi.c
@@ -34,7 +34,7 @@ static struct scsi_host_template mvme16x_scsi_driver_template = {
34static struct platform_device *mvme16x_scsi_device; 34static struct platform_device *mvme16x_scsi_device;
35 35
36static __devinit int 36static __devinit int
37mvme16x_probe(struct device *dev) 37mvme16x_probe(struct platform_device *dev)
38{ 38{
39 struct Scsi_Host * host = NULL; 39 struct Scsi_Host * host = NULL;
40 struct NCR_700_Host_Parameters *hostdata; 40 struct NCR_700_Host_Parameters *hostdata;
@@ -64,7 +64,8 @@ mvme16x_probe(struct device *dev)
64 hostdata->ctest7_extra = CTEST7_TT1; 64 hostdata->ctest7_extra = CTEST7_TT1;
65 65
66 /* and register the chip */ 66 /* and register the chip */
67 host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata, dev); 67 host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata,
68 &dev->dev);
68 if (!host) { 69 if (!host) {
69 printk(KERN_ERR "mvme16x-scsi: No host detected; " 70 printk(KERN_ERR "mvme16x-scsi: No host detected; "
70 "board configuration problem?\n"); 71 "board configuration problem?\n");
@@ -88,7 +89,7 @@ mvme16x_probe(struct device *dev)
88 out_be32(0xfff4202c, v); 89 out_be32(0xfff4202c, v);
89 } 90 }
90 91
91 dev_set_drvdata(dev, host); 92 platform_set_drvdata(dev, host);
92 scsi_scan_host(host); 93 scsi_scan_host(host);
93 94
94 return 0; 95 return 0;
@@ -102,9 +103,9 @@ mvme16x_probe(struct device *dev)
102} 103}
103 104
104static __devexit int 105static __devexit int
105mvme16x_device_remove(struct device *dev) 106mvme16x_device_remove(struct platform_device *dev)
106{ 107{
107 struct Scsi_Host *host = dev_get_drvdata(dev); 108 struct Scsi_Host *host = platform_get_drvdata(dev);
108 struct NCR_700_Host_Parameters *hostdata = shost_priv(host); 109 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
109 110
110 /* Disable scsi chip ints */ 111 /* Disable scsi chip ints */
@@ -123,25 +124,27 @@ mvme16x_device_remove(struct device *dev)
123 return 0; 124 return 0;
124} 125}
125 126
126static struct device_driver mvme16x_scsi_driver = { 127static struct platform_driver mvme16x_scsi_driver = {
127 .name = "mvme16x-scsi", 128 .driver = {
128 .bus = &platform_bus_type, 129 .name = "mvme16x-scsi",
129 .probe = mvme16x_probe, 130 .owner = THIS_MODULE,
130 .remove = __devexit_p(mvme16x_device_remove), 131 },
132 .probe = mvme16x_probe,
133 .remove = __devexit_p(mvme16x_device_remove),
131}; 134};
132 135
133static int __init mvme16x_scsi_init(void) 136static int __init mvme16x_scsi_init(void)
134{ 137{
135 int err; 138 int err;
136 139
137 err = driver_register(&mvme16x_scsi_driver); 140 err = platform_driver_register(&mvme16x_scsi_driver);
138 if (err) 141 if (err)
139 return err; 142 return err;
140 143
141 mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", 144 mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi",
142 -1, NULL, 0); 145 -1, NULL, 0);
143 if (IS_ERR(mvme16x_scsi_device)) { 146 if (IS_ERR(mvme16x_scsi_device)) {
144 driver_unregister(&mvme16x_scsi_driver); 147 platform_driver_unregister(&mvme16x_scsi_driver);
145 return PTR_ERR(mvme16x_scsi_device); 148 return PTR_ERR(mvme16x_scsi_device);
146 } 149 }
147 150
@@ -151,7 +154,7 @@ static int __init mvme16x_scsi_init(void)
151static void __exit mvme16x_scsi_exit(void) 154static void __exit mvme16x_scsi_exit(void)
152{ 155{
153 platform_device_unregister(mvme16x_scsi_device); 156 platform_device_unregister(mvme16x_scsi_device);
154 driver_unregister(&mvme16x_scsi_driver); 157 platform_driver_unregister(&mvme16x_scsi_driver);
155} 158}
156 159
157module_init(mvme16x_scsi_init); 160module_init(mvme16x_scsi_init);
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 45a299f3561..e09d3cebb4f 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1438,12 +1438,12 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m
1438 } else { 1438 } else {
1439 printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " 1439 printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) "
1440 "is a %s\n", 1440 "is a %s\n",
1441 op->dev.bus_id, 1441 dev_name(&op->dev),
1442 (unsigned long long) up[0].port.mapbase, 1442 (unsigned long long) up[0].port.mapbase,
1443 op->irqs[0], sunzilog_type(&up[0].port)); 1443 op->irqs[0], sunzilog_type(&up[0].port));
1444 printk(KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) " 1444 printk(KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) "
1445 "is a %s\n", 1445 "is a %s\n",
1446 op->dev.bus_id, 1446 dev_name(&op->dev),
1447 (unsigned long long) up[1].port.mapbase, 1447 (unsigned long long) up[1].port.mapbase,
1448 op->irqs[0], sunzilog_type(&up[1].port)); 1448 op->irqs[0], sunzilog_type(&up[1].port));
1449 kbm_inst++; 1449 kbm_inst++;
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index c71bb4b4ce8..cab1ab7cfb7 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -379,7 +379,6 @@ static void maple_attach_driver(struct maple_device *mdev)
379 dev_info(&mdev->dev, "no driver found\n"); 379 dev_info(&mdev->dev, "no driver found\n");
380 mdev->driver = &maple_unsupported_device; 380 mdev->driver = &maple_unsupported_device;
381 } 381 }
382
383 dev_set_name(&mdev->dev, "%d:0%d.%lX", mdev->port, 382 dev_set_name(&mdev->dev, "%d:0%d.%lX", mdev->port,
384 mdev->unit, function); 383 mdev->unit, function);
385 } 384 }
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 56ff3e6864e..12e443cc4ac 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -322,7 +322,7 @@ static void atmel_spi_next_message(struct spi_master *master)
322 spi = msg->spi; 322 spi = msg->spi;
323 323
324 dev_dbg(master->dev.parent, "start message %p for %s\n", 324 dev_dbg(master->dev.parent, "start message %p for %s\n",
325 msg, spi->dev.bus_id); 325 msg, dev_name(&spi->dev));
326 326
327 /* select chip if it's not still active */ 327 /* select chip if it's not still active */
328 if (as->stay) { 328 if (as->stay) {
@@ -627,7 +627,7 @@ static int atmel_spi_setup(struct spi_device *spi)
627 if (!asd) 627 if (!asd)
628 return -ENOMEM; 628 return -ENOMEM;
629 629
630 ret = gpio_request(npcs_pin, spi->dev.bus_id); 630 ret = gpio_request(npcs_pin, dev_name(&spi->dev));
631 if (ret) { 631 if (ret) {
632 kfree(asd); 632 kfree(asd);
633 return ret; 633 return ret;
@@ -668,7 +668,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
668 as = spi_master_get_devdata(spi->master); 668 as = spi_master_get_devdata(spi->master);
669 669
670 dev_dbg(controller, "new message %p submitted for %s\n", 670 dev_dbg(controller, "new message %p submitted for %s\n",
671 msg, spi->dev.bus_id); 671 msg, dev_name(&spi->dev));
672 672
673 if (unlikely(list_empty(&msg->transfers))) 673 if (unlikely(list_empty(&msg->transfers)))
674 return -EINVAL; 674 return -EINVAL;
@@ -803,7 +803,7 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
803 as->clk = clk; 803 as->clk = clk;
804 804
805 ret = request_irq(irq, atmel_spi_interrupt, 0, 805 ret = request_irq(irq, atmel_spi_interrupt, 0,
806 pdev->dev.bus_id, master); 806 dev_name(&pdev->dev), master);
807 if (ret) 807 if (ret)
808 goto out_unmap_regs; 808 goto out_unmap_regs;
809 809
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 3b97803e1d1..68c77a91159 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -429,7 +429,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
429 INIT_LIST_HEAD(&mps->queue); 429 INIT_LIST_HEAD(&mps->queue);
430 430
431 mps->workqueue = create_singlethread_workqueue( 431 mps->workqueue = create_singlethread_workqueue(
432 master->dev.parent->bus_id); 432 dev_name(master->dev.parent));
433 if (mps->workqueue == NULL) { 433 if (mps->workqueue == NULL) {
434 ret = -EBUSY; 434 ret = -EBUSY;
435 goto free_irq; 435 goto free_irq;
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 454a2712e62..1c65e380c84 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1003,7 +1003,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
1003 goto err1; 1003 goto err1;
1004 } 1004 }
1005 if (!request_mem_region(r->start, (r->end - r->start) + 1, 1005 if (!request_mem_region(r->start, (r->end - r->start) + 1,
1006 pdev->dev.bus_id)) { 1006 dev_name(&pdev->dev))) {
1007 status = -EBUSY; 1007 status = -EBUSY;
1008 goto err1; 1008 goto err1;
1009 } 1009 }
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index bab6ff061e9..60b5381c65c 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -245,7 +245,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
245 245
246#ifdef VERBOSE 246#ifdef VERBOSE
247 pr_debug("%s: write-%d =%04x\n", 247 pr_debug("%s: write-%d =%04x\n",
248 spi->dev.bus_id, bits, val); 248 dev_name(&spi->dev), bits, val);
249#endif 249#endif
250 if (wait_uwire_csr_flag(CSRB, 0, 0)) 250 if (wait_uwire_csr_flag(CSRB, 0, 0))
251 goto eio; 251 goto eio;
@@ -305,7 +305,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
305 status += bytes; 305 status += bytes;
306#ifdef VERBOSE 306#ifdef VERBOSE
307 pr_debug("%s: read-%d =%04x\n", 307 pr_debug("%s: read-%d =%04x\n",
308 spi->dev.bus_id, bits, val); 308 dev_name(&spi->dev), bits, val);
309#endif 309#endif
310 310
311 } 311 }
@@ -331,7 +331,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
331 uwire = spi_master_get_devdata(spi->master); 331 uwire = spi_master_get_devdata(spi->master);
332 332
333 if (spi->chip_select > 3) { 333 if (spi->chip_select > 3) {
334 pr_debug("%s: cs%d?\n", spi->dev.bus_id, spi->chip_select); 334 pr_debug("%s: cs%d?\n", dev_name(&spi->dev), spi->chip_select);
335 status = -ENODEV; 335 status = -ENODEV;
336 goto done; 336 goto done;
337 } 337 }
@@ -343,7 +343,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
343 bits = 8; 343 bits = 8;
344 344
345 if (bits > 16) { 345 if (bits > 16) {
346 pr_debug("%s: wordsize %d?\n", spi->dev.bus_id, bits); 346 pr_debug("%s: wordsize %d?\n", dev_name(&spi->dev), bits);
347 status = -ENODEV; 347 status = -ENODEV;
348 goto done; 348 goto done;
349 } 349 }
@@ -378,7 +378,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
378 hz = t->speed_hz; 378 hz = t->speed_hz;
379 379
380 if (!hz) { 380 if (!hz) {
381 pr_debug("%s: zero speed?\n", spi->dev.bus_id); 381 pr_debug("%s: zero speed?\n", dev_name(&spi->dev));
382 status = -EINVAL; 382 status = -EINVAL;
383 goto done; 383 goto done;
384 } 384 }
@@ -406,7 +406,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
406 } 406 }
407 if (div1_idx == 4) { 407 if (div1_idx == 4) {
408 pr_debug("%s: lowest clock %ld, need %d\n", 408 pr_debug("%s: lowest clock %ld, need %d\n",
409 spi->dev.bus_id, rate / 10 / 8, hz); 409 dev_name(&spi->dev), rate / 10 / 8, hz);
410 status = -EDOM; 410 status = -EDOM;
411 goto done; 411 goto done;
412 } 412 }
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/orion_spi.c
index 014becb7d53..c8b0babdc2a 100644
--- a/drivers/spi/orion_spi.c
+++ b/drivers/spi/orion_spi.c
@@ -496,7 +496,7 @@ static int __init orion_spi_probe(struct platform_device *pdev)
496 } 496 }
497 497
498 if (!request_mem_region(r->start, (r->end - r->start) + 1, 498 if (!request_mem_region(r->start, (r->end - r->start) + 1,
499 pdev->dev.bus_id)) { 499 dev_name(&pdev->dev))) {
500 status = -EBUSY; 500 status = -EBUSY;
501 goto out; 501 goto out;
502 } 502 }
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index d0fc4ca2f65..ec24f2d16f3 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1333,7 +1333,7 @@ static int __init init_queue(struct driver_data *drv_data)
1333 1333
1334 INIT_WORK(&drv_data->pump_messages, pump_messages); 1334 INIT_WORK(&drv_data->pump_messages, pump_messages);
1335 drv_data->workqueue = create_singlethread_workqueue( 1335 drv_data->workqueue = create_singlethread_workqueue(
1336 drv_data->master->dev.parent->bus_id); 1336 dev_name(drv_data->master->dev.parent));
1337 if (drv_data->workqueue == NULL) 1337 if (drv_data->workqueue == NULL)
1338 return -EBUSY; 1338 return -EBUSY;
1339 1339
@@ -1462,7 +1462,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev)
1462 drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR; 1462 drv_data->mask_sr = SSSR_TINT | SSSR_RFS | SSSR_TFS | SSSR_ROR;
1463 } 1463 }
1464 1464
1465 status = request_irq(ssp->irq, ssp_int, 0, dev->bus_id, drv_data); 1465 status = request_irq(ssp->irq, ssp_int, 0, dev_name(dev), drv_data);
1466 if (status < 0) { 1466 if (status < 0) {
1467 dev_err(&pdev->dev, "cannot get IRQ %d\n", ssp->irq); 1467 dev_err(&pdev->dev, "cannot get IRQ %d\n", ssp->irq);
1468 goto out_error_master_alloc; 1468 goto out_error_master_alloc;
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 7fea3cf4588..3410b0c55ed 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -1160,8 +1160,8 @@ static inline int init_queue(struct driver_data *drv_data)
1160 1160
1161 /* init messages workqueue */ 1161 /* init messages workqueue */
1162 INIT_WORK(&drv_data->pump_messages, pump_messages); 1162 INIT_WORK(&drv_data->pump_messages, pump_messages);
1163 drv_data->workqueue = 1163 drv_data->workqueue = create_singlethread_workqueue(
1164 create_singlethread_workqueue(drv_data->master->dev.parent->bus_id); 1164 dev_name(drv_data->master->dev.parent));
1165 if (drv_data->workqueue == NULL) 1165 if (drv_data->workqueue == NULL)
1166 return -EBUSY; 1166 return -EBUSY;
1167 1167
diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c
index f5ed9721aab..d2866c293de 100644
--- a/drivers/spi/spi_gpio.c
+++ b/drivers/spi/spi_gpio.c
@@ -191,7 +191,7 @@ static int spi_gpio_setup(struct spi_device *spi)
191 return -EINVAL; 191 return -EINVAL;
192 192
193 if (!spi->controller_state) { 193 if (!spi->controller_state) {
194 status = gpio_request(cs, spi->dev.bus_id); 194 status = gpio_request(cs, dev_name(&spi->dev));
195 if (status) 195 if (status)
196 return status; 196 return status;
197 status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); 197 status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH);
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 269a55ec52e..0480d8bb19d 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1381,7 +1381,7 @@ static int __init init_queue(struct driver_data *drv_data)
1381 1381
1382 INIT_WORK(&drv_data->work, pump_messages); 1382 INIT_WORK(&drv_data->work, pump_messages);
1383 drv_data->workqueue = create_singlethread_workqueue( 1383 drv_data->workqueue = create_singlethread_workqueue(
1384 drv_data->master->dev.parent->bus_id); 1384 dev_name(drv_data->master->dev.parent));
1385 if (drv_data->workqueue == NULL) 1385 if (drv_data->workqueue == NULL)
1386 return -EBUSY; 1386 return -EBUSY;
1387 1387
@@ -1525,7 +1525,8 @@ static int __init spi_imx_probe(struct platform_device *pdev)
1525 status = -ENODEV; 1525 status = -ENODEV;
1526 goto err_no_irqres; 1526 goto err_no_irqres;
1527 } 1527 }
1528 status = request_irq(irq, spi_int, IRQF_DISABLED, dev->bus_id, drv_data); 1528 status = request_irq(irq, spi_int, IRQF_DISABLED,
1529 dev_name(dev), drv_data);
1529 if (status < 0) { 1530 if (status < 0) {
1530 dev_err(&pdev->dev, "probe - cannot get IRQ (%d)\n", status); 1531 dev_err(&pdev->dev, "probe - cannot get IRQ (%d)\n", status);
1531 goto err_no_irqres; 1532 goto err_no_irqres;
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index ac0e3e4b3c5..44a2b46ccb7 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -637,7 +637,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
637 INIT_LIST_HEAD(&mpc83xx_spi->queue); 637 INIT_LIST_HEAD(&mpc83xx_spi->queue);
638 638
639 mpc83xx_spi->workqueue = create_singlethread_workqueue( 639 mpc83xx_spi->workqueue = create_singlethread_workqueue(
640 master->dev.parent->bus_id); 640 dev_name(master->dev.parent));
641 if (mpc83xx_spi->workqueue == NULL) { 641 if (mpc83xx_spi->workqueue == NULL) {
642 ret = -EBUSY; 642 ret = -EBUSY;
643 goto free_irq; 643 goto free_irq;
@@ -649,7 +649,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
649 649
650 printk(KERN_INFO 650 printk(KERN_INFO
651 "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n", 651 "%s: MPC83xx SPI Controller driver at 0x%p (irq = %d)\n",
652 dev->dev.bus_id, mpc83xx_spi->base, mpc83xx_spi->irq); 652 dev_name(&dev->dev), mpc83xx_spi->base, mpc83xx_spi->irq);
653 653
654 return ret; 654 return ret;
655 655
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c
index 2296f37ea3c..29cbb065618 100644
--- a/drivers/spi/spi_txx9.c
+++ b/drivers/spi/spi_txx9.c
@@ -404,7 +404,8 @@ static int __init txx9spi_probe(struct platform_device *dev)
404 if (ret) 404 if (ret)
405 goto exit; 405 goto exit;
406 406
407 c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); 407 c->workqueue = create_singlethread_workqueue(
408 dev_name(master->dev.parent));
408 if (!c->workqueue) 409 if (!c->workqueue)
409 goto exit_busy; 410 goto exit_busy;
410 c->last_chipselect = -1; 411 c->last_chipselect = -1;
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c
index f77f62a4b32..e5bd4470a57 100644
--- a/drivers/tc/tc.c
+++ b/drivers/tc/tc.c
@@ -86,7 +86,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
86 slot); 86 slot);
87 goto out_err; 87 goto out_err;
88 } 88 }
89 sprintf(tdev->dev.bus_id, "tc%x", slot); 89 dev_set_name(&tdev->dev, "tc%x", slot);
90 tdev->bus = tbus; 90 tdev->bus = tbus;
91 tdev->dev.parent = &tbus->dev; 91 tdev->dev.parent = &tbus->dev;
92 tdev->dev.bus = &tc_bus_type; 92 tdev->dev.bus = &tc_bus_type;
@@ -104,7 +104,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
104 tdev->vendor[8] = 0; 104 tdev->vendor[8] = 0;
105 tdev->name[8] = 0; 105 tdev->name[8] = 0;
106 106
107 pr_info("%s: %s %s %s\n", tdev->dev.bus_id, tdev->vendor, 107 pr_info("%s: %s %s %s\n", dev_name(&tdev->dev), tdev->vendor,
108 tdev->name, tdev->firmware); 108 tdev->name, tdev->firmware);
109 109
110 devsize = readb(module + offset + TC_SLOT_SIZE); 110 devsize = readb(module + offset + TC_SLOT_SIZE);
@@ -118,7 +118,7 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus)
118 } else { 118 } else {
119 printk(KERN_ERR "%s: Cannot provide slot space " 119 printk(KERN_ERR "%s: Cannot provide slot space "
120 "(%dMiB required, up to %dMiB supported)\n", 120 "(%dMiB required, up to %dMiB supported)\n",
121 tdev->dev.bus_id, devsize >> 20, 121 dev_name(&tdev->dev), devsize >> 20,
122 max(slotsize, extslotsize) >> 20); 122 max(slotsize, extslotsize) >> 20);
123 kfree(tdev); 123 kfree(tdev);
124 goto out_err; 124 goto out_err;
@@ -146,7 +146,7 @@ static int __init tc_init(void)
146 return 0; 146 return 0;
147 147
148 INIT_LIST_HEAD(&tc_bus.devices); 148 INIT_LIST_HEAD(&tc_bus.devices);
149 strcpy(tc_bus.dev.bus_id, "tc"); 149 dev_set_name(&tc_bus.dev, "tc");
150 device_register(&tc_bus.dev); 150 device_register(&tc_bus.dev);
151 151
152 if (tc_bus.info.slot_size) { 152 if (tc_bus.info.slot_size) {
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 04b954cfce7..7f86534de26 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -58,6 +58,24 @@ config UIO_SMX
58 58
59 If you compile this as a module, it will be called uio_smx. 59 If you compile this as a module, it will be called uio_smx.
60 60
61config UIO_AEC
62 tristate "AEC video timestamp device"
63 depends on PCI
64 default n
65 help
66
67 UIO driver for the Adrienne Electronics Corporation PCI time
68 code device.
69
70 This device differs from other UIO devices since it uses I/O
71 ports instead of memory mapped I/O. In order to make it
72 possible for UIO to work with this device a utility, uioport,
73 can be used to read and write the ports:
74
75 git clone git://ifup.org/philips/uioport.git
76
77 If you compile this as a module, it will be called uio_aec.
78
61config UIO_SERCOS3 79config UIO_SERCOS3
62 tristate "Automata Sercos III PCI card driver" 80 tristate "Automata Sercos III PCI card driver"
63 default n 81 default n
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index e6955814985..5c2586d7579 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -3,4 +3,5 @@ obj-$(CONFIG_UIO_CIF) += uio_cif.o
3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o
4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o 4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
5obj-$(CONFIG_UIO_SMX) += uio_smx.o 5obj-$(CONFIG_UIO_SMX) += uio_smx.o
6obj-$(CONFIG_UIO_AEC) += uio_aec.o
6obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o 7obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 4ca85a113aa..03efb065455 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -61,6 +61,14 @@ struct uio_map {
61}; 61};
62#define to_map(map) container_of(map, struct uio_map, kobj) 62#define to_map(map) container_of(map, struct uio_map, kobj)
63 63
64static ssize_t map_name_show(struct uio_mem *mem, char *buf)
65{
66 if (unlikely(!mem->name))
67 mem->name = "";
68
69 return sprintf(buf, "%s\n", mem->name);
70}
71
64static ssize_t map_addr_show(struct uio_mem *mem, char *buf) 72static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
65{ 73{
66 return sprintf(buf, "0x%lx\n", mem->addr); 74 return sprintf(buf, "0x%lx\n", mem->addr);
@@ -82,6 +90,8 @@ struct map_sysfs_entry {
82 ssize_t (*store)(struct uio_mem *, const char *, size_t); 90 ssize_t (*store)(struct uio_mem *, const char *, size_t);
83}; 91};
84 92
93static struct map_sysfs_entry name_attribute =
94 __ATTR(name, S_IRUGO, map_name_show, NULL);
85static struct map_sysfs_entry addr_attribute = 95static struct map_sysfs_entry addr_attribute =
86 __ATTR(addr, S_IRUGO, map_addr_show, NULL); 96 __ATTR(addr, S_IRUGO, map_addr_show, NULL);
87static struct map_sysfs_entry size_attribute = 97static struct map_sysfs_entry size_attribute =
@@ -90,6 +100,7 @@ static struct map_sysfs_entry offset_attribute =
90 __ATTR(offset, S_IRUGO, map_offset_show, NULL); 100 __ATTR(offset, S_IRUGO, map_offset_show, NULL);
91 101
92static struct attribute *attrs[] = { 102static struct attribute *attrs[] = {
103 &name_attribute.attr,
93 &addr_attribute.attr, 104 &addr_attribute.attr,
94 &size_attribute.attr, 105 &size_attribute.attr,
95 &offset_attribute.attr, 106 &offset_attribute.attr,
@@ -133,6 +144,14 @@ struct uio_portio {
133}; 144};
134#define to_portio(portio) container_of(portio, struct uio_portio, kobj) 145#define to_portio(portio) container_of(portio, struct uio_portio, kobj)
135 146
147static ssize_t portio_name_show(struct uio_port *port, char *buf)
148{
149 if (unlikely(!port->name))
150 port->name = "";
151
152 return sprintf(buf, "%s\n", port->name);
153}
154
136static ssize_t portio_start_show(struct uio_port *port, char *buf) 155static ssize_t portio_start_show(struct uio_port *port, char *buf)
137{ 156{
138 return sprintf(buf, "0x%lx\n", port->start); 157 return sprintf(buf, "0x%lx\n", port->start);
@@ -159,6 +178,8 @@ struct portio_sysfs_entry {
159 ssize_t (*store)(struct uio_port *, const char *, size_t); 178 ssize_t (*store)(struct uio_port *, const char *, size_t);
160}; 179};
161 180
181static struct portio_sysfs_entry portio_name_attribute =
182 __ATTR(name, S_IRUGO, portio_name_show, NULL);
162static struct portio_sysfs_entry portio_start_attribute = 183static struct portio_sysfs_entry portio_start_attribute =
163 __ATTR(start, S_IRUGO, portio_start_show, NULL); 184 __ATTR(start, S_IRUGO, portio_start_show, NULL);
164static struct portio_sysfs_entry portio_size_attribute = 185static struct portio_sysfs_entry portio_size_attribute =
@@ -167,6 +188,7 @@ static struct portio_sysfs_entry portio_porttype_attribute =
167 __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL); 188 __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL);
168 189
169static struct attribute *portio_attrs[] = { 190static struct attribute *portio_attrs[] = {
191 &portio_name_attribute.attr,
170 &portio_start_attribute.attr, 192 &portio_start_attribute.attr,
171 &portio_size_attribute.attr, 193 &portio_size_attribute.attr,
172 &portio_porttype_attribute.attr, 194 &portio_porttype_attribute.attr,
@@ -686,7 +708,8 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
686 return -EINVAL; 708 return -EINVAL;
687 709
688 requested_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 710 requested_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
689 actual_pages = (idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; 711 actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK)
712 + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT;
690 if (requested_pages > actual_pages) 713 if (requested_pages > actual_pages)
691 return -EINVAL; 714 return -EINVAL;
692 715
diff --git a/drivers/uio/uio_aec.c b/drivers/uio/uio_aec.c
new file mode 100644
index 00000000000..b7830e9a3ba
--- /dev/null
+++ b/drivers/uio/uio_aec.c
@@ -0,0 +1,175 @@
1/*
2 * uio_aec.c -- simple driver for Adrienne Electronics Corp time code PCI device
3 *
4 * Copyright (C) 2008 Brandon Philips <brandon@ifup.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc., 59
17 * Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/pci.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/cdev.h>
26#include <linux/fs.h>
27#include <linux/io.h>
28#include <linux/uaccess.h>
29#include <linux/uio_driver.h>
30
31#define PCI_VENDOR_ID_AEC 0xaecb
32#define PCI_DEVICE_ID_AEC_VITCLTC 0x6250
33
34#define INT_ENABLE_ADDR 0xFC
35#define INT_ENABLE 0x10
36#define INT_DISABLE 0x0
37
38#define INT_MASK_ADDR 0x2E
39#define INT_MASK_ALL 0x3F
40
41#define INTA_DRVR_ADDR 0xFE
42#define INTA_ENABLED_FLAG 0x08
43#define INTA_FLAG 0x01
44
45#define MAILBOX 0x0F
46
47static struct pci_device_id ids[] = {
48 { PCI_DEVICE(PCI_VENDOR_ID_AEC, PCI_DEVICE_ID_AEC_VITCLTC), },
49 { 0, }
50};
51MODULE_DEVICE_TABLE(pci, ids);
52
53static irqreturn_t aectc_irq(int irq, struct uio_info *dev_info)
54{
55 void __iomem *int_flag = dev_info->priv + INTA_DRVR_ADDR;
56 unsigned char status = ioread8(int_flag);
57
58
59 if ((status & INTA_ENABLED_FLAG) && (status & INTA_FLAG)) {
60 /* application writes 0x00 to 0x2F to get next interrupt */
61 status = ioread8(dev_info->priv + MAILBOX);
62 return IRQ_HANDLED;
63 }
64
65 return IRQ_NONE;
66}
67
68static void print_board_data(struct pci_dev *pdev, struct uio_info *i)
69{
70 dev_info(&pdev->dev, "PCI-TC board vendor: %x%x number: %x%x"
71 " revision: %c%c\n",
72 ioread8(i->priv + 0x01),
73 ioread8(i->priv + 0x00),
74 ioread8(i->priv + 0x03),
75 ioread8(i->priv + 0x02),
76 ioread8(i->priv + 0x06),
77 ioread8(i->priv + 0x07));
78}
79
80static int __devinit probe(struct pci_dev *pdev, const struct pci_device_id *id)
81{
82 struct uio_info *info;
83 int ret;
84
85 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
86 if (!info)
87 return -ENOMEM;
88
89 if (pci_enable_device(pdev))
90 goto out_free;
91
92 if (pci_request_regions(pdev, "aectc"))
93 goto out_disable;
94
95 info->name = "aectc";
96 info->port[0].start = pci_resource_start(pdev, 0);
97 if (!info->port[0].start)
98 goto out_release;
99 info->priv = pci_iomap(pdev, 0, 0);
100 if (!info->priv)
101 goto out_release;
102 info->port[0].size = pci_resource_len(pdev, 0);
103 info->port[0].porttype = UIO_PORT_GPIO;
104
105 info->version = "0.0.1";
106 info->irq = pdev->irq;
107 info->irq_flags = IRQF_SHARED;
108 info->handler = aectc_irq;
109
110 print_board_data(pdev, info);
111 ret = uio_register_device(&pdev->dev, info);
112 if (ret)
113 goto out_unmap;
114
115 iowrite32(INT_ENABLE, info->priv + INT_ENABLE_ADDR);
116 iowrite8(INT_MASK_ALL, info->priv + INT_MASK_ADDR);
117 if (!(ioread8(info->priv + INTA_DRVR_ADDR)
118 & INTA_ENABLED_FLAG))
119 dev_err(&pdev->dev, "aectc: interrupts not enabled\n");
120
121 pci_set_drvdata(pdev, info);
122
123 return 0;
124
125out_unmap:
126 pci_iounmap(pdev, info->priv);
127out_release:
128 pci_release_regions(pdev);
129out_disable:
130 pci_disable_device(pdev);
131out_free:
132 kfree(info);
133 return -ENODEV;
134}
135
136static void remove(struct pci_dev *pdev)
137{
138 struct uio_info *info = pci_get_drvdata(pdev);
139
140 /* disable interrupts */
141 iowrite8(INT_DISABLE, info->priv + INT_MASK_ADDR);
142 iowrite32(INT_DISABLE, info->priv + INT_ENABLE_ADDR);
143 /* read mailbox to ensure board drops irq */
144 ioread8(info->priv + MAILBOX);
145
146 uio_unregister_device(info);
147 pci_release_regions(pdev);
148 pci_disable_device(pdev);
149 pci_set_drvdata(pdev, NULL);
150 iounmap(info->priv);
151
152 kfree(info);
153}
154
155static struct pci_driver pci_driver = {
156 .name = "aectc",
157 .id_table = ids,
158 .probe = probe,
159 .remove = remove,
160};
161
162static int __init aectc_init(void)
163{
164 return pci_register_driver(&pci_driver);
165}
166
167static void __exit aectc_exit(void)
168{
169 pci_unregister_driver(&pci_driver);
170}
171
172MODULE_LICENSE("GPL");
173
174module_init(aectc_init);
175module_exit(aectc_exit);
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index bebf911c7e5..7f4e5eb1dc8 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -2626,7 +2626,7 @@ static int udc_probe(struct device *dev, void __iomem *regs, const char *name)
2626 INIT_LIST_HEAD(&udc->gadget.ep_list); 2626 INIT_LIST_HEAD(&udc->gadget.ep_list);
2627 udc->gadget.ep0 = NULL; 2627 udc->gadget.ep0 = NULL;
2628 2628
2629 strcpy(udc->gadget.dev.bus_id, "gadget"); 2629 dev_set_name(&udc->gadget.dev, "gadget");
2630 udc->gadget.dev.dma_mask = dev->dma_mask; 2630 udc->gadget.dev.dma_mask = dev->dma_mask;
2631 udc->gadget.dev.parent = dev; 2631 udc->gadget.dev.parent = dev;
2632 udc->gadget.dev.release = udc_release; 2632 udc->gadget.dev.release = udc_release;
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index 77c5d0a8a06..cd67ac75e62 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1186,8 +1186,8 @@ static struct imx_udc_struct controller = {
1186 .ep0 = &controller.imx_ep[0].ep, 1186 .ep0 = &controller.imx_ep[0].ep,
1187 .name = driver_name, 1187 .name = driver_name,
1188 .dev = { 1188 .dev = {
1189 .bus_id = "gadget", 1189 .init_name = "gadget",
1190 }, 1190 },
1191 }, 1191 },
1192 1192
1193 .imx_ep[0] = { 1193 .imx_ep[0] = {
diff --git a/drivers/usb/host/fhci-dbg.c b/drivers/usb/host/fhci-dbg.c
index 34e14edf390..ea8a4255c5d 100644
--- a/drivers/usb/host/fhci-dbg.c
+++ b/drivers/usb/host/fhci-dbg.c
@@ -108,7 +108,7 @@ void fhci_dfs_create(struct fhci_hcd *fhci)
108{ 108{
109 struct device *dev = fhci_to_hcd(fhci)->self.controller; 109 struct device *dev = fhci_to_hcd(fhci)->self.controller;
110 110
111 fhci->dfs_root = debugfs_create_dir(dev->bus_id, NULL); 111 fhci->dfs_root = debugfs_create_dir(dev_name(dev), NULL);
112 if (!fhci->dfs_root) { 112 if (!fhci->dfs_root) {
113 WARN_ON(1); 113 WARN_ON(1);
114 return; 114 return;
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index ba622cc8a9b..0951818ef93 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -583,7 +583,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
583 if (sprop && strcmp(sprop, "host")) 583 if (sprop && strcmp(sprop, "host"))
584 return -ENODEV; 584 return -ENODEV;
585 585
586 hcd = usb_create_hcd(&fhci_driver, dev, dev->bus_id); 586 hcd = usb_create_hcd(&fhci_driver, dev, dev_name(dev));
587 if (!hcd) { 587 if (!hcd) {
588 dev_err(dev, "could not create hcd\n"); 588 dev_err(dev, "could not create hcd\n");
589 return -ENOMEM; 589 return -ENOMEM;
@@ -650,7 +650,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
650 } 650 }
651 } 651 }
652 652
653 ret = gpio_request(gpio, dev->bus_id); 653 ret = gpio_request(gpio, dev_name(dev));
654 if (ret) { 654 if (ret) {
655 dev_err(dev, "failed to request gpio %d", i); 655 dev_err(dev, "failed to request gpio %d", i);
656 goto err_gpios; 656 goto err_gpios;
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 62bd4441b5e..378f27745a1 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -457,7 +457,7 @@ static struct fb_ops au1100fb_ops =
457 457
458/* AU1100 LCD controller device driver */ 458/* AU1100 LCD controller device driver */
459 459
460static int __init au1100fb_drv_probe(struct device *dev) 460static int __init au1100fb_drv_probe(struct platform_device *dev)
461{ 461{
462 struct au1100fb_device *fbdev = NULL; 462 struct au1100fb_device *fbdev = NULL;
463 struct resource *regs_res; 463 struct resource *regs_res;
@@ -475,7 +475,7 @@ static int __init au1100fb_drv_probe(struct device *dev)
475 475
476 fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; 476 fbdev->panel = &known_lcd_panels[drv_info.panel_idx];
477 477
478 dev_set_drvdata(dev, (void*)fbdev); 478 platform_set_drvdata(dev, (void *)fbdev);
479 479
480 /* Allocate region for our registers and map them */ 480 /* Allocate region for our registers and map them */
481 if (!(regs_res = platform_get_resource(to_platform_device(dev), 481 if (!(regs_res = platform_get_resource(to_platform_device(dev),
@@ -583,19 +583,19 @@ failed:
583 fb_dealloc_cmap(&fbdev->info.cmap); 583 fb_dealloc_cmap(&fbdev->info.cmap);
584 } 584 }
585 kfree(fbdev); 585 kfree(fbdev);
586 dev_set_drvdata(dev, NULL); 586 platform_set_drvdata(dev, NULL);
587 587
588 return 0; 588 return 0;
589} 589}
590 590
591int au1100fb_drv_remove(struct device *dev) 591int au1100fb_drv_remove(struct platform_device *dev)
592{ 592{
593 struct au1100fb_device *fbdev = NULL; 593 struct au1100fb_device *fbdev = NULL;
594 594
595 if (!dev) 595 if (!dev)
596 return -ENODEV; 596 return -ENODEV;
597 597
598 fbdev = (struct au1100fb_device*) dev_get_drvdata(dev); 598 fbdev = (struct au1100fb_device *) platform_get_drvdata(dev);
599 599
600#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) 600#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
601 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); 601 au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info);
@@ -620,9 +620,9 @@ int au1100fb_drv_remove(struct device *dev)
620static u32 sys_clksrc; 620static u32 sys_clksrc;
621static struct au1100fb_regs fbregs; 621static struct au1100fb_regs fbregs;
622 622
623int au1100fb_drv_suspend(struct device *dev, pm_message_t state) 623int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
624{ 624{
625 struct au1100fb_device *fbdev = dev_get_drvdata(dev); 625 struct au1100fb_device *fbdev = platform_get_drvdata(dev);
626 626
627 if (!fbdev) 627 if (!fbdev)
628 return 0; 628 return 0;
@@ -641,9 +641,9 @@ int au1100fb_drv_suspend(struct device *dev, pm_message_t state)
641 return 0; 641 return 0;
642} 642}
643 643
644int au1100fb_drv_resume(struct device *dev) 644int au1100fb_drv_resume(struct platform_device *dev)
645{ 645{
646 struct au1100fb_device *fbdev = dev_get_drvdata(dev); 646 struct au1100fb_device *fbdev = platform_get_drvdata(dev);
647 647
648 if (!fbdev) 648 if (!fbdev)
649 return 0; 649 return 0;
@@ -663,10 +663,11 @@ int au1100fb_drv_resume(struct device *dev)
663#define au1100fb_drv_resume NULL 663#define au1100fb_drv_resume NULL
664#endif 664#endif
665 665
666static struct device_driver au1100fb_driver = { 666static struct platform_driver au1100fb_driver = {
667 .name = "au1100-lcd", 667 .driver = {
668 .bus = &platform_bus_type, 668 .name = "au1100-lcd",
669 669 .owner = THIS_MODULE,
670 },
670 .probe = au1100fb_drv_probe, 671 .probe = au1100fb_drv_probe,
671 .remove = au1100fb_drv_remove, 672 .remove = au1100fb_drv_remove,
672 .suspend = au1100fb_drv_suspend, 673 .suspend = au1100fb_drv_suspend,
@@ -753,12 +754,12 @@ int __init au1100fb_init(void)
753 return ret; 754 return ret;
754 } 755 }
755 756
756 return driver_register(&au1100fb_driver); 757 return platform_driver_register(&au1100fb_driver);
757} 758}
758 759
759void __exit au1100fb_cleanup(void) 760void __exit au1100fb_cleanup(void)
760{ 761{
761 driver_unregister(&au1100fb_driver); 762 platform_driver_unregister(&au1100fb_driver);
762 763
763 kfree(drv_info.opt_mode); 764 kfree(drv_info.opt_mode);
764} 765}
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 03e57ef8837..0d96f1d2d4c 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1622,7 +1622,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
1622 1622
1623/* AU1200 LCD controller device driver */ 1623/* AU1200 LCD controller device driver */
1624 1624
1625static int au1200fb_drv_probe(struct device *dev) 1625static int au1200fb_drv_probe(struct platform_device *dev)
1626{ 1626{
1627 struct au1200fb_device *fbdev; 1627 struct au1200fb_device *fbdev;
1628 unsigned long page; 1628 unsigned long page;
@@ -1645,7 +1645,7 @@ static int au1200fb_drv_probe(struct device *dev)
1645 /* Allocate the framebuffer to the maximum screen size */ 1645 /* Allocate the framebuffer to the maximum screen size */
1646 fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; 1646 fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;
1647 1647
1648 fbdev->fb_mem = dma_alloc_noncoherent(dev, 1648 fbdev->fb_mem = dma_alloc_noncoherent(&dev->dev,
1649 PAGE_ALIGN(fbdev->fb_len), 1649 PAGE_ALIGN(fbdev->fb_len),
1650 &fbdev->fb_phys, GFP_KERNEL); 1650 &fbdev->fb_phys, GFP_KERNEL);
1651 if (!fbdev->fb_mem) { 1651 if (!fbdev->fb_mem) {
@@ -1715,7 +1715,7 @@ failed:
1715 return ret; 1715 return ret;
1716} 1716}
1717 1717
1718static int au1200fb_drv_remove(struct device *dev) 1718static int au1200fb_drv_remove(struct platform_device *dev)
1719{ 1719{
1720 struct au1200fb_device *fbdev; 1720 struct au1200fb_device *fbdev;
1721 int plane; 1721 int plane;
@@ -1733,7 +1733,8 @@ static int au1200fb_drv_remove(struct device *dev)
1733 /* Clean up all probe data */ 1733 /* Clean up all probe data */
1734 unregister_framebuffer(&fbdev->fb_info); 1734 unregister_framebuffer(&fbdev->fb_info);
1735 if (fbdev->fb_mem) 1735 if (fbdev->fb_mem)
1736 dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len), 1736 dma_free_noncoherent(&dev->dev,
1737 PAGE_ALIGN(fbdev->fb_len),
1737 fbdev->fb_mem, fbdev->fb_phys); 1738 fbdev->fb_mem, fbdev->fb_phys);
1738 if (fbdev->fb_info.cmap.len != 0) 1739 if (fbdev->fb_info.cmap.len != 0)
1739 fb_dealloc_cmap(&fbdev->fb_info.cmap); 1740 fb_dealloc_cmap(&fbdev->fb_info.cmap);
@@ -1747,22 +1748,24 @@ static int au1200fb_drv_remove(struct device *dev)
1747} 1748}
1748 1749
1749#ifdef CONFIG_PM 1750#ifdef CONFIG_PM
1750static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level) 1751static int au1200fb_drv_suspend(struct platform_device *dev, u32 state)
1751{ 1752{
1752 /* TODO */ 1753 /* TODO */
1753 return 0; 1754 return 0;
1754} 1755}
1755 1756
1756static int au1200fb_drv_resume(struct device *dev, u32 level) 1757static int au1200fb_drv_resume(struct platform_device *dev)
1757{ 1758{
1758 /* TODO */ 1759 /* TODO */
1759 return 0; 1760 return 0;
1760} 1761}
1761#endif /* CONFIG_PM */ 1762#endif /* CONFIG_PM */
1762 1763
1763static struct device_driver au1200fb_driver = { 1764static struct platform_driver au1200fb_driver = {
1764 .name = "au1200-lcd", 1765 .driver = {
1765 .bus = &platform_bus_type, 1766 .name = "au1200-lcd",
1767 .owner = THIS_MODULE,
1768 },
1766 .probe = au1200fb_drv_probe, 1769 .probe = au1200fb_drv_probe,
1767 .remove = au1200fb_drv_remove, 1770 .remove = au1200fb_drv_remove,
1768#ifdef CONFIG_PM 1771#ifdef CONFIG_PM
@@ -1906,12 +1909,12 @@ static int __init au1200fb_init(void)
1906 printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); 1909 printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n");
1907 #endif 1910 #endif
1908 1911
1909 return driver_register(&au1200fb_driver); 1912 return platform_driver_register(&au1200fb_driver);
1910} 1913}
1911 1914
1912static void __exit au1200fb_cleanup(void) 1915static void __exit au1200fb_cleanup(void)
1913{ 1916{
1914 driver_unregister(&au1200fb_driver); 1917 platform_driver_unregister(&au1200fb_driver);
1915} 1918}
1916 1919
1917module_init(au1200fb_init); 1920module_init(au1200fb_init);
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c
index 3a3f80f6521..0573ec685a5 100644
--- a/drivers/video/pmag-ba-fb.c
+++ b/drivers/video/pmag-ba-fb.c
@@ -151,7 +151,7 @@ static int __init pmagbafb_probe(struct device *dev)
151 151
152 info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev); 152 info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev);
153 if (!info) { 153 if (!info) {
154 printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); 154 printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev));
155 return -ENOMEM; 155 return -ENOMEM;
156 } 156 }
157 157
@@ -160,7 +160,7 @@ static int __init pmagbafb_probe(struct device *dev)
160 160
161 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { 161 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
162 printk(KERN_ERR "%s: Cannot allocate color map\n", 162 printk(KERN_ERR "%s: Cannot allocate color map\n",
163 dev->bus_id); 163 dev_name(dev));
164 err = -ENOMEM; 164 err = -ENOMEM;
165 goto err_alloc; 165 goto err_alloc;
166 } 166 }
@@ -173,8 +173,9 @@ static int __init pmagbafb_probe(struct device *dev)
173 /* Request the I/O MEM resource. */ 173 /* Request the I/O MEM resource. */
174 start = tdev->resource.start; 174 start = tdev->resource.start;
175 len = tdev->resource.end - start + 1; 175 len = tdev->resource.end - start + 1;
176 if (!request_mem_region(start, len, dev->bus_id)) { 176 if (!request_mem_region(start, len, dev_name(dev))) {
177 printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); 177 printk(KERN_ERR "%s: Cannot reserve FB region\n",
178 dev_name(dev));
178 err = -EBUSY; 179 err = -EBUSY;
179 goto err_cmap; 180 goto err_cmap;
180 } 181 }
@@ -183,7 +184,7 @@ static int __init pmagbafb_probe(struct device *dev)
183 info->fix.mmio_start = start; 184 info->fix.mmio_start = start;
184 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); 185 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len);
185 if (!par->mmio) { 186 if (!par->mmio) {
186 printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); 187 printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev));
187 err = -ENOMEM; 188 err = -ENOMEM;
188 goto err_resource; 189 goto err_resource;
189 } 190 }
@@ -194,7 +195,7 @@ static int __init pmagbafb_probe(struct device *dev)
194 info->screen_base = ioremap_nocache(info->fix.smem_start, 195 info->screen_base = ioremap_nocache(info->fix.smem_start,
195 info->fix.smem_len); 196 info->fix.smem_len);
196 if (!info->screen_base) { 197 if (!info->screen_base) {
197 printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); 198 printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev));
198 err = -ENOMEM; 199 err = -ENOMEM;
199 goto err_mmio_map; 200 goto err_mmio_map;
200 } 201 }
@@ -205,14 +206,14 @@ static int __init pmagbafb_probe(struct device *dev)
205 err = register_framebuffer(info); 206 err = register_framebuffer(info);
206 if (err < 0) { 207 if (err < 0) {
207 printk(KERN_ERR "%s: Cannot register framebuffer\n", 208 printk(KERN_ERR "%s: Cannot register framebuffer\n",
208 dev->bus_id); 209 dev_name(dev));
209 goto err_smem_map; 210 goto err_smem_map;
210 } 211 }
211 212
212 get_device(dev); 213 get_device(dev);
213 214
214 pr_info("fb%d: %s frame buffer device at %s\n", 215 pr_info("fb%d: %s frame buffer device at %s\n",
215 info->node, info->fix.id, dev->bus_id); 216 info->node, info->fix.id, dev_name(dev));
216 217
217 return 0; 218 return 0;
218 219
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c
index 9b80597241b..98748723af9 100644
--- a/drivers/video/pmagb-b-fb.c
+++ b/drivers/video/pmagb-b-fb.c
@@ -258,7 +258,7 @@ static int __init pmagbbfb_probe(struct device *dev)
258 258
259 info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); 259 info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev);
260 if (!info) { 260 if (!info) {
261 printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); 261 printk(KERN_ERR "%s: Cannot allocate memory\n", dev_name(dev));
262 return -ENOMEM; 262 return -ENOMEM;
263 } 263 }
264 264
@@ -267,7 +267,7 @@ static int __init pmagbbfb_probe(struct device *dev)
267 267
268 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { 268 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
269 printk(KERN_ERR "%s: Cannot allocate color map\n", 269 printk(KERN_ERR "%s: Cannot allocate color map\n",
270 dev->bus_id); 270 dev_name(dev));
271 err = -ENOMEM; 271 err = -ENOMEM;
272 goto err_alloc; 272 goto err_alloc;
273 } 273 }
@@ -280,8 +280,9 @@ static int __init pmagbbfb_probe(struct device *dev)
280 /* Request the I/O MEM resource. */ 280 /* Request the I/O MEM resource. */
281 start = tdev->resource.start; 281 start = tdev->resource.start;
282 len = tdev->resource.end - start + 1; 282 len = tdev->resource.end - start + 1;
283 if (!request_mem_region(start, len, dev->bus_id)) { 283 if (!request_mem_region(start, len, dev_name(dev))) {
284 printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); 284 printk(KERN_ERR "%s: Cannot reserve FB region\n",
285 dev_name(dev));
285 err = -EBUSY; 286 err = -EBUSY;
286 goto err_cmap; 287 goto err_cmap;
287 } 288 }
@@ -290,7 +291,7 @@ static int __init pmagbbfb_probe(struct device *dev)
290 info->fix.mmio_start = start; 291 info->fix.mmio_start = start;
291 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); 292 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len);
292 if (!par->mmio) { 293 if (!par->mmio) {
293 printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); 294 printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev));
294 err = -ENOMEM; 295 err = -ENOMEM;
295 goto err_resource; 296 goto err_resource;
296 } 297 }
@@ -301,7 +302,7 @@ static int __init pmagbbfb_probe(struct device *dev)
301 info->fix.smem_start = start + PMAGB_B_FBMEM; 302 info->fix.smem_start = start + PMAGB_B_FBMEM;
302 par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); 303 par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len);
303 if (!par->smem) { 304 if (!par->smem) {
304 printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); 305 printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev));
305 err = -ENOMEM; 306 err = -ENOMEM;
306 goto err_mmio_map; 307 goto err_mmio_map;
307 } 308 }
@@ -316,7 +317,7 @@ static int __init pmagbbfb_probe(struct device *dev)
316 err = register_framebuffer(info); 317 err = register_framebuffer(info);
317 if (err < 0) { 318 if (err < 0) {
318 printk(KERN_ERR "%s: Cannot register framebuffer\n", 319 printk(KERN_ERR "%s: Cannot register framebuffer\n",
319 dev->bus_id); 320 dev_name(dev));
320 goto err_smem_map; 321 goto err_smem_map;
321 } 322 }
322 323
@@ -328,7 +329,7 @@ static int __init pmagbbfb_probe(struct device *dev)
328 par->osc1 / 1000, par->osc1 % 1000); 329 par->osc1 / 1000, par->osc1 % 1000);
329 330
330 pr_info("fb%d: %s frame buffer device at %s\n", 331 pr_info("fb%d: %s frame buffer device at %s\n",
331 info->node, info->fix.id, dev->bus_id); 332 info->node, info->fix.id, dev_name(dev));
332 pr_info("fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n", 333 pr_info("fb%d: Osc0: %s, Osc1: %s, Osc%u selected\n",
333 info->node, freq0, par->osc1 ? freq1 : "disabled", 334 info->node, freq0, par->osc1 ? freq1 : "disabled",
334 par->osc1 != 0); 335 par->osc1 != 0);
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 87f826e4c95..e00c1dff55d 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1213,7 +1213,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1213 dev->core.driver_data = info; 1213 dev->core.driver_data = info;
1214 1214
1215 dev_info(info->device, "%s %s, using %u KiB of video memory\n", 1215 dev_info(info->device, "%s %s, using %u KiB of video memory\n",
1216 dev_driver_string(info->dev), info->dev->bus_id, 1216 dev_driver_string(info->dev), dev_name(info->dev),
1217 info->fix.smem_len >> 10); 1217 info->fix.smem_len >> 10);
1218 1218
1219 task = kthread_run(ps3fbd, info, DEVICE_NAME); 1219 task = kthread_run(ps3fbd, info, DEVICE_NAME);
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index b433b8ac76d..92ea0ab44ce 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -737,7 +737,7 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev)
737 } 737 }
738 738
739 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED, 739 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
740 pdev->dev.bus_id, priv); 740 dev_name(&pdev->dev), priv);
741 if (error) { 741 if (error) {
742 dev_err(&pdev->dev, "unable to request irq\n"); 742 dev_err(&pdev->dev, "unable to request irq\n");
743 goto err1; 743 goto err1;
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index 7baf2dd12d5..a1eb0862255 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -751,7 +751,7 @@ static int __devinit tmiofb_probe(struct platform_device *dev)
751 } 751 }
752 752
753 retval = request_irq(irq, &tmiofb_irq, IRQF_DISABLED, 753 retval = request_irq(irq, &tmiofb_irq, IRQF_DISABLED,
754 dev->dev.bus_id, info); 754 dev_name(&dev->dev), info);
755 755
756 if (retval) 756 if (retval)
757 goto err_request_irq; 757 goto err_request_irq;
diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c
index f1ae3729a19..cce1982a1b5 100644
--- a/drivers/watchdog/rm9k_wdt.c
+++ b/drivers/watchdog/rm9k_wdt.c
@@ -59,8 +59,8 @@ static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long);
59static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); 59static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *);
60static const struct resource *wdt_gpi_get_resource(struct platform_device *, 60static const struct resource *wdt_gpi_get_resource(struct platform_device *,
61 const char *, unsigned int); 61 const char *, unsigned int);
62static int __init wdt_gpi_probe(struct device *); 62static int __init wdt_gpi_probe(struct platform_device *);
63static int __exit wdt_gpi_remove(struct device *); 63static int __exit wdt_gpi_remove(struct platform_device *);
64 64
65 65
66static const char wdt_gpi_name[] = "wdt_gpi"; 66static const char wdt_gpi_name[] = "wdt_gpi";
@@ -346,10 +346,9 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv,
346} 346}
347 347
348/* No hotplugging on the platform bus - use __init */ 348/* No hotplugging on the platform bus - use __init */
349static int __init wdt_gpi_probe(struct device *dev) 349static int __init wdt_gpi_probe(struct platform_device *pdv)
350{ 350{
351 int res; 351 int res;
352 struct platform_device * const pdv = to_platform_device(dev);
353 const struct resource 352 const struct resource
354 * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, 353 * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS,
355 IORESOURCE_MEM), 354 IORESOURCE_MEM),
@@ -374,7 +373,7 @@ static int __init wdt_gpi_probe(struct device *dev)
374 return res; 373 return res;
375} 374}
376 375
377static int __exit wdt_gpi_remove(struct device *dev) 376static int __exit wdt_gpi_remove(struct platform_device *dev)
378{ 377{
379 int res; 378 int res;
380 379
@@ -387,15 +386,13 @@ static int __exit wdt_gpi_remove(struct device *dev)
387 386
388 387
389/* Device driver init & exit */ 388/* Device driver init & exit */
390static struct device_driver wdt_gpi_driver = { 389static struct platform_driver wgt_gpi_driver = {
391 .name = (char *) wdt_gpi_name, 390 .driver = {
392 .bus = &platform_bus_type, 391 .name = wdt_gpi_name,
393 .owner = THIS_MODULE, 392 .owner = THIS_MODULE,
393 },
394 .probe = wdt_gpi_probe, 394 .probe = wdt_gpi_probe,
395 .remove = __exit_p(wdt_gpi_remove), 395 .remove = __devexit_p(wdt_gpi_remove),
396 .shutdown = NULL,
397 .suspend = NULL,
398 .resume = NULL,
399}; 396};
400 397
401static int __init wdt_gpi_init_module(void) 398static int __init wdt_gpi_init_module(void)
@@ -403,12 +400,12 @@ static int __init wdt_gpi_init_module(void)
403 atomic_set(&opencnt, 1); 400 atomic_set(&opencnt, 1);
404 if (timeout > MAX_TIMEOUT_SECONDS) 401 if (timeout > MAX_TIMEOUT_SECONDS)
405 timeout = MAX_TIMEOUT_SECONDS; 402 timeout = MAX_TIMEOUT_SECONDS;
406 return driver_register(&wdt_gpi_driver); 403 return platform_driver_register(&wdt_gpi_driver);
407} 404}
408 405
409static void __exit wdt_gpi_cleanup_module(void) 406static void __exit wdt_gpi_cleanup_module(void)
410{ 407{
411 driver_unregister(&wdt_gpi_driver); 408 platform_driver_unregister(&wdt_gpi_driver);
412} 409}
413 410
414module_init(wdt_gpi_init_module); 411module_init(wdt_gpi_init_module);
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index a1585d6f648..d45fb34e2d2 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -140,7 +140,7 @@ static int __init zorro_init(void)
140 140
141 /* Initialize the Zorro bus */ 141 /* Initialize the Zorro bus */
142 INIT_LIST_HEAD(&zorro_bus.devices); 142 INIT_LIST_HEAD(&zorro_bus.devices);
143 strcpy(zorro_bus.dev.bus_id, "zorro"); 143 dev_set_name(&zorro_bus.dev, "zorro");
144 error = device_register(&zorro_bus.dev); 144 error = device_register(&zorro_bus.dev);
145 if (error) { 145 if (error) {
146 pr_err("Zorro: Error registering zorro_bus\n"); 146 pr_err("Zorro: Error registering zorro_bus\n");
@@ -167,7 +167,7 @@ static int __init zorro_init(void)
167 if (request_resource(zorro_find_parent_resource(z), &z->resource)) 167 if (request_resource(zorro_find_parent_resource(z), &z->resource))
168 pr_err("Zorro: Address space collision on device %s %pR\n", 168 pr_err("Zorro: Address space collision on device %s %pR\n",
169 z->name, &z->resource); 169 z->name, &z->resource);
170 sprintf(z->dev.bus_id, "%02x", i); 170 dev_set_name(&z->dev, "%02x", i);
171 z->dev.parent = &zorro_bus.dev; 171 z->dev.parent = &zorro_bus.dev;
172 z->dev.bus = &zorro_bus_type; 172 z->dev.bus = &zorro_bus_type;
173 error = device_register(&z->dev); 173 error = device_register(&z->dev);