aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 20:02:07 -0500
commit40d7ee5d162203b40b5f4fbb312ab016edddb97f (patch)
tree432db33df85f7f244676127a189a828dfbf2877b
parent5fec8bdbf9a1c4df4ad3f20e52aa2d8caed490c8 (diff)
parentb8ac9fc0e8cda9f9776019c5b0464b0c6d2d4c90 (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: (60 commits) uio: make uio_info's name and version const UIO: Documentation for UIO ioport info handling UIO: Pass information about ioports to userspace (V2) UIO: uio_pdrv_genirq: allow custom irq_flags UIO: use pci_ioremap_bar() in drivers/uio arm: struct device - replace bus_id with dev_name(), dev_set_name() libata: struct device - replace bus_id with dev_name(), dev_set_name() avr: struct device - replace bus_id with dev_name(), dev_set_name() block: struct device - replace bus_id with dev_name(), dev_set_name() chris: struct device - replace bus_id with dev_name(), dev_set_name() dmi: struct device - replace bus_id with dev_name(), dev_set_name() gadget: struct device - replace bus_id with dev_name(), dev_set_name() gpio: struct device - replace bus_id with dev_name(), dev_set_name() gpu: struct device - replace bus_id with dev_name(), dev_set_name() hwmon: struct device - replace bus_id with dev_name(), dev_set_name() i2o: struct device - replace bus_id with dev_name(), dev_set_name() IA64: struct device - replace bus_id with dev_name(), dev_set_name() i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name() infiniband: struct device - replace bus_id with dev_name(), dev_set_name() ISDN: struct device - replace bus_id with dev_name(), dev_set_name() ...
-rw-r--r--Documentation/DocBook/uio-howto.tmpl101
-rw-r--r--Documentation/kobject.txt4
-rw-r--r--arch/arm/kernel/ecard.c2
-rw-r--r--arch/arm/mach-aaec2000/core.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c6
-rw-r--r--arch/arm/mach-integrator/core.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c6
-rw-r--r--arch/arm/mach-lh7a40x/clcd.c2
-rw-r--r--arch/arm/mach-netx/fb.c2
-rw-r--r--arch/arm/mach-realview/core.h2
-rw-r--r--arch/arm/mach-versatile/core.h2
-rw-r--r--arch/arm/plat-omap/include/mach/memory.h2
-rw-r--r--arch/avr32/mach-at32ap/clock.c4
-rw-r--r--arch/cris/arch-v32/drivers/iop_fw_load.c6
-rw-r--r--arch/ia64/kernel/pci-dma.c2
-rw-r--r--arch/ia64/sn/kernel/tiocx.c3
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/s390/include/asm/s390_rdev.h15
-rw-r--r--block/bsg.c6
-rw-r--r--block/genhd.c2
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/base/attribute_container.c2
-rw-r--r--drivers/base/base.h26
-rw-r--r--drivers/base/bus.c52
-rw-r--r--drivers/base/core.c197
-rw-r--r--drivers/base/dd.c26
-rw-r--r--drivers/base/driver.c13
-rw-r--r--drivers/base/firmware_class.c8
-rw-r--r--drivers/base/isa.c7
-rw-r--r--drivers/base/platform.c130
-rw-r--r--drivers/base/power/main.c21
-rw-r--r--drivers/base/power/trace.c4
-rw-r--r--drivers/char/mwave/mwavedd.c2
-rw-r--r--drivers/firmware/dmi-id.c2
-rw-r--r--drivers/gpio/gpiolib.c2
-rw-r--r--drivers/gpu/drm/drm_sysfs.c2
-rw-r--r--drivers/hwmon/hwmon.c2
-rw-r--r--drivers/hwmon/lm75.c2
-rw-r--r--drivers/idle/i7300_idle.c2
-rw-r--r--drivers/infiniband/core/sysfs.c2
-rw-r--r--drivers/infiniband/core/ucm.c3
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c3
-rw-r--r--drivers/isdn/mISDN/dsp_pipeline.c2
-rw-r--r--drivers/lguest/lguest_device.c10
-rw-r--r--drivers/macintosh/macio_asic.c24
-rw-r--r--drivers/memstick/core/memstick.c5
-rw-r--r--drivers/memstick/core/mspro_block.c14
-rw-r--r--drivers/memstick/host/tifm_ms.c4
-rw-r--r--drivers/message/i2o/device.c8
-rw-r--r--drivers/message/i2o/i2o_proc.c2
-rw-r--r--drivers/message/i2o/iop.c2
-rw-r--r--drivers/misc/sgi-gru/grumain.c2
-rw-r--r--drivers/misc/sgi-xp/xp_main.c2
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c8
-rw-r--r--drivers/misc/sgi-xp/xpnet.c2
-rw-r--r--drivers/misc/tifm_7xx1.c2
-rw-r--r--drivers/misc/tifm_core.c7
-rw-r--r--drivers/mtd/devices/m25p80.c16
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c30
-rw-r--r--drivers/mtd/maps/integrator-flash.c2
-rw-r--r--drivers/mtd/maps/ixp2000.c4
-rw-r--r--drivers/mtd/maps/ixp4xx.c2
-rw-r--r--drivers/mtd/maps/omap_nor.c2
-rw-r--r--drivers/mtd/maps/physmap.c6
-rw-r--r--drivers/mtd/maps/physmap_of.c4
-rw-r--r--drivers/mtd/mtdconcat.c2
-rw-r--r--drivers/mtd/nand/fsl_upm.c2
-rw-r--r--drivers/mtd/nand/plat_nand.c2
-rw-r--r--drivers/mtd/nand/tmio_nand.c2
-rw-r--r--drivers/mtd/onenand/generic.c2
-rw-r--r--drivers/mtd/onenand/omap2.c2
-rw-r--r--drivers/mtd/ubi/build.c2
-rw-r--r--drivers/mtd/ubi/vmt.c4
-rw-r--r--drivers/pci/pci-driver.c132
-rw-r--r--drivers/pnp/card.c7
-rw-r--r--drivers/pnp/core.c5
-rw-r--r--drivers/pnp/system.c2
-rw-r--r--drivers/power/ds2760_battery.c4
-rw-r--r--drivers/s390/Makefile2
-rw-r--r--drivers/s390/block/dcssblk.c11
-rw-r--r--drivers/s390/crypto/ap_bus.c7
-rw-r--r--drivers/s390/kvm/kvm_virtio.c5
-rw-r--r--drivers/s390/net/cu3088.c7
-rw-r--r--drivers/s390/net/qeth_core_main.c7
-rw-r--r--drivers/s390/net/qeth_l2_main.c2
-rw-r--r--drivers/s390/net/qeth_l3_main.c2
-rw-r--r--drivers/s390/s390_rdev.c51
-rw-r--r--drivers/serial/serial_core.c4
-rw-r--r--drivers/spi/spi.c20
-rw-r--r--drivers/spi/spi_bitbang.c2
-rw-r--r--drivers/spi/spi_butterfly.c2
-rw-r--r--drivers/spi/spi_lm70llp.c2
-rw-r--r--drivers/thermal/thermal_sys.c6
-rw-r--r--drivers/uio/uio.c159
-rw-r--r--drivers/uio/uio_cif.c3
-rw-r--r--drivers/uio/uio_pdrv_genirq.c5
-rw-r--r--drivers/usb/core/usb.c4
-rw-r--r--drivers/usb/gadget/at91_udc.c2
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c2
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c2
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c2
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c2
-rw-r--r--drivers/video/backlight/backlight.c2
-rw-r--r--drivers/video/backlight/lcd.c2
-rw-r--r--drivers/video/output.c2
-rw-r--r--drivers/virtio/virtio_pci.c17
-rw-r--r--drivers/w1/w1.c19
-rw-r--r--drivers/w1/w1_int.c3
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c27
-rw-r--r--drivers/xen/xenbus/xenbus_probe.h4
-rw-r--r--fs/partitions/check.c11
-rw-r--r--include/linux/device.h39
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h88
-rw-r--r--include/linux/uio_driver.h30
-rw-r--r--init/Kconfig44
-rw-r--r--kernel/ksysfs.c4
-rw-r--r--kernel/power/main.c6
-rw-r--r--lib/dynamic_printk.c58
-rw-r--r--lib/klist.c43
-rw-r--r--lib/kobject_uevent.c8
-rw-r--r--lib/swiotlb.c2
-rw-r--r--net/iucv/iucv.c7
129 files changed, 1063 insertions, 701 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index df87d1b93605..b787e4721c90 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -42,6 +42,12 @@ GPL version 2.
42 42
43<revhistory> 43<revhistory>
44 <revision> 44 <revision>
45 <revnumber>0.6</revnumber>
46 <date>2008-12-05</date>
47 <authorinitials>hjk</authorinitials>
48 <revremark>Added description of portio sysfs attributes.</revremark>
49 </revision>
50 <revision>
45 <revnumber>0.5</revnumber> 51 <revnumber>0.5</revnumber>
46 <date>2008-05-22</date> 52 <date>2008-05-22</date>
47 <authorinitials>hjk</authorinitials> 53 <authorinitials>hjk</authorinitials>
@@ -318,6 +324,54 @@ interested in translating it, please email me
318offset = N * getpagesize(); 324offset = N * getpagesize();
319</programlisting> 325</programlisting>
320 326
327<para>
328 Sometimes there is hardware with memory-like regions that can not be
329 mapped with the technique described here, but there are still ways to
330 access them from userspace. The most common example are x86 ioports.
331 On x86 systems, userspace can access these ioports using
332 <function>ioperm()</function>, <function>iopl()</function>,
333 <function>inb()</function>, <function>outb()</function>, and similar
334 functions.
335</para>
336<para>
337 Since these ioport regions can not be mapped, they will not appear under
338 <filename>/sys/class/uio/uioX/maps/</filename> like the normal memory
339 described above. Without information about the port regions a hardware
340 has to offer, it becomes difficult for the userspace part of the
341 driver to find out which ports belong to which UIO device.
342</para>
343<para>
344 To address this situation, the new directory
345 <filename>/sys/class/uio/uioX/portio/</filename> was added. It only
346 exists if the driver wants to pass information about one or more port
347 regions to userspace. If that is the case, subdirectories named
348 <filename>port0</filename>, <filename>port1</filename>, and so on,
349 will appear underneath
350 <filename>/sys/class/uio/uioX/portio/</filename>.
351</para>
352<para>
353 Each <filename>portX/</filename> directory contains three read-only
354 files that show start, size, and type of the port region:
355</para>
356<itemizedlist>
357<listitem>
358 <para>
359 <filename>start</filename>: The first port of this region.
360 </para>
361</listitem>
362<listitem>
363 <para>
364 <filename>size</filename>: The number of ports in this region.
365 </para>
366</listitem>
367<listitem>
368 <para>
369 <filename>porttype</filename>: A string describing the type of port.
370 </para>
371</listitem>
372</itemizedlist>
373
374
321</sect1> 375</sect1>
322</chapter> 376</chapter>
323 377
@@ -339,12 +393,12 @@ offset = N * getpagesize();
339 393
340<itemizedlist> 394<itemizedlist>
341<listitem><para> 395<listitem><para>
342<varname>char *name</varname>: Required. The name of your driver as 396<varname>const char *name</varname>: Required. The name of your driver as
343it will appear in sysfs. I recommend using the name of your module for this. 397it will appear in sysfs. I recommend using the name of your module for this.
344</para></listitem> 398</para></listitem>
345 399
346<listitem><para> 400<listitem><para>
347<varname>char *version</varname>: Required. This string appears in 401<varname>const char *version</varname>: Required. This string appears in
348<filename>/sys/class/uio/uioX/version</filename>. 402<filename>/sys/class/uio/uioX/version</filename>.
349</para></listitem> 403</para></listitem>
350 404
@@ -356,6 +410,13 @@ See the description below for details.
356</para></listitem> 410</para></listitem>
357 411
358<listitem><para> 412<listitem><para>
413<varname>struct uio_port port[ MAX_UIO_PORTS_REGIONS ]</varname>: Required
414if you want to pass information about ioports to userspace. For each port
415region you need to fill one of the <varname>uio_port</varname> structures.
416See the description below for details.
417</para></listitem>
418
419<listitem><para>
359<varname>long irq</varname>: Required. If your hardware generates an 420<varname>long irq</varname>: Required. If your hardware generates an
360interrupt, it's your modules task to determine the irq number during 421interrupt, it's your modules task to determine the irq number during
361initialization. If you don't have a hardware generated interrupt but 422initialization. If you don't have a hardware generated interrupt but
@@ -448,6 +509,42 @@ Please do not touch the <varname>kobj</varname> element of
448<varname>struct uio_mem</varname>! It is used by the UIO framework 509<varname>struct uio_mem</varname>! It is used by the UIO framework
449to set up sysfs files for this mapping. Simply leave it alone. 510to set up sysfs files for this mapping. Simply leave it alone.
450</para> 511</para>
512
513<para>
514Sometimes, your device can have one or more port regions which can not be
515mapped to userspace. But if there are other possibilities for userspace to
516access these ports, it makes sense to make information about the ports
517available in sysfs. For each region, you have to set up a
518<varname>struct uio_port</varname> in the <varname>port[]</varname> array.
519Here's a description of the fields of <varname>struct uio_port</varname>:
520</para>
521
522<itemizedlist>
523<listitem><para>
524<varname>char *porttype</varname>: Required. Set this to one of the predefined
525constants. Use <varname>UIO_PORT_X86</varname> for the ioports found in x86
526architectures.
527</para></listitem>
528
529<listitem><para>
530<varname>unsigned long start</varname>: Required if the port region is used.
531Fill in the number of the first port of this region.
532</para></listitem>
533
534<listitem><para>
535<varname>unsigned long size</varname>: Fill in the number of ports in this
536region. If <varname>size</varname> is zero, the region is considered unused.
537Note that you <emphasis>must</emphasis> initialize <varname>size</varname>
538with zero for all unused regions.
539</para></listitem>
540</itemizedlist>
541
542<para>
543Please do not touch the <varname>portio</varname> element of
544<varname>struct uio_port</varname>! It is used internally by the UIO
545framework to set up sysfs files for this region. Simply leave it alone.
546</para>
547
451</sect1> 548</sect1>
452 549
453<sect1 id="adding_irq_handler"> 550<sect1 id="adding_irq_handler">
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index f5d2aad65a67..b2e374586bd8 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -118,8 +118,8 @@ the name of the kobject, call kobject_rename():
118 118
119 int kobject_rename(struct kobject *kobj, const char *new_name); 119 int kobject_rename(struct kobject *kobj, const char *new_name);
120 120
121Note kobject_rename does perform any locking or have a solid notion of 121kobject_rename does not perform any locking or have a solid notion of
122what names are valid so the provide must provide their own sanity checking 122what names are valid so the caller must provide their own sanity checking
123and serialization. 123and serialization.
124 124
125There is a function called kobject_set_name() but that is legacy cruft and 125There is a function called kobject_set_name() but that is legacy cruft and
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index 60c079d85355..eed2f795e1b3 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -817,7 +817,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
817 ec->dma = NO_DMA; 817 ec->dma = NO_DMA;
818 ec->ops = &ecard_default_ops; 818 ec->ops = &ecard_default_ops;
819 819
820 snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot); 820 dev_set_name(&ec->dev, "ecard%d", slot);
821 ec->dev.parent = NULL; 821 ec->dev.parent = NULL;
822 ec->dev.bus = &ecard_bus_type; 822 ec->dev.bus = &ecard_bus_type;
823 ec->dev.dma_mask = &ec->dma_mask; 823 ec->dev.dma_mask = &ec->dma_mask;
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index 50e13965dfed..b5c5fc6ba3a9 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -212,7 +212,7 @@ static struct clcd_board clcd_plat_data = {
212 212
213static struct amba_device clcd_device = { 213static struct amba_device clcd_device = {
214 .dev = { 214 .dev = {
215 .bus_id = "mb:16", 215 .init_name = "mb:16",
216 .coherent_dma_mask = ~0, 216 .coherent_dma_mask = ~0,
217 .platform_data = &clcd_plat_data, 217 .platform_data = &clcd_plat_data,
218 }, 218 },
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 4781f323703b..6d9152de6074 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -409,7 +409,7 @@ static struct amba_pl010_data ep93xx_uart_data = {
409 409
410static struct amba_device uart1_device = { 410static struct amba_device uart1_device = {
411 .dev = { 411 .dev = {
412 .bus_id = "apb:uart1", 412 .init_name = "apb:uart1",
413 .platform_data = &ep93xx_uart_data, 413 .platform_data = &ep93xx_uart_data,
414 }, 414 },
415 .res = { 415 .res = {
@@ -423,7 +423,7 @@ static struct amba_device uart1_device = {
423 423
424static struct amba_device uart2_device = { 424static struct amba_device uart2_device = {
425 .dev = { 425 .dev = {
426 .bus_id = "apb:uart2", 426 .init_name = "apb:uart2",
427 .platform_data = &ep93xx_uart_data, 427 .platform_data = &ep93xx_uart_data,
428 }, 428 },
429 .res = { 429 .res = {
@@ -437,7 +437,7 @@ static struct amba_device uart2_device = {
437 437
438static struct amba_device uart3_device = { 438static struct amba_device uart3_device = {
439 .dev = { 439 .dev = {
440 .bus_id = "apb:uart3", 440 .init_name = "apb:uart3",
441 .platform_data = &ep93xx_uart_data, 441 .platform_data = &ep93xx_uart_data,
442 }, 442 },
443 .res = { 443 .res = {
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index c89c949b4d45..6f8872913073 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -37,7 +37,7 @@ static struct amba_pl010_data integrator_uart_data;
37 37
38static struct amba_device rtc_device = { 38static struct amba_device rtc_device = {
39 .dev = { 39 .dev = {
40 .bus_id = "mb:15", 40 .init_name = "mb:15",
41 }, 41 },
42 .res = { 42 .res = {
43 .start = INTEGRATOR_RTC_BASE, 43 .start = INTEGRATOR_RTC_BASE,
@@ -50,7 +50,7 @@ static struct amba_device rtc_device = {
50 50
51static struct amba_device uart0_device = { 51static struct amba_device uart0_device = {
52 .dev = { 52 .dev = {
53 .bus_id = "mb:16", 53 .init_name = "mb:16",
54 .platform_data = &integrator_uart_data, 54 .platform_data = &integrator_uart_data,
55 }, 55 },
56 .res = { 56 .res = {
@@ -64,7 +64,7 @@ static struct amba_device uart0_device = {
64 64
65static struct amba_device uart1_device = { 65static struct amba_device uart1_device = {
66 .dev = { 66 .dev = {
67 .bus_id = "mb:17", 67 .init_name = "mb:17",
68 .platform_data = &integrator_uart_data, 68 .platform_data = &integrator_uart_data,
69 }, 69 },
70 .res = { 70 .res = {
@@ -78,7 +78,7 @@ static struct amba_device uart1_device = {
78 78
79static struct amba_device kmi0_device = { 79static struct amba_device kmi0_device = {
80 .dev = { 80 .dev = {
81 .bus_id = "mb:18", 81 .init_name = "mb:18",
82 }, 82 },
83 .res = { 83 .res = {
84 .start = KMI0_BASE, 84 .start = KMI0_BASE,
@@ -91,7 +91,7 @@ static struct amba_device kmi0_device = {
91 91
92static struct amba_device kmi1_device = { 92static struct amba_device kmi1_device = {
93 .dev = { 93 .dev = {
94 .bus_id = "mb:19", 94 .init_name = "mb:19",
95 }, 95 },
96 .res = { 96 .res = {
97 .start = KMI1_BASE, 97 .start = KMI1_BASE,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 427c2d8dc123..4ac04055c2ea 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -407,7 +407,7 @@ static struct mmc_platform_data mmc_data = {
407 407
408static struct amba_device mmc_device = { 408static struct amba_device mmc_device = {
409 .dev = { 409 .dev = {
410 .bus_id = "mb:1c", 410 .init_name = "mb:1c",
411 .platform_data = &mmc_data, 411 .platform_data = &mmc_data,
412 }, 412 },
413 .res = { 413 .res = {
@@ -421,7 +421,7 @@ static struct amba_device mmc_device = {
421 421
422static struct amba_device aaci_device = { 422static struct amba_device aaci_device = {
423 .dev = { 423 .dev = {
424 .bus_id = "mb:1d", 424 .init_name = "mb:1d",
425 }, 425 },
426 .res = { 426 .res = {
427 .start = INTCP_PA_AACI_BASE, 427 .start = INTCP_PA_AACI_BASE,
@@ -532,7 +532,7 @@ static struct clcd_board clcd_data = {
532 532
533static struct amba_device clcd_device = { 533static struct amba_device clcd_device = {
534 .dev = { 534 .dev = {
535 .bus_id = "mb:c0", 535 .init_name = "mb:c0",
536 .coherent_dma_mask = ~0, 536 .coherent_dma_mask = ~0,
537 .platform_data = &clcd_data, 537 .platform_data = &clcd_data,
538 }, 538 },
diff --git a/arch/arm/mach-lh7a40x/clcd.c b/arch/arm/mach-lh7a40x/clcd.c
index a2a543258fc3..c472b9e8b37c 100644
--- a/arch/arm/mach-lh7a40x/clcd.c
+++ b/arch/arm/mach-lh7a40x/clcd.c
@@ -207,7 +207,7 @@ static struct clcd_board clcd_platform_data = {
207static struct amba_device name##_device = { \ 207static struct amba_device name##_device = { \
208 .dev = { \ 208 .dev = { \
209 .coherent_dma_mask = ~0, \ 209 .coherent_dma_mask = ~0, \
210 .bus_id = busid, \ 210 .init_name = busid, \
211 .platform_data = plat, \ 211 .platform_data = plat, \
212 }, \ 212 }, \
213 .res = { \ 213 .res = { \
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
index 8f1f992f002e..ea8fa8898fe8 100644
--- a/arch/arm/mach-netx/fb.c
+++ b/arch/arm/mach-netx/fb.c
@@ -91,7 +91,7 @@ void clk_put(struct clk *clk)
91 91
92static struct amba_device fb_device = { 92static struct amba_device fb_device = {
93 .dev = { 93 .dev = {
94 .bus_id = "fb", 94 .init_name = "fb",
95 .coherent_dma_mask = ~0, 95 .coherent_dma_mask = ~0,
96 }, 96 },
97 .res = { 97 .res = {
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 63be2abdc19c..44269b162d49 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -31,7 +31,7 @@
31static struct amba_device name##_device = { \ 31static struct amba_device name##_device = { \
32 .dev = { \ 32 .dev = { \
33 .coherent_dma_mask = ~0, \ 33 .coherent_dma_mask = ~0, \
34 .bus_id = busid, \ 34 .init_name = busid, \
35 .platform_data = plat, \ 35 .platform_data = plat, \
36 }, \ 36 }, \
37 .res = { \ 37 .res = { \
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index afcaa858eb1f..9d39886a8351 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -34,7 +34,7 @@ extern unsigned int mmc_status(struct device *dev);
34static struct amba_device name##_device = { \ 34static struct amba_device name##_device = { \
35 .dev = { \ 35 .dev = { \
36 .coherent_dma_mask = ~0, \ 36 .coherent_dma_mask = ~0, \
37 .bus_id = busid, \ 37 .init_name = busid, \
38 .platform_data = plat, \ 38 .platform_data = plat, \
39 }, \ 39 }, \
40 .res = { \ 40 .res = { \
diff --git a/arch/arm/plat-omap/include/mach/memory.h b/arch/arm/plat-omap/include/mach/memory.h
index 211c9f6619e9..d6b5ca6c7da2 100644
--- a/arch/arm/plat-omap/include/mach/memory.h
+++ b/arch/arm/plat-omap/include/mach/memory.h
@@ -59,7 +59,7 @@
59 59
60#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 60#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
61#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 61#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
62#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) 62#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))
63 63
64#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ 64#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
65 (dma_addr_t)virt_to_lbus(page_address(page)) : \ 65 (dma_addr_t)virt_to_lbus(page_address(page)) : \
diff --git a/arch/avr32/mach-at32ap/clock.c b/arch/avr32/mach-at32ap/clock.c
index 138a00a2a2d0..442f08c5e641 100644
--- a/arch/avr32/mach-at32ap/clock.c
+++ b/arch/avr32/mach-at32ap/clock.c
@@ -198,7 +198,7 @@ dump_clock(struct clk *parent, struct clkinf *r)
198 unsigned i; 198 unsigned i;
199 199
200 /* skip clocks coupled to devices that aren't registered */ 200 /* skip clocks coupled to devices that aren't registered */
201 if (parent->dev && !parent->dev->bus_id[0] && !parent->users) 201 if (parent->dev && !dev_name(parent->dev) && !parent->users)
202 return; 202 return;
203 203
204 /* <nest spaces> name <pad to end> */ 204 /* <nest spaces> name <pad to end> */
@@ -214,7 +214,7 @@ dump_clock(struct clk *parent, struct clkinf *r)
214 parent->users ? "on" : "off", /* NOTE: not-paranoid!! */ 214 parent->users ? "on" : "off", /* NOTE: not-paranoid!! */
215 clk_get_rate(parent)); 215 clk_get_rate(parent));
216 if (parent->dev) 216 if (parent->dev)
217 seq_printf(r->s, ", for %s", parent->dev->bus_id); 217 seq_printf(r->s, ", for %s", dev_name(parent->dev));
218 seq_printf(r->s, "\n"); 218 seq_printf(r->s, "\n");
219 219
220 /* cost of this scan is small, but not linear... */ 220 /* cost of this scan is small, but not linear... */
diff --git a/arch/cris/arch-v32/drivers/iop_fw_load.c b/arch/cris/arch-v32/drivers/iop_fw_load.c
index 3b3857ec1f15..2f8ea0f7a63c 100644
--- a/arch/cris/arch-v32/drivers/iop_fw_load.c
+++ b/arch/cris/arch-v32/drivers/iop_fw_load.c
@@ -24,12 +24,12 @@
24#error "Please contact <greg@kroah.com> for details on how to fix it properly." 24#error "Please contact <greg@kroah.com> for details on how to fix it properly."
25 25
26static struct device iop_spu_device[2] = { 26static struct device iop_spu_device[2] = {
27 { .bus_id = "iop-spu0", }, 27 { .init_name = "iop-spu0", },
28 { .bus_id = "iop-spu1", }, 28 { .init_name = "iop-spu1", },
29}; 29};
30 30
31static struct device iop_mpu_device = { 31static struct device iop_mpu_device = {
32 .bus_id = "iop-mpu", 32 .init_name = "iop-mpu",
33}; 33};
34 34
35static int wait_mpu_idle(void) 35static int wait_mpu_idle(void)
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 2a92f637431d..d0ada067a4af 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -39,7 +39,7 @@ int iommu_detected __read_mostly;
39 be probably a smaller DMA mask, but this is bug-to-bug compatible 39 be probably a smaller DMA mask, but this is bug-to-bug compatible
40 to i386. */ 40 to i386. */
41struct device fallback_dev = { 41struct device fallback_dev = {
42 .bus_id = "fallback device", 42 .init_name = "fallback device",
43 .coherent_dma_mask = DMA_32BIT_MASK, 43 .coherent_dma_mask = DMA_32BIT_MASK,
44 .dma_mask = &fallback_dev.coherent_dma_mask, 44 .dma_mask = &fallback_dev.coherent_dma_mask,
45}; 45};
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index a88eba3314d7..3f864238566d 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -206,8 +206,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
206 cx_dev->dev.parent = NULL; 206 cx_dev->dev.parent = NULL;
207 cx_dev->dev.bus = &tiocx_bus_type; 207 cx_dev->dev.bus = &tiocx_bus_type;
208 cx_dev->dev.release = tiocx_bus_release; 208 cx_dev->dev.release = tiocx_bus_release;
209 snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d", 209 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
210 cx_dev->cx_id.nasid);
211 device_register(&cx_dev->dev); 210 device_register(&cx_dev->dev);
212 get_device(&cx_dev->dev); 211 get_device(&cx_dev->dev);
213 212
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 010b27e01f7b..3ca5f42e819d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1454,7 +1454,7 @@ static int __init vpe_module_init(void)
1454 device_initialize(&vpe_device); 1454 device_initialize(&vpe_device);
1455 vpe_device.class = &vpe_class, 1455 vpe_device.class = &vpe_class,
1456 vpe_device.parent = NULL, 1456 vpe_device.parent = NULL,
1457 strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE); 1457 dev_set_name(&vpe_device, "vpe1");
1458 vpe_device.devt = MKDEV(major, minor); 1458 vpe_device.devt = MKDEV(major, minor);
1459 err = device_add(&vpe_device); 1459 err = device_add(&vpe_device);
1460 if (err) { 1460 if (err) {
diff --git a/arch/s390/include/asm/s390_rdev.h b/arch/s390/include/asm/s390_rdev.h
deleted file mode 100644
index 6fa20442a48c..000000000000
--- a/arch/s390/include/asm/s390_rdev.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * include/asm-s390/ccwdev.h
3 *
4 * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 * Carsten Otte <cotte@de.ibm.com>
7 *
8 * Interface for s390 root device
9 */
10
11#ifndef _S390_RDEV_H_
12#define _S390_RDEV_H_
13extern struct device *s390_root_dev_register(const char *);
14extern void s390_root_dev_unregister(struct device *);
15#endif /* _S390_RDEV_H_ */
diff --git a/block/bsg.c b/block/bsg.c
index e73e50daf3d0..d414bb5607e8 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -42,7 +42,7 @@ struct bsg_device {
42 int done_cmds; 42 int done_cmds;
43 wait_queue_head_t wq_done; 43 wait_queue_head_t wq_done;
44 wait_queue_head_t wq_free; 44 wait_queue_head_t wq_free;
45 char name[BUS_ID_SIZE]; 45 char name[20];
46 int max_queue; 46 int max_queue;
47 unsigned long flags; 47 unsigned long flags;
48}; 48};
@@ -781,7 +781,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
781 mutex_lock(&bsg_mutex); 781 mutex_lock(&bsg_mutex);
782 hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode))); 782 hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(iminor(inode)));
783 783
784 strncpy(bd->name, rq->bsg_dev.class_dev->bus_id, sizeof(bd->name) - 1); 784 strncpy(bd->name, dev_name(rq->bsg_dev.class_dev), sizeof(bd->name) - 1);
785 dprintk("bound to <%s>, max queue %d\n", 785 dprintk("bound to <%s>, max queue %d\n",
786 format_dev_t(buf, inode->i_rdev), bd->max_queue); 786 format_dev_t(buf, inode->i_rdev), bd->max_queue);
787 787
@@ -992,7 +992,7 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
992 if (name) 992 if (name)
993 devname = name; 993 devname = name;
994 else 994 else
995 devname = parent->bus_id; 995 devname = dev_name(parent);
996 996
997 /* 997 /*
998 * we need a proper transport to send commands, not a stacked device 998 * we need a proper transport to send commands, not a stacked device
diff --git a/block/genhd.c b/block/genhd.c
index d84a7df1e2a0..397960cf26af 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1084,7 +1084,7 @@ dev_t blk_lookup_devt(const char *name, int partno)
1084 struct gendisk *disk = dev_to_disk(dev); 1084 struct gendisk *disk = dev_to_disk(dev);
1085 struct hd_struct *part; 1085 struct hd_struct *part;
1086 1086
1087 if (strcmp(dev->bus_id, name)) 1087 if (strcmp(dev_name(dev), name))
1088 continue; 1088 continue;
1089 1089
1090 part = disk_get_part(disk, partno); 1090 part = disk_get_part(disk, partno);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 4040d8b53216..9e92107691f2 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3369,7 +3369,7 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3369 3369
3370 if (sdev) { 3370 if (sdev) {
3371 ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n", 3371 ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
3372 sdev->sdev_gendev.bus_id); 3372 dev_name(&sdev->sdev_gendev));
3373 3373
3374 scsi_remove_device(sdev); 3374 scsi_remove_device(sdev);
3375 scsi_device_put(sdev); 3375 scsi_device_put(sdev);
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
index f57652db0a2a..b9cda053d3c0 100644
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -167,7 +167,7 @@ attribute_container_add_device(struct device *dev,
167 ic->classdev.parent = get_device(dev); 167 ic->classdev.parent = get_device(dev);
168 ic->classdev.class = cont->class; 168 ic->classdev.class = cont->class;
169 cont->class->dev_release = attribute_container_release; 169 cont->class->dev_release = attribute_container_release;
170 strcpy(ic->classdev.bus_id, dev->bus_id); 170 dev_set_name(&ic->classdev, dev_name(dev));
171 if (fn) 171 if (fn)
172 fn(cont, dev, &ic->classdev); 172 fn(cont, dev, &ic->classdev);
173 else 173 else
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 0a5f055dffba..b676f8f801f8 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);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 5aee1c0169ea..0f0a50444672 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -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;
@@ -333,7 +340,7 @@ static int match_name(struct device *dev, void *data)
333{ 340{
334 const char *name = data; 341 const char *name = data;
335 342
336 return sysfs_streq(name, dev->bus_id); 343 return sysfs_streq(name, dev_name(dev));
337} 344}
338 345
339/** 346/**
@@ -461,12 +468,12 @@ int bus_add_device(struct device *dev)
461 int error = 0; 468 int error = 0;
462 469
463 if (bus) { 470 if (bus) {
464 pr_debug("bus: '%s': add device %s\n", bus->name, dev->bus_id); 471 pr_debug("bus: '%s': add device %s\n", bus->name, dev_name(dev));
465 error = device_add_attrs(bus, dev); 472 error = device_add_attrs(bus, dev);
466 if (error) 473 if (error)
467 goto out_put; 474 goto out_put;
468 error = sysfs_create_link(&bus->p->devices_kset->kobj, 475 error = sysfs_create_link(&bus->p->devices_kset->kobj,
469 &dev->kobj, dev->bus_id); 476 &dev->kobj, dev_name(dev));
470 if (error) 477 if (error)
471 goto out_id; 478 goto out_id;
472 error = sysfs_create_link(&dev->kobj, 479 error = sysfs_create_link(&dev->kobj,
@@ -482,7 +489,7 @@ int bus_add_device(struct device *dev)
482out_deprecated: 489out_deprecated:
483 sysfs_remove_link(&dev->kobj, "subsystem"); 490 sysfs_remove_link(&dev->kobj, "subsystem");
484out_subsys: 491out_subsys:
485 sysfs_remove_link(&bus->p->devices_kset->kobj, dev->bus_id); 492 sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev));
486out_id: 493out_id:
487 device_remove_attrs(bus, dev); 494 device_remove_attrs(bus, dev);
488out_put: 495out_put:
@@ -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
@@ -526,13 +534,13 @@ void bus_remove_device(struct device *dev)
526 sysfs_remove_link(&dev->kobj, "subsystem"); 534 sysfs_remove_link(&dev->kobj, "subsystem");
527 remove_deprecated_bus_links(dev); 535 remove_deprecated_bus_links(dev);
528 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, 536 sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
529 dev->bus_id); 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->bus_id); 543 dev->bus->name, dev_name(dev));
536 device_release_driver(dev); 544 device_release_driver(dev);
537 bus_put(dev->bus); 545 bus_put(dev->bus);
538 } 546 }
@@ -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}
@@ -993,18 +1003,20 @@ static void device_insertion_sort_klist(struct device *a, struct list_head *list
993{ 1003{
994 struct list_head *pos; 1004 struct list_head *pos;
995 struct klist_node *n; 1005 struct klist_node *n;
1006 struct device_private *dev_prv;
996 struct device *b; 1007 struct device *b;
997 1008
998 list_for_each(pos, list) { 1009 list_for_each(pos, list) {
999 n = container_of(pos, struct klist_node, n_node); 1010 n = container_of(pos, struct klist_node, n_node);
1000 b = container_of(n, struct device, knode_bus); 1011 dev_prv = to_device_private_bus(n);
1012 b = dev_prv->device;
1001 if (compare(a, b) <= 0) { 1013 if (compare(a, b) <= 0) {
1002 list_move_tail(&a->knode_bus.n_node, 1014 list_move_tail(&a->p->knode_bus.n_node,
1003 &b->knode_bus.n_node); 1015 &b->p->knode_bus.n_node);
1004 return; 1016 return;
1005 } 1017 }
1006 } 1018 }
1007 list_move_tail(&a->knode_bus.n_node, list); 1019 list_move_tail(&a->p->knode_bus.n_node, list);
1008} 1020}
1009 1021
1010void bus_sort_breadthfirst(struct bus_type *bus, 1022void bus_sort_breadthfirst(struct bus_type *bus,
@@ -1014,6 +1026,7 @@ void bus_sort_breadthfirst(struct bus_type *bus,
1014 LIST_HEAD(sorted_devices); 1026 LIST_HEAD(sorted_devices);
1015 struct list_head *pos, *tmp; 1027 struct list_head *pos, *tmp;
1016 struct klist_node *n; 1028 struct klist_node *n;
1029 struct device_private *dev_prv;
1017 struct device *dev; 1030 struct device *dev;
1018 struct klist *device_klist; 1031 struct klist *device_klist;
1019 1032
@@ -1022,7 +1035,8 @@ void bus_sort_breadthfirst(struct bus_type *bus,
1022 spin_lock(&device_klist->k_lock); 1035 spin_lock(&device_klist->k_lock);
1023 list_for_each_safe(pos, tmp, &device_klist->k_list) { 1036 list_for_each_safe(pos, tmp, &device_klist->k_list) {
1024 n = container_of(pos, struct klist_node, n_node); 1037 n = container_of(pos, struct klist_node, n_node);
1025 dev = container_of(n, struct device, knode_bus); 1038 dev_prv = to_device_private_bus(n);
1039 dev = dev_prv->device;
1026 device_insertion_sort_klist(dev, &sorted_devices, compare); 1040 device_insertion_sort_klist(dev, &sorted_devices, compare);
1027 } 1041 }
1028 list_splice(&sorted_devices, &device_klist->k_list); 1042 list_splice(&sorted_devices, &device_klist->k_list);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8c2cc2648f5a..61df508fa62b 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);
@@ -119,7 +120,8 @@ static void device_release(struct kobject *kobj)
119 else 120 else
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->bus_id); 123 dev_name(dev));
124 kfree(p);
123} 125}
124 126
125static struct kobj_type device_ktype = { 127static struct kobj_type device_ktype = {
@@ -209,7 +211,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
209 retval = dev->bus->uevent(dev, env); 211 retval = dev->bus->uevent(dev, env);
210 if (retval) 212 if (retval)
211 pr_debug("device: '%s': %s: bus uevent() returned %d\n", 213 pr_debug("device: '%s': %s: bus uevent() returned %d\n",
212 dev->bus_id, __func__, retval); 214 dev_name(dev), __func__, retval);
213 } 215 }
214 216
215 /* have the class specific function add its stuff */ 217 /* have the class specific function add its stuff */
@@ -217,7 +219,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
217 retval = dev->class->dev_uevent(dev, env); 219 retval = dev->class->dev_uevent(dev, env);
218 if (retval) 220 if (retval)
219 pr_debug("device: '%s': %s: class uevent() " 221 pr_debug("device: '%s': %s: class uevent() "
220 "returned %d\n", dev->bus_id, 222 "returned %d\n", dev_name(dev),
221 __func__, retval); 223 __func__, retval);
222 } 224 }
223 225
@@ -226,7 +228,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
226 retval = dev->type->uevent(dev, env); 228 retval = dev->type->uevent(dev, env);
227 if (retval) 229 if (retval)
228 pr_debug("device: '%s': %s: dev_type uevent() " 230 pr_debug("device: '%s': %s: dev_type uevent() "
229 "returned %d\n", dev->bus_id, 231 "returned %d\n", dev_name(dev),
230 __func__, retval); 232 __func__, retval);
231 } 233 }
232 234
@@ -507,14 +509,16 @@ EXPORT_SYMBOL_GPL(device_schedule_callback_owner);
507 509
508static void klist_children_get(struct klist_node *n) 510static void klist_children_get(struct klist_node *n)
509{ 511{
510 struct device *dev = container_of(n, struct device, knode_parent); 512 struct device_private *p = to_device_private_parent(n);
513 struct device *dev = p->device;
511 514
512 get_device(dev); 515 get_device(dev);
513} 516}
514 517
515static void klist_children_put(struct klist_node *n) 518static void klist_children_put(struct klist_node *n)
516{ 519{
517 struct device *dev = container_of(n, struct device, knode_parent); 520 struct device_private *p = to_device_private_parent(n);
521 struct device *dev = p->device;
518 522
519 put_device(dev); 523 put_device(dev);
520} 524}
@@ -536,9 +540,15 @@ static void klist_children_put(struct klist_node *n)
536 */ 540 */
537void device_initialize(struct device *dev) 541void device_initialize(struct device *dev)
538{ 542{
543 dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL);
544 if (!dev->p) {
545 WARN_ON(1);
546 return;
547 }
548 dev->p->device = dev;
539 dev->kobj.kset = devices_kset; 549 dev->kobj.kset = devices_kset;
540 kobject_init(&dev->kobj, &device_ktype); 550 kobject_init(&dev->kobj, &device_ktype);
541 klist_init(&dev->klist_children, klist_children_get, 551 klist_init(&dev->p->klist_children, klist_children_get,
542 klist_children_put); 552 klist_children_put);
543 INIT_LIST_HEAD(&dev->dma_pools); 553 INIT_LIST_HEAD(&dev->dma_pools);
544 init_MUTEX(&dev->sem); 554 init_MUTEX(&dev->sem);
@@ -672,7 +682,7 @@ static int device_add_class_symlinks(struct device *dev)
672 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 682 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
673 device_is_not_partition(dev)) { 683 device_is_not_partition(dev)) {
674 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 684 error = sysfs_create_link(&dev->class->p->class_subsys.kobj,
675 &dev->kobj, dev->bus_id); 685 &dev->kobj, dev_name(dev));
676 if (error) 686 if (error)
677 goto out_subsys; 687 goto out_subsys;
678 } 688 }
@@ -712,11 +722,11 @@ out_busid:
712 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 722 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
713 device_is_not_partition(dev)) 723 device_is_not_partition(dev))
714 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 724 sysfs_remove_link(&dev->class->p->class_subsys.kobj,
715 dev->bus_id); 725 dev_name(dev));
716#else 726#else
717 /* link in the class directory pointing to the device */ 727 /* link in the class directory pointing to the device */
718 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 728 error = sysfs_create_link(&dev->class->p->class_subsys.kobj,
719 &dev->kobj, dev->bus_id); 729 &dev->kobj, dev_name(dev));
720 if (error) 730 if (error)
721 goto out_subsys; 731 goto out_subsys;
722 732
@@ -729,7 +739,7 @@ out_busid:
729 return 0; 739 return 0;
730 740
731out_busid: 741out_busid:
732 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); 742 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
733#endif 743#endif
734 744
735out_subsys: 745out_subsys:
@@ -758,12 +768,12 @@ static void device_remove_class_symlinks(struct device *dev)
758 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 768 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
759 device_is_not_partition(dev)) 769 device_is_not_partition(dev))
760 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 770 sysfs_remove_link(&dev->class->p->class_subsys.kobj,
761 dev->bus_id); 771 dev_name(dev));
762#else 772#else
763 if (dev->parent && device_is_not_partition(dev)) 773 if (dev->parent && device_is_not_partition(dev))
764 sysfs_remove_link(&dev->kobj, "device"); 774 sysfs_remove_link(&dev->kobj, "device");
765 775
766 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); 776 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
767#endif 777#endif
768 778
769 sysfs_remove_link(&dev->kobj, "subsystem"); 779 sysfs_remove_link(&dev->kobj, "subsystem");
@@ -866,7 +876,7 @@ int device_add(struct device *dev)
866 if (!strlen(dev->bus_id)) 876 if (!strlen(dev->bus_id))
867 goto done; 877 goto done;
868 878
869 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 879 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
870 880
871 parent = get_device(dev->parent); 881 parent = get_device(dev->parent);
872 setup_parent(dev, parent); 882 setup_parent(dev, parent);
@@ -876,7 +886,7 @@ int device_add(struct device *dev)
876 set_dev_node(dev, dev_to_node(parent)); 886 set_dev_node(dev, dev_to_node(parent));
877 887
878 /* first, register with generic layer. */ 888 /* first, register with generic layer. */
879 error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); 889 error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev));
880 if (error) 890 if (error)
881 goto Error; 891 goto Error;
882 892
@@ -884,11 +894,6 @@ int device_add(struct device *dev)
884 if (platform_notify) 894 if (platform_notify)
885 platform_notify(dev); 895 platform_notify(dev);
886 896
887 /* notify clients of device entry (new way) */
888 if (dev->bus)
889 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
890 BUS_NOTIFY_ADD_DEVICE, dev);
891
892 error = device_create_file(dev, &uevent_attr); 897 error = device_create_file(dev, &uevent_attr);
893 if (error) 898 if (error)
894 goto attrError; 899 goto attrError;
@@ -916,10 +921,19 @@ int device_add(struct device *dev)
916 if (error) 921 if (error)
917 goto DPMError; 922 goto DPMError;
918 device_pm_add(dev); 923 device_pm_add(dev);
924
925 /* Notify clients of device addition. This call must come
926 * after dpm_sysf_add() and before kobject_uevent().
927 */
928 if (dev->bus)
929 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
930 BUS_NOTIFY_ADD_DEVICE, dev);
931
919 kobject_uevent(&dev->kobj, KOBJ_ADD); 932 kobject_uevent(&dev->kobj, KOBJ_ADD);
920 bus_attach_device(dev); 933 bus_attach_device(dev);
921 if (parent) 934 if (parent)
922 klist_add_tail(&dev->knode_parent, &parent->klist_children); 935 klist_add_tail(&dev->p->knode_parent,
936 &parent->p->klist_children);
923 937
924 if (dev->class) { 938 if (dev->class) {
925 mutex_lock(&dev->class->p->class_mutex); 939 mutex_lock(&dev->class->p->class_mutex);
@@ -940,9 +954,6 @@ done:
940 DPMError: 954 DPMError:
941 bus_remove_device(dev); 955 bus_remove_device(dev);
942 BusError: 956 BusError:
943 if (dev->bus)
944 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
945 BUS_NOTIFY_DEL_DEVICE, dev);
946 device_remove_attrs(dev); 957 device_remove_attrs(dev);
947 AttrsError: 958 AttrsError:
948 device_remove_class_symlinks(dev); 959 device_remove_class_symlinks(dev);
@@ -1027,10 +1038,16 @@ void device_del(struct device *dev)
1027 struct device *parent = dev->parent; 1038 struct device *parent = dev->parent;
1028 struct class_interface *class_intf; 1039 struct class_interface *class_intf;
1029 1040
1041 /* Notify clients of device removal. This call must come
1042 * before dpm_sysfs_remove().
1043 */
1044 if (dev->bus)
1045 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
1046 BUS_NOTIFY_DEL_DEVICE, dev);
1030 device_pm_remove(dev); 1047 device_pm_remove(dev);
1031 dpm_sysfs_remove(dev); 1048 dpm_sysfs_remove(dev);
1032 if (parent) 1049 if (parent)
1033 klist_del(&dev->knode_parent); 1050 klist_del(&dev->p->knode_parent);
1034 if (MAJOR(dev->devt)) { 1051 if (MAJOR(dev->devt)) {
1035 device_remove_sys_dev_entry(dev); 1052 device_remove_sys_dev_entry(dev);
1036 device_remove_file(dev, &devt_attr); 1053 device_remove_file(dev, &devt_attr);
@@ -1064,9 +1081,6 @@ void device_del(struct device *dev)
1064 */ 1081 */
1065 if (platform_notify_remove) 1082 if (platform_notify_remove)
1066 platform_notify_remove(dev); 1083 platform_notify_remove(dev);
1067 if (dev->bus)
1068 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
1069 BUS_NOTIFY_DEL_DEVICE, dev);
1070 kobject_uevent(&dev->kobj, KOBJ_REMOVE); 1084 kobject_uevent(&dev->kobj, KOBJ_REMOVE);
1071 cleanup_device_parent(dev); 1085 cleanup_device_parent(dev);
1072 kobject_del(&dev->kobj); 1086 kobject_del(&dev->kobj);
@@ -1086,7 +1100,7 @@ void device_del(struct device *dev)
1086 */ 1100 */
1087void device_unregister(struct device *dev) 1101void device_unregister(struct device *dev)
1088{ 1102{
1089 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 1103 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
1090 device_del(dev); 1104 device_del(dev);
1091 put_device(dev); 1105 put_device(dev);
1092} 1106}
@@ -1094,7 +1108,14 @@ void device_unregister(struct device *dev)
1094static struct device *next_device(struct klist_iter *i) 1108static struct device *next_device(struct klist_iter *i)
1095{ 1109{
1096 struct klist_node *n = klist_next(i); 1110 struct klist_node *n = klist_next(i);
1097 return n ? container_of(n, struct device, knode_parent) : NULL; 1111 struct device *dev = NULL;
1112 struct device_private *p;
1113
1114 if (n) {
1115 p = to_device_private_parent(n);
1116 dev = p->device;
1117 }
1118 return dev;
1098} 1119}
1099 1120
1100/** 1121/**
@@ -1116,7 +1137,7 @@ int device_for_each_child(struct device *parent, void *data,
1116 struct device *child; 1137 struct device *child;
1117 int error = 0; 1138 int error = 0;
1118 1139
1119 klist_iter_init(&parent->klist_children, &i); 1140 klist_iter_init(&parent->p->klist_children, &i);
1120 while ((child = next_device(&i)) && !error) 1141 while ((child = next_device(&i)) && !error)
1121 error = fn(child, data); 1142 error = fn(child, data);
1122 klist_iter_exit(&i); 1143 klist_iter_exit(&i);
@@ -1147,7 +1168,7 @@ struct device *device_find_child(struct device *parent, void *data,
1147 if (!parent) 1168 if (!parent)
1148 return NULL; 1169 return NULL;
1149 1170
1150 klist_iter_init(&parent->klist_children, &i); 1171 klist_iter_init(&parent->p->klist_children, &i);
1151 while ((child = next_device(&i))) 1172 while ((child = next_device(&i)))
1152 if (match(child, data) && get_device(child)) 1173 if (match(child, data) && get_device(child))
1153 break; 1174 break;
@@ -1196,10 +1217,101 @@ EXPORT_SYMBOL_GPL(put_device);
1196EXPORT_SYMBOL_GPL(device_create_file); 1217EXPORT_SYMBOL_GPL(device_create_file);
1197EXPORT_SYMBOL_GPL(device_remove_file); 1218EXPORT_SYMBOL_GPL(device_remove_file);
1198 1219
1220struct root_device
1221{
1222 struct device dev;
1223 struct module *owner;
1224};
1225
1226#define to_root_device(dev) container_of(dev, struct root_device, dev)
1227
1228static void root_device_release(struct device *dev)
1229{
1230 kfree(to_root_device(dev));
1231}
1232
1233/**
1234 * __root_device_register - allocate and register a root device
1235 * @name: root device name
1236 * @owner: owner module of the root device, usually THIS_MODULE
1237 *
1238 * This function allocates a root device and registers it
1239 * using device_register(). In order to free the returned
1240 * device, use root_device_unregister().
1241 *
1242 * Root devices are dummy devices which allow other devices
1243 * to be grouped under /sys/devices. Use this function to
1244 * allocate a root device and then use it as the parent of
1245 * any device which should appear under /sys/devices/{name}
1246 *
1247 * The /sys/devices/{name} directory will also contain a
1248 * 'module' symlink which points to the @owner directory
1249 * in sysfs.
1250 *
1251 * Note: You probably want to use root_device_register().
1252 */
1253struct device *__root_device_register(const char *name, struct module *owner)
1254{
1255 struct root_device *root;
1256 int err = -ENOMEM;
1257
1258 root = kzalloc(sizeof(struct root_device), GFP_KERNEL);
1259 if (!root)
1260 return ERR_PTR(err);
1261
1262 err = dev_set_name(&root->dev, name);
1263 if (err) {
1264 kfree(root);
1265 return ERR_PTR(err);
1266 }
1267
1268 root->dev.release = root_device_release;
1269
1270 err = device_register(&root->dev);
1271 if (err) {
1272 put_device(&root->dev);
1273 return ERR_PTR(err);
1274 }
1275
1276#ifdef CONFIG_MODULE /* gotta find a "cleaner" way to do this */
1277 if (owner) {
1278 struct module_kobject *mk = &owner->mkobj;
1279
1280 err = sysfs_create_link(&root->dev.kobj, &mk->kobj, "module");
1281 if (err) {
1282 device_unregister(&root->dev);
1283 return ERR_PTR(err);
1284 }
1285 root->owner = owner;
1286 }
1287#endif
1288
1289 return &root->dev;
1290}
1291EXPORT_SYMBOL_GPL(__root_device_register);
1292
1293/**
1294 * root_device_unregister - unregister and free a root device
1295 * @root: device going away.
1296 *
1297 * This function unregisters and cleans up a device that was created by
1298 * root_device_register().
1299 */
1300void root_device_unregister(struct device *dev)
1301{
1302 struct root_device *root = to_root_device(dev);
1303
1304 if (root->owner)
1305 sysfs_remove_link(&root->dev.kobj, "module");
1306
1307 device_unregister(dev);
1308}
1309EXPORT_SYMBOL_GPL(root_device_unregister);
1310
1199 1311
1200static void device_create_release(struct device *dev) 1312static void device_create_release(struct device *dev)
1201{ 1313{
1202 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 1314 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
1203 kfree(dev); 1315 kfree(dev);
1204} 1316}
1205 1317
@@ -1344,7 +1456,7 @@ int device_rename(struct device *dev, char *new_name)
1344 if (!dev) 1456 if (!dev)
1345 return -EINVAL; 1457 return -EINVAL;
1346 1458
1347 pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id, 1459 pr_debug("device: '%s': %s: renaming to '%s'\n", dev_name(dev),
1348 __func__, new_name); 1460 __func__, new_name);
1349 1461
1350#ifdef CONFIG_SYSFS_DEPRECATED 1462#ifdef CONFIG_SYSFS_DEPRECATED
@@ -1381,7 +1493,7 @@ int device_rename(struct device *dev, char *new_name)
1381#else 1493#else
1382 if (dev->class) { 1494 if (dev->class) {
1383 error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, 1495 error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj,
1384 &dev->kobj, dev->bus_id); 1496 &dev->kobj, dev_name(dev));
1385 if (error) 1497 if (error)
1386 goto out; 1498 goto out;
1387 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 1499 sysfs_remove_link(&dev->class->p->class_subsys.kobj,
@@ -1459,8 +1571,8 @@ int device_move(struct device *dev, struct device *new_parent)
1459 new_parent = get_device(new_parent); 1571 new_parent = get_device(new_parent);
1460 new_parent_kobj = get_device_parent(dev, new_parent); 1572 new_parent_kobj = get_device_parent(dev, new_parent);
1461 1573
1462 pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id, 1574 pr_debug("device: '%s': %s: moving to '%s'\n", dev_name(dev),
1463 __func__, new_parent ? new_parent->bus_id : "<NULL>"); 1575 __func__, new_parent ? dev_name(new_parent) : "<NULL>");
1464 error = kobject_move(&dev->kobj, new_parent_kobj); 1576 error = kobject_move(&dev->kobj, new_parent_kobj);
1465 if (error) { 1577 if (error) {
1466 cleanup_glue_dir(dev, new_parent_kobj); 1578 cleanup_glue_dir(dev, new_parent_kobj);
@@ -1470,9 +1582,10 @@ int device_move(struct device *dev, struct device *new_parent)
1470 old_parent = dev->parent; 1582 old_parent = dev->parent;
1471 dev->parent = new_parent; 1583 dev->parent = new_parent;
1472 if (old_parent) 1584 if (old_parent)
1473 klist_remove(&dev->knode_parent); 1585 klist_remove(&dev->p->knode_parent);
1474 if (new_parent) { 1586 if (new_parent) {
1475 klist_add_tail(&dev->knode_parent, &new_parent->klist_children); 1587 klist_add_tail(&dev->p->knode_parent,
1588 &new_parent->p->klist_children);
1476 set_dev_node(dev, dev_to_node(new_parent)); 1589 set_dev_node(dev, dev_to_node(new_parent));
1477 } 1590 }
1478 1591
@@ -1484,11 +1597,11 @@ int device_move(struct device *dev, struct device *new_parent)
1484 device_move_class_links(dev, new_parent, old_parent); 1597 device_move_class_links(dev, new_parent, old_parent);
1485 if (!kobject_move(&dev->kobj, &old_parent->kobj)) { 1598 if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
1486 if (new_parent) 1599 if (new_parent)
1487 klist_remove(&dev->knode_parent); 1600 klist_remove(&dev->p->knode_parent);
1488 dev->parent = old_parent; 1601 dev->parent = old_parent;
1489 if (old_parent) { 1602 if (old_parent) {
1490 klist_add_tail(&dev->knode_parent, 1603 klist_add_tail(&dev->p->knode_parent,
1491 &old_parent->klist_children); 1604 &old_parent->p->klist_children);
1492 set_dev_node(dev, dev_to_node(old_parent)); 1605 set_dev_node(dev, dev_to_node(old_parent));
1493 } 1606 }
1494 } 1607 }
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 20febc00a525..6fdaf76f033f 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -28,20 +28,20 @@
28 28
29static void driver_bound(struct device *dev) 29static void driver_bound(struct device *dev)
30{ 30{
31 if (klist_node_attached(&dev->knode_driver)) { 31 if (klist_node_attached(&dev->p->knode_driver)) {
32 printk(KERN_WARNING "%s: device %s already bound\n", 32 printk(KERN_WARNING "%s: device %s already bound\n",
33 __func__, kobject_name(&dev->kobj)); 33 __func__, kobject_name(&dev->kobj));
34 return; 34 return;
35 } 35 }
36 36
37 pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->bus_id, 37 pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
38 __func__, dev->driver->name); 38 __func__, dev->driver->name);
39 39
40 if (dev->bus) 40 if (dev->bus)
41 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 41 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
42 BUS_NOTIFY_BOUND_DRIVER, dev); 42 BUS_NOTIFY_BOUND_DRIVER, dev);
43 43
44 klist_add_tail(&dev->knode_driver, &dev->driver->p->klist_devices); 44 klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
45} 45}
46 46
47static int driver_sysfs_add(struct device *dev) 47static int driver_sysfs_add(struct device *dev)
@@ -104,13 +104,13 @@ static int really_probe(struct device *dev, struct device_driver *drv)
104 104
105 atomic_inc(&probe_count); 105 atomic_inc(&probe_count);
106 pr_debug("bus: '%s': %s: probing driver %s with device %s\n", 106 pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
107 drv->bus->name, __func__, drv->name, dev->bus_id); 107 drv->bus->name, __func__, drv->name, dev_name(dev));
108 WARN_ON(!list_empty(&dev->devres_head)); 108 WARN_ON(!list_empty(&dev->devres_head));
109 109
110 dev->driver = drv; 110 dev->driver = drv;
111 if (driver_sysfs_add(dev)) { 111 if (driver_sysfs_add(dev)) {
112 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", 112 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
113 __func__, dev->bus_id); 113 __func__, dev_name(dev));
114 goto probe_failed; 114 goto probe_failed;
115 } 115 }
116 116
@@ -127,7 +127,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
127 driver_bound(dev); 127 driver_bound(dev);
128 ret = 1; 128 ret = 1;
129 pr_debug("bus: '%s': %s: bound device %s to driver %s\n", 129 pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
130 drv->bus->name, __func__, dev->bus_id, drv->name); 130 drv->bus->name, __func__, dev_name(dev), drv->name);
131 goto done; 131 goto done;
132 132
133probe_failed: 133probe_failed:
@@ -139,7 +139,7 @@ probe_failed:
139 /* driver matched but the probe failed */ 139 /* driver matched but the probe failed */
140 printk(KERN_WARNING 140 printk(KERN_WARNING
141 "%s: probe of %s failed with error %d\n", 141 "%s: probe of %s failed with error %d\n",
142 drv->name, dev->bus_id, ret); 142 drv->name, dev_name(dev), ret);
143 } 143 }
144 /* 144 /*
145 * Ignore errors returned by ->probe so that the next driver can try 145 * Ignore errors returned by ->probe so that the next driver can try
@@ -194,7 +194,7 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
194 goto done; 194 goto done;
195 195
196 pr_debug("bus: '%s': %s: matched device %s with driver %s\n", 196 pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
197 drv->bus->name, __func__, dev->bus_id, drv->name); 197 drv->bus->name, __func__, dev_name(dev), drv->name);
198 198
199 ret = really_probe(dev, drv); 199 ret = really_probe(dev, drv);
200 200
@@ -298,7 +298,6 @@ static void __device_release_driver(struct device *dev)
298 drv = dev->driver; 298 drv = dev->driver;
299 if (drv) { 299 if (drv) {
300 driver_sysfs_remove(dev); 300 driver_sysfs_remove(dev);
301 sysfs_remove_link(&dev->kobj, "driver");
302 301
303 if (dev->bus) 302 if (dev->bus)
304 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 303 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
@@ -311,7 +310,7 @@ static void __device_release_driver(struct device *dev)
311 drv->remove(dev); 310 drv->remove(dev);
312 devres_release_all(dev); 311 devres_release_all(dev);
313 dev->driver = NULL; 312 dev->driver = NULL;
314 klist_remove(&dev->knode_driver); 313 klist_remove(&dev->p->knode_driver);
315 } 314 }
316} 315}
317 316
@@ -341,6 +340,7 @@ EXPORT_SYMBOL_GPL(device_release_driver);
341 */ 340 */
342void driver_detach(struct device_driver *drv) 341void driver_detach(struct device_driver *drv)
343{ 342{
343 struct device_private *dev_prv;
344 struct device *dev; 344 struct device *dev;
345 345
346 for (;;) { 346 for (;;) {
@@ -349,8 +349,10 @@ void driver_detach(struct device_driver *drv)
349 spin_unlock(&drv->p->klist_devices.k_lock); 349 spin_unlock(&drv->p->klist_devices.k_lock);
350 break; 350 break;
351 } 351 }
352 dev = list_entry(drv->p->klist_devices.k_list.prev, 352 dev_prv = list_entry(drv->p->klist_devices.k_list.prev,
353 struct device, knode_driver.n_node); 353 struct device_private,
354 knode_driver.n_node);
355 dev = dev_prv->device;
354 get_device(dev); 356 get_device(dev);
355 spin_unlock(&drv->p->klist_devices.k_lock); 357 spin_unlock(&drv->p->klist_devices.k_lock);
356 358
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1e2bda780e48..b76cc69f1106 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;
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b7e571031ecd..44699d9dd85c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -291,12 +291,6 @@ firmware_class_timeout(u_long data)
291 fw_load_abort(fw_priv); 291 fw_load_abort(fw_priv);
292} 292}
293 293
294static inline void fw_setup_device_id(struct device *f_dev, struct device *dev)
295{
296 /* XXX warning we should watch out for name collisions */
297 strlcpy(f_dev->bus_id, dev->bus_id, BUS_ID_SIZE);
298}
299
300static int fw_register_device(struct device **dev_p, const char *fw_name, 294static int fw_register_device(struct device **dev_p, const char *fw_name,
301 struct device *device) 295 struct device *device)
302{ 296{
@@ -321,7 +315,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
321 fw_priv->timeout.data = (u_long) fw_priv; 315 fw_priv->timeout.data = (u_long) fw_priv;
322 init_timer(&fw_priv->timeout); 316 init_timer(&fw_priv->timeout);
323 317
324 fw_setup_device_id(f_dev, device); 318 dev_set_name(f_dev, dev_name(device));
325 f_dev->parent = device; 319 f_dev->parent = device;
326 f_dev->class = &firmware_class; 320 f_dev->class = &firmware_class;
327 dev_set_drvdata(f_dev, fw_priv); 321 dev_set_drvdata(f_dev, fw_priv);
diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index efd577574948..479694b6cbe3 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -11,7 +11,7 @@
11#include <linux/isa.h> 11#include <linux/isa.h>
12 12
13static struct device isa_bus = { 13static struct device isa_bus = {
14 .bus_id = "isa" 14 .init_name = "isa"
15}; 15};
16 16
17struct isa_dev { 17struct isa_dev {
@@ -135,9 +135,8 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
135 isa_dev->dev.parent = &isa_bus; 135 isa_dev->dev.parent = &isa_bus;
136 isa_dev->dev.bus = &isa_bus_type; 136 isa_dev->dev.bus = &isa_bus_type;
137 137
138 snprintf(isa_dev->dev.bus_id, BUS_ID_SIZE, "%s.%u", 138 dev_set_name(&isa_dev->dev, "%s.%u",
139 isa_driver->driver.name, id); 139 isa_driver->driver.name, id);
140
141 isa_dev->dev.platform_data = isa_driver; 140 isa_dev->dev.platform_data = isa_driver;
142 isa_dev->dev.release = isa_dev_release; 141 isa_dev->dev.release = isa_dev_release;
143 isa_dev->id = id; 142 isa_dev->id = id;
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index dfcbfe504867..349a1013603f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -24,7 +24,7 @@
24 driver)) 24 driver))
25 25
26struct device platform_bus = { 26struct device platform_bus = {
27 .bus_id = "platform", 27 .init_name = "platform",
28}; 28};
29EXPORT_SYMBOL_GPL(platform_bus); 29EXPORT_SYMBOL_GPL(platform_bus);
30 30
@@ -242,16 +242,15 @@ int platform_device_add(struct platform_device *pdev)
242 pdev->dev.bus = &platform_bus_type; 242 pdev->dev.bus = &platform_bus_type;
243 243
244 if (pdev->id != -1) 244 if (pdev->id != -1)
245 snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%d", pdev->name, 245 dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
246 pdev->id);
247 else 246 else
248 strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE); 247 dev_set_name(&pdev->dev, pdev->name);
249 248
250 for (i = 0; i < pdev->num_resources; i++) { 249 for (i = 0; i < pdev->num_resources; i++) {
251 struct resource *p, *r = &pdev->resource[i]; 250 struct resource *p, *r = &pdev->resource[i];
252 251
253 if (r->name == NULL) 252 if (r->name == NULL)
254 r->name = pdev->dev.bus_id; 253 r->name = dev_name(&pdev->dev);
255 254
256 p = r->parent; 255 p = r->parent;
257 if (!p) { 256 if (!p) {
@@ -264,14 +263,14 @@ int platform_device_add(struct platform_device *pdev)
264 if (p && insert_resource(p, r)) { 263 if (p && insert_resource(p, r)) {
265 printk(KERN_ERR 264 printk(KERN_ERR
266 "%s: failed to claim resource %d\n", 265 "%s: failed to claim resource %d\n",
267 pdev->dev.bus_id, i); 266 dev_name(&pdev->dev), i);
268 ret = -EBUSY; 267 ret = -EBUSY;
269 goto failed; 268 goto failed;
270 } 269 }
271 } 270 }
272 271
273 pr_debug("Registering platform device '%s'. Parent at %s\n", 272 pr_debug("Registering platform device '%s'. Parent at %s\n",
274 pdev->dev.bus_id, pdev->dev.parent->bus_id); 273 dev_name(&pdev->dev), dev_name(pdev->dev.parent));
275 274
276 ret = device_add(&pdev->dev); 275 ret = device_add(&pdev->dev);
277 if (ret == 0) 276 if (ret == 0)
@@ -503,8 +502,6 @@ int platform_driver_register(struct platform_driver *drv)
503 drv->driver.suspend = platform_drv_suspend; 502 drv->driver.suspend = platform_drv_suspend;
504 if (drv->resume) 503 if (drv->resume)
505 drv->driver.resume = platform_drv_resume; 504 drv->driver.resume = platform_drv_resume;
506 if (drv->pm)
507 drv->driver.pm = &drv->pm->base;
508 return driver_register(&drv->driver); 505 return driver_register(&drv->driver);
509} 506}
510EXPORT_SYMBOL_GPL(platform_driver_register); 507EXPORT_SYMBOL_GPL(platform_driver_register);
@@ -609,7 +606,7 @@ static int platform_match(struct device *dev, struct device_driver *drv)
609 struct platform_device *pdev; 606 struct platform_device *pdev;
610 607
611 pdev = container_of(dev, struct platform_device, dev); 608 pdev = container_of(dev, struct platform_device, dev);
612 return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0); 609 return (strcmp(pdev->name, drv->name) == 0);
613} 610}
614 611
615#ifdef CONFIG_PM_SLEEP 612#ifdef CONFIG_PM_SLEEP
@@ -686,7 +683,10 @@ static int platform_pm_suspend(struct device *dev)
686 struct device_driver *drv = dev->driver; 683 struct device_driver *drv = dev->driver;
687 int ret = 0; 684 int ret = 0;
688 685
689 if (drv && drv->pm) { 686 if (!drv)
687 return 0;
688
689 if (drv->pm) {
690 if (drv->pm->suspend) 690 if (drv->pm->suspend)
691 ret = drv->pm->suspend(dev); 691 ret = drv->pm->suspend(dev);
692 } else { 692 } else {
@@ -698,16 +698,15 @@ static int platform_pm_suspend(struct device *dev)
698 698
699static int platform_pm_suspend_noirq(struct device *dev) 699static int platform_pm_suspend_noirq(struct device *dev)
700{ 700{
701 struct platform_driver *pdrv; 701 struct device_driver *drv = dev->driver;
702 int ret = 0; 702 int ret = 0;
703 703
704 if (!dev->driver) 704 if (!drv)
705 return 0; 705 return 0;
706 706
707 pdrv = to_platform_driver(dev->driver); 707 if (drv->pm) {
708 if (pdrv->pm) { 708 if (drv->pm->suspend_noirq)
709 if (pdrv->pm->suspend_noirq) 709 ret = drv->pm->suspend_noirq(dev);
710 ret = pdrv->pm->suspend_noirq(dev);
711 } else { 710 } else {
712 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND); 711 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
713 } 712 }
@@ -720,7 +719,10 @@ static int platform_pm_resume(struct device *dev)
720 struct device_driver *drv = dev->driver; 719 struct device_driver *drv = dev->driver;
721 int ret = 0; 720 int ret = 0;
722 721
723 if (drv && drv->pm) { 722 if (!drv)
723 return 0;
724
725 if (drv->pm) {
724 if (drv->pm->resume) 726 if (drv->pm->resume)
725 ret = drv->pm->resume(dev); 727 ret = drv->pm->resume(dev);
726 } else { 728 } else {
@@ -732,16 +734,15 @@ static int platform_pm_resume(struct device *dev)
732 734
733static int platform_pm_resume_noirq(struct device *dev) 735static int platform_pm_resume_noirq(struct device *dev)
734{ 736{
735 struct platform_driver *pdrv; 737 struct device_driver *drv = dev->driver;
736 int ret = 0; 738 int ret = 0;
737 739
738 if (!dev->driver) 740 if (!drv)
739 return 0; 741 return 0;
740 742
741 pdrv = to_platform_driver(dev->driver); 743 if (drv->pm) {
742 if (pdrv->pm) { 744 if (drv->pm->resume_noirq)
743 if (pdrv->pm->resume_noirq) 745 ret = drv->pm->resume_noirq(dev);
744 ret = pdrv->pm->resume_noirq(dev);
745 } else { 746 } else {
746 ret = platform_legacy_resume_early(dev); 747 ret = platform_legacy_resume_early(dev);
747 } 748 }
@@ -780,16 +781,15 @@ static int platform_pm_freeze(struct device *dev)
780 781
781static int platform_pm_freeze_noirq(struct device *dev) 782static int platform_pm_freeze_noirq(struct device *dev)
782{ 783{
783 struct platform_driver *pdrv; 784 struct device_driver *drv = dev->driver;
784 int ret = 0; 785 int ret = 0;
785 786
786 if (!dev->driver) 787 if (!drv)
787 return 0; 788 return 0;
788 789
789 pdrv = to_platform_driver(dev->driver); 790 if (drv->pm) {
790 if (pdrv->pm) { 791 if (drv->pm->freeze_noirq)
791 if (pdrv->pm->freeze_noirq) 792 ret = drv->pm->freeze_noirq(dev);
792 ret = pdrv->pm->freeze_noirq(dev);
793 } else { 793 } else {
794 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE); 794 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
795 } 795 }
@@ -802,7 +802,10 @@ static int platform_pm_thaw(struct device *dev)
802 struct device_driver *drv = dev->driver; 802 struct device_driver *drv = dev->driver;
803 int ret = 0; 803 int ret = 0;
804 804
805 if (drv && drv->pm) { 805 if (!drv)
806 return 0;
807
808 if (drv->pm) {
806 if (drv->pm->thaw) 809 if (drv->pm->thaw)
807 ret = drv->pm->thaw(dev); 810 ret = drv->pm->thaw(dev);
808 } else { 811 } else {
@@ -814,16 +817,15 @@ static int platform_pm_thaw(struct device *dev)
814 817
815static int platform_pm_thaw_noirq(struct device *dev) 818static int platform_pm_thaw_noirq(struct device *dev)
816{ 819{
817 struct platform_driver *pdrv; 820 struct device_driver *drv = dev->driver;
818 int ret = 0; 821 int ret = 0;
819 822
820 if (!dev->driver) 823 if (!drv)
821 return 0; 824 return 0;
822 825
823 pdrv = to_platform_driver(dev->driver); 826 if (drv->pm) {
824 if (pdrv->pm) { 827 if (drv->pm->thaw_noirq)
825 if (pdrv->pm->thaw_noirq) 828 ret = drv->pm->thaw_noirq(dev);
826 ret = pdrv->pm->thaw_noirq(dev);
827 } else { 829 } else {
828 ret = platform_legacy_resume_early(dev); 830 ret = platform_legacy_resume_early(dev);
829 } 831 }
@@ -836,7 +838,10 @@ static int platform_pm_poweroff(struct device *dev)
836 struct device_driver *drv = dev->driver; 838 struct device_driver *drv = dev->driver;
837 int ret = 0; 839 int ret = 0;
838 840
839 if (drv && drv->pm) { 841 if (!drv)
842 return 0;
843
844 if (drv->pm) {
840 if (drv->pm->poweroff) 845 if (drv->pm->poweroff)
841 ret = drv->pm->poweroff(dev); 846 ret = drv->pm->poweroff(dev);
842 } else { 847 } else {
@@ -848,16 +853,15 @@ static int platform_pm_poweroff(struct device *dev)
848 853
849static int platform_pm_poweroff_noirq(struct device *dev) 854static int platform_pm_poweroff_noirq(struct device *dev)
850{ 855{
851 struct platform_driver *pdrv; 856 struct device_driver *drv = dev->driver;
852 int ret = 0; 857 int ret = 0;
853 858
854 if (!dev->driver) 859 if (!drv)
855 return 0; 860 return 0;
856 861
857 pdrv = to_platform_driver(dev->driver); 862 if (drv->pm) {
858 if (pdrv->pm) { 863 if (drv->pm->poweroff_noirq)
859 if (pdrv->pm->poweroff_noirq) 864 ret = drv->pm->poweroff_noirq(dev);
860 ret = pdrv->pm->poweroff_noirq(dev);
861 } else { 865 } else {
862 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE); 866 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
863 } 867 }
@@ -870,7 +874,10 @@ static int platform_pm_restore(struct device *dev)
870 struct device_driver *drv = dev->driver; 874 struct device_driver *drv = dev->driver;
871 int ret = 0; 875 int ret = 0;
872 876
873 if (drv && drv->pm) { 877 if (!drv)
878 return 0;
879
880 if (drv->pm) {
874 if (drv->pm->restore) 881 if (drv->pm->restore)
875 ret = drv->pm->restore(dev); 882 ret = drv->pm->restore(dev);
876 } else { 883 } else {
@@ -882,16 +889,15 @@ static int platform_pm_restore(struct device *dev)
882 889
883static int platform_pm_restore_noirq(struct device *dev) 890static int platform_pm_restore_noirq(struct device *dev)
884{ 891{
885 struct platform_driver *pdrv; 892 struct device_driver *drv = dev->driver;
886 int ret = 0; 893 int ret = 0;
887 894
888 if (!dev->driver) 895 if (!drv)
889 return 0; 896 return 0;
890 897
891 pdrv = to_platform_driver(dev->driver); 898 if (drv->pm) {
892 if (pdrv->pm) { 899 if (drv->pm->restore_noirq)
893 if (pdrv->pm->restore_noirq) 900 ret = drv->pm->restore_noirq(dev);
894 ret = pdrv->pm->restore_noirq(dev);
895 } else { 901 } else {
896 ret = platform_legacy_resume_early(dev); 902 ret = platform_legacy_resume_early(dev);
897 } 903 }
@@ -912,17 +918,15 @@ static int platform_pm_restore_noirq(struct device *dev)
912 918
913#endif /* !CONFIG_HIBERNATION */ 919#endif /* !CONFIG_HIBERNATION */
914 920
915static struct pm_ext_ops platform_pm_ops = { 921static struct dev_pm_ops platform_dev_pm_ops = {
916 .base = { 922 .prepare = platform_pm_prepare,
917 .prepare = platform_pm_prepare, 923 .complete = platform_pm_complete,
918 .complete = platform_pm_complete, 924 .suspend = platform_pm_suspend,
919 .suspend = platform_pm_suspend, 925 .resume = platform_pm_resume,
920 .resume = platform_pm_resume, 926 .freeze = platform_pm_freeze,
921 .freeze = platform_pm_freeze, 927 .thaw = platform_pm_thaw,
922 .thaw = platform_pm_thaw, 928 .poweroff = platform_pm_poweroff,
923 .poweroff = platform_pm_poweroff, 929 .restore = platform_pm_restore,
924 .restore = platform_pm_restore,
925 },
926 .suspend_noirq = platform_pm_suspend_noirq, 930 .suspend_noirq = platform_pm_suspend_noirq,
927 .resume_noirq = platform_pm_resume_noirq, 931 .resume_noirq = platform_pm_resume_noirq,
928 .freeze_noirq = platform_pm_freeze_noirq, 932 .freeze_noirq = platform_pm_freeze_noirq,
@@ -931,7 +935,7 @@ static struct pm_ext_ops platform_pm_ops = {
931 .restore_noirq = platform_pm_restore_noirq, 935 .restore_noirq = platform_pm_restore_noirq,
932}; 936};
933 937
934#define PLATFORM_PM_OPS_PTR &platform_pm_ops 938#define PLATFORM_PM_OPS_PTR (&platform_dev_pm_ops)
935 939
936#else /* !CONFIG_PM_SLEEP */ 940#else /* !CONFIG_PM_SLEEP */
937 941
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 692c20ba5144..670c9d6c1407 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -76,7 +76,7 @@ void device_pm_add(struct device *dev)
76 if (dev->parent) { 76 if (dev->parent) {
77 if (dev->parent->power.status >= DPM_SUSPENDING) 77 if (dev->parent->power.status >= DPM_SUSPENDING)
78 dev_warn(dev, "parent %s should not be sleeping\n", 78 dev_warn(dev, "parent %s should not be sleeping\n",
79 dev->parent->bus_id); 79 dev_name(dev->parent));
80 } else if (transition_started) { 80 } else if (transition_started) {
81 /* 81 /*
82 * We refuse to register parentless devices while a PM 82 * We refuse to register parentless devices while a PM
@@ -112,7 +112,8 @@ void device_pm_remove(struct device *dev)
112 * @ops: PM operations to choose from. 112 * @ops: PM operations to choose from.
113 * @state: PM transition of the system being carried out. 113 * @state: PM transition of the system being carried out.
114 */ 114 */
115static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state) 115static int pm_op(struct device *dev, struct dev_pm_ops *ops,
116 pm_message_t state)
116{ 117{
117 int error = 0; 118 int error = 0;
118 119
@@ -174,7 +175,7 @@ static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state)
174 * The operation is executed with interrupts disabled by the only remaining 175 * The operation is executed with interrupts disabled by the only remaining
175 * functional CPU in the system. 176 * functional CPU in the system.
176 */ 177 */
177static int pm_noirq_op(struct device *dev, struct pm_ext_ops *ops, 178static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops,
178 pm_message_t state) 179 pm_message_t state)
179{ 180{
180 int error = 0; 181 int error = 0;
@@ -354,7 +355,7 @@ static int resume_device(struct device *dev, pm_message_t state)
354 if (dev->bus) { 355 if (dev->bus) {
355 if (dev->bus->pm) { 356 if (dev->bus->pm) {
356 pm_dev_dbg(dev, state, ""); 357 pm_dev_dbg(dev, state, "");
357 error = pm_op(dev, &dev->bus->pm->base, state); 358 error = pm_op(dev, dev->bus->pm, state);
358 } else if (dev->bus->resume) { 359 } else if (dev->bus->resume) {
359 pm_dev_dbg(dev, state, "legacy "); 360 pm_dev_dbg(dev, state, "legacy ");
360 error = dev->bus->resume(dev); 361 error = dev->bus->resume(dev);
@@ -451,9 +452,9 @@ static void complete_device(struct device *dev, pm_message_t state)
451 dev->type->pm->complete(dev); 452 dev->type->pm->complete(dev);
452 } 453 }
453 454
454 if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { 455 if (dev->bus && dev->bus->pm && dev->bus->pm->complete) {
455 pm_dev_dbg(dev, state, "completing "); 456 pm_dev_dbg(dev, state, "completing ");
456 dev->bus->pm->base.complete(dev); 457 dev->bus->pm->complete(dev);
457 } 458 }
458 459
459 up(&dev->sem); 460 up(&dev->sem);
@@ -624,7 +625,7 @@ static int suspend_device(struct device *dev, pm_message_t state)
624 if (dev->bus) { 625 if (dev->bus) {
625 if (dev->bus->pm) { 626 if (dev->bus->pm) {
626 pm_dev_dbg(dev, state, ""); 627 pm_dev_dbg(dev, state, "");
627 error = pm_op(dev, &dev->bus->pm->base, state); 628 error = pm_op(dev, dev->bus->pm, state);
628 } else if (dev->bus->suspend) { 629 } else if (dev->bus->suspend) {
629 pm_dev_dbg(dev, state, "legacy "); 630 pm_dev_dbg(dev, state, "legacy ");
630 error = dev->bus->suspend(dev, state); 631 error = dev->bus->suspend(dev, state);
@@ -685,10 +686,10 @@ static int prepare_device(struct device *dev, pm_message_t state)
685 686
686 down(&dev->sem); 687 down(&dev->sem);
687 688
688 if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { 689 if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {
689 pm_dev_dbg(dev, state, "preparing "); 690 pm_dev_dbg(dev, state, "preparing ");
690 error = dev->bus->pm->base.prepare(dev); 691 error = dev->bus->pm->prepare(dev);
691 suspend_report_result(dev->bus->pm->base.prepare, error); 692 suspend_report_result(dev->bus->pm->prepare, error);
692 if (error) 693 if (error)
693 goto End; 694 goto End;
694 } 695 }
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index 2aa6e8fc4def..0a1a2c4dbc6e 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -140,7 +140,7 @@ static unsigned int hash_string(unsigned int seed, const char *data, unsigned in
140 140
141void set_trace_device(struct device *dev) 141void set_trace_device(struct device *dev)
142{ 142{
143 dev_hash_value = hash_string(DEVSEED, dev->bus_id, DEVHASH); 143 dev_hash_value = hash_string(DEVSEED, dev_name(dev), DEVHASH);
144} 144}
145EXPORT_SYMBOL(set_trace_device); 145EXPORT_SYMBOL(set_trace_device);
146 146
@@ -192,7 +192,7 @@ static int show_dev_hash(unsigned int value)
192 192
193 while (entry != &dpm_list) { 193 while (entry != &dpm_list) {
194 struct device * dev = to_device(entry); 194 struct device * dev = to_device(entry);
195 unsigned int hash = hash_string(DEVSEED, dev->bus_id, DEVHASH); 195 unsigned int hash = hash_string(DEVSEED, dev_name(dev), DEVHASH);
196 if (hash == value) { 196 if (hash == value) {
197 dev_info(dev, "hash matches\n"); 197 dev_info(dev, "hash matches\n");
198 match++; 198 match++;
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index 4f8d67fed292..94ad2c3bfc4a 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -663,7 +663,7 @@ static int __init mwave_init(void)
663#if 0 663#if 0
664 /* sysfs */ 664 /* sysfs */
665 memset(&mwave_device, 0, sizeof (struct device)); 665 memset(&mwave_device, 0, sizeof (struct device));
666 snprintf(mwave_device.bus_id, BUS_ID_SIZE, "mwave"); 666 dev_set_name(&mwave_device, "mwave");
667 667
668 if (device_register(&mwave_device)) 668 if (device_register(&mwave_device))
669 goto cleanup_error; 669 goto cleanup_error;
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index e880d6c8d896..5a76d056b9d0 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -223,7 +223,7 @@ static int __init dmi_id_init(void)
223 } 223 }
224 224
225 dmi_dev->class = &dmi_class; 225 dmi_dev->class = &dmi_class;
226 strcpy(dmi_dev->bus_id, "id"); 226 dev_set_name(dmi_dev, "id");
227 dmi_dev->groups = sys_dmi_attribute_groups; 227 dmi_dev->groups = sys_dmi_attribute_groups;
228 228
229 ret = device_register(dmi_dev); 229 ret = device_register(dmi_dev);
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 82020abc329e..35e7aea4222c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1213,7 +1213,7 @@ static int gpiolib_show(struct seq_file *s, void *unused)
1213 if (dev) 1213 if (dev)
1214 seq_printf(s, ", %s/%s", 1214 seq_printf(s, ", %s/%s",
1215 dev->bus ? dev->bus->name : "no-bus", 1215 dev->bus ? dev->bus->name : "no-bus",
1216 dev->bus_id); 1216 dev_name(dev));
1217 if (chip->label) 1217 if (chip->label)
1218 seq_printf(s, ", %s", chip->label); 1218 seq_printf(s, ", %s", chip->label);
1219 if (chip->can_sleep) 1219 if (chip->can_sleep)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 65d72d094c81..5aa6780652aa 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -488,7 +488,7 @@ int drm_sysfs_device_add(struct drm_minor *minor)
488 else 488 else
489 minor_str = "card%d"; 489 minor_str = "card%d";
490 490
491 snprintf(minor->kdev.bus_id, BUS_ID_SIZE, minor_str, minor->index); 491 dev_set_name(&minor->kdev, minor_str, minor->index);
492 492
493 err = device_register(&minor->kdev); 493 err = device_register(&minor->kdev);
494 if (err) { 494 if (err) {
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 076a59cdabe9..e15c3e7b07e9 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -76,7 +76,7 @@ void hwmon_device_unregister(struct device *dev)
76{ 76{
77 int id; 77 int id;
78 78
79 if (likely(sscanf(dev->bus_id, HWMON_ID_FORMAT, &id) == 1)) { 79 if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
80 device_unregister(dev); 80 device_unregister(dev);
81 spin_lock(&idr_lock); 81 spin_lock(&idr_lock);
82 idr_remove(&hwmon_idr, id); 82 idr_remove(&hwmon_idr, id);
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 8f9595f2fb53..55bd87c15c9a 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -190,7 +190,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
190 } 190 }
191 191
192 dev_info(&client->dev, "%s: sensor '%s'\n", 192 dev_info(&client->dev, "%s: sensor '%s'\n",
193 data->hwmon_dev->bus_id, client->name); 193 dev_name(data->hwmon_dev), client->name);
194 194
195 return 0; 195 return 0;
196 196
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c
index fb176f6ef9f8..17e8ddd01334 100644
--- a/drivers/idle/i7300_idle.c
+++ b/drivers/idle/i7300_idle.c
@@ -177,7 +177,7 @@ static int __init i7300_idle_ioat_selftest(u8 *ctl,
177} 177}
178 178
179static struct device dummy_dma_dev = { 179static struct device dummy_dma_dev = {
180 .bus_id = "fallback device", 180 .init_name = "fallback device",
181 .coherent_dma_mask = DMA_64BIT_MASK, 181 .coherent_dma_mask = DMA_64BIT_MASK,
182 .dma_mask = &dummy_dma_dev.coherent_dma_mask, 182 .dma_mask = &dummy_dma_dev.coherent_dma_mask,
183}; 183};
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 4f4d1bb9f069..b43f7d3682d3 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -778,7 +778,7 @@ int ib_device_register_sysfs(struct ib_device *device)
778 class_dev->class = &ib_class; 778 class_dev->class = &ib_class;
779 class_dev->driver_data = device; 779 class_dev->driver_data = device;
780 class_dev->parent = device->dma_device; 780 class_dev->parent = device->dma_device;
781 strlcpy(class_dev->bus_id, device->name, BUS_ID_SIZE); 781 dev_set_name(class_dev, device->name);
782 782
783 INIT_LIST_HEAD(&device->port_list); 783 INIT_LIST_HEAD(&device->port_list);
784 784
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index e603736682bf..51bd9669cb1f 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1266,8 +1266,7 @@ static void ib_ucm_add_one(struct ib_device *device)
1266 ucm_dev->dev.parent = device->dma_device; 1266 ucm_dev->dev.parent = device->dma_device;
1267 ucm_dev->dev.devt = ucm_dev->cdev.dev; 1267 ucm_dev->dev.devt = ucm_dev->cdev.dev;
1268 ucm_dev->dev.release = ib_ucm_release_dev; 1268 ucm_dev->dev.release = ib_ucm_release_dev;
1269 snprintf(ucm_dev->dev.bus_id, BUS_ID_SIZE, "ucm%d", 1269 dev_set_name(&ucm_dev->dev, "ucm%d", ucm_dev->devnum);
1270 ucm_dev->devnum);
1271 if (device_register(&ucm_dev->dev)) 1270 if (device_register(&ucm_dev->dev))
1272 goto err_cdev; 1271 goto err_cdev;
1273 1272
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 7c13db885bf6..54c8fe25c423 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1949,8 +1949,7 @@ static struct srp_host *srp_add_port(struct srp_device *device, u8 port)
1949 1949
1950 host->dev.class = &srp_class; 1950 host->dev.class = &srp_class;
1951 host->dev.parent = device->dev->dma_device; 1951 host->dev.parent = device->dev->dma_device;
1952 snprintf(host->dev.bus_id, BUS_ID_SIZE, "srp-%s-%d", 1952 dev_set_name(&host->dev, "srp-%s-%d", device->dev->name, port);
1953 device->dev->name, port);
1954 1953
1955 if (device_register(&host->dev)) 1954 if (device_register(&host->dev))
1956 goto free_host; 1955 goto free_host;
diff --git a/drivers/isdn/mISDN/dsp_pipeline.c b/drivers/isdn/mISDN/dsp_pipeline.c
index 5ee6651b45b9..83639be7f7ad 100644
--- a/drivers/isdn/mISDN/dsp_pipeline.c
+++ b/drivers/isdn/mISDN/dsp_pipeline.c
@@ -91,7 +91,7 @@ int mISDN_dsp_element_register(struct mISDN_dsp_element *elem)
91 91
92 entry->dev.class = elements_class; 92 entry->dev.class = elements_class;
93 dev_set_drvdata(&entry->dev, elem); 93 dev_set_drvdata(&entry->dev, elem);
94 snprintf(entry->dev.bus_id, BUS_ID_SIZE, elem->name); 94 dev_set_name(&entry->dev, elem->name);
95 ret = device_register(&entry->dev); 95 ret = device_register(&entry->dev);
96 if (ret) { 96 if (ret) {
97 printk(KERN_ERR "%s: failed to register %s\n", 97 printk(KERN_ERR "%s: failed to register %s\n",
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 915da6b8c924..b4d44e571d76 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -321,10 +321,7 @@ static struct virtio_config_ops lguest_config_ops = {
321 321
322/* The root device for the lguest virtio devices. This makes them appear as 322/* The root device for the lguest virtio devices. This makes them appear as
323 * /sys/devices/lguest/0,1,2 not /sys/devices/0,1,2. */ 323 * /sys/devices/lguest/0,1,2 not /sys/devices/0,1,2. */
324static struct device lguest_root = { 324static struct device *lguest_root;
325 .parent = NULL,
326 .bus_id = "lguest",
327};
328 325
329/*D:120 This is the core of the lguest bus: actually adding a new device. 326/*D:120 This is the core of the lguest bus: actually adding a new device.
330 * It's a separate function because it's neater that way, and because an 327 * It's a separate function because it's neater that way, and because an
@@ -351,7 +348,7 @@ static void add_lguest_device(struct lguest_device_desc *d,
351 } 348 }
352 349
353 /* This devices' parent is the lguest/ dir. */ 350 /* This devices' parent is the lguest/ dir. */
354 ldev->vdev.dev.parent = &lguest_root; 351 ldev->vdev.dev.parent = lguest_root;
355 /* We have a unique device index thanks to the dev_index counter. */ 352 /* We have a unique device index thanks to the dev_index counter. */
356 ldev->vdev.id.device = d->type; 353 ldev->vdev.id.device = d->type;
357 /* We have a simple set of routines for querying the device's 354 /* We have a simple set of routines for querying the device's
@@ -407,7 +404,8 @@ static int __init lguest_devices_init(void)
407 if (strcmp(pv_info.name, "lguest") != 0) 404 if (strcmp(pv_info.name, "lguest") != 0)
408 return 0; 405 return 0;
409 406
410 if (device_register(&lguest_root) != 0) 407 lguest_root = root_device_register("lguest");
408 if (IS_ERR(lguest_root))
411 panic("Could not register lguest root"); 409 panic("Could not register lguest root");
412 410
413 /* Devices are in a single page above top of "normal" mem */ 411 /* Devices are in a single page above top of "normal" mem */
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index ec9e5f32f0ae..6e149f4a1fff 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -33,7 +33,7 @@
33 33
34#undef DEBUG 34#undef DEBUG
35 35
36#define MAX_NODE_NAME_SIZE (BUS_ID_SIZE - 12) 36#define MAX_NODE_NAME_SIZE (20 - 12)
37 37
38static struct macio_chip *macio_on_hold; 38static struct macio_chip *macio_on_hold;
39 39
@@ -240,7 +240,7 @@ static void macio_create_fixup_irq(struct macio_dev *dev, int index,
240 if (irq != NO_IRQ) { 240 if (irq != NO_IRQ) {
241 dev->interrupt[index].start = irq; 241 dev->interrupt[index].start = irq;
242 dev->interrupt[index].flags = IORESOURCE_IRQ; 242 dev->interrupt[index].flags = IORESOURCE_IRQ;
243 dev->interrupt[index].name = dev->ofdev.dev.bus_id; 243 dev->interrupt[index].name = dev_name(&dev->ofdev.dev);
244 } 244 }
245 if (dev->n_interrupts <= index) 245 if (dev->n_interrupts <= index)
246 dev->n_interrupts = index + 1; 246 dev->n_interrupts = index + 1;
@@ -303,7 +303,7 @@ static void macio_setup_interrupts(struct macio_dev *dev)
303 break; 303 break;
304 res->start = irq; 304 res->start = irq;
305 res->flags = IORESOURCE_IRQ; 305 res->flags = IORESOURCE_IRQ;
306 res->name = dev->ofdev.dev.bus_id; 306 res->name = dev_name(&dev->ofdev.dev);
307 if (macio_resource_quirks(np, res, i - 1)) { 307 if (macio_resource_quirks(np, res, i - 1)) {
308 memset(res, 0, sizeof(struct resource)); 308 memset(res, 0, sizeof(struct resource));
309 continue; 309 continue;
@@ -325,7 +325,7 @@ static void macio_setup_resources(struct macio_dev *dev,
325 if (index >= MACIO_DEV_COUNT_RESOURCES) 325 if (index >= MACIO_DEV_COUNT_RESOURCES)
326 break; 326 break;
327 *res = r; 327 *res = r;
328 res->name = dev->ofdev.dev.bus_id; 328 res->name = dev_name(&dev->ofdev.dev);
329 329
330 if (macio_resource_quirks(np, res, index)) { 330 if (macio_resource_quirks(np, res, index)) {
331 memset(res, 0, sizeof(struct resource)); 331 memset(res, 0, sizeof(struct resource));
@@ -338,7 +338,7 @@ static void macio_setup_resources(struct macio_dev *dev,
338 if (insert_resource(parent_res, res)) { 338 if (insert_resource(parent_res, res)) {
339 printk(KERN_WARNING "Can't request resource " 339 printk(KERN_WARNING "Can't request resource "
340 "%d for MacIO device %s\n", 340 "%d for MacIO device %s\n",
341 index, dev->ofdev.dev.bus_id); 341 index, dev_name(&dev->ofdev.dev));
342 } 342 }
343 } 343 }
344 dev->n_resources = index; 344 dev->n_resources = index;
@@ -385,8 +385,8 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
385 385
386 /* MacIO itself has a different reg, we use it's PCI base */ 386 /* MacIO itself has a different reg, we use it's PCI base */
387 if (np == chip->of_node) { 387 if (np == chip->of_node) {
388 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 388 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
389 chip->lbus.index, 389 chip->lbus.index,
390#ifdef CONFIG_PCI 390#ifdef CONFIG_PCI
391 (unsigned int)pci_resource_start(chip->lbus.pdev, 0), 391 (unsigned int)pci_resource_start(chip->lbus.pdev, 0),
392#else 392#else
@@ -395,9 +395,9 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
395 MAX_NODE_NAME_SIZE, np->name); 395 MAX_NODE_NAME_SIZE, np->name);
396 } else { 396 } else {
397 reg = of_get_property(np, "reg", NULL); 397 reg = of_get_property(np, "reg", NULL);
398 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 398 dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s",
399 chip->lbus.index, 399 chip->lbus.index,
400 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); 400 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
401 } 401 }
402 402
403 /* Setup interrupts & resources */ 403 /* Setup interrupts & resources */
@@ -408,7 +408,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
408 /* Register with core */ 408 /* Register with core */
409 if (of_device_register(&dev->ofdev) != 0) { 409 if (of_device_register(&dev->ofdev) != 0) {
410 printk(KERN_DEBUG"macio: device registration error for %s!\n", 410 printk(KERN_DEBUG"macio: device registration error for %s!\n",
411 dev->ofdev.dev.bus_id); 411 dev_name(&dev->ofdev.dev));
412 kfree(dev); 412 kfree(dev);
413 return NULL; 413 return NULL;
414 } 414 }
@@ -558,7 +558,7 @@ err_out:
558 resource_no, 558 resource_no,
559 macio_resource_len(dev, resource_no), 559 macio_resource_len(dev, resource_no),
560 macio_resource_start(dev, resource_no), 560 macio_resource_start(dev, resource_no),
561 dev->ofdev.dev.bus_id); 561 dev_name(&dev->ofdev.dev));
562 return -EBUSY; 562 return -EBUSY;
563} 563}
564 564
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index cea46906408e..a5b448ea4eab 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -385,8 +385,7 @@ static struct memstick_dev *memstick_alloc_card(struct memstick_host *host)
385 385
386 if (card) { 386 if (card) {
387 card->host = host; 387 card->host = host;
388 snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), 388 dev_set_name(&card->dev, "%s", dev_name(&host->dev));
389 "%s", host->dev.bus_id);
390 card->dev.parent = &host->dev; 389 card->dev.parent = &host->dev;
391 card->dev.bus = &memstick_bus_type; 390 card->dev.bus = &memstick_bus_type;
392 card->dev.release = memstick_free_card; 391 card->dev.release = memstick_free_card;
@@ -519,7 +518,7 @@ int memstick_add_host(struct memstick_host *host)
519 if (rc) 518 if (rc)
520 return rc; 519 return rc;
521 520
522 snprintf(host->dev.bus_id, BUS_ID_SIZE, "memstick%u", host->id); 521 dev_set_name(&host->dev, "memstick%u", host->id);
523 522
524 rc = device_add(&host->dev); 523 rc = device_add(&host->dev);
525 if (rc) { 524 if (rc) {
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 7911151e56a3..1f1e3982b1aa 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -887,14 +887,14 @@ try_again:
887 if (rc) { 887 if (rc) {
888 printk(KERN_WARNING 888 printk(KERN_WARNING
889 "%s: could not switch to 4-bit mode, error %d\n", 889 "%s: could not switch to 4-bit mode, error %d\n",
890 card->dev.bus_id, rc); 890 dev_name(&card->dev), rc);
891 return 0; 891 return 0;
892 } 892 }
893 893
894 msb->system = MEMSTICK_SYS_PAR4; 894 msb->system = MEMSTICK_SYS_PAR4;
895 host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); 895 host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4);
896 printk(KERN_INFO "%s: switching to 4-bit parallel mode\n", 896 printk(KERN_INFO "%s: switching to 4-bit parallel mode\n",
897 card->dev.bus_id); 897 dev_name(&card->dev));
898 898
899 if (msb->caps & MEMSTICK_CAP_PAR8) { 899 if (msb->caps & MEMSTICK_CAP_PAR8) {
900 rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR8); 900 rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR8);
@@ -905,11 +905,11 @@ try_again:
905 MEMSTICK_PAR8); 905 MEMSTICK_PAR8);
906 printk(KERN_INFO 906 printk(KERN_INFO
907 "%s: switching to 8-bit parallel mode\n", 907 "%s: switching to 8-bit parallel mode\n",
908 card->dev.bus_id); 908 dev_name(&card->dev));
909 } else 909 } else
910 printk(KERN_WARNING 910 printk(KERN_WARNING
911 "%s: could not switch to 8-bit mode, error %d\n", 911 "%s: could not switch to 8-bit mode, error %d\n",
912 card->dev.bus_id, rc); 912 dev_name(&card->dev), rc);
913 } 913 }
914 914
915 card->next_request = h_mspro_block_req_init; 915 card->next_request = h_mspro_block_req_init;
@@ -922,7 +922,7 @@ try_again:
922 if (rc) { 922 if (rc) {
923 printk(KERN_WARNING 923 printk(KERN_WARNING
924 "%s: interface error, trying to fall back to serial\n", 924 "%s: interface error, trying to fall back to serial\n",
925 card->dev.bus_id); 925 dev_name(&card->dev));
926 msb->system = MEMSTICK_SYS_SERIAL; 926 msb->system = MEMSTICK_SYS_SERIAL;
927 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); 927 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
928 msleep(10); 928 msleep(10);
@@ -992,14 +992,14 @@ static int mspro_block_read_attributes(struct memstick_dev *card)
992 992
993 if (be16_to_cpu(attr->signature) != MSPRO_BLOCK_SIGNATURE) { 993 if (be16_to_cpu(attr->signature) != MSPRO_BLOCK_SIGNATURE) {
994 printk(KERN_ERR "%s: unrecognized device signature %x\n", 994 printk(KERN_ERR "%s: unrecognized device signature %x\n",
995 card->dev.bus_id, be16_to_cpu(attr->signature)); 995 dev_name(&card->dev), be16_to_cpu(attr->signature));
996 rc = -ENODEV; 996 rc = -ENODEV;
997 goto out_free_attr; 997 goto out_free_attr;
998 } 998 }
999 999
1000 if (attr->count > MSPRO_BLOCK_MAX_ATTRIBUTES) { 1000 if (attr->count > MSPRO_BLOCK_MAX_ATTRIBUTES) {
1001 printk(KERN_WARNING "%s: way too many attribute entries\n", 1001 printk(KERN_WARNING "%s: way too many attribute entries\n",
1002 card->dev.bus_id); 1002 dev_name(&card->dev));
1003 attr_count = MSPRO_BLOCK_MAX_ATTRIBUTES; 1003 attr_count = MSPRO_BLOCK_MAX_ATTRIBUTES;
1004 } else 1004 } else
1005 attr_count = attr->count; 1005 attr_count = attr->count;
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index d32d6ad8f3fc..03f71a431c82 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -546,7 +546,7 @@ static void tifm_ms_abort(unsigned long data)
546 printk(KERN_ERR 546 printk(KERN_ERR
547 "%s : card failed to respond for a long period of time " 547 "%s : card failed to respond for a long period of time "
548 "(%x, %x)\n", 548 "(%x, %x)\n",
549 host->dev->dev.bus_id, host->req ? host->req->tpc : 0, 549 dev_name(&host->dev->dev), host->req ? host->req->tpc : 0,
550 host->cmd_flags); 550 host->cmd_flags);
551 551
552 tifm_eject(host->dev); 552 tifm_eject(host->dev);
@@ -561,7 +561,7 @@ static int tifm_ms_probe(struct tifm_dev *sock)
561 if (!(TIFM_SOCK_STATE_OCCUPIED 561 if (!(TIFM_SOCK_STATE_OCCUPIED
562 & readl(sock->addr + SOCK_PRESENT_STATE))) { 562 & readl(sock->addr + SOCK_PRESENT_STATE))) {
563 printk(KERN_WARNING "%s : card gone, unexpectedly\n", 563 printk(KERN_WARNING "%s : card gone, unexpectedly\n",
564 sock->dev.bus_id); 564 dev_name(&sock->dev));
565 return rc; 565 return rc;
566 } 566 }
567 567
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c
index c455da4ff411..0ee4264f5db7 100644
--- a/drivers/message/i2o/device.c
+++ b/drivers/message/i2o/device.c
@@ -132,7 +132,7 @@ static void i2o_device_release(struct device *dev)
132{ 132{
133 struct i2o_device *i2o_dev = to_i2o_device(dev); 133 struct i2o_device *i2o_dev = to_i2o_device(dev);
134 134
135 pr_debug("i2o: device %s released\n", dev->bus_id); 135 pr_debug("i2o: device %s released\n", dev_name(dev));
136 136
137 kfree(i2o_dev); 137 kfree(i2o_dev);
138} 138}
@@ -227,8 +227,8 @@ static int i2o_device_add(struct i2o_controller *c, i2o_lct_entry *entry)
227 227
228 i2o_dev->lct_data = *entry; 228 i2o_dev->lct_data = *entry;
229 229
230 snprintf(i2o_dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit, 230 dev_set_name(&i2o_dev->device, "%d:%03x", c->unit,
231 i2o_dev->lct_data.tid); 231 i2o_dev->lct_data.tid);
232 232
233 i2o_dev->iop = c; 233 i2o_dev->iop = c;
234 i2o_dev->device.parent = &c->device; 234 i2o_dev->device.parent = &c->device;
@@ -279,7 +279,7 @@ static int i2o_device_add(struct i2o_controller *c, i2o_lct_entry *entry)
279 279
280 i2o_driver_notify_device_add_all(i2o_dev); 280 i2o_driver_notify_device_add_all(i2o_dev);
281 281
282 pr_debug("i2o: device %s added\n", i2o_dev->device.bus_id); 282 pr_debug("i2o: device %s added\n", dev_name(&i2o_dev->device));
283 283
284 return 0; 284 return 0;
285 285
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 54a3016ff45d..9a36b5a7de57 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -1300,7 +1300,7 @@ static int i2o_seq_show_dev_name(struct seq_file *seq, void *v)
1300{ 1300{
1301 struct i2o_device *d = (struct i2o_device *)seq->private; 1301 struct i2o_device *d = (struct i2o_device *)seq->private;
1302 1302
1303 seq_printf(seq, "%s\n", d->device.bus_id); 1303 seq_printf(seq, "%s\n", dev_name(&d->device));
1304 1304
1305 return 0; 1305 return 0;
1306} 1306}
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 35c67d1f255e..27cf4af0e13d 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -1072,7 +1072,7 @@ struct i2o_controller *i2o_iop_alloc(void)
1072 1072
1073 c->device.release = &i2o_iop_release; 1073 c->device.release = &i2o_iop_release;
1074 1074
1075 snprintf(c->device.bus_id, BUS_ID_SIZE, "iop%d", c->unit); 1075 dev_set_name(&c->device, "iop%d", c->unit);
1076 1076
1077#if BITS_PER_LONG == 64 1077#if BITS_PER_LONG == 64
1078 spin_lock_init(&c->context_list_lock); 1078 spin_lock_init(&c->context_list_lock);
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index e11e1ac50900..3d2fc216bae5 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -29,7 +29,7 @@ static struct device_driver gru_driver = {
29}; 29};
30 30
31static struct device gru_device = { 31static struct device gru_device = {
32 .bus_id = {0}, 32 .init_name = "",
33 .driver = &gru_driver, 33 .driver = &gru_driver,
34}; 34};
35 35
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c
index 9a2e77172d94..16f8dcab2da4 100644
--- a/drivers/misc/sgi-xp/xp_main.c
+++ b/drivers/misc/sgi-xp/xp_main.c
@@ -25,7 +25,7 @@ struct device_driver xp_dbg_name = {
25}; 25};
26 26
27struct device xp_dbg_subname = { 27struct device xp_dbg_subname = {
28 .bus_id = {0}, /* set to "" */ 28 .init_name = "", /* set to "" */
29 .driver = &xp_dbg_name 29 .driver = &xp_dbg_name
30}; 30};
31 31
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index e8d5cfbd32c2..89218f7cfaa7 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -59,12 +59,12 @@ struct device_driver xpc_dbg_name = {
59}; 59};
60 60
61struct device xpc_part_dbg_subname = { 61struct device xpc_part_dbg_subname = {
62 .bus_id = {0}, /* set to "part" at xpc_init() time */ 62 .init_name = "", /* set to "part" at xpc_init() time */
63 .driver = &xpc_dbg_name 63 .driver = &xpc_dbg_name
64}; 64};
65 65
66struct device xpc_chan_dbg_subname = { 66struct device xpc_chan_dbg_subname = {
67 .bus_id = {0}, /* set to "chan" at xpc_init() time */ 67 .init_name = "", /* set to "chan" at xpc_init() time */
68 .driver = &xpc_dbg_name 68 .driver = &xpc_dbg_name
69}; 69};
70 70
@@ -1258,8 +1258,8 @@ xpc_init(void)
1258 int ret; 1258 int ret;
1259 struct task_struct *kthread; 1259 struct task_struct *kthread;
1260 1260
1261 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part"); 1261 dev_set_name(xpc_part, "part");
1262 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan"); 1262 dev_set_name(xpc_chan, "chan");
1263 1263
1264 if (is_shub()) { 1264 if (is_shub()) {
1265 /* 1265 /*
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 8e6aa9508f46..81152b3e360c 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -138,7 +138,7 @@ struct device_driver xpnet_dbg_name = {
138}; 138};
139 139
140struct device xpnet_dbg_subname = { 140struct device xpnet_dbg_subname = {
141 .bus_id = {0}, /* set to "" */ 141 .init_name = "", /* set to "" */
142 .driver = &xpnet_dbg_name 142 .driver = &xpnet_dbg_name
143}; 143};
144 144
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index af6173319e07..be5672a98702 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -164,7 +164,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
164 if (sock) { 164 if (sock) {
165 printk(KERN_INFO 165 printk(KERN_INFO
166 "%s : demand removing card from socket %u:%u\n", 166 "%s : demand removing card from socket %u:%u\n",
167 fm->dev.bus_id, fm->id, cnt); 167 dev_name(&fm->dev), fm->id, cnt);
168 fm->sockets[cnt] = NULL; 168 fm->sockets[cnt] = NULL;
169 sock_addr = sock->addr; 169 sock_addr = sock->addr;
170 spin_unlock_irqrestore(&fm->lock, flags); 170 spin_unlock_irqrestore(&fm->lock, flags);
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 82dc72a1484f..98bcba521da2 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -203,7 +203,7 @@ int tifm_add_adapter(struct tifm_adapter *fm)
203 if (rc) 203 if (rc)
204 return rc; 204 return rc;
205 205
206 snprintf(fm->dev.bus_id, BUS_ID_SIZE, "tifm%u", fm->id); 206 dev_set_name(&fm->dev, "tifm%u", fm->id);
207 rc = device_add(&fm->dev); 207 rc = device_add(&fm->dev);
208 if (rc) { 208 if (rc) {
209 spin_lock(&tifm_adapter_lock); 209 spin_lock(&tifm_adapter_lock);
@@ -266,9 +266,8 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
266 sock->dev.dma_mask = fm->dev.parent->dma_mask; 266 sock->dev.dma_mask = fm->dev.parent->dma_mask;
267 sock->dev.release = tifm_free_device; 267 sock->dev.release = tifm_free_device;
268 268
269 snprintf(sock->dev.bus_id, BUS_ID_SIZE, 269 dev_set_name(&sock->dev, "tifm_%s%u:%u",
270 "tifm_%s%u:%u", tifm_media_type_name(type, 2), 270 tifm_media_type_name(type, 2), fm->id, id);
271 fm->id, id);
272 printk(KERN_INFO DRIVER_NAME 271 printk(KERN_INFO DRIVER_NAME
273 ": %s card detected in socket %u:%u\n", 272 ": %s card detected in socket %u:%u\n",
274 tifm_media_type_name(type, 0), fm->id, id); 273 tifm_media_type_name(type, 0), fm->id, id);
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6659b2275c0c..5733f0643843 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -170,7 +170,7 @@ static int wait_till_ready(struct m25p *flash)
170static int erase_chip(struct m25p *flash) 170static int erase_chip(struct m25p *flash)
171{ 171{
172 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n", 172 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n",
173 flash->spi->dev.bus_id, __func__, 173 dev_name(&flash->spi->dev), __func__,
174 flash->mtd.size / 1024); 174 flash->mtd.size / 1024);
175 175
176 /* Wait until finished previous write command. */ 176 /* Wait until finished previous write command. */
@@ -197,7 +197,7 @@ static int erase_chip(struct m25p *flash)
197static int erase_sector(struct m25p *flash, u32 offset) 197static int erase_sector(struct m25p *flash, u32 offset)
198{ 198{
199 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB at 0x%08x\n", 199 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB at 0x%08x\n",
200 flash->spi->dev.bus_id, __func__, 200 dev_name(&flash->spi->dev), __func__,
201 flash->mtd.erasesize / 1024, offset); 201 flash->mtd.erasesize / 1024, offset);
202 202
203 /* Wait until finished previous write command. */ 203 /* Wait until finished previous write command. */
@@ -234,7 +234,7 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
234 u32 addr,len; 234 u32 addr,len;
235 235
236 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %d\n", 236 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %d\n",
237 flash->spi->dev.bus_id, __func__, "at", 237 dev_name(&flash->spi->dev), __func__, "at",
238 (u32)instr->addr, instr->len); 238 (u32)instr->addr, instr->len);
239 239
240 /* sanity checks */ 240 /* sanity checks */
@@ -295,7 +295,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
295 struct spi_message m; 295 struct spi_message m;
296 296
297 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n", 297 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
298 flash->spi->dev.bus_id, __func__, "from", 298 dev_name(&flash->spi->dev), __func__, "from",
299 (u32)from, len); 299 (u32)from, len);
300 300
301 /* sanity checks */ 301 /* sanity checks */
@@ -367,7 +367,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
367 struct spi_message m; 367 struct spi_message m;
368 368
369 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n", 369 DEBUG(MTD_DEBUG_LEVEL2, "%s: %s %s 0x%08x, len %zd\n",
370 flash->spi->dev.bus_id, __func__, "to", 370 dev_name(&flash->spi->dev), __func__, "to",
371 (u32)to, len); 371 (u32)to, len);
372 372
373 if (retlen) 373 if (retlen)
@@ -563,7 +563,7 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
563 tmp = spi_write_then_read(spi, &code, 1, id, 5); 563 tmp = spi_write_then_read(spi, &code, 1, id, 5);
564 if (tmp < 0) { 564 if (tmp < 0) {
565 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n", 565 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
566 spi->dev.bus_id, tmp); 566 dev_name(&spi->dev), tmp);
567 return NULL; 567 return NULL;
568 } 568 }
569 jedec = id[0]; 569 jedec = id[0];
@@ -617,7 +617,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
617 /* unrecognized chip? */ 617 /* unrecognized chip? */
618 if (i == ARRAY_SIZE(m25p_data)) { 618 if (i == ARRAY_SIZE(m25p_data)) {
619 DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n", 619 DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n",
620 spi->dev.bus_id, data->type); 620 dev_name(&spi->dev), data->type);
621 info = NULL; 621 info = NULL;
622 622
623 /* recognized; is that chip really what's there? */ 623 /* recognized; is that chip really what's there? */
@@ -658,7 +658,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
658 if (data && data->name) 658 if (data && data->name)
659 flash->mtd.name = data->name; 659 flash->mtd.name = data->name;
660 else 660 else
661 flash->mtd.name = spi->dev.bus_id; 661 flash->mtd.name = dev_name(&spi->dev);
662 662
663 flash->mtd.type = MTD_NORFLASH; 663 flash->mtd.type = MTD_NORFLASH;
664 flash->mtd.writesize = 1; 664 flash->mtd.writesize = 1;
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 6dd9aff8bb2d..65126cd668ff 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -128,7 +128,7 @@ static int dataflash_waitready(struct spi_device *spi)
128 status = dataflash_status(spi); 128 status = dataflash_status(spi);
129 if (status < 0) { 129 if (status < 0) {
130 DEBUG(MTD_DEBUG_LEVEL1, "%s: status %d?\n", 130 DEBUG(MTD_DEBUG_LEVEL1, "%s: status %d?\n",
131 spi->dev.bus_id, status); 131 dev_name(&spi->dev), status);
132 status = 0; 132 status = 0;
133 } 133 }
134 134
@@ -154,7 +154,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
154 uint8_t *command; 154 uint8_t *command;
155 155
156 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n", 156 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n",
157 spi->dev.bus_id, 157 dev_name(&spi->dev),
158 instr->addr, instr->len); 158 instr->addr, instr->len);
159 159
160 /* Sanity checks */ 160 /* Sanity checks */
@@ -197,7 +197,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
197 197
198 if (status < 0) { 198 if (status < 0) {
199 printk(KERN_ERR "%s: erase %x, err %d\n", 199 printk(KERN_ERR "%s: erase %x, err %d\n",
200 spi->dev.bus_id, pageaddr, status); 200 dev_name(&spi->dev), pageaddr, status);
201 /* REVISIT: can retry instr->retries times; or 201 /* REVISIT: can retry instr->retries times; or
202 * giveup and instr->fail_addr = instr->addr; 202 * giveup and instr->fail_addr = instr->addr;
203 */ 203 */
@@ -239,7 +239,7 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
239 int status; 239 int status;
240 240
241 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n", 241 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n",
242 priv->spi->dev.bus_id, (unsigned)from, (unsigned)(from + len)); 242 dev_name(&priv->spi->dev), (unsigned)from, (unsigned)(from + len));
243 243
244 *retlen = 0; 244 *retlen = 0;
245 245
@@ -288,7 +288,7 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len,
288 status = 0; 288 status = 0;
289 } else 289 } else
290 DEBUG(MTD_DEBUG_LEVEL1, "%s: read %x..%x --> %d\n", 290 DEBUG(MTD_DEBUG_LEVEL1, "%s: read %x..%x --> %d\n",
291 priv->spi->dev.bus_id, 291 dev_name(&priv->spi->dev),
292 (unsigned)from, (unsigned)(from + len), 292 (unsigned)from, (unsigned)(from + len),
293 status); 293 status);
294 return status; 294 return status;
@@ -315,7 +315,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
315 uint8_t *command; 315 uint8_t *command;
316 316
317 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n", 317 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n",
318 spi->dev.bus_id, (unsigned)to, (unsigned)(to + len)); 318 dev_name(&spi->dev), (unsigned)to, (unsigned)(to + len));
319 319
320 *retlen = 0; 320 *retlen = 0;
321 321
@@ -374,7 +374,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
374 status = spi_sync(spi, &msg); 374 status = spi_sync(spi, &msg);
375 if (status < 0) 375 if (status < 0)
376 DEBUG(MTD_DEBUG_LEVEL1, "%s: xfer %u -> %d \n", 376 DEBUG(MTD_DEBUG_LEVEL1, "%s: xfer %u -> %d \n",
377 spi->dev.bus_id, addr, status); 377 dev_name(&spi->dev), addr, status);
378 378
379 (void) dataflash_waitready(priv->spi); 379 (void) dataflash_waitready(priv->spi);
380 } 380 }
@@ -396,7 +396,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
396 spi_transfer_del(x + 1); 396 spi_transfer_del(x + 1);
397 if (status < 0) 397 if (status < 0)
398 DEBUG(MTD_DEBUG_LEVEL1, "%s: pgm %u/%u -> %d \n", 398 DEBUG(MTD_DEBUG_LEVEL1, "%s: pgm %u/%u -> %d \n",
399 spi->dev.bus_id, addr, writelen, status); 399 dev_name(&spi->dev), addr, writelen, status);
400 400
401 (void) dataflash_waitready(priv->spi); 401 (void) dataflash_waitready(priv->spi);
402 402
@@ -416,14 +416,14 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
416 status = spi_sync(spi, &msg); 416 status = spi_sync(spi, &msg);
417 if (status < 0) 417 if (status < 0)
418 DEBUG(MTD_DEBUG_LEVEL1, "%s: compare %u -> %d \n", 418 DEBUG(MTD_DEBUG_LEVEL1, "%s: compare %u -> %d \n",
419 spi->dev.bus_id, addr, status); 419 dev_name(&spi->dev), addr, status);
420 420
421 status = dataflash_waitready(priv->spi); 421 status = dataflash_waitready(priv->spi);
422 422
423 /* Check result of the compare operation */ 423 /* Check result of the compare operation */
424 if (status & (1 << 6)) { 424 if (status & (1 << 6)) {
425 printk(KERN_ERR "%s: compare page %u, err %d\n", 425 printk(KERN_ERR "%s: compare page %u, err %d\n",
426 spi->dev.bus_id, pageaddr, status); 426 dev_name(&spi->dev), pageaddr, status);
427 remaining = 0; 427 remaining = 0;
428 status = -EIO; 428 status = -EIO;
429 break; 429 break;
@@ -779,7 +779,7 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
779 tmp = spi_write_then_read(spi, &code, 1, id, 3); 779 tmp = spi_write_then_read(spi, &code, 1, id, 3);
780 if (tmp < 0) { 780 if (tmp < 0) {
781 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n", 781 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
782 spi->dev.bus_id, tmp); 782 dev_name(&spi->dev), tmp);
783 return ERR_PTR(tmp); 783 return ERR_PTR(tmp);
784 } 784 }
785 if (id[0] != 0x1f) 785 if (id[0] != 0x1f)
@@ -869,7 +869,7 @@ static int __devinit dataflash_probe(struct spi_device *spi)
869 status = dataflash_status(spi); 869 status = dataflash_status(spi);
870 if (status <= 0 || status == 0xff) { 870 if (status <= 0 || status == 0xff) {
871 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n", 871 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n",
872 spi->dev.bus_id, status); 872 dev_name(&spi->dev), status);
873 if (status == 0 || status == 0xff) 873 if (status == 0 || status == 0xff)
874 status = -ENODEV; 874 status = -ENODEV;
875 return status; 875 return status;
@@ -905,13 +905,13 @@ static int __devinit dataflash_probe(struct spi_device *spi)
905 /* obsolete AT45DB1282 not (yet?) supported */ 905 /* obsolete AT45DB1282 not (yet?) supported */
906 default: 906 default:
907 DEBUG(MTD_DEBUG_LEVEL1, "%s: unsupported device (%x)\n", 907 DEBUG(MTD_DEBUG_LEVEL1, "%s: unsupported device (%x)\n",
908 spi->dev.bus_id, status & 0x3c); 908 dev_name(&spi->dev), status & 0x3c);
909 status = -ENODEV; 909 status = -ENODEV;
910 } 910 }
911 911
912 if (status < 0) 912 if (status < 0)
913 DEBUG(MTD_DEBUG_LEVEL1, "%s: add_dataflash --> %d\n", 913 DEBUG(MTD_DEBUG_LEVEL1, "%s: add_dataflash --> %d\n",
914 spi->dev.bus_id, status); 914 dev_name(&spi->dev), status);
915 915
916 return status; 916 return status;
917} 917}
@@ -921,7 +921,7 @@ static int __devexit dataflash_remove(struct spi_device *spi)
921 struct dataflash *flash = dev_get_drvdata(&spi->dev); 921 struct dataflash *flash = dev_get_drvdata(&spi->dev);
922 int status; 922 int status;
923 923
924 DEBUG(MTD_DEBUG_LEVEL1, "%s: remove\n", spi->dev.bus_id); 924 DEBUG(MTD_DEBUG_LEVEL1, "%s: remove\n", dev_name(&spi->dev));
925 925
926 if (mtd_has_partitions() && flash->partitioned) 926 if (mtd_has_partitions() && flash->partitioned)
927 status = del_mtd_partitions(&flash->mtd); 927 status = del_mtd_partitions(&flash->mtd);
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index 7100ee3c7b01..d2ec262666c7 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -105,7 +105,7 @@ static int armflash_probe(struct platform_device *dev)
105 info->map.bankwidth = plat->width; 105 info->map.bankwidth = plat->width;
106 info->map.phys = res->start; 106 info->map.phys = res->start;
107 info->map.virt = base; 107 info->map.virt = base;
108 info->map.name = dev->dev.bus_id; 108 info->map.name = dev_name(&dev->dev);
109 info->map.set_vpp = armflash_set_vpp; 109 info->map.set_vpp = armflash_set_vpp;
110 110
111 simple_map_init(&info->map); 111 simple_map_init(&info->map);
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 3ea1de9be720..d4fb9a3ab4df 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -188,7 +188,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
188 */ 188 */
189 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup; 189 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup;
190 190
191 info->map.name = dev->dev.bus_id; 191 info->map.name = dev_name(&dev->dev);
192 info->map.read = ixp2000_flash_read8; 192 info->map.read = ixp2000_flash_read8;
193 info->map.write = ixp2000_flash_write8; 193 info->map.write = ixp2000_flash_write8;
194 info->map.copy_from = ixp2000_flash_copy_from; 194 info->map.copy_from = ixp2000_flash_copy_from;
@@ -196,7 +196,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
196 196
197 info->res = request_mem_region(dev->resource->start, 197 info->res = request_mem_region(dev->resource->start,
198 dev->resource->end - dev->resource->start + 1, 198 dev->resource->end - dev->resource->start + 1,
199 dev->dev.bus_id); 199 dev_name(&dev->dev));
200 if (!info->res) { 200 if (!info->res) {
201 dev_err(&dev->dev, "Could not reserve memory region\n"); 201 dev_err(&dev->dev, "Could not reserve memory region\n");
202 err = -ENOMEM; 202 err = -ENOMEM;
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 16555cbeaea4..7214b876feba 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -218,7 +218,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
218 * handle that. 218 * handle that.
219 */ 219 */
220 info->map.bankwidth = 2; 220 info->map.bankwidth = 2;
221 info->map.name = dev->dev.bus_id; 221 info->map.name = dev_name(&dev->dev);
222 info->map.read = ixp4xx_read16, 222 info->map.read = ixp4xx_read16,
223 info->map.write = ixp4xx_probe_write16, 223 info->map.write = ixp4xx_probe_write16,
224 info->map.copy_from = ixp4xx_copy_from, 224 info->map.copy_from = ixp4xx_copy_from,
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index 05f276af15da..7e50e9b1b781 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -101,7 +101,7 @@ static int __init omapflash_probe(struct platform_device *pdev)
101 err = -ENOMEM; 101 err = -ENOMEM;
102 goto out_release_mem_region; 102 goto out_release_mem_region;
103 } 103 }
104 info->map.name = pdev->dev.bus_id; 104 info->map.name = dev_name(&pdev->dev);
105 info->map.phys = res->start; 105 info->map.phys = res->start;
106 info->map.size = size; 106 info->map.size = size;
107 info->map.bankwidth = pdata->width; 107 info->map.bankwidth = pdata->width;
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index dfbf3f270cea..1db16e549e38 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -108,13 +108,13 @@ static int physmap_flash_probe(struct platform_device *dev)
108 if (!devm_request_mem_region(&dev->dev, 108 if (!devm_request_mem_region(&dev->dev,
109 dev->resource[i].start, 109 dev->resource[i].start,
110 dev->resource[i].end - dev->resource[i].start + 1, 110 dev->resource[i].end - dev->resource[i].start + 1,
111 dev->dev.bus_id)) { 111 dev_name(&dev->dev))) {
112 dev_err(&dev->dev, "Could not reserve memory region\n"); 112 dev_err(&dev->dev, "Could not reserve memory region\n");
113 err = -ENOMEM; 113 err = -ENOMEM;
114 goto err_out; 114 goto err_out;
115 } 115 }
116 116
117 info->map[i].name = dev->dev.bus_id; 117 info->map[i].name = dev_name(&dev->dev);
118 info->map[i].phys = dev->resource[i].start; 118 info->map[i].phys = dev->resource[i].start;
119 info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; 119 info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1;
120 info->map[i].bankwidth = physmap_data->width; 120 info->map[i].bankwidth = physmap_data->width;
@@ -150,7 +150,7 @@ static int physmap_flash_probe(struct platform_device *dev)
150 * We detected multiple devices. Concatenate them together. 150 * We detected multiple devices. Concatenate them together.
151 */ 151 */
152#ifdef CONFIG_MTD_CONCAT 152#ifdef CONFIG_MTD_CONCAT
153 info->cmtd = mtd_concat_create(info->mtd, devices_found, dev->dev.bus_id); 153 info->cmtd = mtd_concat_create(info->mtd, devices_found, dev_name(&dev->dev));
154 if (info->cmtd == NULL) 154 if (info->cmtd == NULL)
155 err = -ENXIO; 155 err = -ENXIO;
156#else 156#else
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 5fcfec034a94..fbf0ca939d72 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -183,7 +183,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
183 183
184 err = -EBUSY; 184 err = -EBUSY;
185 info->res = request_mem_region(res.start, res.end - res.start + 1, 185 info->res = request_mem_region(res.start, res.end - res.start + 1,
186 dev->dev.bus_id); 186 dev_name(&dev->dev));
187 if (!info->res) 187 if (!info->res)
188 goto err_out; 188 goto err_out;
189 189
@@ -194,7 +194,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
194 goto err_out; 194 goto err_out;
195 } 195 }
196 196
197 info->map.name = dev->dev.bus_id; 197 info->map.name = dev_name(&dev->dev);
198 info->map.phys = res.start; 198 info->map.phys = res.start;
199 info->map.size = res.end - res.start + 1; 199 info->map.size = res.end - res.start + 1;
200 info->map.bankwidth = *width; 200 info->map.bankwidth = *width;
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 789842d0e6f2..1a05cf37851e 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -691,7 +691,7 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs)
691 */ 691 */
692struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to concatenate */ 692struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to concatenate */
693 int num_devs, /* number of subdevices */ 693 int num_devs, /* number of subdevices */
694 char *name) 694 const char *name)
695{ /* name for the new device */ 695{ /* name for the new device */
696 int i; 696 int i;
697 size_t size; 697 size_t size;
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index a83192f80eba..7815a404a632 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -222,7 +222,7 @@ static int __devinit fun_probe(struct of_device *ofdev,
222 222
223 fun->rnb_gpio = of_get_gpio(ofdev->node, 0); 223 fun->rnb_gpio = of_get_gpio(ofdev->node, 0);
224 if (fun->rnb_gpio >= 0) { 224 if (fun->rnb_gpio >= 0) {
225 ret = gpio_request(fun->rnb_gpio, ofdev->dev.bus_id); 225 ret = gpio_request(fun->rnb_gpio, dev_name(&ofdev->dev));
226 if (ret) { 226 if (ret) {
227 dev_err(&ofdev->dev, "can't request RNB gpio\n"); 227 dev_err(&ofdev->dev, "can't request RNB gpio\n");
228 goto err2; 228 goto err2;
diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index f674c5427b17..75f9f4874ecf 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -54,7 +54,7 @@ static int __init plat_nand_probe(struct platform_device *pdev)
54 data->chip.priv = &data; 54 data->chip.priv = &data;
55 data->mtd.priv = &data->chip; 55 data->mtd.priv = &data->chip;
56 data->mtd.owner = THIS_MODULE; 56 data->mtd.owner = THIS_MODULE;
57 data->mtd.name = pdev->dev.bus_id; 57 data->mtd.name = dev_name(&pdev->dev);
58 58
59 data->chip.IO_ADDR_R = data->io_base; 59 data->chip.IO_ADDR_R = data->io_base;
60 data->chip.IO_ADDR_W = data->io_base; 60 data->chip.IO_ADDR_W = data->io_base;
diff --git a/drivers/mtd/nand/tmio_nand.c b/drivers/mtd/nand/tmio_nand.c
index edb1e322113d..daa6a4c3b8ce 100644
--- a/drivers/mtd/nand/tmio_nand.c
+++ b/drivers/mtd/nand/tmio_nand.c
@@ -433,7 +433,7 @@ static int tmio_probe(struct platform_device *dev)
433 nand_chip->chip_delay = 15; 433 nand_chip->chip_delay = 15;
434 434
435 retval = request_irq(irq, &tmio_irq, 435 retval = request_irq(irq, &tmio_irq,
436 IRQF_DISABLED, dev->dev.bus_id, tmio); 436 IRQF_DISABLED, dev_name(&dev->dev), tmio);
437 if (retval) { 437 if (retval) {
438 dev_err(&dev->dev, "request_irq error %d\n", retval); 438 dev_err(&dev->dev, "request_irq error %d\n", retval);
439 goto err_irq; 439 goto err_irq;
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c
index ad81ab8e95e2..5b69e7773c6c 100644
--- a/drivers/mtd/onenand/generic.c
+++ b/drivers/mtd/onenand/generic.c
@@ -63,7 +63,7 @@ static int __devinit generic_onenand_probe(struct device *dev)
63 info->onenand.mmcontrol = pdata->mmcontrol; 63 info->onenand.mmcontrol = pdata->mmcontrol;
64 info->onenand.irq = platform_get_irq(pdev, 0); 64 info->onenand.irq = platform_get_irq(pdev, 0);
65 65
66 info->mtd.name = pdev->dev.bus_id; 66 info->mtd.name = dev_name(&pdev->dev);
67 info->mtd.priv = &info->onenand; 67 info->mtd.priv = &info->onenand;
68 info->mtd.owner = THIS_MODULE; 68 info->mtd.owner = THIS_MODULE;
69 69
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index d1e0b8e7224b..96ecc1766fa8 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -668,7 +668,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
668 c->onenand.base); 668 c->onenand.base);
669 669
670 c->pdev = pdev; 670 c->pdev = pdev;
671 c->mtd.name = pdev->dev.bus_id; 671 c->mtd.name = dev_name(&pdev->dev);
672 c->mtd.priv = &c->onenand; 672 c->mtd.priv = &c->onenand;
673 c->mtd.owner = THIS_MODULE; 673 c->mtd.owner = THIS_MODULE;
674 674
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index ba0bd3d5775b..7caf22cd5ad0 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -280,7 +280,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
280 ubi->dev.release = dev_release; 280 ubi->dev.release = dev_release;
281 ubi->dev.devt = ubi->cdev.dev; 281 ubi->dev.devt = ubi->cdev.dev;
282 ubi->dev.class = ubi_class; 282 ubi->dev.class = ubi_class;
283 sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num); 283 dev_set_name(&ubi->dev, UBI_NAME_STR"%d", ubi->ubi_num);
284 err = device_register(&ubi->dev); 284 err = device_register(&ubi->dev);
285 if (err) 285 if (err)
286 return err; 286 return err;
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 3531ca9a1e24..22e1d7398fce 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -329,7 +329,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
329 vol->dev.devt = dev; 329 vol->dev.devt = dev;
330 vol->dev.class = ubi_class; 330 vol->dev.class = ubi_class;
331 331
332 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id); 332 dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id);
333 err = device_register(&vol->dev); 333 err = device_register(&vol->dev);
334 if (err) { 334 if (err) {
335 ubi_err("cannot register device"); 335 ubi_err("cannot register device");
@@ -678,7 +678,7 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
678 vol->dev.parent = &ubi->dev; 678 vol->dev.parent = &ubi->dev;
679 vol->dev.devt = dev; 679 vol->dev.devt = dev;
680 vol->dev.class = ubi_class; 680 vol->dev.class = ubi_class;
681 sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id); 681 dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id);
682 err = device_register(&vol->dev); 682 err = device_register(&vol->dev);
683 if (err) 683 if (err)
684 goto out_gluebi; 684 goto out_gluebi;
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index b4cdd690ae71..99d867bcf22a 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -300,6 +300,14 @@ static void pci_device_shutdown(struct device *dev)
300 300
301#ifdef CONFIG_PM_SLEEP 301#ifdef CONFIG_PM_SLEEP
302 302
303static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
304{
305 struct pci_driver *drv = pci_dev->driver;
306
307 return drv && (drv->suspend || drv->suspend_late || drv->resume
308 || drv->resume_early);
309}
310
303/* 311/*
304 * Default "suspend" method for devices that have no driver provided suspend, 312 * Default "suspend" method for devices that have no driver provided suspend,
305 * or not even a driver at all. 313 * or not even a driver at all.
@@ -317,14 +325,22 @@ static void pci_default_pm_suspend(struct pci_dev *pci_dev)
317 325
318/* 326/*
319 * Default "resume" method for devices that have no driver provided resume, 327 * Default "resume" method for devices that have no driver provided resume,
320 * or not even a driver at all. 328 * or not even a driver at all (first part).
321 */ 329 */
322static int pci_default_pm_resume(struct pci_dev *pci_dev) 330static void pci_default_pm_resume_early(struct pci_dev *pci_dev)
323{ 331{
324 int retval = 0;
325
326 /* restore the PCI config space */ 332 /* restore the PCI config space */
327 pci_restore_state(pci_dev); 333 pci_restore_state(pci_dev);
334}
335
336/*
337 * Default "resume" method for devices that have no driver provided resume,
338 * or not even a driver at all (second part).
339 */
340static int pci_default_pm_resume_late(struct pci_dev *pci_dev)
341{
342 int retval;
343
328 /* if the device was enabled before suspend, reenable */ 344 /* if the device was enabled before suspend, reenable */
329 retval = pci_reenable_device(pci_dev); 345 retval = pci_reenable_device(pci_dev);
330 /* 346 /*
@@ -371,10 +387,12 @@ static int pci_legacy_resume(struct device *dev)
371 struct pci_dev * pci_dev = to_pci_dev(dev); 387 struct pci_dev * pci_dev = to_pci_dev(dev);
372 struct pci_driver * drv = pci_dev->driver; 388 struct pci_driver * drv = pci_dev->driver;
373 389
374 if (drv && drv->resume) 390 if (drv && drv->resume) {
375 error = drv->resume(pci_dev); 391 error = drv->resume(pci_dev);
376 else 392 } else {
377 error = pci_default_pm_resume(pci_dev); 393 pci_default_pm_resume_early(pci_dev);
394 error = pci_default_pm_resume_late(pci_dev);
395 }
378 return error; 396 return error;
379} 397}
380 398
@@ -420,10 +438,8 @@ static int pci_pm_suspend(struct device *dev)
420 if (drv->pm->suspend) { 438 if (drv->pm->suspend) {
421 error = drv->pm->suspend(dev); 439 error = drv->pm->suspend(dev);
422 suspend_report_result(drv->pm->suspend, error); 440 suspend_report_result(drv->pm->suspend, error);
423 } else {
424 pci_default_pm_suspend(pci_dev);
425 } 441 }
426 } else { 442 } else if (pci_has_legacy_pm_support(pci_dev)) {
427 error = pci_legacy_suspend(dev, PMSG_SUSPEND); 443 error = pci_legacy_suspend(dev, PMSG_SUSPEND);
428 } 444 }
429 pci_fixup_device(pci_fixup_suspend, pci_dev); 445 pci_fixup_device(pci_fixup_suspend, pci_dev);
@@ -434,7 +450,7 @@ static int pci_pm_suspend(struct device *dev)
434static int pci_pm_suspend_noirq(struct device *dev) 450static int pci_pm_suspend_noirq(struct device *dev)
435{ 451{
436 struct pci_dev *pci_dev = to_pci_dev(dev); 452 struct pci_dev *pci_dev = to_pci_dev(dev);
437 struct pci_driver *drv = pci_dev->driver; 453 struct device_driver *drv = dev->driver;
438 int error = 0; 454 int error = 0;
439 455
440 if (drv && drv->pm) { 456 if (drv && drv->pm) {
@@ -442,8 +458,10 @@ static int pci_pm_suspend_noirq(struct device *dev)
442 error = drv->pm->suspend_noirq(dev); 458 error = drv->pm->suspend_noirq(dev);
443 suspend_report_result(drv->pm->suspend_noirq, error); 459 suspend_report_result(drv->pm->suspend_noirq, error);
444 } 460 }
445 } else { 461 } else if (pci_has_legacy_pm_support(pci_dev)) {
446 error = pci_legacy_suspend_late(dev, PMSG_SUSPEND); 462 error = pci_legacy_suspend_late(dev, PMSG_SUSPEND);
463 } else {
464 pci_default_pm_suspend(pci_dev);
447 } 465 }
448 466
449 return error; 467 return error;
@@ -453,15 +471,17 @@ static int pci_pm_resume(struct device *dev)
453{ 471{
454 struct pci_dev *pci_dev = to_pci_dev(dev); 472 struct pci_dev *pci_dev = to_pci_dev(dev);
455 struct device_driver *drv = dev->driver; 473 struct device_driver *drv = dev->driver;
456 int error; 474 int error = 0;
457 475
458 pci_fixup_device(pci_fixup_resume, pci_dev); 476 pci_fixup_device(pci_fixup_resume, pci_dev);
459 477
460 if (drv && drv->pm) { 478 if (drv && drv->pm) {
461 error = drv->pm->resume ? drv->pm->resume(dev) : 479 if (drv->pm->resume)
462 pci_default_pm_resume(pci_dev); 480 error = drv->pm->resume(dev);
463 } else { 481 } else if (pci_has_legacy_pm_support(pci_dev)) {
464 error = pci_legacy_resume(dev); 482 error = pci_legacy_resume(dev);
483 } else {
484 error = pci_default_pm_resume_late(pci_dev);
465 } 485 }
466 486
467 return error; 487 return error;
@@ -470,16 +490,18 @@ static int pci_pm_resume(struct device *dev)
470static int pci_pm_resume_noirq(struct device *dev) 490static int pci_pm_resume_noirq(struct device *dev)
471{ 491{
472 struct pci_dev *pci_dev = to_pci_dev(dev); 492 struct pci_dev *pci_dev = to_pci_dev(dev);
473 struct pci_driver *drv = pci_dev->driver; 493 struct device_driver *drv = dev->driver;
474 int error = 0; 494 int error = 0;
475 495
476 pci_fixup_device(pci_fixup_resume_early, pci_dev); 496 pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev));
477 497
478 if (drv && drv->pm) { 498 if (drv && drv->pm) {
479 if (drv->pm->resume_noirq) 499 if (drv->pm->resume_noirq)
480 error = drv->pm->resume_noirq(dev); 500 error = drv->pm->resume_noirq(dev);
481 } else { 501 } else if (pci_has_legacy_pm_support(pci_dev)) {
482 error = pci_legacy_resume_early(dev); 502 error = pci_legacy_resume_early(dev);
503 } else {
504 pci_default_pm_resume_early(pci_dev);
483 } 505 }
484 506
485 return error; 507 return error;
@@ -506,10 +528,8 @@ static int pci_pm_freeze(struct device *dev)
506 if (drv->pm->freeze) { 528 if (drv->pm->freeze) {
507 error = drv->pm->freeze(dev); 529 error = drv->pm->freeze(dev);
508 suspend_report_result(drv->pm->freeze, error); 530 suspend_report_result(drv->pm->freeze, error);
509 } else {
510 pci_default_pm_suspend(pci_dev);
511 } 531 }
512 } else { 532 } else if (pci_has_legacy_pm_support(pci_dev)) {
513 error = pci_legacy_suspend(dev, PMSG_FREEZE); 533 error = pci_legacy_suspend(dev, PMSG_FREEZE);
514 pci_fixup_device(pci_fixup_suspend, pci_dev); 534 pci_fixup_device(pci_fixup_suspend, pci_dev);
515 } 535 }
@@ -520,7 +540,7 @@ static int pci_pm_freeze(struct device *dev)
520static int pci_pm_freeze_noirq(struct device *dev) 540static int pci_pm_freeze_noirq(struct device *dev)
521{ 541{
522 struct pci_dev *pci_dev = to_pci_dev(dev); 542 struct pci_dev *pci_dev = to_pci_dev(dev);
523 struct pci_driver *drv = pci_dev->driver; 543 struct device_driver *drv = dev->driver;
524 int error = 0; 544 int error = 0;
525 545
526 if (drv && drv->pm) { 546 if (drv && drv->pm) {
@@ -528,8 +548,10 @@ static int pci_pm_freeze_noirq(struct device *dev)
528 error = drv->pm->freeze_noirq(dev); 548 error = drv->pm->freeze_noirq(dev);
529 suspend_report_result(drv->pm->freeze_noirq, error); 549 suspend_report_result(drv->pm->freeze_noirq, error);
530 } 550 }
531 } else { 551 } else if (pci_has_legacy_pm_support(pci_dev)) {
532 error = pci_legacy_suspend_late(dev, PMSG_FREEZE); 552 error = pci_legacy_suspend_late(dev, PMSG_FREEZE);
553 } else {
554 pci_default_pm_suspend(pci_dev);
533 } 555 }
534 556
535 return error; 557 return error;
@@ -537,14 +559,15 @@ static int pci_pm_freeze_noirq(struct device *dev)
537 559
538static int pci_pm_thaw(struct device *dev) 560static int pci_pm_thaw(struct device *dev)
539{ 561{
562 struct pci_dev *pci_dev = to_pci_dev(dev);
540 struct device_driver *drv = dev->driver; 563 struct device_driver *drv = dev->driver;
541 int error = 0; 564 int error = 0;
542 565
543 if (drv && drv->pm) { 566 if (drv && drv->pm) {
544 if (drv->pm->thaw) 567 if (drv->pm->thaw)
545 error = drv->pm->thaw(dev); 568 error = drv->pm->thaw(dev);
546 } else { 569 } else if (pci_has_legacy_pm_support(pci_dev)) {
547 pci_fixup_device(pci_fixup_resume, to_pci_dev(dev)); 570 pci_fixup_device(pci_fixup_resume, pci_dev);
548 error = pci_legacy_resume(dev); 571 error = pci_legacy_resume(dev);
549 } 572 }
550 573
@@ -554,14 +577,14 @@ static int pci_pm_thaw(struct device *dev)
554static int pci_pm_thaw_noirq(struct device *dev) 577static int pci_pm_thaw_noirq(struct device *dev)
555{ 578{
556 struct pci_dev *pci_dev = to_pci_dev(dev); 579 struct pci_dev *pci_dev = to_pci_dev(dev);
557 struct pci_driver *drv = pci_dev->driver; 580 struct device_driver *drv = dev->driver;
558 int error = 0; 581 int error = 0;
559 582
560 if (drv && drv->pm) { 583 if (drv && drv->pm) {
561 if (drv->pm->thaw_noirq) 584 if (drv->pm->thaw_noirq)
562 error = drv->pm->thaw_noirq(dev); 585 error = drv->pm->thaw_noirq(dev);
563 } else { 586 } else if (pci_has_legacy_pm_support(pci_dev)) {
564 pci_fixup_device(pci_fixup_resume_early, pci_dev); 587 pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev));
565 error = pci_legacy_resume_early(dev); 588 error = pci_legacy_resume_early(dev);
566 } 589 }
567 590
@@ -570,17 +593,18 @@ static int pci_pm_thaw_noirq(struct device *dev)
570 593
571static int pci_pm_poweroff(struct device *dev) 594static int pci_pm_poweroff(struct device *dev)
572{ 595{
596 struct pci_dev *pci_dev = to_pci_dev(dev);
573 struct device_driver *drv = dev->driver; 597 struct device_driver *drv = dev->driver;
574 int error = 0; 598 int error = 0;
575 599
576 pci_fixup_device(pci_fixup_suspend, to_pci_dev(dev)); 600 pci_fixup_device(pci_fixup_suspend, pci_dev);
577 601
578 if (drv && drv->pm) { 602 if (drv && drv->pm) {
579 if (drv->pm->poweroff) { 603 if (drv->pm->poweroff) {
580 error = drv->pm->poweroff(dev); 604 error = drv->pm->poweroff(dev);
581 suspend_report_result(drv->pm->poweroff, error); 605 suspend_report_result(drv->pm->poweroff, error);
582 } 606 }
583 } else { 607 } else if (pci_has_legacy_pm_support(pci_dev)) {
584 error = pci_legacy_suspend(dev, PMSG_HIBERNATE); 608 error = pci_legacy_suspend(dev, PMSG_HIBERNATE);
585 } 609 }
586 610
@@ -589,8 +613,7 @@ static int pci_pm_poweroff(struct device *dev)
589 613
590static int pci_pm_poweroff_noirq(struct device *dev) 614static int pci_pm_poweroff_noirq(struct device *dev)
591{ 615{
592 struct pci_dev *pci_dev = to_pci_dev(dev); 616 struct device_driver *drv = dev->driver;
593 struct pci_driver *drv = pci_dev->driver;
594 int error = 0; 617 int error = 0;
595 618
596 if (drv && drv->pm) { 619 if (drv && drv->pm) {
@@ -598,7 +621,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
598 error = drv->pm->poweroff_noirq(dev); 621 error = drv->pm->poweroff_noirq(dev);
599 suspend_report_result(drv->pm->poweroff_noirq, error); 622 suspend_report_result(drv->pm->poweroff_noirq, error);
600 } 623 }
601 } else { 624 } else if (pci_has_legacy_pm_support(to_pci_dev(dev))) {
602 error = pci_legacy_suspend_late(dev, PMSG_HIBERNATE); 625 error = pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
603 } 626 }
604 627
@@ -609,13 +632,15 @@ static int pci_pm_restore(struct device *dev)
609{ 632{
610 struct pci_dev *pci_dev = to_pci_dev(dev); 633 struct pci_dev *pci_dev = to_pci_dev(dev);
611 struct device_driver *drv = dev->driver; 634 struct device_driver *drv = dev->driver;
612 int error; 635 int error = 0;
613 636
614 if (drv && drv->pm) { 637 if (drv && drv->pm) {
615 error = drv->pm->restore ? drv->pm->restore(dev) : 638 if (drv->pm->restore)
616 pci_default_pm_resume(pci_dev); 639 error = drv->pm->restore(dev);
617 } else { 640 } else if (pci_has_legacy_pm_support(pci_dev)) {
618 error = pci_legacy_resume(dev); 641 error = pci_legacy_resume(dev);
642 } else {
643 error = pci_default_pm_resume_late(pci_dev);
619 } 644 }
620 pci_fixup_device(pci_fixup_resume, pci_dev); 645 pci_fixup_device(pci_fixup_resume, pci_dev);
621 646
@@ -625,7 +650,7 @@ static int pci_pm_restore(struct device *dev)
625static int pci_pm_restore_noirq(struct device *dev) 650static int pci_pm_restore_noirq(struct device *dev)
626{ 651{
627 struct pci_dev *pci_dev = to_pci_dev(dev); 652 struct pci_dev *pci_dev = to_pci_dev(dev);
628 struct pci_driver *drv = pci_dev->driver; 653 struct device_driver *drv = dev->driver;
629 int error = 0; 654 int error = 0;
630 655
631 pci_fixup_device(pci_fixup_resume, pci_dev); 656 pci_fixup_device(pci_fixup_resume, pci_dev);
@@ -633,8 +658,10 @@ static int pci_pm_restore_noirq(struct device *dev)
633 if (drv && drv->pm) { 658 if (drv && drv->pm) {
634 if (drv->pm->restore_noirq) 659 if (drv->pm->restore_noirq)
635 error = drv->pm->restore_noirq(dev); 660 error = drv->pm->restore_noirq(dev);
636 } else { 661 } else if (pci_has_legacy_pm_support(pci_dev)) {
637 error = pci_legacy_resume_early(dev); 662 error = pci_legacy_resume_early(dev);
663 } else {
664 pci_default_pm_resume_early(pci_dev);
638 } 665 }
639 pci_fixup_device(pci_fixup_resume_early, pci_dev); 666 pci_fixup_device(pci_fixup_resume_early, pci_dev);
640 667
@@ -654,17 +681,15 @@ static int pci_pm_restore_noirq(struct device *dev)
654 681
655#endif /* !CONFIG_HIBERNATION */ 682#endif /* !CONFIG_HIBERNATION */
656 683
657struct pm_ext_ops pci_pm_ops = { 684struct dev_pm_ops pci_dev_pm_ops = {
658 .base = { 685 .prepare = pci_pm_prepare,
659 .prepare = pci_pm_prepare, 686 .complete = pci_pm_complete,
660 .complete = pci_pm_complete, 687 .suspend = pci_pm_suspend,
661 .suspend = pci_pm_suspend, 688 .resume = pci_pm_resume,
662 .resume = pci_pm_resume, 689 .freeze = pci_pm_freeze,
663 .freeze = pci_pm_freeze, 690 .thaw = pci_pm_thaw,
664 .thaw = pci_pm_thaw, 691 .poweroff = pci_pm_poweroff,
665 .poweroff = pci_pm_poweroff, 692 .restore = pci_pm_restore,
666 .restore = pci_pm_restore,
667 },
668 .suspend_noirq = pci_pm_suspend_noirq, 693 .suspend_noirq = pci_pm_suspend_noirq,
669 .resume_noirq = pci_pm_resume_noirq, 694 .resume_noirq = pci_pm_resume_noirq,
670 .freeze_noirq = pci_pm_freeze_noirq, 695 .freeze_noirq = pci_pm_freeze_noirq,
@@ -673,7 +698,7 @@ struct pm_ext_ops pci_pm_ops = {
673 .restore_noirq = pci_pm_restore_noirq, 698 .restore_noirq = pci_pm_restore_noirq,
674}; 699};
675 700
676#define PCI_PM_OPS_PTR &pci_pm_ops 701#define PCI_PM_OPS_PTR (&pci_dev_pm_ops)
677 702
678#else /* !CONFIG_PM_SLEEP */ 703#else /* !CONFIG_PM_SLEEP */
679 704
@@ -703,9 +728,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner,
703 drv->driver.owner = owner; 728 drv->driver.owner = owner;
704 drv->driver.mod_name = mod_name; 729 drv->driver.mod_name = mod_name;
705 730
706 if (drv->pm)
707 drv->driver.pm = &drv->pm->base;
708
709 spin_lock_init(&drv->dynids.lock); 731 spin_lock_init(&drv->dynids.lock);
710 INIT_LIST_HEAD(&drv->dynids.list); 732 INIT_LIST_HEAD(&drv->dynids.list);
711 733
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index e75b060daa95..efea128f02da 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -165,8 +165,7 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp
165 card->number = id; 165 card->number = id;
166 166
167 card->dev.parent = &card->protocol->dev; 167 card->dev.parent = &card->protocol->dev;
168 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, 168 dev_set_name(&card->dev, "%02x:%02x", card->protocol->number, card->number);
169 card->number);
170 169
171 card->dev.coherent_dma_mask = DMA_24BIT_MASK; 170 card->dev.coherent_dma_mask = DMA_24BIT_MASK;
172 card->dev.dma_mask = &card->dev.coherent_dma_mask; 171 card->dev.dma_mask = &card->dev.coherent_dma_mask;
@@ -295,8 +294,8 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
295{ 294{
296 dev->dev.parent = &card->dev; 295 dev->dev.parent = &card->dev;
297 dev->card_link = NULL; 296 dev->card_link = NULL;
298 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", 297 dev_set_name(&dev->dev, "%02x:%02x.%02x",
299 dev->protocol->number, card->number, dev->number); 298 dev->protocol->number, card->number, dev->number);
300 spin_lock(&pnp_lock); 299 spin_lock(&pnp_lock);
301 dev->card = card; 300 dev->card = card;
302 list_add_tail(&dev->card_list, &card->devices); 301 list_add_tail(&dev->card_list, &card->devices);
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 16c01c6fa7c5..14814f231739 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -70,7 +70,7 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
70 spin_unlock(&pnp_lock); 70 spin_unlock(&pnp_lock);
71 71
72 protocol->number = nodenum; 72 protocol->number = nodenum;
73 sprintf(protocol->dev.bus_id, "pnp%d", nodenum); 73 dev_set_name(&protocol->dev, "pnp%d", nodenum);
74 return device_register(&protocol->dev); 74 return device_register(&protocol->dev);
75} 75}
76 76
@@ -145,8 +145,7 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
145 dev->dev.coherent_dma_mask = dev->dma_mask; 145 dev->dev.coherent_dma_mask = dev->dma_mask;
146 dev->dev.release = &pnp_release_device; 146 dev->dev.release = &pnp_release_device;
147 147
148 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 148 dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
149 dev->number);
150 149
151 dev_id = pnp_add_id(dev, pnpid); 150 dev_id = pnp_add_id(dev, pnpid);
152 if (!dev_id) { 151 if (!dev_id) {
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 764f3a310685..59b90922da8c 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -26,7 +26,7 @@ static void reserve_range(struct pnp_dev *dev, resource_size_t start,
26 resource_size_t end, int port) 26 resource_size_t end, int port)
27{ 27{
28 char *regionid; 28 char *regionid;
29 const char *pnpid = dev->dev.bus_id; 29 const char *pnpid = dev_name(&dev->dev);
30 struct resource *res; 30 struct resource *res;
31 31
32 regionid = kmalloc(16, GFP_KERNEL); 32 regionid = kmalloc(16, GFP_KERNEL);
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index 308ddb201b66..1d768928e0bb 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -354,7 +354,7 @@ static int ds2760_battery_probe(struct platform_device *pdev)
354 pdata = pdev->dev.platform_data; 354 pdata = pdev->dev.platform_data;
355 di->dev = &pdev->dev; 355 di->dev = &pdev->dev;
356 di->w1_dev = pdev->dev.parent; 356 di->w1_dev = pdev->dev.parent;
357 di->bat.name = pdev->dev.bus_id; 357 di->bat.name = dev_name(&pdev->dev);
358 di->bat.type = POWER_SUPPLY_TYPE_BATTERY; 358 di->bat.type = POWER_SUPPLY_TYPE_BATTERY;
359 di->bat.properties = ds2760_battery_props; 359 di->bat.properties = ds2760_battery_props;
360 di->bat.num_properties = ARRAY_SIZE(ds2760_battery_props); 360 di->bat.num_properties = ARRAY_SIZE(ds2760_battery_props);
@@ -371,7 +371,7 @@ static int ds2760_battery_probe(struct platform_device *pdev)
371 } 371 }
372 372
373 INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work); 373 INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work);
374 di->monitor_wqueue = create_singlethread_workqueue(pdev->dev.bus_id); 374 di->monitor_wqueue = create_singlethread_workqueue(dev_name(&pdev->dev));
375 if (!di->monitor_wqueue) { 375 if (!di->monitor_wqueue) {
376 retval = -ESRCH; 376 retval = -ESRCH;
377 goto workqueue_failed; 377 goto workqueue_failed;
diff --git a/drivers/s390/Makefile b/drivers/s390/Makefile
index 4f4e7cf105d4..d0eae59bc366 100644
--- a/drivers/s390/Makefile
+++ b/drivers/s390/Makefile
@@ -4,7 +4,7 @@
4 4
5CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w 5CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w
6 6
7obj-y += s390mach.o sysinfo.o s390_rdev.o 7obj-y += s390mach.o sysinfo.o
8obj-y += cio/ block/ char/ crypto/ net/ scsi/ kvm/ 8obj-y += cio/ block/ char/ crypto/ net/ scsi/ kvm/
9 9
10drivers-y += drivers/s390/built-in.o 10drivers-y += drivers/s390/built-in.o
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 26ffc6ab441d..cfdcf1aed33c 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -18,7 +18,6 @@
18#include <asm/io.h> 18#include <asm/io.h>
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <asm/s390_rdev.h>
22 21
23#define DCSSBLK_NAME "dcssblk" 22#define DCSSBLK_NAME "dcssblk"
24#define DCSSBLK_MINORS_PER_DISK 1 23#define DCSSBLK_MINORS_PER_DISK 1
@@ -946,7 +945,7 @@ dcssblk_check_params(void)
946static void __exit 945static void __exit
947dcssblk_exit(void) 946dcssblk_exit(void)
948{ 947{
949 s390_root_dev_unregister(dcssblk_root_dev); 948 root_device_unregister(dcssblk_root_dev);
950 unregister_blkdev(dcssblk_major, DCSSBLK_NAME); 949 unregister_blkdev(dcssblk_major, DCSSBLK_NAME);
951} 950}
952 951
@@ -955,22 +954,22 @@ dcssblk_init(void)
955{ 954{
956 int rc; 955 int rc;
957 956
958 dcssblk_root_dev = s390_root_dev_register("dcssblk"); 957 dcssblk_root_dev = root_device_register("dcssblk");
959 if (IS_ERR(dcssblk_root_dev)) 958 if (IS_ERR(dcssblk_root_dev))
960 return PTR_ERR(dcssblk_root_dev); 959 return PTR_ERR(dcssblk_root_dev);
961 rc = device_create_file(dcssblk_root_dev, &dev_attr_add); 960 rc = device_create_file(dcssblk_root_dev, &dev_attr_add);
962 if (rc) { 961 if (rc) {
963 s390_root_dev_unregister(dcssblk_root_dev); 962 root_device_unregister(dcssblk_root_dev);
964 return rc; 963 return rc;
965 } 964 }
966 rc = device_create_file(dcssblk_root_dev, &dev_attr_remove); 965 rc = device_create_file(dcssblk_root_dev, &dev_attr_remove);
967 if (rc) { 966 if (rc) {
968 s390_root_dev_unregister(dcssblk_root_dev); 967 root_device_unregister(dcssblk_root_dev);
969 return rc; 968 return rc;
970 } 969 }
971 rc = register_blkdev(0, DCSSBLK_NAME); 970 rc = register_blkdev(0, DCSSBLK_NAME);
972 if (rc < 0) { 971 if (rc < 0) {
973 s390_root_dev_unregister(dcssblk_root_dev); 972 root_device_unregister(dcssblk_root_dev);
974 return rc; 973 return rc;
975 } 974 }
976 dcssblk_major = rc; 975 dcssblk_major = rc;
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 1f5f5d2d87d9..9c148406b980 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -36,7 +36,6 @@
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/kthread.h> 37#include <linux/kthread.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <asm/s390_rdev.h>
40#include <asm/reset.h> 39#include <asm/reset.h>
41#include <asm/airq.h> 40#include <asm/airq.h>
42#include <asm/atomic.h> 41#include <asm/atomic.h>
@@ -1522,7 +1521,7 @@ int __init ap_module_init(void)
1522 } 1521 }
1523 1522
1524 /* Create /sys/devices/ap. */ 1523 /* Create /sys/devices/ap. */
1525 ap_root_device = s390_root_dev_register("ap"); 1524 ap_root_device = root_device_register("ap");
1526 rc = IS_ERR(ap_root_device) ? PTR_ERR(ap_root_device) : 0; 1525 rc = IS_ERR(ap_root_device) ? PTR_ERR(ap_root_device) : 0;
1527 if (rc) 1526 if (rc)
1528 goto out_bus; 1527 goto out_bus;
@@ -1565,7 +1564,7 @@ out_work:
1565 hrtimer_cancel(&ap_poll_timer); 1564 hrtimer_cancel(&ap_poll_timer);
1566 destroy_workqueue(ap_work_queue); 1565 destroy_workqueue(ap_work_queue);
1567out_root: 1566out_root:
1568 s390_root_dev_unregister(ap_root_device); 1567 root_device_unregister(ap_root_device);
1569out_bus: 1568out_bus:
1570 while (i--) 1569 while (i--)
1571 bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); 1570 bus_remove_file(&ap_bus_type, ap_bus_attrs[i]);
@@ -1600,7 +1599,7 @@ void ap_module_exit(void)
1600 hrtimer_cancel(&ap_poll_timer); 1599 hrtimer_cancel(&ap_poll_timer);
1601 destroy_workqueue(ap_work_queue); 1600 destroy_workqueue(ap_work_queue);
1602 tasklet_kill(&ap_tasklet); 1601 tasklet_kill(&ap_tasklet);
1603 s390_root_dev_unregister(ap_root_device); 1602 root_device_unregister(ap_root_device);
1604 while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, 1603 while ((dev = bus_find_device(&ap_bus_type, NULL, NULL,
1605 __ap_match_all))) 1604 __ap_match_all)))
1606 { 1605 {
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 28c90b89f2b4..cbc8566fab70 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -24,7 +24,6 @@
24#include <asm/kvm_virtio.h> 24#include <asm/kvm_virtio.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/s390_ext.h> 26#include <asm/s390_ext.h>
27#include <asm/s390_rdev.h>
28 27
29#define VIRTIO_SUBCODE_64 0x0D00 28#define VIRTIO_SUBCODE_64 0x0D00
30 29
@@ -335,7 +334,7 @@ static int __init kvm_devices_init(void)
335 if (!MACHINE_IS_KVM) 334 if (!MACHINE_IS_KVM)
336 return -ENODEV; 335 return -ENODEV;
337 336
338 kvm_root = s390_root_dev_register("kvm_s390"); 337 kvm_root = root_device_register("kvm_s390");
339 if (IS_ERR(kvm_root)) { 338 if (IS_ERR(kvm_root)) {
340 rc = PTR_ERR(kvm_root); 339 rc = PTR_ERR(kvm_root);
341 printk(KERN_ERR "Could not register kvm_s390 root device"); 340 printk(KERN_ERR "Could not register kvm_s390 root device");
@@ -344,7 +343,7 @@ static int __init kvm_devices_init(void)
344 343
345 rc = vmem_add_mapping(real_memory_size, PAGE_SIZE); 344 rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
346 if (rc) { 345 if (rc) {
347 s390_root_dev_unregister(kvm_root); 346 root_device_unregister(kvm_root);
348 return rc; 347 return rc;
349 } 348 }
350 349
diff --git a/drivers/s390/net/cu3088.c b/drivers/s390/net/cu3088.c
index f4a32375c037..48383459e99b 100644
--- a/drivers/s390/net/cu3088.c
+++ b/drivers/s390/net/cu3088.c
@@ -25,7 +25,6 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/err.h> 26#include <linux/err.h>
27 27
28#include <asm/s390_rdev.h>
29#include <asm/ccwdev.h> 28#include <asm/ccwdev.h>
30#include <asm/ccwgroup.h> 29#include <asm/ccwgroup.h>
31 30
@@ -120,12 +119,12 @@ cu3088_init (void)
120{ 119{
121 int rc; 120 int rc;
122 121
123 cu3088_root_dev = s390_root_dev_register("cu3088"); 122 cu3088_root_dev = root_device_register("cu3088");
124 if (IS_ERR(cu3088_root_dev)) 123 if (IS_ERR(cu3088_root_dev))
125 return PTR_ERR(cu3088_root_dev); 124 return PTR_ERR(cu3088_root_dev);
126 rc = ccw_driver_register(&cu3088_driver); 125 rc = ccw_driver_register(&cu3088_driver);
127 if (rc) 126 if (rc)
128 s390_root_dev_unregister(cu3088_root_dev); 127 root_device_unregister(cu3088_root_dev);
129 128
130 return rc; 129 return rc;
131} 130}
@@ -134,7 +133,7 @@ static void __exit
134cu3088_exit (void) 133cu3088_exit (void)
135{ 134{
136 ccw_driver_unregister(&cu3088_driver); 135 ccw_driver_unregister(&cu3088_driver);
137 s390_root_dev_unregister(cu3088_root_dev); 136 root_device_unregister(cu3088_root_dev);
138} 137}
139 138
140MODULE_DEVICE_TABLE(ccw,cu3088_ids); 139MODULE_DEVICE_TABLE(ccw,cu3088_ids);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 6811dd529f48..d1b5bebea7fb 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -24,7 +24,6 @@
24 24
25#include <asm/ebcdic.h> 25#include <asm/ebcdic.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/s390_rdev.h>
28 27
29#include "qeth_core.h" 28#include "qeth_core.h"
30#include "qeth_core_offl.h" 29#include "qeth_core_offl.h"
@@ -4525,7 +4524,7 @@ static int __init qeth_core_init(void)
4525 &driver_attr_group); 4524 &driver_attr_group);
4526 if (rc) 4525 if (rc)
4527 goto driver_err; 4526 goto driver_err;
4528 qeth_core_root_dev = s390_root_dev_register("qeth"); 4527 qeth_core_root_dev = root_device_register("qeth");
4529 rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; 4528 rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0;
4530 if (rc) 4529 if (rc)
4531 goto register_err; 4530 goto register_err;
@@ -4539,7 +4538,7 @@ static int __init qeth_core_init(void)
4539 4538
4540 return 0; 4539 return 0;
4541slab_err: 4540slab_err:
4542 s390_root_dev_unregister(qeth_core_root_dev); 4541 root_device_unregister(qeth_core_root_dev);
4543register_err: 4542register_err:
4544 driver_remove_file(&qeth_core_ccwgroup_driver.driver, 4543 driver_remove_file(&qeth_core_ccwgroup_driver.driver,
4545 &driver_attr_group); 4544 &driver_attr_group);
@@ -4557,7 +4556,7 @@ out_err:
4557 4556
4558static void __exit qeth_core_exit(void) 4557static void __exit qeth_core_exit(void)
4559{ 4558{
4560 s390_root_dev_unregister(qeth_core_root_dev); 4559 root_device_unregister(qeth_core_root_dev);
4561 driver_remove_file(&qeth_core_ccwgroup_driver.driver, 4560 driver_remove_file(&qeth_core_ccwgroup_driver.driver,
4562 &driver_attr_group); 4561 &driver_attr_group);
4563 ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); 4562 ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver);
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 21627ba3093b..591a2b3ae4cb 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -20,8 +20,6 @@
20#include <linux/mii.h> 20#include <linux/mii.h>
21#include <linux/ip.h> 21#include <linux/ip.h>
22 22
23#include <asm/s390_rdev.h>
24
25#include "qeth_core.h" 23#include "qeth_core.h"
26#include "qeth_core_offl.h" 24#include "qeth_core_offl.h"
27 25
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index cfda1ecffdf2..4693ee4e7b98 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -26,8 +26,6 @@
26#include <net/ip.h> 26#include <net/ip.h>
27#include <net/arp.h> 27#include <net/arp.h>
28 28
29#include <asm/s390_rdev.h>
30
31#include "qeth_l3.h" 29#include "qeth_l3.h"
32#include "qeth_core_offl.h" 30#include "qeth_core_offl.h"
33 31
diff --git a/drivers/s390/s390_rdev.c b/drivers/s390/s390_rdev.c
deleted file mode 100644
index 64371c05a3b3..000000000000
--- a/drivers/s390/s390_rdev.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * drivers/s390/s390_rdev.c
3 * s390 root device
4 *
5 * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH,
6 * IBM Corporation
7 * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com)
8 * Carsten Otte (cotte@de.ibm.com)
9 */
10
11#include <linux/slab.h>
12#include <linux/err.h>
13#include <linux/device.h>
14#include <asm/s390_rdev.h>
15
16static void
17s390_root_dev_release(struct device *dev)
18{
19 kfree(dev);
20}
21
22struct device *
23s390_root_dev_register(const char *name)
24{
25 struct device *dev;
26 int ret;
27
28 if (!strlen(name))
29 return ERR_PTR(-EINVAL);
30 dev = kzalloc(sizeof(struct device), GFP_KERNEL);
31 if (!dev)
32 return ERR_PTR(-ENOMEM);
33 dev_set_name(dev, name);
34 dev->release = s390_root_dev_release;
35 ret = device_register(dev);
36 if (ret) {
37 kfree(dev);
38 return ERR_PTR(ret);
39 }
40 return dev;
41}
42
43void
44s390_root_dev_unregister(struct device *dev)
45{
46 if (dev)
47 device_unregister(dev);
48}
49
50EXPORT_SYMBOL(s390_root_dev_register);
51EXPORT_SYMBOL(s390_root_dev_unregister);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index dc68b7e0c930..42f4e66fccaf 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2030,7 +2030,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
2030 if (!tries) 2030 if (!tries)
2031 printk(KERN_ERR "%s%s%s%d: Unable to drain " 2031 printk(KERN_ERR "%s%s%s%d: Unable to drain "
2032 "transmitter\n", 2032 "transmitter\n",
2033 port->dev ? port->dev->bus_id : "", 2033 port->dev ? dev_name(port->dev) : "",
2034 port->dev ? ": " : "", 2034 port->dev ? ": " : "",
2035 drv->dev_name, 2035 drv->dev_name,
2036 drv->tty_driver->name_base + port->line); 2036 drv->tty_driver->name_base + port->line);
@@ -2156,7 +2156,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
2156 } 2156 }
2157 2157
2158 printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n", 2158 printk(KERN_INFO "%s%s%s%d at %s (irq = %d) is a %s\n",
2159 port->dev ? port->dev->bus_id : "", 2159 port->dev ? dev_name(port->dev) : "",
2160 port->dev ? ": " : "", 2160 port->dev ? ": " : "",
2161 drv->dev_name, 2161 drv->dev_name,
2162 drv->tty_driver->name_base + port->line, 2162 drv->tty_driver->name_base + port->line,
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3734dc9708e1..643908b74bc0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -47,7 +47,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf)
47{ 47{
48 const struct spi_device *spi = to_spi_device(dev); 48 const struct spi_device *spi = to_spi_device(dev);
49 49
50 return snprintf(buf, BUS_ID_SIZE + 1, "%s\n", spi->modalias); 50 return sprintf(buf, "%s\n", spi->modalias);
51} 51}
52 52
53static struct device_attribute spi_dev_attrs[] = { 53static struct device_attribute spi_dev_attrs[] = {
@@ -63,7 +63,7 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)
63{ 63{
64 const struct spi_device *spi = to_spi_device(dev); 64 const struct spi_device *spi = to_spi_device(dev);
65 65
66 return strncmp(spi->modalias, drv->name, BUS_ID_SIZE) == 0; 66 return strcmp(spi->modalias, drv->name) == 0;
67} 67}
68 68
69static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) 69static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
@@ -243,8 +243,7 @@ int spi_add_device(struct spi_device *spi)
243 } 243 }
244 244
245 /* Set the bus ID string */ 245 /* Set the bus ID string */
246 snprintf(spi->dev.bus_id, sizeof spi->dev.bus_id, 246 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev),
247 "%s.%u", spi->master->dev.bus_id,
248 spi->chip_select); 247 spi->chip_select);
249 248
250 249
@@ -254,7 +253,7 @@ int spi_add_device(struct spi_device *spi)
254 */ 253 */
255 mutex_lock(&spi_add_lock); 254 mutex_lock(&spi_add_lock);
256 255
257 if (bus_find_device_by_name(&spi_bus_type, NULL, spi->dev.bus_id) 256 if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev))
258 != NULL) { 257 != NULL) {
259 dev_err(dev, "chipselect %d already in use\n", 258 dev_err(dev, "chipselect %d already in use\n",
260 spi->chip_select); 259 spi->chip_select);
@@ -269,7 +268,7 @@ int spi_add_device(struct spi_device *spi)
269 status = spi->master->setup(spi); 268 status = spi->master->setup(spi);
270 if (status < 0) { 269 if (status < 0) {
271 dev_err(dev, "can't %s %s, status %d\n", 270 dev_err(dev, "can't %s %s, status %d\n",
272 "setup", spi->dev.bus_id, status); 271 "setup", dev_name(&spi->dev), status);
273 goto done; 272 goto done;
274 } 273 }
275 274
@@ -277,9 +276,9 @@ int spi_add_device(struct spi_device *spi)
277 status = device_add(&spi->dev); 276 status = device_add(&spi->dev);
278 if (status < 0) 277 if (status < 0)
279 dev_err(dev, "can't %s %s, status %d\n", 278 dev_err(dev, "can't %s %s, status %d\n",
280 "add", spi->dev.bus_id, status); 279 "add", dev_name(&spi->dev), status);
281 else 280 else
282 dev_dbg(dev, "registered child %s\n", spi->dev.bus_id); 281 dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev));
283 282
284done: 283done:
285 mutex_unlock(&spi_add_lock); 284 mutex_unlock(&spi_add_lock);
@@ -504,12 +503,11 @@ int spi_register_master(struct spi_master *master)
504 /* register the device, then userspace will see it. 503 /* register the device, then userspace will see it.
505 * registration fails if the bus ID is in use. 504 * registration fails if the bus ID is in use.
506 */ 505 */
507 snprintf(master->dev.bus_id, sizeof master->dev.bus_id, 506 dev_set_name(&master->dev, "spi%u", master->bus_num);
508 "spi%u", master->bus_num);
509 status = device_add(&master->dev); 507 status = device_add(&master->dev);
510 if (status < 0) 508 if (status < 0)
511 goto done; 509 goto done;
512 dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, 510 dev_dbg(dev, "registered master %s%s\n", dev_name(&master->dev),
513 dynamic ? " (dynamic)" : ""); 511 dynamic ? " (dynamic)" : "");
514 512
515 /* populate children from any spi device tables */ 513 /* populate children from any spi device tables */
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 96cc39ecb6e2..85e61f451218 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -475,7 +475,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
475 /* this task is the only thing to touch the SPI bits */ 475 /* this task is the only thing to touch the SPI bits */
476 bitbang->busy = 0; 476 bitbang->busy = 0;
477 bitbang->workqueue = create_singlethread_workqueue( 477 bitbang->workqueue = create_singlethread_workqueue(
478 bitbang->master->dev.parent->bus_id); 478 dev_name(bitbang->master->dev.parent));
479 if (bitbang->workqueue == NULL) { 479 if (bitbang->workqueue == NULL) {
480 status = -EBUSY; 480 status = -EBUSY;
481 goto err1; 481 goto err1;
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 0ee2b2090252..c2184866fa9c 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -287,7 +287,7 @@ static void butterfly_attach(struct parport *p)
287 pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]); 287 pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]);
288 if (pp->dataflash) 288 if (pp->dataflash)
289 pr_debug("%s: dataflash at %s\n", p->name, 289 pr_debug("%s: dataflash at %s\n", p->name,
290 pp->dataflash->dev.bus_id); 290 dev_name(&pp->dataflash->dev));
291 291
292 // dev_info(_what?_, ...) 292 // dev_info(_what?_, ...)
293 pr_info("%s: AVR Butterfly\n", p->name); 293 pr_info("%s: AVR Butterfly\n", p->name);
diff --git a/drivers/spi/spi_lm70llp.c b/drivers/spi/spi_lm70llp.c
index 39d8d8ad65c0..af6526767e2a 100644
--- a/drivers/spi/spi_lm70llp.c
+++ b/drivers/spi/spi_lm70llp.c
@@ -287,7 +287,7 @@ static void spi_lm70llp_attach(struct parport *p)
287 pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info); 287 pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info);
288 if (pp->spidev_lm70) 288 if (pp->spidev_lm70)
289 dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n", 289 dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
290 pp->spidev_lm70->dev.bus_id); 290 dev_name(&pp->spidev_lm70->dev));
291 else { 291 else {
292 printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME); 292 printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME);
293 status = -ENODEV; 293 status = -ENODEV;
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index fe07462d5947..8171ca17b936 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -579,7 +579,7 @@ static void thermal_release(struct device *dev)
579 struct thermal_zone_device *tz; 579 struct thermal_zone_device *tz;
580 struct thermal_cooling_device *cdev; 580 struct thermal_cooling_device *cdev;
581 581
582 if (!strncmp(dev->bus_id, "thermal_zone", sizeof "thermal_zone" - 1)) { 582 if (!strncmp(dev_name(dev), "thermal_zone", sizeof "thermal_zone" - 1)) {
583 tz = to_thermal_zone(dev); 583 tz = to_thermal_zone(dev);
584 kfree(tz); 584 kfree(tz);
585 } else { 585 } else {
@@ -630,7 +630,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
630 cdev->ops = ops; 630 cdev->ops = ops;
631 cdev->device.class = &thermal_class; 631 cdev->device.class = &thermal_class;
632 cdev->devdata = devdata; 632 cdev->devdata = devdata;
633 sprintf(cdev->device.bus_id, "cooling_device%d", cdev->id); 633 dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
634 result = device_register(&cdev->device); 634 result = device_register(&cdev->device);
635 if (result) { 635 if (result) {
636 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); 636 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
@@ -769,7 +769,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
769 tz->device.class = &thermal_class; 769 tz->device.class = &thermal_class;
770 tz->devdata = devdata; 770 tz->devdata = devdata;
771 tz->trips = trips; 771 tz->trips = trips;
772 sprintf(tz->device.bus_id, "thermal_zone%d", tz->id); 772 dev_set_name(&tz->device, "thermal_zone%d", tz->id);
773 result = device_register(&tz->device); 773 result = device_register(&tz->device);
774 if (result) { 774 if (result) {
775 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 775 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 2d2440cd57a9..4ca85a113aa2 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -35,6 +35,7 @@ struct uio_device {
35 int vma_count; 35 int vma_count;
36 struct uio_info *info; 36 struct uio_info *info;
37 struct kobject *map_dir; 37 struct kobject *map_dir;
38 struct kobject *portio_dir;
38}; 39};
39 40
40static int uio_major; 41static int uio_major;
@@ -75,17 +76,17 @@ static ssize_t map_offset_show(struct uio_mem *mem, char *buf)
75 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK); 76 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK);
76} 77}
77 78
78struct uio_sysfs_entry { 79struct map_sysfs_entry {
79 struct attribute attr; 80 struct attribute attr;
80 ssize_t (*show)(struct uio_mem *, char *); 81 ssize_t (*show)(struct uio_mem *, char *);
81 ssize_t (*store)(struct uio_mem *, const char *, size_t); 82 ssize_t (*store)(struct uio_mem *, const char *, size_t);
82}; 83};
83 84
84static struct uio_sysfs_entry addr_attribute = 85static struct map_sysfs_entry addr_attribute =
85 __ATTR(addr, S_IRUGO, map_addr_show, NULL); 86 __ATTR(addr, S_IRUGO, map_addr_show, NULL);
86static struct uio_sysfs_entry size_attribute = 87static struct map_sysfs_entry size_attribute =
87 __ATTR(size, S_IRUGO, map_size_show, NULL); 88 __ATTR(size, S_IRUGO, map_size_show, NULL);
88static struct uio_sysfs_entry offset_attribute = 89static struct map_sysfs_entry offset_attribute =
89 __ATTR(offset, S_IRUGO, map_offset_show, NULL); 90 __ATTR(offset, S_IRUGO, map_offset_show, NULL);
90 91
91static struct attribute *attrs[] = { 92static struct attribute *attrs[] = {
@@ -106,9 +107,9 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
106{ 107{
107 struct uio_map *map = to_map(kobj); 108 struct uio_map *map = to_map(kobj);
108 struct uio_mem *mem = map->mem; 109 struct uio_mem *mem = map->mem;
109 struct uio_sysfs_entry *entry; 110 struct map_sysfs_entry *entry;
110 111
111 entry = container_of(attr, struct uio_sysfs_entry, attr); 112 entry = container_of(attr, struct map_sysfs_entry, attr);
112 113
113 if (!entry->show) 114 if (!entry->show)
114 return -EIO; 115 return -EIO;
@@ -116,16 +117,93 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
116 return entry->show(mem, buf); 117 return entry->show(mem, buf);
117} 118}
118 119
119static struct sysfs_ops uio_sysfs_ops = { 120static struct sysfs_ops map_sysfs_ops = {
120 .show = map_type_show, 121 .show = map_type_show,
121}; 122};
122 123
123static struct kobj_type map_attr_type = { 124static struct kobj_type map_attr_type = {
124 .release = map_release, 125 .release = map_release,
125 .sysfs_ops = &uio_sysfs_ops, 126 .sysfs_ops = &map_sysfs_ops,
126 .default_attrs = attrs, 127 .default_attrs = attrs,
127}; 128};
128 129
130struct uio_portio {
131 struct kobject kobj;
132 struct uio_port *port;
133};
134#define to_portio(portio) container_of(portio, struct uio_portio, kobj)
135
136static ssize_t portio_start_show(struct uio_port *port, char *buf)
137{
138 return sprintf(buf, "0x%lx\n", port->start);
139}
140
141static ssize_t portio_size_show(struct uio_port *port, char *buf)
142{
143 return sprintf(buf, "0x%lx\n", port->size);
144}
145
146static ssize_t portio_porttype_show(struct uio_port *port, char *buf)
147{
148 const char *porttypes[] = {"none", "x86", "gpio", "other"};
149
150 if ((port->porttype < 0) || (port->porttype > UIO_PORT_OTHER))
151 return -EINVAL;
152
153 return sprintf(buf, "port_%s\n", porttypes[port->porttype]);
154}
155
156struct portio_sysfs_entry {
157 struct attribute attr;
158 ssize_t (*show)(struct uio_port *, char *);
159 ssize_t (*store)(struct uio_port *, const char *, size_t);
160};
161
162static struct portio_sysfs_entry portio_start_attribute =
163 __ATTR(start, S_IRUGO, portio_start_show, NULL);
164static struct portio_sysfs_entry portio_size_attribute =
165 __ATTR(size, S_IRUGO, portio_size_show, NULL);
166static struct portio_sysfs_entry portio_porttype_attribute =
167 __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL);
168
169static struct attribute *portio_attrs[] = {
170 &portio_start_attribute.attr,
171 &portio_size_attribute.attr,
172 &portio_porttype_attribute.attr,
173 NULL,
174};
175
176static void portio_release(struct kobject *kobj)
177{
178 struct uio_portio *portio = to_portio(kobj);
179 kfree(portio);
180}
181
182static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,
183 char *buf)
184{
185 struct uio_portio *portio = to_portio(kobj);
186 struct uio_port *port = portio->port;
187 struct portio_sysfs_entry *entry;
188
189 entry = container_of(attr, struct portio_sysfs_entry, attr);
190
191 if (!entry->show)
192 return -EIO;
193
194 return entry->show(port, buf);
195}
196
197static struct sysfs_ops portio_sysfs_ops = {
198 .show = portio_type_show,
199};
200
201static struct kobj_type portio_attr_type = {
202 .release = portio_release,
203 .sysfs_ops = &portio_sysfs_ops,
204 .default_attrs = portio_attrs,
205};
206
129static ssize_t show_name(struct device *dev, 207static ssize_t show_name(struct device *dev,
130 struct device_attribute *attr, char *buf) 208 struct device_attribute *attr, char *buf)
131{ 209{
@@ -177,10 +255,13 @@ static struct attribute_group uio_attr_grp = {
177static int uio_dev_add_attributes(struct uio_device *idev) 255static int uio_dev_add_attributes(struct uio_device *idev)
178{ 256{
179 int ret; 257 int ret;
180 int mi; 258 int mi, pi;
181 int map_found = 0; 259 int map_found = 0;
260 int portio_found = 0;
182 struct uio_mem *mem; 261 struct uio_mem *mem;
183 struct uio_map *map; 262 struct uio_map *map;
263 struct uio_port *port;
264 struct uio_portio *portio;
184 265
185 ret = sysfs_create_group(&idev->dev->kobj, &uio_attr_grp); 266 ret = sysfs_create_group(&idev->dev->kobj, &uio_attr_grp);
186 if (ret) 267 if (ret)
@@ -195,25 +276,58 @@ static int uio_dev_add_attributes(struct uio_device *idev)
195 idev->map_dir = kobject_create_and_add("maps", 276 idev->map_dir = kobject_create_and_add("maps",
196 &idev->dev->kobj); 277 &idev->dev->kobj);
197 if (!idev->map_dir) 278 if (!idev->map_dir)
198 goto err; 279 goto err_map;
199 } 280 }
200 map = kzalloc(sizeof(*map), GFP_KERNEL); 281 map = kzalloc(sizeof(*map), GFP_KERNEL);
201 if (!map) 282 if (!map)
202 goto err; 283 goto err_map;
203 kobject_init(&map->kobj, &map_attr_type); 284 kobject_init(&map->kobj, &map_attr_type);
204 map->mem = mem; 285 map->mem = mem;
205 mem->map = map; 286 mem->map = map;
206 ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); 287 ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi);
207 if (ret) 288 if (ret)
208 goto err; 289 goto err_map;
209 ret = kobject_uevent(&map->kobj, KOBJ_ADD); 290 ret = kobject_uevent(&map->kobj, KOBJ_ADD);
210 if (ret) 291 if (ret)
211 goto err; 292 goto err_map;
293 }
294
295 for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) {
296 port = &idev->info->port[pi];
297 if (port->size == 0)
298 break;
299 if (!portio_found) {
300 portio_found = 1;
301 idev->portio_dir = kobject_create_and_add("portio",
302 &idev->dev->kobj);
303 if (!idev->portio_dir)
304 goto err_portio;
305 }
306 portio = kzalloc(sizeof(*portio), GFP_KERNEL);
307 if (!portio)
308 goto err_portio;
309 kobject_init(&portio->kobj, &portio_attr_type);
310 portio->port = port;
311 port->portio = portio;
312 ret = kobject_add(&portio->kobj, idev->portio_dir,
313 "port%d", pi);
314 if (ret)
315 goto err_portio;
316 ret = kobject_uevent(&portio->kobj, KOBJ_ADD);
317 if (ret)
318 goto err_portio;
212 } 319 }
213 320
214 return 0; 321 return 0;
215 322
216err: 323err_portio:
324 for (pi--; pi >= 0; pi--) {
325 port = &idev->info->port[pi];
326 portio = port->portio;
327 kobject_put(&portio->kobj);
328 }
329 kobject_put(idev->portio_dir);
330err_map:
217 for (mi--; mi>=0; mi--) { 331 for (mi--; mi>=0; mi--) {
218 mem = &idev->info->mem[mi]; 332 mem = &idev->info->mem[mi];
219 map = mem->map; 333 map = mem->map;
@@ -228,15 +342,26 @@ err_group:
228 342
229static void uio_dev_del_attributes(struct uio_device *idev) 343static void uio_dev_del_attributes(struct uio_device *idev)
230{ 344{
231 int mi; 345 int i;
232 struct uio_mem *mem; 346 struct uio_mem *mem;
233 for (mi = 0; mi < MAX_UIO_MAPS; mi++) { 347 struct uio_port *port;
234 mem = &idev->info->mem[mi]; 348
349 for (i = 0; i < MAX_UIO_MAPS; i++) {
350 mem = &idev->info->mem[i];
235 if (mem->size == 0) 351 if (mem->size == 0)
236 break; 352 break;
237 kobject_put(&mem->map->kobj); 353 kobject_put(&mem->map->kobj);
238 } 354 }
239 kobject_put(idev->map_dir); 355 kobject_put(idev->map_dir);
356
357 for (i = 0; i < MAX_UIO_PORT_REGIONS; i++) {
358 port = &idev->info->port[i];
359 if (port->size == 0)
360 break;
361 kobject_put(&port->portio->kobj);
362 }
363 kobject_put(idev->portio_dir);
364
240 sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp); 365 sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp);
241} 366}
242 367
diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c
index 57376060b978..c60b8fcf0e3e 100644
--- a/drivers/uio/uio_cif.c
+++ b/drivers/uio/uio_cif.c
@@ -57,8 +57,7 @@ static int __devinit hilscher_pci_probe(struct pci_dev *dev,
57 info->mem[0].addr = pci_resource_start(dev, 0); 57 info->mem[0].addr = pci_resource_start(dev, 0);
58 if (!info->mem[0].addr) 58 if (!info->mem[0].addr)
59 goto out_release; 59 goto out_release;
60 info->mem[0].internal_addr = ioremap(pci_resource_start(dev, 0), 60 info->mem[0].internal_addr = pci_ioremap_bar(dev, 0);
61 pci_resource_len(dev, 0));
62 if (!info->mem[0].internal_addr) 61 if (!info->mem[0].internal_addr)
63 goto out_release; 62 goto out_release;
64 63
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 1f82c83a92ae..3f06818cf9fa 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -81,7 +81,8 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
81 goto bad0; 81 goto bad0;
82 } 82 }
83 83
84 if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) { 84 if (uioinfo->handler || uioinfo->irqcontrol ||
85 uioinfo->irq_flags & IRQF_SHARED) {
85 dev_err(&pdev->dev, "interrupt configuration error\n"); 86 dev_err(&pdev->dev, "interrupt configuration error\n");
86 goto bad0; 87 goto bad0;
87 } 88 }
@@ -132,7 +133,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
132 * Interrupt sharing is not supported. 133 * Interrupt sharing is not supported.
133 */ 134 */
134 135
135 uioinfo->irq_flags = IRQF_DISABLED; 136 uioinfo->irq_flags |= IRQF_DISABLED;
136 uioinfo->handler = uio_pdrv_genirq_handler; 137 uioinfo->handler = uio_pdrv_genirq_handler;
137 uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol; 138 uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol;
138 uioinfo->priv = priv; 139 uioinfo->priv = priv;
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index be1fa0723f2c..399e15fc5052 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -286,7 +286,7 @@ static int usb_dev_restore(struct device *dev)
286 return usb_resume(dev); 286 return usb_resume(dev);
287} 287}
288 288
289static struct pm_ops usb_device_pm_ops = { 289static struct dev_pm_ops usb_device_pm_ops = {
290 .prepare = usb_dev_prepare, 290 .prepare = usb_dev_prepare,
291 .complete = usb_dev_complete, 291 .complete = usb_dev_complete,
292 .suspend = usb_dev_suspend, 292 .suspend = usb_dev_suspend,
@@ -301,7 +301,7 @@ static struct pm_ops usb_device_pm_ops = {
301 301
302#define ksuspend_usb_init() 0 302#define ksuspend_usb_init() 0
303#define ksuspend_usb_cleanup() do {} while (0) 303#define ksuspend_usb_cleanup() do {} while (0)
304#define usb_device_pm_ops (*(struct pm_ops *)0) 304#define usb_device_pm_ops (*(struct dev_pm_ops *)0)
305 305
306#endif /* CONFIG_PM */ 306#endif /* CONFIG_PM */
307 307
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a8a1de413321..0b2bb8f0706d 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1474,7 +1474,7 @@ static struct at91_udc controller = {
1474 .ep0 = &controller.ep[0].ep, 1474 .ep0 = &controller.ep[0].ep,
1475 .name = driver_name, 1475 .name = driver_name,
1476 .dev = { 1476 .dev = {
1477 .bus_id = "gadget", 1477 .init_name = "gadget",
1478 .release = nop_release, 1478 .release = nop_release,
1479 } 1479 }
1480 }, 1480 },
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index ae30ab1d264f..65b03e3445a1 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1034,7 +1034,7 @@ static struct usba_udc the_udc = {
1034 .is_dualspeed = 1, 1034 .is_dualspeed = 1,
1035 .name = "atmel_usba_udc", 1035 .name = "atmel_usba_udc",
1036 .dev = { 1036 .dev = {
1037 .bus_id = "gadget", 1037 .init_name = "gadget",
1038 .release = nop_release, 1038 .release = nop_release,
1039 }, 1039 },
1040 }, 1040 },
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index b3408ff39fba..f40272565098 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -2545,7 +2545,7 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
2545 2545
2546 device_initialize(&udc_controller->gadget.dev); 2546 device_initialize(&udc_controller->gadget.dev);
2547 2547
2548 strcpy(udc_controller->gadget.dev.bus_id, "gadget"); 2548 dev_set_name(&udc_controller->gadget.dev, "gadget");
2549 2549
2550 udc_controller->gadget.dev.release = qe_udc_release; 2550 udc_controller->gadget.dev.release = qe_udc_release;
2551 udc_controller->gadget.dev.parent = &ofdev->dev; 2551 udc_controller->gadget.dev.parent = &ofdev->dev;
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index c6e7df04c69a..d554b0895603 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -1981,7 +1981,7 @@ static struct lh7a40x_udc memory = {
1981 .ep0 = &memory.ep[0].ep, 1981 .ep0 = &memory.ep[0].ep,
1982 .name = driver_name, 1982 .name = driver_name,
1983 .dev = { 1983 .dev = {
1984 .bus_id = "gadget", 1984 .init_name = "gadget",
1985 .release = nop_release, 1985 .release = nop_release,
1986 }, 1986 },
1987 }, 1987 },
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 8c5026be79d4..697a0ca349bf 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1833,7 +1833,7 @@ static struct pxa25x_udc memory = {
1833 .ep0 = &memory.ep[0].ep, 1833 .ep0 = &memory.ep[0].ep,
1834 .name = driver_name, 1834 .name = driver_name,
1835 .dev = { 1835 .dev = {
1836 .bus_id = "gadget", 1836 .init_name = "gadget",
1837 .release = nop_release, 1837 .release = nop_release,
1838 }, 1838 },
1839 }, 1839 },
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 944e4ff641df..65110d02a206 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -2162,7 +2162,7 @@ static struct pxa_udc memory = {
2162 .ep0 = &memory.udc_usb_ep[0].usb_ep, 2162 .ep0 = &memory.udc_usb_ep[0].usb_ep,
2163 .name = driver_name, 2163 .name = driver_name,
2164 .dev = { 2164 .dev = {
2165 .bus_id = "gadget", 2165 .init_name = "gadget",
2166 }, 2166 },
2167 }, 2167 },
2168 2168
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index 8d8d65165983..c7e255636803 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1727,7 +1727,7 @@ static struct s3c2410_udc memory = {
1727 .ep0 = &memory.ep[0].ep, 1727 .ep0 = &memory.ep[0].ep,
1728 .name = gadget_name, 1728 .name = gadget_name,
1729 .dev = { 1729 .dev = {
1730 .bus_id = "gadget", 1730 .init_name = "gadget",
1731 }, 1731 },
1732 }, 1732 },
1733 1733
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index fab0bc874b58..0664fc032235 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -217,7 +217,7 @@ struct backlight_device *backlight_device_register(const char *name,
217 new_bd->dev.class = backlight_class; 217 new_bd->dev.class = backlight_class;
218 new_bd->dev.parent = parent; 218 new_bd->dev.parent = parent;
219 new_bd->dev.release = bl_device_release; 219 new_bd->dev.release = bl_device_release;
220 strlcpy(new_bd->dev.bus_id, name, BUS_ID_SIZE); 220 dev_set_name(&new_bd->dev, name);
221 dev_set_drvdata(&new_bd->dev, devdata); 221 dev_set_drvdata(&new_bd->dev, devdata);
222 222
223 rc = device_register(&new_bd->dev); 223 rc = device_register(&new_bd->dev);
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 680e57b616cd..b6449470106c 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -208,7 +208,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
208 new_ld->dev.class = lcd_class; 208 new_ld->dev.class = lcd_class;
209 new_ld->dev.parent = parent; 209 new_ld->dev.parent = parent;
210 new_ld->dev.release = lcd_device_release; 210 new_ld->dev.release = lcd_device_release;
211 strlcpy(new_ld->dev.bus_id, name, BUS_ID_SIZE); 211 dev_set_name(&new_ld->dev, name);
212 dev_set_drvdata(&new_ld->dev, devdata); 212 dev_set_drvdata(&new_ld->dev, devdata);
213 213
214 rc = device_register(&new_ld->dev); 214 rc = device_register(&new_ld->dev);
diff --git a/drivers/video/output.c b/drivers/video/output.c
index f2df5519c9c4..5e6439ae7394 100644
--- a/drivers/video/output.c
+++ b/drivers/video/output.c
@@ -96,7 +96,7 @@ struct output_device *video_output_register(const char *name,
96 new_dev->props = op; 96 new_dev->props = op;
97 new_dev->dev.class = &video_output_class; 97 new_dev->dev.class = &video_output_class;
98 new_dev->dev.parent = dev; 98 new_dev->dev.parent = dev;
99 strlcpy(new_dev->dev.bus_id,name, BUS_ID_SIZE); 99 dev_set_name(&new_dev->dev, name);
100 dev_set_drvdata(&new_dev->dev, devdata); 100 dev_set_drvdata(&new_dev->dev, devdata);
101 ret_code = device_register(&new_dev->dev); 101 ret_code = device_register(&new_dev->dev);
102 if (ret_code) { 102 if (ret_code) {
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 265fdf2d1276..bef6b45e8a5c 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -73,10 +73,7 @@ MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
73/* A PCI device has it's own struct device and so does a virtio device so 73/* A PCI device has it's own struct device and so does a virtio device so
74 * we create a place for the virtio devices to show up in sysfs. I think it 74 * we create a place for the virtio devices to show up in sysfs. I think it
75 * would make more sense for virtio to not insist on having it's own device. */ 75 * would make more sense for virtio to not insist on having it's own device. */
76static struct device virtio_pci_root = { 76static struct device *virtio_pci_root;
77 .parent = NULL,
78 .init_name = "virtio-pci",
79};
80 77
81/* Convert a generic virtio device to our structure */ 78/* Convert a generic virtio device to our structure */
82static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) 79static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
@@ -343,7 +340,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
343 if (vp_dev == NULL) 340 if (vp_dev == NULL)
344 return -ENOMEM; 341 return -ENOMEM;
345 342
346 vp_dev->vdev.dev.parent = &virtio_pci_root; 343 vp_dev->vdev.dev.parent = virtio_pci_root;
347 vp_dev->vdev.dev.release = virtio_pci_release_dev; 344 vp_dev->vdev.dev.release = virtio_pci_release_dev;
348 vp_dev->vdev.config = &virtio_pci_config_ops; 345 vp_dev->vdev.config = &virtio_pci_config_ops;
349 vp_dev->pci_dev = pci_dev; 346 vp_dev->pci_dev = pci_dev;
@@ -437,13 +434,13 @@ static int __init virtio_pci_init(void)
437{ 434{
438 int err; 435 int err;
439 436
440 err = device_register(&virtio_pci_root); 437 virtio_pci_root = root_device_register("virtio-pci");
441 if (err) 438 if (IS_ERR(virtio_pci_root))
442 return err; 439 return PTR_ERR(virtio_pci_root);
443 440
444 err = pci_register_driver(&virtio_pci_driver); 441 err = pci_register_driver(&virtio_pci_driver);
445 if (err) 442 if (err)
446 device_unregister(&virtio_pci_root); 443 device_unregister(virtio_pci_root);
447 444
448 return err; 445 return err;
449} 446}
@@ -452,8 +449,8 @@ module_init(virtio_pci_init);
452 449
453static void __exit virtio_pci_exit(void) 450static void __exit virtio_pci_exit(void)
454{ 451{
455 device_unregister(&virtio_pci_root);
456 pci_unregister_driver(&virtio_pci_driver); 452 pci_unregister_driver(&virtio_pci_driver);
453 root_device_unregister(virtio_pci_root);
457} 454}
458 455
459module_exit(virtio_pci_exit); 456module_exit(virtio_pci_exit);
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 3b615d4022ee..acc7e3b7fe17 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -197,7 +197,7 @@ struct device_driver w1_master_driver = {
197struct device w1_master_device = { 197struct device w1_master_device = {
198 .parent = NULL, 198 .parent = NULL,
199 .bus = &w1_bus_type, 199 .bus = &w1_bus_type,
200 .bus_id = "w1 bus master", 200 .init_name = "w1 bus master",
201 .driver = &w1_master_driver, 201 .driver = &w1_master_driver,
202 .release = &w1_master_release 202 .release = &w1_master_release
203}; 203};
@@ -211,7 +211,7 @@ static struct device_driver w1_slave_driver = {
211struct device w1_slave_device = { 211struct device w1_slave_device = {
212 .parent = NULL, 212 .parent = NULL,
213 .bus = &w1_bus_type, 213 .bus = &w1_bus_type,
214 .bus_id = "w1 bus slave", 214 .init_name = "w1 bus slave",
215 .driver = &w1_slave_driver, 215 .driver = &w1_slave_driver,
216 .release = &w1_slave_release 216 .release = &w1_slave_release
217}; 217};
@@ -573,7 +573,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
573 } 573 }
574 574
575 dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n", 575 dev_dbg(dev, "Hotplug event for %s %s, bus_id=%s.\n",
576 event_owner, name, dev->bus_id); 576 event_owner, name, dev_name(dev));
577 577
578 if (dev->driver != &w1_slave_driver || !sl) 578 if (dev->driver != &w1_slave_driver || !sl)
579 return 0; 579 return 0;
@@ -605,8 +605,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
605 sl->dev.bus = &w1_bus_type; 605 sl->dev.bus = &w1_bus_type;
606 sl->dev.release = &w1_slave_release; 606 sl->dev.release = &w1_slave_release;
607 607
608 snprintf(&sl->dev.bus_id[0], sizeof(sl->dev.bus_id), 608 dev_set_name(&sl->dev, "%02x-%012llx",
609 "%02x-%012llx",
610 (unsigned int) sl->reg_num.family, 609 (unsigned int) sl->reg_num.family,
611 (unsigned long long) sl->reg_num.id); 610 (unsigned long long) sl->reg_num.id);
612 snprintf(&sl->name[0], sizeof(sl->name), 611 snprintf(&sl->name[0], sizeof(sl->name),
@@ -615,13 +614,13 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
615 (unsigned long long) sl->reg_num.id); 614 (unsigned long long) sl->reg_num.id);
616 615
617 dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, 616 dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__,
618 &sl->dev.bus_id[0], sl); 617 dev_name(&sl->dev), sl);
619 618
620 err = device_register(&sl->dev); 619 err = device_register(&sl->dev);
621 if (err < 0) { 620 if (err < 0) {
622 dev_err(&sl->dev, 621 dev_err(&sl->dev,
623 "Device registration [%s] failed. err=%d\n", 622 "Device registration [%s] failed. err=%d\n",
624 sl->dev.bus_id, err); 623 dev_name(&sl->dev), err);
625 return err; 624 return err;
626 } 625 }
627 626
@@ -630,7 +629,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
630 if (err < 0) { 629 if (err < 0) {
631 dev_err(&sl->dev, 630 dev_err(&sl->dev,
632 "sysfs file creation for [%s] failed. err=%d\n", 631 "sysfs file creation for [%s] failed. err=%d\n",
633 sl->dev.bus_id, err); 632 dev_name(&sl->dev), err);
634 goto out_unreg; 633 goto out_unreg;
635 } 634 }
636 635
@@ -639,7 +638,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
639 if (err < 0) { 638 if (err < 0) {
640 dev_err(&sl->dev, 639 dev_err(&sl->dev,
641 "sysfs file creation for [%s] failed. err=%d\n", 640 "sysfs file creation for [%s] failed. err=%d\n",
642 sl->dev.bus_id, err); 641 dev_name(&sl->dev), err);
643 goto out_rem1; 642 goto out_rem1;
644 } 643 }
645 644
@@ -648,7 +647,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
648 ((err = sl->family->fops->add_slave(sl)) < 0)) { 647 ((err = sl->family->fops->add_slave(sl)) < 0)) {
649 dev_err(&sl->dev, 648 dev_err(&sl->dev,
650 "sysfs file creation for [%s] failed. err=%d\n", 649 "sysfs file creation for [%s] failed. err=%d\n",
651 sl->dev.bus_id, err); 650 dev_name(&sl->dev), err);
652 goto out_rem2; 651 goto out_rem2;
653 } 652 }
654 653
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index a3a54567bfba..4a46ed58ece9 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -75,8 +75,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
75 mutex_init(&dev->mutex); 75 mutex_init(&dev->mutex);
76 76
77 memcpy(&dev->dev, device, sizeof(struct device)); 77 memcpy(&dev->dev, device, sizeof(struct device));
78 snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), 78 dev_set_name(&dev->dev, "w1_bus_master%u", dev->id);
79 "w1_bus_master%u", dev->id);
80 snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id); 79 snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id);
81 80
82 dev->driver = driver; 81 dev->driver = driver;
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 7f24a98a446f..b2a03184a246 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -99,15 +99,15 @@ static int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env)
99} 99}
100 100
101/* device/<type>/<id> => <type>-<id> */ 101/* device/<type>/<id> => <type>-<id> */
102static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) 102static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
103{ 103{
104 nodename = strchr(nodename, '/'); 104 nodename = strchr(nodename, '/');
105 if (!nodename || strlen(nodename + 1) >= BUS_ID_SIZE) { 105 if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) {
106 printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); 106 printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename);
107 return -EINVAL; 107 return -EINVAL;
108 } 108 }
109 109
110 strlcpy(bus_id, nodename + 1, BUS_ID_SIZE); 110 strlcpy(bus_id, nodename + 1, XEN_BUS_ID_SIZE);
111 if (!strchr(bus_id, '/')) { 111 if (!strchr(bus_id, '/')) {
112 printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); 112 printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id);
113 return -EINVAL; 113 return -EINVAL;
@@ -460,6 +460,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,
460 const char *type, 460 const char *type,
461 const char *nodename) 461 const char *nodename)
462{ 462{
463 char devname[XEN_BUS_ID_SIZE];
463 int err; 464 int err;
464 struct xenbus_device *xendev; 465 struct xenbus_device *xendev;
465 size_t stringlen; 466 size_t stringlen;
@@ -494,10 +495,12 @@ int xenbus_probe_node(struct xen_bus_type *bus,
494 xendev->dev.bus = &bus->bus; 495 xendev->dev.bus = &bus->bus;
495 xendev->dev.release = xenbus_dev_release; 496 xendev->dev.release = xenbus_dev_release;
496 497
497 err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); 498 err = bus->get_bus_id(devname, xendev->nodename);
498 if (err) 499 if (err)
499 goto fail; 500 goto fail;
500 501
502 dev_set_name(&xendev->dev, devname);
503
501 /* Register with generic device framework. */ 504 /* Register with generic device framework. */
502 err = device_register(&xendev->dev); 505 err = device_register(&xendev->dev);
503 if (err) 506 if (err)
@@ -611,7 +614,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
611{ 614{
612 int exists, rootlen; 615 int exists, rootlen;
613 struct xenbus_device *dev; 616 struct xenbus_device *dev;
614 char type[BUS_ID_SIZE]; 617 char type[XEN_BUS_ID_SIZE];
615 const char *p, *root; 618 const char *p, *root;
616 619
617 if (char_count(node, '/') < 2) 620 if (char_count(node, '/') < 2)
@@ -625,8 +628,8 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
625 628
626 /* backend/<type>/... or device/<type>/... */ 629 /* backend/<type>/... or device/<type>/... */
627 p = strchr(node, '/') + 1; 630 p = strchr(node, '/') + 1;
628 snprintf(type, BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); 631 snprintf(type, XEN_BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p);
629 type[BUS_ID_SIZE-1] = '\0'; 632 type[XEN_BUS_ID_SIZE-1] = '\0';
630 633
631 rootlen = strsep_len(node, '/', bus->levels); 634 rootlen = strsep_len(node, '/', bus->levels);
632 if (rootlen < 0) 635 if (rootlen < 0)
@@ -674,7 +677,7 @@ static int suspend_dev(struct device *dev, void *data)
674 err = drv->suspend(xdev); 677 err = drv->suspend(xdev);
675 if (err) 678 if (err)
676 printk(KERN_WARNING 679 printk(KERN_WARNING
677 "xenbus: suspend %s failed: %i\n", dev->bus_id, err); 680 "xenbus: suspend %s failed: %i\n", dev_name(dev), err);
678 return 0; 681 return 0;
679} 682}
680 683
@@ -695,7 +698,7 @@ static int suspend_cancel_dev(struct device *dev, void *data)
695 if (err) 698 if (err)
696 printk(KERN_WARNING 699 printk(KERN_WARNING
697 "xenbus: suspend_cancel %s failed: %i\n", 700 "xenbus: suspend_cancel %s failed: %i\n",
698 dev->bus_id, err); 701 dev_name(dev), err);
699 return 0; 702 return 0;
700} 703}
701 704
@@ -717,7 +720,7 @@ static int resume_dev(struct device *dev, void *data)
717 if (err) { 720 if (err) {
718 printk(KERN_WARNING 721 printk(KERN_WARNING
719 "xenbus: resume (talk_to_otherend) %s failed: %i\n", 722 "xenbus: resume (talk_to_otherend) %s failed: %i\n",
720 dev->bus_id, err); 723 dev_name(dev), err);
721 return err; 724 return err;
722 } 725 }
723 726
@@ -728,7 +731,7 @@ static int resume_dev(struct device *dev, void *data)
728 if (err) { 731 if (err) {
729 printk(KERN_WARNING 732 printk(KERN_WARNING
730 "xenbus: resume %s failed: %i\n", 733 "xenbus: resume %s failed: %i\n",
731 dev->bus_id, err); 734 dev_name(dev), err);
732 return err; 735 return err;
733 } 736 }
734 } 737 }
@@ -737,7 +740,7 @@ static int resume_dev(struct device *dev, void *data)
737 if (err) { 740 if (err) {
738 printk(KERN_WARNING 741 printk(KERN_WARNING
739 "xenbus_probe: resume (watch_otherend) %s failed: " 742 "xenbus_probe: resume (watch_otherend) %s failed: "
740 "%d.\n", dev->bus_id, err); 743 "%d.\n", dev_name(dev), err);
741 return err; 744 return err;
742 } 745 }
743 746
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index e09b19415a40..6c5e3185a6a2 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -34,6 +34,8 @@
34#ifndef _XENBUS_PROBE_H 34#ifndef _XENBUS_PROBE_H
35#define _XENBUS_PROBE_H 35#define _XENBUS_PROBE_H
36 36
37#define XEN_BUS_ID_SIZE 20
38
37#ifdef CONFIG_XEN_BACKEND 39#ifdef CONFIG_XEN_BACKEND
38extern void xenbus_backend_suspend(int (*fn)(struct device *, void *)); 40extern void xenbus_backend_suspend(int (*fn)(struct device *, void *));
39extern void xenbus_backend_resume(int (*fn)(struct device *, void *)); 41extern void xenbus_backend_resume(int (*fn)(struct device *, void *));
@@ -52,7 +54,7 @@ struct xen_bus_type
52{ 54{
53 char *root; 55 char *root;
54 unsigned int levels; 56 unsigned int levels;
55 int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename); 57 int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename);
56 int (*probe)(const char *type, const char *dir); 58 int (*probe)(const char *type, const char *dir);
57 struct bus_type bus; 59 struct bus_type bus;
58}; 60};
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 6d5b213b8a9b..5198ada67398 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -384,9 +384,9 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
384 384
385 dname = dev_name(ddev); 385 dname = dev_name(ddev);
386 if (isdigit(dname[strlen(dname) - 1])) 386 if (isdigit(dname[strlen(dname) - 1]))
387 snprintf(pdev->bus_id, BUS_ID_SIZE, "%sp%d", dname, partno); 387 dev_set_name(pdev, "%sp%d", dname, partno);
388 else 388 else
389 snprintf(pdev->bus_id, BUS_ID_SIZE, "%s%d", dname, partno); 389 dev_set_name(pdev, "%s%d", dname, partno);
390 390
391 device_initialize(pdev); 391 device_initialize(pdev);
392 pdev->class = &block_class; 392 pdev->class = &block_class;
@@ -447,16 +447,11 @@ void register_disk(struct gendisk *disk)
447 struct block_device *bdev; 447 struct block_device *bdev;
448 struct disk_part_iter piter; 448 struct disk_part_iter piter;
449 struct hd_struct *part; 449 struct hd_struct *part;
450 char *s;
451 int err; 450 int err;
452 451
453 ddev->parent = disk->driverfs_dev; 452 ddev->parent = disk->driverfs_dev;
454 453
455 strlcpy(ddev->bus_id, disk->disk_name, BUS_ID_SIZE); 454 dev_set_name(ddev, disk->disk_name);
456 /* ewww... some of these buggers have / in the name... */
457 s = strchr(ddev->bus_id, '/');
458 if (s)
459 *s = '!';
460 455
461 /* delay uevents, until we scanned partition table */ 456 /* delay uevents, until we scanned partition table */
462 ddev->uevent_suppress = 1; 457 ddev->uevent_suppress = 1;
diff --git a/include/linux/device.h b/include/linux/device.h
index 1a3686d15f98..7d9da4b4993f 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -28,6 +28,7 @@
28#define BUS_ID_SIZE 20 28#define BUS_ID_SIZE 20
29 29
30struct device; 30struct device;
31struct device_private;
31struct device_driver; 32struct device_driver;
32struct driver_private; 33struct driver_private;
33struct class; 34struct class;
@@ -65,7 +66,7 @@ struct bus_type {
65 int (*resume_early)(struct device *dev); 66 int (*resume_early)(struct device *dev);
66 int (*resume)(struct device *dev); 67 int (*resume)(struct device *dev);
67 68
68 struct pm_ext_ops *pm; 69 struct dev_pm_ops *pm;
69 70
70 struct bus_type_private *p; 71 struct bus_type_private *p;
71}; 72};
@@ -133,7 +134,7 @@ struct device_driver {
133 int (*resume) (struct device *dev); 134 int (*resume) (struct device *dev);
134 struct attribute_group **groups; 135 struct attribute_group **groups;
135 136
136 struct pm_ops *pm; 137 struct dev_pm_ops *pm;
137 138
138 struct driver_private *p; 139 struct driver_private *p;
139}; 140};
@@ -198,7 +199,7 @@ struct class {
198 int (*suspend)(struct device *dev, pm_message_t state); 199 int (*suspend)(struct device *dev, pm_message_t state);
199 int (*resume)(struct device *dev); 200 int (*resume)(struct device *dev);
200 201
201 struct pm_ops *pm; 202 struct dev_pm_ops *pm;
202 struct class_private *p; 203 struct class_private *p;
203}; 204};
204 205
@@ -291,7 +292,7 @@ struct device_type {
291 int (*suspend)(struct device *dev, pm_message_t state); 292 int (*suspend)(struct device *dev, pm_message_t state);
292 int (*resume)(struct device *dev); 293 int (*resume)(struct device *dev);
293 294
294 struct pm_ops *pm; 295 struct dev_pm_ops *pm;
295}; 296};
296 297
297/* interface for exporting device attributes */ 298/* interface for exporting device attributes */
@@ -365,17 +366,15 @@ struct device_dma_parameters {
365}; 366};
366 367
367struct device { 368struct device {
368 struct klist klist_children;
369 struct klist_node knode_parent; /* node in sibling list */
370 struct klist_node knode_driver;
371 struct klist_node knode_bus;
372 struct device *parent; 369 struct device *parent;
373 370
371 struct device_private *p;
372
374 struct kobject kobj; 373 struct kobject kobj;
375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 374 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
375 unsigned uevent_suppress:1;
376 const char *init_name; /* initial name of the device */ 376 const char *init_name; /* initial name of the device */
377 struct device_type *type; 377 struct device_type *type;
378 unsigned uevent_suppress:1;
379 378
380 struct semaphore sem; /* semaphore to synchronize calls to 379 struct semaphore sem; /* semaphore to synchronize calls to
381 * its driver. 380 * its driver.
@@ -408,12 +407,13 @@ struct device {
408 /* arch specific additions */ 407 /* arch specific additions */
409 struct dev_archdata archdata; 408 struct dev_archdata archdata;
410 409
410 dev_t devt; /* dev_t, creates the sysfs "dev" */
411
411 spinlock_t devres_lock; 412 spinlock_t devres_lock;
412 struct list_head devres_head; 413 struct list_head devres_head;
413 414
414 struct klist_node knode_class; 415 struct klist_node knode_class;
415 struct class *class; 416 struct class *class;
416 dev_t devt; /* dev_t, creates the sysfs "dev" */
417 struct attribute_group **groups; /* optional groups */ 417 struct attribute_group **groups; /* optional groups */
418 418
419 void (*release)(struct device *dev); 419 void (*release)(struct device *dev);
@@ -483,6 +483,17 @@ extern int device_rename(struct device *dev, char *new_name);
483extern int device_move(struct device *dev, struct device *new_parent); 483extern int device_move(struct device *dev, struct device *new_parent);
484 484
485/* 485/*
486 * Root device objects for grouping under /sys/devices
487 */
488extern struct device *__root_device_register(const char *name,
489 struct module *owner);
490static inline struct device *root_device_register(const char *name)
491{
492 return __root_device_register(name, THIS_MODULE);
493}
494extern void root_device_unregister(struct device *root);
495
496/*
486 * Manual binding of a device to driver. See drivers/base/bus.c 497 * Manual binding of a device to driver. See drivers/base/bus.c
487 * for information on use. 498 * for information on use.
488 */ 499 */
@@ -553,13 +564,13 @@ extern const char *dev_driver_string(const struct device *dev);
553#define dev_info(dev, format, arg...) \ 564#define dev_info(dev, format, arg...) \
554 dev_printk(KERN_INFO , dev , format , ## arg) 565 dev_printk(KERN_INFO , dev , format , ## arg)
555 566
556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 567#if defined(DEBUG)
568#define dev_dbg(dev, format, arg...) \
569 dev_printk(KERN_DEBUG , dev , format , ## arg)
570#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \ 571#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 572 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0) 573 } while (0)
560#elif defined(DEBUG)
561#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 574#else
564#define dev_dbg(dev, format, arg...) \ 575#define dev_dbg(dev, format, arg...) \
565 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 576 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 721984844c94..6b8e2027165e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -355,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
356 356
357/* If you are writing a driver, please use dev_dbg instead */ 357/* If you are writing a driver, please use dev_dbg instead */
358#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 358#if defined(DEBUG)
359#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
359#define pr_debug(fmt, ...) do { \ 362#define pr_debug(fmt, ...) do { \
360 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
361 } while (0) 364 } while (0)
362#elif defined(DEBUG)
363#define pr_debug(fmt, ...) \
364 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
365#else 365#else
366#define pr_debug(fmt, ...) \ 366#define pr_debug(fmt, ...) \
367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 8ea98db223e5..d5a27af9dba5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -13,7 +13,6 @@
13#define _LINUX_KLIST_H 13#define _LINUX_KLIST_H
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/completion.h>
17#include <linux/kref.h> 16#include <linux/kref.h>
18#include <linux/list.h> 17#include <linux/list.h>
19 18
@@ -41,7 +40,6 @@ struct klist_node {
41 void *n_klist; /* never access directly */ 40 void *n_klist; /* never access directly */
42 struct list_head n_node; 41 struct list_head n_node;
43 struct kref n_ref; 42 struct kref n_ref;
44 struct completion n_removed;
45}; 43};
46 44
47extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index c02f3d264ecf..e80c674daeb3 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -13,7 +13,7 @@
13struct mtd_info *mtd_concat_create( 13struct mtd_info *mtd_concat_create(
14 struct mtd_info *subdev[], /* subdevices to concatenate */ 14 struct mtd_info *subdev[], /* subdevices to concatenate */
15 int num_devs, /* number of subdevices */ 15 int num_devs, /* number of subdevices */
16 char *name); /* name for the new device */ 16 const char *name); /* name for the new device */
17 17
18void mtd_concat_destroy(struct mtd_info *mtd); 18void mtd_concat_destroy(struct mtd_info *mtd);
19 19
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 03b0b8c3c81b..4bb156ba854a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -421,7 +421,6 @@ struct pci_driver {
421 int (*resume_early) (struct pci_dev *dev); 421 int (*resume_early) (struct pci_dev *dev);
422 int (*resume) (struct pci_dev *dev); /* Device woken up */ 422 int (*resume) (struct pci_dev *dev); /* Device woken up */
423 void (*shutdown) (struct pci_dev *dev); 423 void (*shutdown) (struct pci_dev *dev);
424 struct pm_ext_ops *pm;
425 struct pci_error_handlers *err_handler; 424 struct pci_error_handlers *err_handler;
426 struct device_driver driver; 425 struct device_driver driver;
427 struct pci_dynids dynids; 426 struct pci_dynids dynids;
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 4b8cc6a32479..9a342699c607 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,7 +55,6 @@ struct platform_driver {
55 int (*suspend_late)(struct platform_device *, pm_message_t state); 55 int (*suspend_late)(struct platform_device *, pm_message_t state);
56 int (*resume_early)(struct platform_device *); 56 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 57 int (*resume)(struct platform_device *);
58 struct pm_ext_ops *pm;
59 struct device_driver driver; 58 struct device_driver driver;
60}; 59};
61 60
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 42de4003c4ee..de2e0a8f6728 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -41,7 +41,7 @@ typedef struct pm_message {
41} pm_message_t; 41} pm_message_t;
42 42
43/** 43/**
44 * struct pm_ops - device PM callbacks 44 * struct dev_pm_ops - device PM callbacks
45 * 45 *
46 * Several driver power state transitions are externally visible, affecting 46 * Several driver power state transitions are externally visible, affecting
47 * the state of pending I/O queues and (for drivers that touch hardware) 47 * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {
126 * On most platforms, there are no restrictions on availability of 126 * On most platforms, there are no restrictions on availability of
127 * resources like clocks during @restore(). 127 * resources like clocks during @restore().
128 * 128 *
129 * All of the above callbacks, except for @complete(), return error codes.
130 * However, the error codes returned by the resume operations, @resume(),
131 * @thaw(), and @restore(), do not cause the PM core to abort the resume
132 * transition during which they are returned. The error codes returned in
133 * that cases are only printed by the PM core to the system logs for debugging
134 * purposes. Still, it is recommended that drivers only return error codes
135 * from their resume methods in case of an unrecoverable failure (i.e. when the
136 * device being handled refuses to resume and becomes unusable) to allow us to
137 * modify the PM core in the future, so that it can avoid attempting to handle
138 * devices that failed to resume and their children.
139 *
140 * It is allowed to unregister devices while the above callbacks are being
141 * executed. However, it is not allowed to unregister a device from within any
142 * of its own callbacks.
143 */
144
145struct pm_ops {
146 int (*prepare)(struct device *dev);
147 void (*complete)(struct device *dev);
148 int (*suspend)(struct device *dev);
149 int (*resume)(struct device *dev);
150 int (*freeze)(struct device *dev);
151 int (*thaw)(struct device *dev);
152 int (*poweroff)(struct device *dev);
153 int (*restore)(struct device *dev);
154};
155
156/**
157 * struct pm_ext_ops - extended device PM callbacks
158 *
159 * Some devices require certain operations related to suspend and hibernation
160 * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below
161 * is defined, adding callbacks to be executed with interrupts disabled to
162 * 'struct pm_ops'.
163 *
164 * The following callbacks included in 'struct pm_ext_ops' are executed with
165 * the nonboot CPUs switched off and with interrupts disabled on the only
166 * functional CPU. They also are executed with the PM core list of devices
167 * locked, so they must NOT unregister any devices.
168 *
169 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 129 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
170 * actions required for suspending the device that need interrupts to be 130 * actions required for suspending the device that need interrupts to be
171 * disabled 131 * disabled
@@ -190,18 +150,32 @@ struct pm_ops {
190 * actions required for restoring the operations of the device that need 150 * actions required for restoring the operations of the device that need
191 * interrupts to be disabled 151 * interrupts to be disabled
192 * 152 *
193 * All of the above callbacks return error codes, but the error codes returned 153 * All of the above callbacks, except for @complete(), return error codes.
194 * by the resume operations, @resume_noirq(), @thaw_noirq(), and 154 * However, the error codes returned by the resume operations, @resume(),
195 * @restore_noirq(), do not cause the PM core to abort the resume transition 155 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do
196 * during which they are returned. The error codes returned in that cases are 156 * not cause the PM core to abort the resume transition during which they are
197 * only printed by the PM core to the system logs for debugging purposes. 157 * returned. The error codes returned in that cases are only printed by the PM
198 * Still, as stated above, it is recommended that drivers only return error 158 * core to the system logs for debugging purposes. Still, it is recommended
199 * codes from their resume methods if the device being handled fails to resume 159 * that drivers only return error codes from their resume methods in case of an
200 * and is not usable any more. 160 * unrecoverable failure (i.e. when the device being handled refuses to resume
161 * and becomes unusable) to allow us to modify the PM core in the future, so
162 * that it can avoid attempting to handle devices that failed to resume and
163 * their children.
164 *
165 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks.
201 */ 168 */
202 169
203struct pm_ext_ops { 170struct dev_pm_ops {
204 struct pm_ops base; 171 int (*prepare)(struct device *dev);
172 void (*complete)(struct device *dev);
173 int (*suspend)(struct device *dev);
174 int (*resume)(struct device *dev);
175 int (*freeze)(struct device *dev);
176 int (*thaw)(struct device *dev);
177 int (*poweroff)(struct device *dev);
178 int (*restore)(struct device *dev);
205 int (*suspend_noirq)(struct device *dev); 179 int (*suspend_noirq)(struct device *dev);
206 int (*resume_noirq)(struct device *dev); 180 int (*resume_noirq)(struct device *dev);
207 int (*freeze_noirq)(struct device *dev); 181 int (*freeze_noirq)(struct device *dev);
@@ -278,7 +252,7 @@ struct pm_ext_ops {
278#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) 252#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
279#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) 253#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
280#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) 254#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
281#define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) 255#define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
282#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) 256#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
283#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) 257#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
284 258
@@ -291,15 +265,15 @@ struct pm_ext_ops {
291#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) 265#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
292#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) 266#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
293#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) 267#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
294#define PMSG_USER_SUSPEND ((struct pm_messge) \ 268#define PMSG_USER_SUSPEND ((struct pm_message) \
295 { .event = PM_EVENT_USER_SUSPEND, }) 269 { .event = PM_EVENT_USER_SUSPEND, })
296#define PMSG_USER_RESUME ((struct pm_messge) \ 270#define PMSG_USER_RESUME ((struct pm_message) \
297 { .event = PM_EVENT_USER_RESUME, }) 271 { .event = PM_EVENT_USER_RESUME, })
298#define PMSG_REMOTE_RESUME ((struct pm_messge) \ 272#define PMSG_REMOTE_RESUME ((struct pm_message) \
299 { .event = PM_EVENT_REMOTE_RESUME, }) 273 { .event = PM_EVENT_REMOTE_RESUME, })
300#define PMSG_AUTO_SUSPEND ((struct pm_messge) \ 274#define PMSG_AUTO_SUSPEND ((struct pm_message) \
301 { .event = PM_EVENT_AUTO_SUSPEND, }) 275 { .event = PM_EVENT_AUTO_SUSPEND, })
302#define PMSG_AUTO_RESUME ((struct pm_messge) \ 276#define PMSG_AUTO_RESUME ((struct pm_message) \
303 { .event = PM_EVENT_AUTO_RESUME, }) 277 { .event = PM_EVENT_AUTO_RESUME, })
304 278
305/** 279/**
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d94b7f..a0bb6bd2e5c1 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -38,6 +38,24 @@ struct uio_mem {
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_portio;
42
43/**
44 * struct uio_port - description of a UIO port region
45 * @start: start of port region
46 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only.
49 */
50struct uio_port {
51 unsigned long start;
52 unsigned long size;
53 int porttype;
54 struct uio_portio *portio;
55};
56
57#define MAX_UIO_PORT_REGIONS 5
58
41struct uio_device; 59struct uio_device;
42 60
43/** 61/**
@@ -46,6 +64,7 @@ struct uio_device;
46 * @name: device name 64 * @name: device name
47 * @version: device driver version 65 * @version: device driver version
48 * @mem: list of mappable memory regions, size==0 for end of list 66 * @mem: list of mappable memory regions, size==0 for end of list
67 * @port: list of port regions, size==0 for end of list
49 * @irq: interrupt number or UIO_IRQ_CUSTOM 68 * @irq: interrupt number or UIO_IRQ_CUSTOM
50 * @irq_flags: flags for request_irq() 69 * @irq_flags: flags for request_irq()
51 * @priv: optional private data 70 * @priv: optional private data
@@ -57,9 +76,10 @@ struct uio_device;
57 */ 76 */
58struct uio_info { 77struct uio_info {
59 struct uio_device *uio_dev; 78 struct uio_device *uio_dev;
60 char *name; 79 const char *name;
61 char *version; 80 const char *version;
62 struct uio_mem mem[MAX_UIO_MAPS]; 81 struct uio_mem mem[MAX_UIO_MAPS];
82 struct uio_port port[MAX_UIO_PORT_REGIONS];
63 long irq; 83 long irq;
64 unsigned long irq_flags; 84 unsigned long irq_flags;
65 void *priv; 85 void *priv;
@@ -92,4 +112,10 @@ extern void uio_event_notify(struct uio_info *info);
92#define UIO_MEM_LOGICAL 2 112#define UIO_MEM_LOGICAL 2
93#define UIO_MEM_VIRTUAL 3 113#define UIO_MEM_VIRTUAL 3
94 114
115/* defines for uio_port->porttype */
116#define UIO_PORT_NONE 0
117#define UIO_PORT_X86 1
118#define UIO_PORT_GPIO 2
119#define UIO_PORT_OTHER 3
120
95#endif /* _LINUX_UIO_DRIVER_H_ */ 121#endif /* _LINUX_UIO_DRIVER_H_ */
diff --git a/init/Kconfig b/init/Kconfig
index 315a6114bf87..e7893b1d3e42 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -423,27 +423,37 @@ config SYSFS_DEPRECATED
423 bool 423 bool
424 424
425config SYSFS_DEPRECATED_V2 425config SYSFS_DEPRECATED_V2
426 bool "Create deprecated sysfs files" 426 bool "Create deprecated sysfs layout for older userspace tools"
427 depends on SYSFS 427 depends on SYSFS
428 default y 428 default y
429 select SYSFS_DEPRECATED 429 select SYSFS_DEPRECATED
430 help 430 help
431 This option creates deprecated symlinks such as the 431 This option switches the layout of sysfs to the deprecated
432 "device"-link, the <subsystem>:<name>-link, and the 432 version.
433 "bus"-link. It may also add deprecated key in the 433
434 uevent environment. 434 The current sysfs layout features a unified device tree at
435 None of these features or values should be used today, as 435 /sys/devices/, which is able to express a hierarchy between
436 they export driver core implementation details to userspace 436 class devices. If the deprecated option is set to Y, the
437 or export properties which can't be kept stable across kernel 437 unified device tree is split into a bus device tree at
438 releases. 438 /sys/devices/ and several individual class device trees at
439 439 /sys/class/. The class and bus devices will be connected by
440 If enabled, this option will also move any device structures 440 "<subsystem>:<name>" and the "device" links. The "block"
441 that belong to a class, back into the /sys/class hierarchy, in 441 class devices, will not show up in /sys/class/block/. Some
442 order to support older versions of udev and some userspace 442 subsystems will suppress the creation of some devices which
443 programs. 443 depend on the unified device tree.
444 444
445 If you are using a distro with the most recent userspace 445 This option is not a pure compatibility option that can
446 packages, it should be safe to say N here. 446 be safely enabled on newer distributions. It will change the
447 layout of sysfs to the non-extensible deprecated version,
448 and disable some features, which can not be exported without
449 confusing older userspace tools. Since 2007/2008 all major
450 distributions do not enable this option, and ship no tools which
451 depend on the deprecated layout or this option.
452
453 If you are using a new kernel on an older distribution, or use
454 older userspace tools, you might need to say Y here. Do not say Y,
455 if the original kernel, that came with your distribution, has
456 this option set to N.
447 457
448config PROC_PID_CPUSET 458config PROC_PID_CPUSET
449 bool "Include legacy /proc/<pid>/cpuset file" 459 bool "Include legacy /proc/<pid>/cpuset file"
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 08dd8ed86c77..528dd78e7e7e 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -24,7 +24,7 @@ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
24static struct kobj_attribute _name##_attr = \ 24static struct kobj_attribute _name##_attr = \
25 __ATTR(_name, 0644, _name##_show, _name##_store) 25 __ATTR(_name, 0644, _name##_show, _name##_store)
26 26
27#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 27#if defined(CONFIG_HOTPLUG)
28/* current uevent sequence number */ 28/* current uevent sequence number */
29static ssize_t uevent_seqnum_show(struct kobject *kobj, 29static ssize_t uevent_seqnum_show(struct kobject *kobj,
30 struct kobj_attribute *attr, char *buf) 30 struct kobj_attribute *attr, char *buf)
@@ -137,7 +137,7 @@ struct kobject *kernel_kobj;
137EXPORT_SYMBOL_GPL(kernel_kobj); 137EXPORT_SYMBOL_GPL(kernel_kobj);
138 138
139static struct attribute * kernel_attrs[] = { 139static struct attribute * kernel_attrs[] = {
140#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 140#if defined(CONFIG_HOTPLUG)
141 &uevent_seqnum_attr.attr, 141 &uevent_seqnum_attr.attr,
142 &uevent_helper_attr.attr, 142 &uevent_helper_attr.attr,
143#endif 143#endif
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 613f16941b85..239988873971 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -615,7 +615,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
615 /* this may fail if the RTC hasn't been initialized */ 615 /* this may fail if the RTC hasn't been initialized */
616 status = rtc_read_time(rtc, &alm.time); 616 status = rtc_read_time(rtc, &alm.time);
617 if (status < 0) { 617 if (status < 0) {
618 printk(err_readtime, rtc->dev.bus_id, status); 618 printk(err_readtime, dev_name(&rtc->dev), status);
619 return; 619 return;
620 } 620 }
621 rtc_tm_to_time(&alm.time, &now); 621 rtc_tm_to_time(&alm.time, &now);
@@ -626,7 +626,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
626 626
627 status = rtc_set_alarm(rtc, &alm); 627 status = rtc_set_alarm(rtc, &alm);
628 if (status < 0) { 628 if (status < 0) {
629 printk(err_wakealarm, rtc->dev.bus_id, status); 629 printk(err_wakealarm, dev_name(&rtc->dev), status);
630 return; 630 return;
631 } 631 }
632 632
@@ -660,7 +660,7 @@ static int __init has_wakealarm(struct device *dev, void *name_ptr)
660 if (!device_may_wakeup(candidate->dev.parent)) 660 if (!device_may_wakeup(candidate->dev.parent))
661 return 0; 661 return 0;
662 662
663 *(char **)name_ptr = dev->bus_id; 663 *(const char **)name_ptr = dev_name(dev);
664 return 1; 664 return 1;
665} 665}
666 666
diff --git a/lib/dynamic_printk.c b/lib/dynamic_printk.c
index 8e30295e8566..165a19763dc9 100644
--- a/lib/dynamic_printk.c
+++ b/lib/dynamic_printk.c
@@ -277,40 +277,34 @@ static ssize_t pr_debug_write(struct file *file, const char __user *buf,
277 dynamic_enabled = DYNAMIC_ENABLED_NONE; 277 dynamic_enabled = DYNAMIC_ENABLED_NONE;
278 } 278 }
279 err = 0; 279 err = 0;
280 } else { 280 } else if (elem) {
281 if (elem) { 281 if (value && (elem->enable == 0)) {
282 if (value && (elem->enable == 0)) { 282 dynamic_printk_enabled |= (1LL << elem->hash1);
283 dynamic_printk_enabled |= 283 dynamic_printk_enabled2 |= (1LL << elem->hash2);
284 (1LL << elem->hash1); 284 elem->enable = 1;
285 dynamic_printk_enabled2 |= 285 num_enabled++;
286 (1LL << elem->hash2); 286 dynamic_enabled = DYNAMIC_ENABLED_SOME;
287 elem->enable = 1; 287 err = 0;
288 num_enabled++; 288 printk(KERN_DEBUG
289 dynamic_enabled = DYNAMIC_ENABLED_SOME; 289 "debugging enabled for module %s\n",
290 err = 0; 290 elem->name);
291 printk(KERN_DEBUG 291 } else if (!value && (elem->enable == 1)) {
292 "debugging enabled for module %s\n", 292 elem->enable = 0;
293 elem->name); 293 num_enabled--;
294 } else if (!value && (elem->enable == 1)) { 294 if (disabled_hash(elem->hash1, true))
295 elem->enable = 0; 295 dynamic_printk_enabled &=
296 num_enabled--;
297 if (disabled_hash(elem->hash1, true))
298 dynamic_printk_enabled &=
299 ~(1LL << elem->hash1); 296 ~(1LL << elem->hash1);
300 if (disabled_hash(elem->hash2, false)) 297 if (disabled_hash(elem->hash2, false))
301 dynamic_printk_enabled2 &= 298 dynamic_printk_enabled2 &=
302 ~(1LL << elem->hash2); 299 ~(1LL << elem->hash2);
303 if (num_enabled) 300 if (num_enabled)
304 dynamic_enabled = 301 dynamic_enabled = DYNAMIC_ENABLED_SOME;
305 DYNAMIC_ENABLED_SOME; 302 else
306 else 303 dynamic_enabled = DYNAMIC_ENABLED_NONE;
307 dynamic_enabled = 304 err = 0;
308 DYNAMIC_ENABLED_NONE; 305 printk(KERN_DEBUG
309 err = 0; 306 "debugging disabled for module %s\n",
310 printk(KERN_DEBUG 307 elem->name);
311 "debugging disabled for module "
312 "%s\n", elem->name);
313 }
314 } 308 }
315 } 309 }
316 } 310 }
diff --git a/lib/klist.c b/lib/klist.c
index bbdd3015c2c7..573d6068a42e 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -36,6 +36,7 @@
36 36
37#include <linux/klist.h> 37#include <linux/klist.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/sched.h>
39 40
40/* 41/*
41 * Use the lowest bit of n_klist to mark deleted nodes and exclude 42 * Use the lowest bit of n_klist to mark deleted nodes and exclude
@@ -108,7 +109,6 @@ static void add_tail(struct klist *k, struct klist_node *n)
108static void klist_node_init(struct klist *k, struct klist_node *n) 109static void klist_node_init(struct klist *k, struct klist_node *n)
109{ 110{
110 INIT_LIST_HEAD(&n->n_node); 111 INIT_LIST_HEAD(&n->n_node);
111 init_completion(&n->n_removed);
112 kref_init(&n->n_ref); 112 kref_init(&n->n_ref);
113 knode_set_klist(n, k); 113 knode_set_klist(n, k);
114 if (k->get) 114 if (k->get)
@@ -171,13 +171,34 @@ void klist_add_before(struct klist_node *n, struct klist_node *pos)
171} 171}
172EXPORT_SYMBOL_GPL(klist_add_before); 172EXPORT_SYMBOL_GPL(klist_add_before);
173 173
174struct klist_waiter {
175 struct list_head list;
176 struct klist_node *node;
177 struct task_struct *process;
178 int woken;
179};
180
181static DEFINE_SPINLOCK(klist_remove_lock);
182static LIST_HEAD(klist_remove_waiters);
183
174static void klist_release(struct kref *kref) 184static void klist_release(struct kref *kref)
175{ 185{
186 struct klist_waiter *waiter, *tmp;
176 struct klist_node *n = container_of(kref, struct klist_node, n_ref); 187 struct klist_node *n = container_of(kref, struct klist_node, n_ref);
177 188
178 WARN_ON(!knode_dead(n)); 189 WARN_ON(!knode_dead(n));
179 list_del(&n->n_node); 190 list_del(&n->n_node);
180 complete(&n->n_removed); 191 spin_lock(&klist_remove_lock);
192 list_for_each_entry_safe(waiter, tmp, &klist_remove_waiters, list) {
193 if (waiter->node != n)
194 continue;
195
196 waiter->woken = 1;
197 mb();
198 wake_up_process(waiter->process);
199 list_del(&waiter->list);
200 }
201 spin_unlock(&klist_remove_lock);
181 knode_set_klist(n, NULL); 202 knode_set_klist(n, NULL);
182} 203}
183 204
@@ -217,8 +238,24 @@ EXPORT_SYMBOL_GPL(klist_del);
217 */ 238 */
218void klist_remove(struct klist_node *n) 239void klist_remove(struct klist_node *n)
219{ 240{
241 struct klist_waiter waiter;
242
243 waiter.node = n;
244 waiter.process = current;
245 waiter.woken = 0;
246 spin_lock(&klist_remove_lock);
247 list_add(&waiter.list, &klist_remove_waiters);
248 spin_unlock(&klist_remove_lock);
249
220 klist_del(n); 250 klist_del(n);
221 wait_for_completion(&n->n_removed); 251
252 for (;;) {
253 set_current_state(TASK_UNINTERRUPTIBLE);
254 if (waiter.woken)
255 break;
256 schedule();
257 }
258 __set_current_state(TASK_RUNNING);
222} 259}
223EXPORT_SYMBOL_GPL(klist_remove); 260EXPORT_SYMBOL_GPL(klist_remove);
224 261
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 3f914725bda8..318328ddbd1c 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -165,7 +165,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
165 /* keys passed in from the caller */ 165 /* keys passed in from the caller */
166 if (envp_ext) { 166 if (envp_ext) {
167 for (i = 0; envp_ext[i]; i++) { 167 for (i = 0; envp_ext[i]; i++) {
168 retval = add_uevent_var(env, envp_ext[i]); 168 retval = add_uevent_var(env, "%s", envp_ext[i]);
169 if (retval) 169 if (retval)
170 goto exit; 170 goto exit;
171 } 171 }
@@ -225,8 +225,10 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
225 } 225 }
226 226
227 NETLINK_CB(skb).dst_group = 1; 227 NETLINK_CB(skb).dst_group = 1;
228 netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL); 228 retval = netlink_broadcast(uevent_sock, skb, 0, 1,
229 } 229 GFP_KERNEL);
230 } else
231 retval = -ENOMEM;
230 } 232 }
231#endif 233#endif
232 234
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 7f5e21b9c16b..c2a4e6401456 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -647,7 +647,7 @@ swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
647 * the damage, or panic when the transfer is too big. 647 * the damage, or panic when the transfer is too big.
648 */ 648 */
649 printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at " 649 printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
650 "device %s\n", size, dev ? dev->bus_id : "?"); 650 "device %s\n", size, dev ? dev_name(dev) : "?");
651 651
652 if (size > io_tlb_overflow && do_panic) { 652 if (size > io_tlb_overflow && do_panic) {
653 if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) 653 if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 032f61e98595..a35240f61ec3 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -50,7 +50,6 @@
50#include <asm/ebcdic.h> 50#include <asm/ebcdic.h>
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/s390_ext.h> 52#include <asm/s390_ext.h>
53#include <asm/s390_rdev.h>
54#include <asm/smp.h> 53#include <asm/smp.h>
55 54
56/* 55/*
@@ -1696,7 +1695,7 @@ static int __init iucv_init(void)
1696 rc = register_external_interrupt(0x4000, iucv_external_interrupt); 1695 rc = register_external_interrupt(0x4000, iucv_external_interrupt);
1697 if (rc) 1696 if (rc)
1698 goto out; 1697 goto out;
1699 iucv_root = s390_root_dev_register("iucv"); 1698 iucv_root = root_device_register("iucv");
1700 if (IS_ERR(iucv_root)) { 1699 if (IS_ERR(iucv_root)) {
1701 rc = PTR_ERR(iucv_root); 1700 rc = PTR_ERR(iucv_root);
1702 goto out_int; 1701 goto out_int;
@@ -1740,7 +1739,7 @@ out_free:
1740 kfree(iucv_irq_data[cpu]); 1739 kfree(iucv_irq_data[cpu]);
1741 iucv_irq_data[cpu] = NULL; 1740 iucv_irq_data[cpu] = NULL;
1742 } 1741 }
1743 s390_root_dev_unregister(iucv_root); 1742 root_device_unregister(iucv_root);
1744out_int: 1743out_int:
1745 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1744 unregister_external_interrupt(0x4000, iucv_external_interrupt);
1746out: 1745out:
@@ -1770,7 +1769,7 @@ static void __exit iucv_exit(void)
1770 kfree(iucv_irq_data[cpu]); 1769 kfree(iucv_irq_data[cpu]);
1771 iucv_irq_data[cpu] = NULL; 1770 iucv_irq_data[cpu] = NULL;
1772 } 1771 }
1773 s390_root_dev_unregister(iucv_root); 1772 root_device_unregister(iucv_root);
1774 bus_unregister(&iucv_bus); 1773 bus_unregister(&iucv_bus);
1775 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1774 unregister_external_interrupt(0x4000, iucv_external_interrupt);
1776} 1775}