Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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()
...

+1061 -699
+99 -2
Documentation/DocBook/uio-howto.tmpl
··· 42 42 43 43 <revhistory> 44 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 51 <revnumber>0.5</revnumber> 46 52 <date>2008-05-22</date> 47 53 <authorinitials>hjk</authorinitials> ··· 324 318 offset = N * getpagesize(); 325 319 </programlisting> 326 320 321 + <para> 322 + Sometimes there is hardware with memory-like regions that can not be 323 + mapped with the technique described here, but there are still ways to 324 + access them from userspace. The most common example are x86 ioports. 325 + On x86 systems, userspace can access these ioports using 326 + <function>ioperm()</function>, <function>iopl()</function>, 327 + <function>inb()</function>, <function>outb()</function>, and similar 328 + functions. 329 + </para> 330 + <para> 331 + Since these ioport regions can not be mapped, they will not appear under 332 + <filename>/sys/class/uio/uioX/maps/</filename> like the normal memory 333 + described above. Without information about the port regions a hardware 334 + has to offer, it becomes difficult for the userspace part of the 335 + driver to find out which ports belong to which UIO device. 336 + </para> 337 + <para> 338 + To address this situation, the new directory 339 + <filename>/sys/class/uio/uioX/portio/</filename> was added. It only 340 + exists if the driver wants to pass information about one or more port 341 + regions to userspace. If that is the case, subdirectories named 342 + <filename>port0</filename>, <filename>port1</filename>, and so on, 343 + will appear underneath 344 + <filename>/sys/class/uio/uioX/portio/</filename>. 345 + </para> 346 + <para> 347 + Each <filename>portX/</filename> directory contains three read-only 348 + files that show start, size, and type of the port region: 349 + </para> 350 + <itemizedlist> 351 + <listitem> 352 + <para> 353 + <filename>start</filename>: The first port of this region. 354 + </para> 355 + </listitem> 356 + <listitem> 357 + <para> 358 + <filename>size</filename>: The number of ports in this region. 359 + </para> 360 + </listitem> 361 + <listitem> 362 + <para> 363 + <filename>porttype</filename>: A string describing the type of port. 364 + </para> 365 + </listitem> 366 + </itemizedlist> 367 + 368 + 327 369 </sect1> 328 370 </chapter> 329 371 ··· 393 339 394 340 <itemizedlist> 395 341 <listitem><para> 396 - <varname>char *name</varname>: Required. The name of your driver as 342 + <varname>const char *name</varname>: Required. The name of your driver as 397 343 it will appear in sysfs. I recommend using the name of your module for this. 398 344 </para></listitem> 399 345 400 346 <listitem><para> 401 - <varname>char *version</varname>: Required. This string appears in 347 + <varname>const char *version</varname>: Required. This string appears in 402 348 <filename>/sys/class/uio/uioX/version</filename>. 403 349 </para></listitem> 404 350 ··· 406 352 <varname>struct uio_mem mem[ MAX_UIO_MAPS ]</varname>: Required if you 407 353 have memory that can be mapped with <function>mmap()</function>. For each 408 354 mapping you need to fill one of the <varname>uio_mem</varname> structures. 355 + See the description below for details. 356 + </para></listitem> 357 + 358 + <listitem><para> 359 + <varname>struct uio_port port[ MAX_UIO_PORTS_REGIONS ]</varname>: Required 360 + if you want to pass information about ioports to userspace. For each port 361 + region you need to fill one of the <varname>uio_port</varname> structures. 409 362 See the description below for details. 410 363 </para></listitem> 411 364 ··· 509 448 <varname>struct uio_mem</varname>! It is used by the UIO framework 510 449 to set up sysfs files for this mapping. Simply leave it alone. 511 450 </para> 451 + 452 + <para> 453 + Sometimes, your device can have one or more port regions which can not be 454 + mapped to userspace. But if there are other possibilities for userspace to 455 + access these ports, it makes sense to make information about the ports 456 + available in sysfs. For each region, you have to set up a 457 + <varname>struct uio_port</varname> in the <varname>port[]</varname> array. 458 + Here's a description of the fields of <varname>struct uio_port</varname>: 459 + </para> 460 + 461 + <itemizedlist> 462 + <listitem><para> 463 + <varname>char *porttype</varname>: Required. Set this to one of the predefined 464 + constants. Use <varname>UIO_PORT_X86</varname> for the ioports found in x86 465 + architectures. 466 + </para></listitem> 467 + 468 + <listitem><para> 469 + <varname>unsigned long start</varname>: Required if the port region is used. 470 + Fill in the number of the first port of this region. 471 + </para></listitem> 472 + 473 + <listitem><para> 474 + <varname>unsigned long size</varname>: Fill in the number of ports in this 475 + region. If <varname>size</varname> is zero, the region is considered unused. 476 + Note that you <emphasis>must</emphasis> initialize <varname>size</varname> 477 + with zero for all unused regions. 478 + </para></listitem> 479 + </itemizedlist> 480 + 481 + <para> 482 + Please do not touch the <varname>portio</varname> element of 483 + <varname>struct uio_port</varname>! It is used internally by the UIO 484 + framework to set up sysfs files for this region. Simply leave it alone. 485 + </para> 486 + 512 487 </sect1> 513 488 514 489 <sect1 id="adding_irq_handler">
+2 -2
Documentation/kobject.txt
··· 118 118 119 119 int kobject_rename(struct kobject *kobj, const char *new_name); 120 120 121 - Note kobject_rename does perform any locking or have a solid notion of 122 - what names are valid so the provide must provide their own sanity checking 121 + kobject_rename does not perform any locking or have a solid notion of 122 + what names are valid so the caller must provide their own sanity checking 123 123 and serialization. 124 124 125 125 There is a function called kobject_set_name() but that is legacy cruft and
+1 -1
arch/arm/kernel/ecard.c
··· 817 817 ec->dma = NO_DMA; 818 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 821 ec->dev.parent = NULL; 822 822 ec->dev.bus = &ecard_bus_type; 823 823 ec->dev.dma_mask = &ec->dma_mask;
+1 -1
arch/arm/mach-aaec2000/core.c
··· 212 212 213 213 static struct amba_device clcd_device = { 214 214 .dev = { 215 - .bus_id = "mb:16", 215 + .init_name = "mb:16", 216 216 .coherent_dma_mask = ~0, 217 217 .platform_data = &clcd_plat_data, 218 218 },
+3 -3
arch/arm/mach-ep93xx/core.c
··· 409 409 410 410 static struct amba_device uart1_device = { 411 411 .dev = { 412 - .bus_id = "apb:uart1", 412 + .init_name = "apb:uart1", 413 413 .platform_data = &ep93xx_uart_data, 414 414 }, 415 415 .res = { ··· 423 423 424 424 static struct amba_device uart2_device = { 425 425 .dev = { 426 - .bus_id = "apb:uart2", 426 + .init_name = "apb:uart2", 427 427 .platform_data = &ep93xx_uart_data, 428 428 }, 429 429 .res = { ··· 437 437 438 438 static struct amba_device uart3_device = { 439 439 .dev = { 440 - .bus_id = "apb:uart3", 440 + .init_name = "apb:uart3", 441 441 .platform_data = &ep93xx_uart_data, 442 442 }, 443 443 .res = {
+5 -5
arch/arm/mach-integrator/core.c
··· 37 37 38 38 static struct amba_device rtc_device = { 39 39 .dev = { 40 - .bus_id = "mb:15", 40 + .init_name = "mb:15", 41 41 }, 42 42 .res = { 43 43 .start = INTEGRATOR_RTC_BASE, ··· 50 50 51 51 static struct amba_device uart0_device = { 52 52 .dev = { 53 - .bus_id = "mb:16", 53 + .init_name = "mb:16", 54 54 .platform_data = &integrator_uart_data, 55 55 }, 56 56 .res = { ··· 64 64 65 65 static struct amba_device uart1_device = { 66 66 .dev = { 67 - .bus_id = "mb:17", 67 + .init_name = "mb:17", 68 68 .platform_data = &integrator_uart_data, 69 69 }, 70 70 .res = { ··· 78 78 79 79 static struct amba_device kmi0_device = { 80 80 .dev = { 81 - .bus_id = "mb:18", 81 + .init_name = "mb:18", 82 82 }, 83 83 .res = { 84 84 .start = KMI0_BASE, ··· 91 91 92 92 static struct amba_device kmi1_device = { 93 93 .dev = { 94 - .bus_id = "mb:19", 94 + .init_name = "mb:19", 95 95 }, 96 96 .res = { 97 97 .start = KMI1_BASE,
+3 -3
arch/arm/mach-integrator/integrator_cp.c
··· 407 407 408 408 static struct amba_device mmc_device = { 409 409 .dev = { 410 - .bus_id = "mb:1c", 410 + .init_name = "mb:1c", 411 411 .platform_data = &mmc_data, 412 412 }, 413 413 .res = { ··· 421 421 422 422 static struct amba_device aaci_device = { 423 423 .dev = { 424 - .bus_id = "mb:1d", 424 + .init_name = "mb:1d", 425 425 }, 426 426 .res = { 427 427 .start = INTCP_PA_AACI_BASE, ··· 532 532 533 533 static struct amba_device clcd_device = { 534 534 .dev = { 535 - .bus_id = "mb:c0", 535 + .init_name = "mb:c0", 536 536 .coherent_dma_mask = ~0, 537 537 .platform_data = &clcd_data, 538 538 },
+1 -1
arch/arm/mach-lh7a40x/clcd.c
··· 207 207 static struct amba_device name##_device = { \ 208 208 .dev = { \ 209 209 .coherent_dma_mask = ~0, \ 210 - .bus_id = busid, \ 210 + .init_name = busid, \ 211 211 .platform_data = plat, \ 212 212 }, \ 213 213 .res = { \
+1 -1
arch/arm/mach-netx/fb.c
··· 91 91 92 92 static struct amba_device fb_device = { 93 93 .dev = { 94 - .bus_id = "fb", 94 + .init_name = "fb", 95 95 .coherent_dma_mask = ~0, 96 96 }, 97 97 .res = {
+1 -1
arch/arm/mach-realview/core.h
··· 31 31 static struct amba_device name##_device = { \ 32 32 .dev = { \ 33 33 .coherent_dma_mask = ~0, \ 34 - .bus_id = busid, \ 34 + .init_name = busid, \ 35 35 .platform_data = plat, \ 36 36 }, \ 37 37 .res = { \
+1 -1
arch/arm/mach-versatile/core.h
··· 34 34 static struct amba_device name##_device = { \ 35 35 .dev = { \ 36 36 .coherent_dma_mask = ~0, \ 37 - .bus_id = busid, \ 37 + .init_name = busid, \ 38 38 .platform_data = plat, \ 39 39 }, \ 40 40 .res = { \
+1 -1
arch/arm/plat-omap/include/mach/memory.h
··· 59 59 60 60 #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 61 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 64 #define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ 65 65 (dma_addr_t)virt_to_lbus(page_address(page)) : \
+2 -2
arch/avr32/mach-at32ap/clock.c
··· 198 198 unsigned i; 199 199 200 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 202 return; 203 203 204 204 /* <nest spaces> name <pad to end> */ ··· 214 214 parent->users ? "on" : "off", /* NOTE: not-paranoid!! */ 215 215 clk_get_rate(parent)); 216 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 218 seq_printf(r->s, "\n"); 219 219 220 220 /* cost of this scan is small, but not linear... */
+3 -3
arch/cris/arch-v32/drivers/iop_fw_load.c
··· 24 24 #error "Please contact <greg@kroah.com> for details on how to fix it properly." 25 25 26 26 static struct device iop_spu_device[2] = { 27 - { .bus_id = "iop-spu0", }, 28 - { .bus_id = "iop-spu1", }, 27 + { .init_name = "iop-spu0", }, 28 + { .init_name = "iop-spu1", }, 29 29 }; 30 30 31 31 static struct device iop_mpu_device = { 32 - .bus_id = "iop-mpu", 32 + .init_name = "iop-mpu", 33 33 }; 34 34 35 35 static int wait_mpu_idle(void)
+1 -1
arch/ia64/kernel/pci-dma.c
··· 39 39 be probably a smaller DMA mask, but this is bug-to-bug compatible 40 40 to i386. */ 41 41 struct device fallback_dev = { 42 - .bus_id = "fallback device", 42 + .init_name = "fallback device", 43 43 .coherent_dma_mask = DMA_32BIT_MASK, 44 44 .dma_mask = &fallback_dev.coherent_dma_mask, 45 45 };
+1 -2
arch/ia64/sn/kernel/tiocx.c
··· 206 206 cx_dev->dev.parent = NULL; 207 207 cx_dev->dev.bus = &tiocx_bus_type; 208 208 cx_dev->dev.release = tiocx_bus_release; 209 - snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d", 210 - cx_dev->cx_id.nasid); 209 + dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid); 211 210 device_register(&cx_dev->dev); 212 211 get_device(&cx_dev->dev); 213 212
+1 -1
arch/mips/kernel/vpe.c
··· 1454 1454 device_initialize(&vpe_device); 1455 1455 vpe_device.class = &vpe_class, 1456 1456 vpe_device.parent = NULL, 1457 - strlcpy(vpe_device.bus_id, "vpe1", BUS_ID_SIZE); 1457 + dev_set_name(&vpe_device, "vpe1"); 1458 1458 vpe_device.devt = MKDEV(major, minor); 1459 1459 err = device_add(&vpe_device); 1460 1460 if (err) {
-15
arch/s390/include/asm/s390_rdev.h
··· 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_ 13 - extern struct device *s390_root_dev_register(const char *); 14 - extern void s390_root_dev_unregister(struct device *); 15 - #endif /* _S390_RDEV_H_ */
+3 -3
block/bsg.c
··· 42 42 int done_cmds; 43 43 wait_queue_head_t wq_done; 44 44 wait_queue_head_t wq_free; 45 - char name[BUS_ID_SIZE]; 45 + char name[20]; 46 46 int max_queue; 47 47 unsigned long flags; 48 48 }; ··· 781 781 mutex_lock(&bsg_mutex); 782 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 785 dprintk("bound to <%s>, max queue %d\n", 786 786 format_dev_t(buf, inode->i_rdev), bd->max_queue); 787 787 ··· 992 992 if (name) 993 993 devname = name; 994 994 else 995 - devname = parent->bus_id; 995 + devname = dev_name(parent); 996 996 997 997 /* 998 998 * we need a proper transport to send commands, not a stacked device
+1 -1
block/genhd.c
··· 1084 1084 struct gendisk *disk = dev_to_disk(dev); 1085 1085 struct hd_struct *part; 1086 1086 1087 - if (strcmp(dev->bus_id, name)) 1087 + if (strcmp(dev_name(dev), name)) 1088 1088 continue; 1089 1089 1090 1090 part = disk_get_part(disk, partno);
+1 -1
drivers/ata/libata-scsi.c
··· 3369 3369 3370 3370 if (sdev) { 3371 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 3374 scsi_remove_device(sdev); 3375 3375 scsi_device_put(sdev);
+1 -1
drivers/base/attribute_container.c
··· 167 167 ic->classdev.parent = get_device(dev); 168 168 ic->classdev.class = cont->class; 169 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 171 if (fn) 172 172 fn(cont, dev, &ic->classdev); 173 173 else
+26
drivers/base/base.h
··· 63 63 #define to_class(obj) \ 64 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 + */ 78 + struct 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 92 /* initialisation functions */ 67 93 extern int devices_init(void); 68 94 extern int buses_init(void);
+33 -19
drivers/base/bus.c
··· 253 253 static struct device *next_device(struct klist_iter *i) 254 254 { 255 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 /** ··· 293 286 return -EINVAL; 294 287 295 288 klist_iter_init_node(&bus->p->klist_devices, &i, 296 - (start ? &start->knode_bus : NULL)); 289 + (start ? &start->p->knode_bus : NULL)); 297 290 while ((dev = next_device(&i)) && !error) 298 291 error = fn(dev, data); 299 292 klist_iter_exit(&i); ··· 327 320 return NULL; 328 321 329 322 klist_iter_init_node(&bus->p->klist_devices, &i, 330 - (start ? &start->knode_bus : NULL)); 323 + (start ? &start->p->knode_bus : NULL)); 331 324 while ((dev = next_device(&i))) 332 325 if (match(dev, data) && get_device(dev)) 333 326 break; ··· 340 333 { 341 334 const char *name = data; 342 335 343 - return sysfs_streq(name, dev->bus_id); 336 + return sysfs_streq(name, dev_name(dev)); 344 337 } 345 338 346 339 /** ··· 468 461 int error = 0; 469 462 470 463 if (bus) { 471 - pr_debug("bus: '%s': add device %s\n", bus->name, dev->bus_id); 464 + pr_debug("bus: '%s': add device %s\n", bus->name, dev_name(dev)); 472 465 error = device_add_attrs(bus, dev); 473 466 if (error) 474 467 goto out_put; 475 468 error = sysfs_create_link(&bus->p->devices_kset->kobj, 476 - &dev->kobj, dev->bus_id); 469 + &dev->kobj, dev_name(dev)); 477 470 if (error) 478 471 goto out_id; 479 472 error = sysfs_create_link(&dev->kobj, ··· 489 482 out_deprecated: 490 483 sysfs_remove_link(&dev->kobj, "subsystem"); 491 484 out_subsys: 492 - sysfs_remove_link(&bus->p->devices_kset->kobj, dev->bus_id); 485 + sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); 493 486 out_id: 494 487 device_remove_attrs(bus, dev); 495 488 out_put: ··· 514 507 ret = device_attach(dev); 515 508 WARN_ON(ret < 0); 516 509 if (ret >= 0) 517 - klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); 510 + klist_add_tail(&dev->p->knode_bus, 511 + &bus->p->klist_devices); 518 512 } 519 513 } 520 514 ··· 534 526 sysfs_remove_link(&dev->kobj, "subsystem"); 535 527 remove_deprecated_bus_links(dev); 536 528 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, 537 - dev->bus_id); 529 + dev_name(dev)); 538 530 device_remove_attrs(dev->bus, dev); 539 - if (klist_node_attached(&dev->knode_bus)) 540 - klist_del(&dev->knode_bus); 531 + if (klist_node_attached(&dev->p->knode_bus)) 532 + klist_del(&dev->p->knode_bus); 541 533 542 534 pr_debug("bus: '%s': remove device %s\n", 543 - dev->bus->name, dev->bus_id); 535 + dev->bus->name, dev_name(dev)); 544 536 device_release_driver(dev); 545 537 bus_put(dev->bus); 546 538 } ··· 839 831 840 832 static void klist_devices_get(struct klist_node *n) 841 833 { 842 - struct device *dev = container_of(n, struct device, knode_bus); 834 + struct device_private *dev_prv = to_device_private_bus(n); 835 + struct device *dev = dev_prv->device; 843 836 844 837 get_device(dev); 845 838 } 846 839 847 840 static void klist_devices_put(struct klist_node *n) 848 841 { 849 - 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; 850 844 851 845 put_device(dev); 852 846 } ··· 1003 993 { 1004 994 struct list_head *pos; 1005 995 struct klist_node *n; 996 + struct device_private *dev_prv; 1006 997 struct device *b; 1007 998 1008 999 list_for_each(pos, list) { 1009 1000 n = container_of(pos, struct klist_node, n_node); 1010 - b = container_of(n, struct device, knode_bus); 1001 + dev_prv = to_device_private_bus(n); 1002 + b = dev_prv->device; 1011 1003 if (compare(a, b) <= 0) { 1012 - list_move_tail(&a->knode_bus.n_node, 1013 - &b->knode_bus.n_node); 1004 + list_move_tail(&a->p->knode_bus.n_node, 1005 + &b->p->knode_bus.n_node); 1014 1006 return; 1015 1007 } 1016 1008 } 1017 - list_move_tail(&a->knode_bus.n_node, list); 1009 + list_move_tail(&a->p->knode_bus.n_node, list); 1018 1010 } 1019 1011 1020 1012 void bus_sort_breadthfirst(struct bus_type *bus, ··· 1026 1014 LIST_HEAD(sorted_devices); 1027 1015 struct list_head *pos, *tmp; 1028 1016 struct klist_node *n; 1017 + struct device_private *dev_prv; 1029 1018 struct device *dev; 1030 1019 struct klist *device_klist; 1031 1020 ··· 1035 1022 spin_lock(&device_klist->k_lock); 1036 1023 list_for_each_safe(pos, tmp, &device_klist->k_list) { 1037 1024 n = container_of(pos, struct klist_node, n_node); 1038 - dev = container_of(n, struct device, knode_bus); 1025 + dev_prv = to_device_private_bus(n); 1026 + dev = dev_prv->device; 1039 1027 device_insertion_sort_klist(dev, &sorted_devices, compare); 1040 1028 } 1041 1029 list_splice(&sorted_devices, &device_klist->k_list);
+155 -42
drivers/base/core.c
··· 109 109 static void device_release(struct kobject *kobj) 110 110 { 111 111 struct device *dev = to_dev(kobj); 112 + struct device_private *p = dev->p; 112 113 113 114 if (dev->release) 114 115 dev->release(dev); ··· 120 119 else 121 120 WARN(1, KERN_ERR "Device '%s' does not have a release() " 122 121 "function, it is broken and must be fixed.\n", 123 - dev->bus_id); 122 + dev_name(dev)); 123 + kfree(p); 124 124 } 125 125 126 126 static struct kobj_type device_ktype = { ··· 211 209 retval = dev->bus->uevent(dev, env); 212 210 if (retval) 213 211 pr_debug("device: '%s': %s: bus uevent() returned %d\n", 214 - dev->bus_id, __func__, retval); 212 + dev_name(dev), __func__, retval); 215 213 } 216 214 217 215 /* have the class specific function add its stuff */ ··· 219 217 retval = dev->class->dev_uevent(dev, env); 220 218 if (retval) 221 219 pr_debug("device: '%s': %s: class uevent() " 222 - "returned %d\n", dev->bus_id, 220 + "returned %d\n", dev_name(dev), 223 221 __func__, retval); 224 222 } 225 223 ··· 228 226 retval = dev->type->uevent(dev, env); 229 227 if (retval) 230 228 pr_debug("device: '%s': %s: dev_type uevent() " 231 - "returned %d\n", dev->bus_id, 229 + "returned %d\n", dev_name(dev), 232 230 __func__, retval); 233 231 } 234 232 ··· 509 507 510 508 static void klist_children_get(struct klist_node *n) 511 509 { 512 - struct device *dev = container_of(n, struct device, knode_parent); 510 + struct device_private *p = to_device_private_parent(n); 511 + struct device *dev = p->device; 513 512 514 513 get_device(dev); 515 514 } 516 515 517 516 static void klist_children_put(struct klist_node *n) 518 517 { 519 - struct device *dev = container_of(n, struct device, knode_parent); 518 + struct device_private *p = to_device_private_parent(n); 519 + struct device *dev = p->device; 520 520 521 521 put_device(dev); 522 522 } ··· 540 536 */ 541 537 void device_initialize(struct device *dev) 542 538 { 539 + dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL); 540 + if (!dev->p) { 541 + WARN_ON(1); 542 + return; 543 + } 544 + dev->p->device = dev; 543 545 dev->kobj.kset = devices_kset; 544 546 kobject_init(&dev->kobj, &device_ktype); 545 - klist_init(&dev->klist_children, klist_children_get, 547 + klist_init(&dev->p->klist_children, klist_children_get, 546 548 klist_children_put); 547 549 INIT_LIST_HEAD(&dev->dma_pools); 548 550 init_MUTEX(&dev->sem); ··· 682 672 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 683 673 device_is_not_partition(dev)) { 684 674 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 685 - &dev->kobj, dev->bus_id); 675 + &dev->kobj, dev_name(dev)); 686 676 if (error) 687 677 goto out_subsys; 688 678 } ··· 722 712 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 723 713 device_is_not_partition(dev)) 724 714 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 725 - dev->bus_id); 715 + dev_name(dev)); 726 716 #else 727 717 /* link in the class directory pointing to the device */ 728 718 error = sysfs_create_link(&dev->class->p->class_subsys.kobj, 729 - &dev->kobj, dev->bus_id); 719 + &dev->kobj, dev_name(dev)); 730 720 if (error) 731 721 goto out_subsys; 732 722 ··· 739 729 return 0; 740 730 741 731 out_busid: 742 - sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); 732 + sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev)); 743 733 #endif 744 734 745 735 out_subsys: ··· 768 758 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 769 759 device_is_not_partition(dev)) 770 760 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 771 - dev->bus_id); 761 + dev_name(dev)); 772 762 #else 773 763 if (dev->parent && device_is_not_partition(dev)) 774 764 sysfs_remove_link(&dev->kobj, "device"); 775 765 776 - sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); 766 + sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev)); 777 767 #endif 778 768 779 769 sysfs_remove_link(&dev->kobj, "subsystem"); ··· 876 866 if (!strlen(dev->bus_id)) 877 867 goto done; 878 868 879 - pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 869 + pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 880 870 881 871 parent = get_device(dev->parent); 882 872 setup_parent(dev, parent); ··· 886 876 set_dev_node(dev, dev_to_node(parent)); 887 877 888 878 /* first, register with generic layer. */ 889 - error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id); 879 + error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev)); 890 880 if (error) 891 881 goto Error; 892 882 893 883 /* notify platform of device entry */ 894 884 if (platform_notify) 895 885 platform_notify(dev); 896 - 897 - /* notify clients of device entry (new way) */ 898 - if (dev->bus) 899 - blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 900 - BUS_NOTIFY_ADD_DEVICE, dev); 901 886 902 887 error = device_create_file(dev, &uevent_attr); 903 888 if (error) ··· 921 916 if (error) 922 917 goto DPMError; 923 918 device_pm_add(dev); 919 + 920 + /* Notify clients of device addition. This call must come 921 + * after dpm_sysf_add() and before kobject_uevent(). 922 + */ 923 + if (dev->bus) 924 + blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 925 + BUS_NOTIFY_ADD_DEVICE, dev); 926 + 924 927 kobject_uevent(&dev->kobj, KOBJ_ADD); 925 928 bus_attach_device(dev); 926 929 if (parent) 927 - klist_add_tail(&dev->knode_parent, &parent->klist_children); 930 + klist_add_tail(&dev->p->knode_parent, 931 + &parent->p->klist_children); 928 932 929 933 if (dev->class) { 930 934 mutex_lock(&dev->class->p->class_mutex); ··· 954 940 DPMError: 955 941 bus_remove_device(dev); 956 942 BusError: 957 - if (dev->bus) 958 - blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 959 - BUS_NOTIFY_DEL_DEVICE, dev); 960 943 device_remove_attrs(dev); 961 944 AttrsError: 962 945 device_remove_class_symlinks(dev); ··· 1038 1027 struct device *parent = dev->parent; 1039 1028 struct class_interface *class_intf; 1040 1029 1030 + /* Notify clients of device removal. This call must come 1031 + * before dpm_sysfs_remove(). 1032 + */ 1033 + if (dev->bus) 1034 + blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 1035 + BUS_NOTIFY_DEL_DEVICE, dev); 1041 1036 device_pm_remove(dev); 1042 1037 dpm_sysfs_remove(dev); 1043 1038 if (parent) 1044 - klist_del(&dev->knode_parent); 1039 + klist_del(&dev->p->knode_parent); 1045 1040 if (MAJOR(dev->devt)) { 1046 1041 device_remove_sys_dev_entry(dev); 1047 1042 device_remove_file(dev, &devt_attr); ··· 1081 1064 */ 1082 1065 if (platform_notify_remove) 1083 1066 platform_notify_remove(dev); 1084 - if (dev->bus) 1085 - blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 1086 - BUS_NOTIFY_DEL_DEVICE, dev); 1087 1067 kobject_uevent(&dev->kobj, KOBJ_REMOVE); 1088 1068 cleanup_device_parent(dev); 1089 1069 kobject_del(&dev->kobj); ··· 1100 1086 */ 1101 1087 void device_unregister(struct device *dev) 1102 1088 { 1103 - pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 1089 + pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 1104 1090 device_del(dev); 1105 1091 put_device(dev); 1106 1092 } ··· 1108 1094 static struct device *next_device(struct klist_iter *i) 1109 1095 { 1110 1096 struct klist_node *n = klist_next(i); 1111 - return n ? container_of(n, struct device, knode_parent) : NULL; 1097 + struct device *dev = NULL; 1098 + struct device_private *p; 1099 + 1100 + if (n) { 1101 + p = to_device_private_parent(n); 1102 + dev = p->device; 1103 + } 1104 + return dev; 1112 1105 } 1113 1106 1114 1107 /** ··· 1137 1116 struct device *child; 1138 1117 int error = 0; 1139 1118 1140 - klist_iter_init(&parent->klist_children, &i); 1119 + klist_iter_init(&parent->p->klist_children, &i); 1141 1120 while ((child = next_device(&i)) && !error) 1142 1121 error = fn(child, data); 1143 1122 klist_iter_exit(&i); ··· 1168 1147 if (!parent) 1169 1148 return NULL; 1170 1149 1171 - klist_iter_init(&parent->klist_children, &i); 1150 + klist_iter_init(&parent->p->klist_children, &i); 1172 1151 while ((child = next_device(&i))) 1173 1152 if (match(child, data) && get_device(child)) 1174 1153 break; ··· 1217 1196 EXPORT_SYMBOL_GPL(device_create_file); 1218 1197 EXPORT_SYMBOL_GPL(device_remove_file); 1219 1198 1199 + struct root_device 1200 + { 1201 + struct device dev; 1202 + struct module *owner; 1203 + }; 1204 + 1205 + #define to_root_device(dev) container_of(dev, struct root_device, dev) 1206 + 1207 + static void root_device_release(struct device *dev) 1208 + { 1209 + kfree(to_root_device(dev)); 1210 + } 1211 + 1212 + /** 1213 + * __root_device_register - allocate and register a root device 1214 + * @name: root device name 1215 + * @owner: owner module of the root device, usually THIS_MODULE 1216 + * 1217 + * This function allocates a root device and registers it 1218 + * using device_register(). In order to free the returned 1219 + * device, use root_device_unregister(). 1220 + * 1221 + * Root devices are dummy devices which allow other devices 1222 + * to be grouped under /sys/devices. Use this function to 1223 + * allocate a root device and then use it as the parent of 1224 + * any device which should appear under /sys/devices/{name} 1225 + * 1226 + * The /sys/devices/{name} directory will also contain a 1227 + * 'module' symlink which points to the @owner directory 1228 + * in sysfs. 1229 + * 1230 + * Note: You probably want to use root_device_register(). 1231 + */ 1232 + struct device *__root_device_register(const char *name, struct module *owner) 1233 + { 1234 + struct root_device *root; 1235 + int err = -ENOMEM; 1236 + 1237 + root = kzalloc(sizeof(struct root_device), GFP_KERNEL); 1238 + if (!root) 1239 + return ERR_PTR(err); 1240 + 1241 + err = dev_set_name(&root->dev, name); 1242 + if (err) { 1243 + kfree(root); 1244 + return ERR_PTR(err); 1245 + } 1246 + 1247 + root->dev.release = root_device_release; 1248 + 1249 + err = device_register(&root->dev); 1250 + if (err) { 1251 + put_device(&root->dev); 1252 + return ERR_PTR(err); 1253 + } 1254 + 1255 + #ifdef CONFIG_MODULE /* gotta find a "cleaner" way to do this */ 1256 + if (owner) { 1257 + struct module_kobject *mk = &owner->mkobj; 1258 + 1259 + err = sysfs_create_link(&root->dev.kobj, &mk->kobj, "module"); 1260 + if (err) { 1261 + device_unregister(&root->dev); 1262 + return ERR_PTR(err); 1263 + } 1264 + root->owner = owner; 1265 + } 1266 + #endif 1267 + 1268 + return &root->dev; 1269 + } 1270 + EXPORT_SYMBOL_GPL(__root_device_register); 1271 + 1272 + /** 1273 + * root_device_unregister - unregister and free a root device 1274 + * @root: device going away. 1275 + * 1276 + * This function unregisters and cleans up a device that was created by 1277 + * root_device_register(). 1278 + */ 1279 + void root_device_unregister(struct device *dev) 1280 + { 1281 + struct root_device *root = to_root_device(dev); 1282 + 1283 + if (root->owner) 1284 + sysfs_remove_link(&root->dev.kobj, "module"); 1285 + 1286 + device_unregister(dev); 1287 + } 1288 + EXPORT_SYMBOL_GPL(root_device_unregister); 1289 + 1220 1290 1221 1291 static void device_create_release(struct device *dev) 1222 1292 { 1223 - pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 1293 + pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 1224 1294 kfree(dev); 1225 1295 } 1226 1296 ··· 1456 1344 if (!dev) 1457 1345 return -EINVAL; 1458 1346 1459 - pr_debug("device: '%s': %s: renaming to '%s'\n", dev->bus_id, 1347 + pr_debug("device: '%s': %s: renaming to '%s'\n", dev_name(dev), 1460 1348 __func__, new_name); 1461 1349 1462 1350 #ifdef CONFIG_SYSFS_DEPRECATED ··· 1493 1381 #else 1494 1382 if (dev->class) { 1495 1383 error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, 1496 - &dev->kobj, dev->bus_id); 1384 + &dev->kobj, dev_name(dev)); 1497 1385 if (error) 1498 1386 goto out; 1499 1387 sysfs_remove_link(&dev->class->p->class_subsys.kobj, ··· 1571 1459 new_parent = get_device(new_parent); 1572 1460 new_parent_kobj = get_device_parent(dev, new_parent); 1573 1461 1574 - pr_debug("device: '%s': %s: moving to '%s'\n", dev->bus_id, 1575 - __func__, new_parent ? new_parent->bus_id : "<NULL>"); 1462 + pr_debug("device: '%s': %s: moving to '%s'\n", dev_name(dev), 1463 + __func__, new_parent ? dev_name(new_parent) : "<NULL>"); 1576 1464 error = kobject_move(&dev->kobj, new_parent_kobj); 1577 1465 if (error) { 1578 1466 cleanup_glue_dir(dev, new_parent_kobj); ··· 1582 1470 old_parent = dev->parent; 1583 1471 dev->parent = new_parent; 1584 1472 if (old_parent) 1585 - klist_remove(&dev->knode_parent); 1473 + klist_remove(&dev->p->knode_parent); 1586 1474 if (new_parent) { 1587 - klist_add_tail(&dev->knode_parent, &new_parent->klist_children); 1475 + klist_add_tail(&dev->p->knode_parent, 1476 + &new_parent->p->klist_children); 1588 1477 set_dev_node(dev, dev_to_node(new_parent)); 1589 1478 } 1590 1479 ··· 1597 1484 device_move_class_links(dev, new_parent, old_parent); 1598 1485 if (!kobject_move(&dev->kobj, &old_parent->kobj)) { 1599 1486 if (new_parent) 1600 - klist_remove(&dev->knode_parent); 1487 + klist_remove(&dev->p->knode_parent); 1601 1488 dev->parent = old_parent; 1602 1489 if (old_parent) { 1603 - klist_add_tail(&dev->knode_parent, 1604 - &old_parent->klist_children); 1490 + klist_add_tail(&dev->p->knode_parent, 1491 + &old_parent->p->klist_children); 1605 1492 set_dev_node(dev, dev_to_node(old_parent)); 1606 1493 } 1607 1494 }
+14 -12
drivers/base/dd.c
··· 28 28 29 29 static 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 32 printk(KERN_WARNING "%s: device %s already bound\n", 33 33 __func__, kobject_name(&dev->kobj)); 34 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 38 __func__, dev->driver->name); 39 39 40 40 if (dev->bus) 41 41 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 42 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 47 47 static int driver_sysfs_add(struct device *dev) ··· 104 104 105 105 atomic_inc(&probe_count); 106 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 108 WARN_ON(!list_empty(&dev->devres_head)); 109 109 110 110 dev->driver = drv; 111 111 if (driver_sysfs_add(dev)) { 112 112 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", 113 - __func__, dev->bus_id); 113 + __func__, dev_name(dev)); 114 114 goto probe_failed; 115 115 } 116 116 ··· 127 127 driver_bound(dev); 128 128 ret = 1; 129 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 131 goto done; 132 132 133 133 probe_failed: ··· 139 139 /* driver matched but the probe failed */ 140 140 printk(KERN_WARNING 141 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 145 * Ignore errors returned by ->probe so that the next driver can try ··· 194 194 goto done; 195 195 196 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 199 ret = really_probe(dev, drv); 200 200 ··· 298 298 drv = dev->driver; 299 299 if (drv) { 300 300 driver_sysfs_remove(dev); 301 - sysfs_remove_link(&dev->kobj, "driver"); 302 301 303 302 if (dev->bus) 304 303 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, ··· 310 311 drv->remove(dev); 311 312 devres_release_all(dev); 312 313 dev->driver = NULL; 313 - klist_remove(&dev->knode_driver); 314 + klist_remove(&dev->p->knode_driver); 314 315 } 315 316 } 316 317 ··· 340 341 */ 341 342 void driver_detach(struct device_driver *drv) 342 343 { 344 + struct device_private *dev_prv; 343 345 struct device *dev; 344 346 345 347 for (;;) { ··· 349 349 spin_unlock(&drv->p->klist_devices.k_lock); 350 350 break; 351 351 } 352 - dev = list_entry(drv->p->klist_devices.k_list.prev, 353 - struct device, knode_driver.n_node); 352 + dev_prv = list_entry(drv->p->klist_devices.k_list.prev, 353 + struct device_private, 354 + knode_driver.n_node); 355 + dev = dev_prv->device; 354 356 get_device(dev); 355 357 spin_unlock(&drv->p->klist_devices.k_lock); 356 358
+10 -3
drivers/base/driver.c
··· 19 19 static struct device *next_device(struct klist_iter *i) 20 20 { 21 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 /** ··· 49 42 return -EINVAL; 50 43 51 44 klist_iter_init_node(&drv->p->klist_devices, &i, 52 - start ? &start->knode_driver : NULL); 45 + start ? &start->p->knode_driver : NULL); 53 46 while ((dev = next_device(&i)) && !error) 54 47 error = fn(dev, data); 55 48 klist_iter_exit(&i); ··· 83 76 return NULL; 84 77 85 78 klist_iter_init_node(&drv->p->klist_devices, &i, 86 - (start ? &start->knode_driver : NULL)); 79 + (start ? &start->p->knode_driver : NULL)); 87 80 while ((dev = next_device(&i))) 88 81 if (match(dev, data) && get_device(dev)) 89 82 break;
+1 -7
drivers/base/firmware_class.c
··· 291 291 fw_load_abort(fw_priv); 292 292 } 293 293 294 - static 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 - 300 294 static int fw_register_device(struct device **dev_p, const char *fw_name, 301 295 struct device *device) 302 296 { ··· 315 321 fw_priv->timeout.data = (u_long) fw_priv; 316 322 init_timer(&fw_priv->timeout); 317 323 318 - fw_setup_device_id(f_dev, device); 324 + dev_set_name(f_dev, dev_name(device)); 319 325 f_dev->parent = device; 320 326 f_dev->class = &firmware_class; 321 327 dev_set_drvdata(f_dev, fw_priv);
+3 -4
drivers/base/isa.c
··· 11 11 #include <linux/isa.h> 12 12 13 13 static struct device isa_bus = { 14 - .bus_id = "isa" 14 + .init_name = "isa" 15 15 }; 16 16 17 17 struct isa_dev { ··· 135 135 isa_dev->dev.parent = &isa_bus; 136 136 isa_dev->dev.bus = &isa_bus_type; 137 137 138 - snprintf(isa_dev->dev.bus_id, BUS_ID_SIZE, "%s.%u", 139 - isa_driver->driver.name, id); 140 - 138 + dev_set_name(&isa_dev->dev, "%s.%u", 139 + isa_driver->driver.name, id); 141 140 isa_dev->dev.platform_data = isa_driver; 142 141 isa_dev->dev.release = isa_dev_release; 143 142 isa_dev->id = id;
+67 -63
drivers/base/platform.c
··· 24 24 driver)) 25 25 26 26 struct device platform_bus = { 27 - .bus_id = "platform", 27 + .init_name = "platform", 28 28 }; 29 29 EXPORT_SYMBOL_GPL(platform_bus); 30 30 ··· 242 242 pdev->dev.bus = &platform_bus_type; 243 243 244 244 if (pdev->id != -1) 245 - snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%d", pdev->name, 246 - pdev->id); 245 + dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); 247 246 else 248 - strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE); 247 + dev_set_name(&pdev->dev, pdev->name); 249 248 250 249 for (i = 0; i < pdev->num_resources; i++) { 251 250 struct resource *p, *r = &pdev->resource[i]; 252 251 253 252 if (r->name == NULL) 254 - r->name = pdev->dev.bus_id; 253 + r->name = dev_name(&pdev->dev); 255 254 256 255 p = r->parent; 257 256 if (!p) { ··· 263 264 if (p && insert_resource(p, r)) { 264 265 printk(KERN_ERR 265 266 "%s: failed to claim resource %d\n", 266 - pdev->dev.bus_id, i); 267 + dev_name(&pdev->dev), i); 267 268 ret = -EBUSY; 268 269 goto failed; 269 270 } 270 271 } 271 272 272 273 pr_debug("Registering platform device '%s'. Parent at %s\n", 273 - pdev->dev.bus_id, pdev->dev.parent->bus_id); 274 + dev_name(&pdev->dev), dev_name(pdev->dev.parent)); 274 275 275 276 ret = device_add(&pdev->dev); 276 277 if (ret == 0) ··· 502 503 drv->driver.suspend = platform_drv_suspend; 503 504 if (drv->resume) 504 505 drv->driver.resume = platform_drv_resume; 505 - if (drv->pm) 506 - drv->driver.pm = &drv->pm->base; 507 506 return driver_register(&drv->driver); 508 507 } 509 508 EXPORT_SYMBOL_GPL(platform_driver_register); ··· 606 609 struct platform_device *pdev; 607 610 608 611 pdev = container_of(dev, struct platform_device, dev); 609 - return (strncmp(pdev->name, drv->name, BUS_ID_SIZE) == 0); 612 + return (strcmp(pdev->name, drv->name) == 0); 610 613 } 611 614 612 615 #ifdef CONFIG_PM_SLEEP ··· 683 686 struct device_driver *drv = dev->driver; 684 687 int ret = 0; 685 688 686 - if (drv && drv->pm) { 689 + if (!drv) 690 + return 0; 691 + 692 + if (drv->pm) { 687 693 if (drv->pm->suspend) 688 694 ret = drv->pm->suspend(dev); 689 695 } else { ··· 698 698 699 699 static int platform_pm_suspend_noirq(struct device *dev) 700 700 { 701 - struct platform_driver *pdrv; 701 + struct device_driver *drv = dev->driver; 702 702 int ret = 0; 703 703 704 - if (!dev->driver) 704 + if (!drv) 705 705 return 0; 706 706 707 - pdrv = to_platform_driver(dev->driver); 708 - if (pdrv->pm) { 709 - if (pdrv->pm->suspend_noirq) 710 - ret = pdrv->pm->suspend_noirq(dev); 707 + if (drv->pm) { 708 + if (drv->pm->suspend_noirq) 709 + ret = drv->pm->suspend_noirq(dev); 711 710 } else { 712 711 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND); 713 712 } ··· 719 720 struct device_driver *drv = dev->driver; 720 721 int ret = 0; 721 722 722 - if (drv && drv->pm) { 723 + if (!drv) 724 + return 0; 725 + 726 + if (drv->pm) { 723 727 if (drv->pm->resume) 724 728 ret = drv->pm->resume(dev); 725 729 } else { ··· 734 732 735 733 static int platform_pm_resume_noirq(struct device *dev) 736 734 { 737 - struct platform_driver *pdrv; 735 + struct device_driver *drv = dev->driver; 738 736 int ret = 0; 739 737 740 - if (!dev->driver) 738 + if (!drv) 741 739 return 0; 742 740 743 - pdrv = to_platform_driver(dev->driver); 744 - if (pdrv->pm) { 745 - if (pdrv->pm->resume_noirq) 746 - ret = pdrv->pm->resume_noirq(dev); 741 + if (drv->pm) { 742 + if (drv->pm->resume_noirq) 743 + ret = drv->pm->resume_noirq(dev); 747 744 } else { 748 745 ret = platform_legacy_resume_early(dev); 749 746 } ··· 781 780 782 781 static int platform_pm_freeze_noirq(struct device *dev) 783 782 { 784 - struct platform_driver *pdrv; 783 + struct device_driver *drv = dev->driver; 785 784 int ret = 0; 786 785 787 - if (!dev->driver) 786 + if (!drv) 788 787 return 0; 789 788 790 - pdrv = to_platform_driver(dev->driver); 791 - if (pdrv->pm) { 792 - if (pdrv->pm->freeze_noirq) 793 - ret = pdrv->pm->freeze_noirq(dev); 789 + if (drv->pm) { 790 + if (drv->pm->freeze_noirq) 791 + ret = drv->pm->freeze_noirq(dev); 794 792 } else { 795 793 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE); 796 794 } ··· 802 802 struct device_driver *drv = dev->driver; 803 803 int ret = 0; 804 804 805 - if (drv && drv->pm) { 805 + if (!drv) 806 + return 0; 807 + 808 + if (drv->pm) { 806 809 if (drv->pm->thaw) 807 810 ret = drv->pm->thaw(dev); 808 811 } else { ··· 817 814 818 815 static int platform_pm_thaw_noirq(struct device *dev) 819 816 { 820 - struct platform_driver *pdrv; 817 + struct device_driver *drv = dev->driver; 821 818 int ret = 0; 822 819 823 - if (!dev->driver) 820 + if (!drv) 824 821 return 0; 825 822 826 - pdrv = to_platform_driver(dev->driver); 827 - if (pdrv->pm) { 828 - if (pdrv->pm->thaw_noirq) 829 - ret = pdrv->pm->thaw_noirq(dev); 823 + if (drv->pm) { 824 + if (drv->pm->thaw_noirq) 825 + ret = drv->pm->thaw_noirq(dev); 830 826 } else { 831 827 ret = platform_legacy_resume_early(dev); 832 828 } ··· 838 836 struct device_driver *drv = dev->driver; 839 837 int ret = 0; 840 838 841 - if (drv && drv->pm) { 839 + if (!drv) 840 + return 0; 841 + 842 + if (drv->pm) { 842 843 if (drv->pm->poweroff) 843 844 ret = drv->pm->poweroff(dev); 844 845 } else { ··· 853 848 854 849 static int platform_pm_poweroff_noirq(struct device *dev) 855 850 { 856 - struct platform_driver *pdrv; 851 + struct device_driver *drv = dev->driver; 857 852 int ret = 0; 858 853 859 - if (!dev->driver) 854 + if (!drv) 860 855 return 0; 861 856 862 - pdrv = to_platform_driver(dev->driver); 863 - if (pdrv->pm) { 864 - if (pdrv->pm->poweroff_noirq) 865 - ret = pdrv->pm->poweroff_noirq(dev); 857 + if (drv->pm) { 858 + if (drv->pm->poweroff_noirq) 859 + ret = drv->pm->poweroff_noirq(dev); 866 860 } else { 867 861 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE); 868 862 } ··· 874 870 struct device_driver *drv = dev->driver; 875 871 int ret = 0; 876 872 877 - if (drv && drv->pm) { 873 + if (!drv) 874 + return 0; 875 + 876 + if (drv->pm) { 878 877 if (drv->pm->restore) 879 878 ret = drv->pm->restore(dev); 880 879 } else { ··· 889 882 890 883 static int platform_pm_restore_noirq(struct device *dev) 891 884 { 892 - struct platform_driver *pdrv; 885 + struct device_driver *drv = dev->driver; 893 886 int ret = 0; 894 887 895 - if (!dev->driver) 888 + if (!drv) 896 889 return 0; 897 890 898 - pdrv = to_platform_driver(dev->driver); 899 - if (pdrv->pm) { 900 - if (pdrv->pm->restore_noirq) 901 - ret = pdrv->pm->restore_noirq(dev); 891 + if (drv->pm) { 892 + if (drv->pm->restore_noirq) 893 + ret = drv->pm->restore_noirq(dev); 902 894 } else { 903 895 ret = platform_legacy_resume_early(dev); 904 896 } ··· 918 912 919 913 #endif /* !CONFIG_HIBERNATION */ 920 914 921 - static struct pm_ext_ops platform_pm_ops = { 922 - .base = { 923 - .prepare = platform_pm_prepare, 924 - .complete = platform_pm_complete, 925 - .suspend = platform_pm_suspend, 926 - .resume = platform_pm_resume, 927 - .freeze = platform_pm_freeze, 928 - .thaw = platform_pm_thaw, 929 - .poweroff = platform_pm_poweroff, 930 - .restore = platform_pm_restore, 931 - }, 915 + static struct dev_pm_ops platform_dev_pm_ops = { 916 + .prepare = platform_pm_prepare, 917 + .complete = platform_pm_complete, 918 + .suspend = platform_pm_suspend, 919 + .resume = platform_pm_resume, 920 + .freeze = platform_pm_freeze, 921 + .thaw = platform_pm_thaw, 922 + .poweroff = platform_pm_poweroff, 923 + .restore = platform_pm_restore, 932 924 .suspend_noirq = platform_pm_suspend_noirq, 933 925 .resume_noirq = platform_pm_resume_noirq, 934 926 .freeze_noirq = platform_pm_freeze_noirq, ··· 935 931 .restore_noirq = platform_pm_restore_noirq, 936 932 }; 937 933 938 - #define PLATFORM_PM_OPS_PTR &platform_pm_ops 934 + #define PLATFORM_PM_OPS_PTR (&platform_dev_pm_ops) 939 935 940 936 #else /* !CONFIG_PM_SLEEP */ 941 937
+11 -10
drivers/base/power/main.c
··· 76 76 if (dev->parent) { 77 77 if (dev->parent->power.status >= DPM_SUSPENDING) 78 78 dev_warn(dev, "parent %s should not be sleeping\n", 79 - dev->parent->bus_id); 79 + dev_name(dev->parent)); 80 80 } else if (transition_started) { 81 81 /* 82 82 * We refuse to register parentless devices while a PM ··· 112 112 * @ops: PM operations to choose from. 113 113 * @state: PM transition of the system being carried out. 114 114 */ 115 - static int pm_op(struct device *dev, struct pm_ops *ops, pm_message_t state) 115 + static int pm_op(struct device *dev, struct dev_pm_ops *ops, 116 + pm_message_t state) 116 117 { 117 118 int error = 0; 118 119 ··· 175 174 * The operation is executed with interrupts disabled by the only remaining 176 175 * functional CPU in the system. 177 176 */ 178 - static int pm_noirq_op(struct device *dev, struct pm_ext_ops *ops, 177 + static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops, 179 178 pm_message_t state) 180 179 { 181 180 int error = 0; ··· 355 354 if (dev->bus) { 356 355 if (dev->bus->pm) { 357 356 pm_dev_dbg(dev, state, ""); 358 - error = pm_op(dev, &dev->bus->pm->base, state); 357 + error = pm_op(dev, dev->bus->pm, state); 359 358 } else if (dev->bus->resume) { 360 359 pm_dev_dbg(dev, state, "legacy "); 361 360 error = dev->bus->resume(dev); ··· 452 451 dev->type->pm->complete(dev); 453 452 } 454 453 455 - if (dev->bus && dev->bus->pm && dev->bus->pm->base.complete) { 454 + if (dev->bus && dev->bus->pm && dev->bus->pm->complete) { 456 455 pm_dev_dbg(dev, state, "completing "); 457 - dev->bus->pm->base.complete(dev); 456 + dev->bus->pm->complete(dev); 458 457 } 459 458 460 459 up(&dev->sem); ··· 625 624 if (dev->bus) { 626 625 if (dev->bus->pm) { 627 626 pm_dev_dbg(dev, state, ""); 628 - error = pm_op(dev, &dev->bus->pm->base, state); 627 + error = pm_op(dev, dev->bus->pm, state); 629 628 } else if (dev->bus->suspend) { 630 629 pm_dev_dbg(dev, state, "legacy "); 631 630 error = dev->bus->suspend(dev, state); ··· 686 685 687 686 down(&dev->sem); 688 687 689 - if (dev->bus && dev->bus->pm && dev->bus->pm->base.prepare) { 688 + if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) { 690 689 pm_dev_dbg(dev, state, "preparing "); 691 - error = dev->bus->pm->base.prepare(dev); 692 - suspend_report_result(dev->bus->pm->base.prepare, error); 690 + error = dev->bus->pm->prepare(dev); 691 + suspend_report_result(dev->bus->pm->prepare, error); 693 692 if (error) 694 693 goto End; 695 694 }
+2 -2
drivers/base/power/trace.c
··· 140 140 141 141 void 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 } 145 145 EXPORT_SYMBOL(set_trace_device); 146 146 ··· 192 192 193 193 while (entry != &dpm_list) { 194 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 196 if (hash == value) { 197 197 dev_info(dev, "hash matches\n"); 198 198 match++;
+1 -1
drivers/char/mwave/mwavedd.c
··· 663 663 #if 0 664 664 /* sysfs */ 665 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 668 if (device_register(&mwave_device)) 669 669 goto cleanup_error;
+1 -1
drivers/firmware/dmi-id.c
··· 223 223 } 224 224 225 225 dmi_dev->class = &dmi_class; 226 - strcpy(dmi_dev->bus_id, "id"); 226 + dev_set_name(dmi_dev, "id"); 227 227 dmi_dev->groups = sys_dmi_attribute_groups; 228 228 229 229 ret = device_register(dmi_dev);
+1 -1
drivers/gpio/gpiolib.c
··· 1213 1213 if (dev) 1214 1214 seq_printf(s, ", %s/%s", 1215 1215 dev->bus ? dev->bus->name : "no-bus", 1216 - dev->bus_id); 1216 + dev_name(dev)); 1217 1217 if (chip->label) 1218 1218 seq_printf(s, ", %s", chip->label); 1219 1219 if (chip->can_sleep)
+1 -1
drivers/gpu/drm/drm_sysfs.c
··· 488 488 else 489 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 493 err = device_register(&minor->kdev); 494 494 if (err) {
+1 -1
drivers/hwmon/hwmon.c
··· 76 76 { 77 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 80 device_unregister(dev); 81 81 spin_lock(&idr_lock); 82 82 idr_remove(&hwmon_idr, id);
+1 -1
drivers/hwmon/lm75.c
··· 190 190 } 191 191 192 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 195 return 0; 196 196
+1 -1
drivers/idle/i7300_idle.c
··· 177 177 } 178 178 179 179 static struct device dummy_dma_dev = { 180 - .bus_id = "fallback device", 180 + .init_name = "fallback device", 181 181 .coherent_dma_mask = DMA_64BIT_MASK, 182 182 .dma_mask = &dummy_dma_dev.coherent_dma_mask, 183 183 };
+1 -1
drivers/infiniband/core/sysfs.c
··· 778 778 class_dev->class = &ib_class; 779 779 class_dev->driver_data = device; 780 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 783 INIT_LIST_HEAD(&device->port_list); 784 784
+1 -2
drivers/infiniband/core/ucm.c
··· 1266 1266 ucm_dev->dev.parent = device->dma_device; 1267 1267 ucm_dev->dev.devt = ucm_dev->cdev.dev; 1268 1268 ucm_dev->dev.release = ib_ucm_release_dev; 1269 - snprintf(ucm_dev->dev.bus_id, BUS_ID_SIZE, "ucm%d", 1270 - ucm_dev->devnum); 1269 + dev_set_name(&ucm_dev->dev, "ucm%d", ucm_dev->devnum); 1271 1270 if (device_register(&ucm_dev->dev)) 1272 1271 goto err_cdev; 1273 1272
+1 -2
drivers/infiniband/ulp/srp/ib_srp.c
··· 1949 1949 1950 1950 host->dev.class = &srp_class; 1951 1951 host->dev.parent = device->dev->dma_device; 1952 - snprintf(host->dev.bus_id, BUS_ID_SIZE, "srp-%s-%d", 1953 - device->dev->name, port); 1952 + dev_set_name(&host->dev, "srp-%s-%d", device->dev->name, port); 1954 1953 1955 1954 if (device_register(&host->dev)) 1956 1955 goto free_host;
+1 -1
drivers/isdn/mISDN/dsp_pipeline.c
··· 91 91 92 92 entry->dev.class = elements_class; 93 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 95 ret = device_register(&entry->dev); 96 96 if (ret) { 97 97 printk(KERN_ERR "%s: failed to register %s\n",
+4 -6
drivers/lguest/lguest_device.c
··· 321 321 322 322 /* The root device for the lguest virtio devices. This makes them appear as 323 323 * /sys/devices/lguest/0,1,2 not /sys/devices/0,1,2. */ 324 - static struct device lguest_root = { 325 - .parent = NULL, 326 - .bus_id = "lguest", 327 - }; 324 + static struct device *lguest_root; 328 325 329 326 /*D:120 This is the core of the lguest bus: actually adding a new device. 330 327 * It's a separate function because it's neater that way, and because an ··· 348 351 } 349 352 350 353 /* This devices' parent is the lguest/ dir. */ 351 - ldev->vdev.dev.parent = &lguest_root; 354 + ldev->vdev.dev.parent = lguest_root; 352 355 /* We have a unique device index thanks to the dev_index counter. */ 353 356 ldev->vdev.id.device = d->type; 354 357 /* We have a simple set of routines for querying the device's ··· 404 407 if (strcmp(pv_info.name, "lguest") != 0) 405 408 return 0; 406 409 407 - if (device_register(&lguest_root) != 0) 410 + lguest_root = root_device_register("lguest"); 411 + if (IS_ERR(lguest_root)) 408 412 panic("Could not register lguest root"); 409 413 410 414 /* Devices are in a single page above top of "normal" mem */
+12 -12
drivers/macintosh/macio_asic.c
··· 33 33 34 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 38 38 static struct macio_chip *macio_on_hold; 39 39 ··· 240 240 if (irq != NO_IRQ) { 241 241 dev->interrupt[index].start = irq; 242 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 245 if (dev->n_interrupts <= index) 246 246 dev->n_interrupts = index + 1; ··· 303 303 break; 304 304 res->start = irq; 305 305 res->flags = IORESOURCE_IRQ; 306 - res->name = dev->ofdev.dev.bus_id; 306 + res->name = dev_name(&dev->ofdev.dev); 307 307 if (macio_resource_quirks(np, res, i - 1)) { 308 308 memset(res, 0, sizeof(struct resource)); 309 309 continue; ··· 325 325 if (index >= MACIO_DEV_COUNT_RESOURCES) 326 326 break; 327 327 *res = r; 328 - res->name = dev->ofdev.dev.bus_id; 328 + res->name = dev_name(&dev->ofdev.dev); 329 329 330 330 if (macio_resource_quirks(np, res, index)) { 331 331 memset(res, 0, sizeof(struct resource)); ··· 338 338 if (insert_resource(parent_res, res)) { 339 339 printk(KERN_WARNING "Can't request resource " 340 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 344 dev->n_resources = index; ··· 385 385 386 386 /* MacIO itself has a different reg, we use it's PCI base */ 387 387 if (np == chip->of_node) { 388 - sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 389 - chip->lbus.index, 388 + dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", 389 + chip->lbus.index, 390 390 #ifdef CONFIG_PCI 391 391 (unsigned int)pci_resource_start(chip->lbus.pdev, 0), 392 392 #else ··· 395 395 MAX_NODE_NAME_SIZE, np->name); 396 396 } else { 397 397 reg = of_get_property(np, "reg", NULL); 398 - sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 399 - chip->lbus.index, 400 - reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); 398 + dev_set_name(&dev->ofdev.dev, "%1d.%08x:%.*s", 399 + chip->lbus.index, 400 + reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name); 401 401 } 402 402 403 403 /* Setup interrupts & resources */ ··· 408 408 /* Register with core */ 409 409 if (of_device_register(&dev->ofdev) != 0) { 410 410 printk(KERN_DEBUG"macio: device registration error for %s!\n", 411 - dev->ofdev.dev.bus_id); 411 + dev_name(&dev->ofdev.dev)); 412 412 kfree(dev); 413 413 return NULL; 414 414 } ··· 558 558 resource_no, 559 559 macio_resource_len(dev, resource_no), 560 560 macio_resource_start(dev, resource_no), 561 - dev->ofdev.dev.bus_id); 561 + dev_name(&dev->ofdev.dev)); 562 562 return -EBUSY; 563 563 } 564 564
+2 -3
drivers/memstick/core/memstick.c
··· 385 385 386 386 if (card) { 387 387 card->host = host; 388 - snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), 389 - "%s", host->dev.bus_id); 388 + dev_set_name(&card->dev, "%s", dev_name(&host->dev)); 390 389 card->dev.parent = &host->dev; 391 390 card->dev.bus = &memstick_bus_type; 392 391 card->dev.release = memstick_free_card; ··· 518 519 if (rc) 519 520 return rc; 520 521 521 - snprintf(host->dev.bus_id, BUS_ID_SIZE, "memstick%u", host->id); 522 + dev_set_name(&host->dev, "memstick%u", host->id); 522 523 523 524 rc = device_add(&host->dev); 524 525 if (rc) {
+7 -7
drivers/memstick/core/mspro_block.c
··· 887 887 if (rc) { 888 888 printk(KERN_WARNING 889 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 891 return 0; 892 892 } 893 893 894 894 msb->system = MEMSTICK_SYS_PAR4; 895 895 host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); 896 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 899 if (msb->caps & MEMSTICK_CAP_PAR8) { 900 900 rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR8); ··· 905 905 MEMSTICK_PAR8); 906 906 printk(KERN_INFO 907 907 "%s: switching to 8-bit parallel mode\n", 908 - card->dev.bus_id); 908 + dev_name(&card->dev)); 909 909 } else 910 910 printk(KERN_WARNING 911 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 915 card->next_request = h_mspro_block_req_init; ··· 922 922 if (rc) { 923 923 printk(KERN_WARNING 924 924 "%s: interface error, trying to fall back to serial\n", 925 - card->dev.bus_id); 925 + dev_name(&card->dev)); 926 926 msb->system = MEMSTICK_SYS_SERIAL; 927 927 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); 928 928 msleep(10); ··· 992 992 993 993 if (be16_to_cpu(attr->signature) != MSPRO_BLOCK_SIGNATURE) { 994 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 996 rc = -ENODEV; 997 997 goto out_free_attr; 998 998 } 999 999 1000 1000 if (attr->count > MSPRO_BLOCK_MAX_ATTRIBUTES) { 1001 1001 printk(KERN_WARNING "%s: way too many attribute entries\n", 1002 - card->dev.bus_id); 1002 + dev_name(&card->dev)); 1003 1003 attr_count = MSPRO_BLOCK_MAX_ATTRIBUTES; 1004 1004 } else 1005 1005 attr_count = attr->count;
+2 -2
drivers/memstick/host/tifm_ms.c
··· 546 546 printk(KERN_ERR 547 547 "%s : card failed to respond for a long period of time " 548 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 550 host->cmd_flags); 551 551 552 552 tifm_eject(host->dev); ··· 561 561 if (!(TIFM_SOCK_STATE_OCCUPIED 562 562 & readl(sock->addr + SOCK_PRESENT_STATE))) { 563 563 printk(KERN_WARNING "%s : card gone, unexpectedly\n", 564 - sock->dev.bus_id); 564 + dev_name(&sock->dev)); 565 565 return rc; 566 566 } 567 567
+4 -4
drivers/message/i2o/device.c
··· 132 132 { 133 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 137 kfree(i2o_dev); 138 138 } ··· 227 227 228 228 i2o_dev->lct_data = *entry; 229 229 230 - snprintf(i2o_dev->device.bus_id, BUS_ID_SIZE, "%d:%03x", c->unit, 231 - i2o_dev->lct_data.tid); 230 + dev_set_name(&i2o_dev->device, "%d:%03x", c->unit, 231 + i2o_dev->lct_data.tid); 232 232 233 233 i2o_dev->iop = c; 234 234 i2o_dev->device.parent = &c->device; ··· 279 279 280 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 284 return 0; 285 285
+1 -1
drivers/message/i2o/i2o_proc.c
··· 1300 1300 { 1301 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 1305 return 0; 1306 1306 }
+1 -1
drivers/message/i2o/iop.c
··· 1072 1072 1073 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 1077 #if BITS_PER_LONG == 64 1078 1078 spin_lock_init(&c->context_list_lock);
+1 -1
drivers/misc/sgi-gru/grumain.c
··· 29 29 }; 30 30 31 31 static struct device gru_device = { 32 - .bus_id = {0}, 32 + .init_name = "", 33 33 .driver = &gru_driver, 34 34 }; 35 35
+1 -1
drivers/misc/sgi-xp/xp_main.c
··· 25 25 }; 26 26 27 27 struct device xp_dbg_subname = { 28 - .bus_id = {0}, /* set to "" */ 28 + .init_name = "", /* set to "" */ 29 29 .driver = &xp_dbg_name 30 30 }; 31 31
+4 -4
drivers/misc/sgi-xp/xpc_main.c
··· 59 59 }; 60 60 61 61 struct 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 63 .driver = &xpc_dbg_name 64 64 }; 65 65 66 66 struct 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 68 .driver = &xpc_dbg_name 69 69 }; 70 70 ··· 1258 1258 int ret; 1259 1259 struct task_struct *kthread; 1260 1260 1261 - snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part"); 1262 - snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan"); 1261 + dev_set_name(xpc_part, "part"); 1262 + dev_set_name(xpc_chan, "chan"); 1263 1263 1264 1264 if (is_shub()) { 1265 1265 /*
+1 -1
drivers/misc/sgi-xp/xpnet.c
··· 138 138 }; 139 139 140 140 struct device xpnet_dbg_subname = { 141 - .bus_id = {0}, /* set to "" */ 141 + .init_name = "", /* set to "" */ 142 142 .driver = &xpnet_dbg_name 143 143 }; 144 144
+1 -1
drivers/misc/tifm_7xx1.c
··· 164 164 if (sock) { 165 165 printk(KERN_INFO 166 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 168 fm->sockets[cnt] = NULL; 169 169 sock_addr = sock->addr; 170 170 spin_unlock_irqrestore(&fm->lock, flags);
+3 -4
drivers/misc/tifm_core.c
··· 203 203 if (rc) 204 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 207 rc = device_add(&fm->dev); 208 208 if (rc) { 209 209 spin_lock(&tifm_adapter_lock); ··· 266 266 sock->dev.dma_mask = fm->dev.parent->dma_mask; 267 267 sock->dev.release = tifm_free_device; 268 268 269 - snprintf(sock->dev.bus_id, BUS_ID_SIZE, 270 - "tifm_%s%u:%u", tifm_media_type_name(type, 2), 271 - fm->id, id); 269 + dev_set_name(&sock->dev, "tifm_%s%u:%u", 270 + tifm_media_type_name(type, 2), fm->id, id); 272 271 printk(KERN_INFO DRIVER_NAME 273 272 ": %s card detected in socket %u:%u\n", 274 273 tifm_media_type_name(type, 0), fm->id, id);
+8 -8
drivers/mtd/devices/m25p80.c
··· 170 170 static int erase_chip(struct m25p *flash) 171 171 { 172 172 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n", 173 - flash->spi->dev.bus_id, __func__, 173 + dev_name(&flash->spi->dev), __func__, 174 174 flash->mtd.size / 1024); 175 175 176 176 /* Wait until finished previous write command. */ ··· 197 197 static int erase_sector(struct m25p *flash, u32 offset) 198 198 { 199 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 201 flash->mtd.erasesize / 1024, offset); 202 202 203 203 /* Wait until finished previous write command. */ ··· 234 234 u32 addr,len; 235 235 236 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 238 (u32)instr->addr, instr->len); 239 239 240 240 /* sanity checks */ ··· 295 295 struct spi_message m; 296 296 297 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 299 (u32)from, len); 300 300 301 301 /* sanity checks */ ··· 367 367 struct spi_message m; 368 368 369 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 371 (u32)to, len); 372 372 373 373 if (retlen) ··· 563 563 tmp = spi_write_then_read(spi, &code, 1, id, 5); 564 564 if (tmp < 0) { 565 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 567 return NULL; 568 568 } 569 569 jedec = id[0]; ··· 617 617 /* unrecognized chip? */ 618 618 if (i == ARRAY_SIZE(m25p_data)) { 619 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 621 info = NULL; 622 622 623 623 /* recognized; is that chip really what's there? */ ··· 658 658 if (data && data->name) 659 659 flash->mtd.name = data->name; 660 660 else 661 - flash->mtd.name = spi->dev.bus_id; 661 + flash->mtd.name = dev_name(&spi->dev); 662 662 663 663 flash->mtd.type = MTD_NORFLASH; 664 664 flash->mtd.writesize = 1;
+15 -15
drivers/mtd/devices/mtd_dataflash.c
··· 128 128 status = dataflash_status(spi); 129 129 if (status < 0) { 130 130 DEBUG(MTD_DEBUG_LEVEL1, "%s: status %d?\n", 131 - spi->dev.bus_id, status); 131 + dev_name(&spi->dev), status); 132 132 status = 0; 133 133 } 134 134 ··· 154 154 uint8_t *command; 155 155 156 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 158 instr->addr, instr->len); 159 159 160 160 /* Sanity checks */ ··· 197 197 198 198 if (status < 0) { 199 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 201 /* REVISIT: can retry instr->retries times; or 202 202 * giveup and instr->fail_addr = instr->addr; 203 203 */ ··· 239 239 int status; 240 240 241 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 244 *retlen = 0; 245 245 ··· 288 288 status = 0; 289 289 } else 290 290 DEBUG(MTD_DEBUG_LEVEL1, "%s: read %x..%x --> %d\n", 291 - priv->spi->dev.bus_id, 291 + dev_name(&priv->spi->dev), 292 292 (unsigned)from, (unsigned)(from + len), 293 293 status); 294 294 return status; ··· 315 315 uint8_t *command; 316 316 317 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 320 *retlen = 0; 321 321 ··· 374 374 status = spi_sync(spi, &msg); 375 375 if (status < 0) 376 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 379 (void) dataflash_waitready(priv->spi); 380 380 } ··· 396 396 spi_transfer_del(x + 1); 397 397 if (status < 0) 398 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 401 (void) dataflash_waitready(priv->spi); 402 402 ··· 416 416 status = spi_sync(spi, &msg); 417 417 if (status < 0) 418 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 421 status = dataflash_waitready(priv->spi); 422 422 423 423 /* Check result of the compare operation */ 424 424 if (status & (1 << 6)) { 425 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 427 remaining = 0; 428 428 status = -EIO; 429 429 break; ··· 779 779 tmp = spi_write_then_read(spi, &code, 1, id, 3); 780 780 if (tmp < 0) { 781 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 783 return ERR_PTR(tmp); 784 784 } 785 785 if (id[0] != 0x1f) ··· 869 869 status = dataflash_status(spi); 870 870 if (status <= 0 || status == 0xff) { 871 871 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n", 872 - spi->dev.bus_id, status); 872 + dev_name(&spi->dev), status); 873 873 if (status == 0 || status == 0xff) 874 874 status = -ENODEV; 875 875 return status; ··· 905 905 /* obsolete AT45DB1282 not (yet?) supported */ 906 906 default: 907 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 909 status = -ENODEV; 910 910 } 911 911 912 912 if (status < 0) 913 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 916 return status; 917 917 } ··· 921 921 struct dataflash *flash = dev_get_drvdata(&spi->dev); 922 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 926 if (mtd_has_partitions() && flash->partitioned) 927 927 status = del_mtd_partitions(&flash->mtd);
+1 -1
drivers/mtd/maps/integrator-flash.c
··· 105 105 info->map.bankwidth = plat->width; 106 106 info->map.phys = res->start; 107 107 info->map.virt = base; 108 - info->map.name = dev->dev.bus_id; 108 + info->map.name = dev_name(&dev->dev); 109 109 info->map.set_vpp = armflash_set_vpp; 110 110 111 111 simple_map_init(&info->map);
+2 -2
drivers/mtd/maps/ixp2000.c
··· 188 188 */ 189 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 192 info->map.read = ixp2000_flash_read8; 193 193 info->map.write = ixp2000_flash_write8; 194 194 info->map.copy_from = ixp2000_flash_copy_from; ··· 196 196 197 197 info->res = request_mem_region(dev->resource->start, 198 198 dev->resource->end - dev->resource->start + 1, 199 - dev->dev.bus_id); 199 + dev_name(&dev->dev)); 200 200 if (!info->res) { 201 201 dev_err(&dev->dev, "Could not reserve memory region\n"); 202 202 err = -ENOMEM;
+1 -1
drivers/mtd/maps/ixp4xx.c
··· 218 218 * handle that. 219 219 */ 220 220 info->map.bankwidth = 2; 221 - info->map.name = dev->dev.bus_id; 221 + info->map.name = dev_name(&dev->dev); 222 222 info->map.read = ixp4xx_read16, 223 223 info->map.write = ixp4xx_probe_write16, 224 224 info->map.copy_from = ixp4xx_copy_from,
+1 -1
drivers/mtd/maps/omap_nor.c
··· 101 101 err = -ENOMEM; 102 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 105 info->map.phys = res->start; 106 106 info->map.size = size; 107 107 info->map.bankwidth = pdata->width;
+3 -3
drivers/mtd/maps/physmap.c
··· 108 108 if (!devm_request_mem_region(&dev->dev, 109 109 dev->resource[i].start, 110 110 dev->resource[i].end - dev->resource[i].start + 1, 111 - dev->dev.bus_id)) { 111 + dev_name(&dev->dev))) { 112 112 dev_err(&dev->dev, "Could not reserve memory region\n"); 113 113 err = -ENOMEM; 114 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 118 info->map[i].phys = dev->resource[i].start; 119 119 info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; 120 120 info->map[i].bankwidth = physmap_data->width; ··· 150 150 * We detected multiple devices. Concatenate them together. 151 151 */ 152 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 154 if (info->cmtd == NULL) 155 155 err = -ENXIO; 156 156 #else
+2 -2
drivers/mtd/maps/physmap_of.c
··· 183 183 184 184 err = -EBUSY; 185 185 info->res = request_mem_region(res.start, res.end - res.start + 1, 186 - dev->dev.bus_id); 186 + dev_name(&dev->dev)); 187 187 if (!info->res) 188 188 goto err_out; 189 189 ··· 194 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 198 info->map.phys = res.start; 199 199 info->map.size = res.end - res.start + 1; 200 200 info->map.bankwidth = *width;
+1 -1
drivers/mtd/mtdconcat.c
··· 691 691 */ 692 692 struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to concatenate */ 693 693 int num_devs, /* number of subdevices */ 694 - char *name) 694 + const char *name) 695 695 { /* name for the new device */ 696 696 int i; 697 697 size_t size;
+1 -1
drivers/mtd/nand/fsl_upm.c
··· 222 222 223 223 fun->rnb_gpio = of_get_gpio(ofdev->node, 0); 224 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 226 if (ret) { 227 227 dev_err(&ofdev->dev, "can't request RNB gpio\n"); 228 228 goto err2;
+1 -1
drivers/mtd/nand/plat_nand.c
··· 54 54 data->chip.priv = &data; 55 55 data->mtd.priv = &data->chip; 56 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 59 data->chip.IO_ADDR_R = data->io_base; 60 60 data->chip.IO_ADDR_W = data->io_base;
+1 -1
drivers/mtd/nand/tmio_nand.c
··· 433 433 nand_chip->chip_delay = 15; 434 434 435 435 retval = request_irq(irq, &tmio_irq, 436 - IRQF_DISABLED, dev->dev.bus_id, tmio); 436 + IRQF_DISABLED, dev_name(&dev->dev), tmio); 437 437 if (retval) { 438 438 dev_err(&dev->dev, "request_irq error %d\n", retval); 439 439 goto err_irq;
+1 -1
drivers/mtd/onenand/generic.c
··· 63 63 info->onenand.mmcontrol = pdata->mmcontrol; 64 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 67 info->mtd.priv = &info->onenand; 68 68 info->mtd.owner = THIS_MODULE; 69 69
+1 -1
drivers/mtd/onenand/omap2.c
··· 668 668 c->onenand.base); 669 669 670 670 c->pdev = pdev; 671 - c->mtd.name = pdev->dev.bus_id; 671 + c->mtd.name = dev_name(&pdev->dev); 672 672 c->mtd.priv = &c->onenand; 673 673 c->mtd.owner = THIS_MODULE; 674 674
+1 -1
drivers/mtd/ubi/build.c
··· 280 280 ubi->dev.release = dev_release; 281 281 ubi->dev.devt = ubi->cdev.dev; 282 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 284 err = device_register(&ubi->dev); 285 285 if (err) 286 286 return err;
+2 -2
drivers/mtd/ubi/vmt.c
··· 329 329 vol->dev.devt = dev; 330 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 333 err = device_register(&vol->dev); 334 334 if (err) { 335 335 ubi_err("cannot register device"); ··· 678 678 vol->dev.parent = &ubi->dev; 679 679 vol->dev.devt = dev; 680 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 682 err = device_register(&vol->dev); 683 683 if (err) 684 684 goto out_gluebi;
+77 -55
drivers/pci/pci-driver.c
··· 300 300 301 301 #ifdef CONFIG_PM_SLEEP 302 302 303 + static 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 312 * Default "suspend" method for devices that have no driver provided suspend, 305 313 * or not even a driver at all. ··· 325 317 326 318 /* 327 319 * Default "resume" method for devices that have no driver provided resume, 328 - * or not even a driver at all. 320 + * or not even a driver at all (first part). 329 321 */ 330 - static int pci_default_pm_resume(struct pci_dev *pci_dev) 322 + static void pci_default_pm_resume_early(struct pci_dev *pci_dev) 331 323 { 332 - int retval = 0; 333 - 334 324 /* restore the PCI config space */ 335 325 pci_restore_state(pci_dev); 326 + } 327 + 328 + /* 329 + * Default "resume" method for devices that have no driver provided resume, 330 + * or not even a driver at all (second part). 331 + */ 332 + static int pci_default_pm_resume_late(struct pci_dev *pci_dev) 333 + { 334 + int retval; 335 + 336 336 /* if the device was enabled before suspend, reenable */ 337 337 retval = pci_reenable_device(pci_dev); 338 338 /* ··· 387 371 struct pci_dev * pci_dev = to_pci_dev(dev); 388 372 struct pci_driver * drv = pci_dev->driver; 389 373 390 - if (drv && drv->resume) 374 + if (drv && drv->resume) { 391 375 error = drv->resume(pci_dev); 392 - else 393 - error = pci_default_pm_resume(pci_dev); 376 + } else { 377 + pci_default_pm_resume_early(pci_dev); 378 + error = pci_default_pm_resume_late(pci_dev); 379 + } 394 380 return error; 395 381 } 396 382 ··· 438 420 if (drv->pm->suspend) { 439 421 error = drv->pm->suspend(dev); 440 422 suspend_report_result(drv->pm->suspend, error); 441 - } else { 442 - pci_default_pm_suspend(pci_dev); 443 423 } 444 - } else { 424 + } else if (pci_has_legacy_pm_support(pci_dev)) { 445 425 error = pci_legacy_suspend(dev, PMSG_SUSPEND); 446 426 } 447 427 pci_fixup_device(pci_fixup_suspend, pci_dev); ··· 450 434 static int pci_pm_suspend_noirq(struct device *dev) 451 435 { 452 436 struct pci_dev *pci_dev = to_pci_dev(dev); 453 - struct pci_driver *drv = pci_dev->driver; 437 + struct device_driver *drv = dev->driver; 454 438 int error = 0; 455 439 456 440 if (drv && drv->pm) { ··· 458 442 error = drv->pm->suspend_noirq(dev); 459 443 suspend_report_result(drv->pm->suspend_noirq, error); 460 444 } 461 - } else { 445 + } else if (pci_has_legacy_pm_support(pci_dev)) { 462 446 error = pci_legacy_suspend_late(dev, PMSG_SUSPEND); 447 + } else { 448 + pci_default_pm_suspend(pci_dev); 463 449 } 464 450 465 451 return error; ··· 471 453 { 472 454 struct pci_dev *pci_dev = to_pci_dev(dev); 473 455 struct device_driver *drv = dev->driver; 474 - int error; 456 + int error = 0; 475 457 476 458 pci_fixup_device(pci_fixup_resume, pci_dev); 477 459 478 460 if (drv && drv->pm) { 479 - error = drv->pm->resume ? drv->pm->resume(dev) : 480 - pci_default_pm_resume(pci_dev); 481 - } else { 461 + if (drv->pm->resume) 462 + error = drv->pm->resume(dev); 463 + } else if (pci_has_legacy_pm_support(pci_dev)) { 482 464 error = pci_legacy_resume(dev); 465 + } else { 466 + error = pci_default_pm_resume_late(pci_dev); 483 467 } 484 468 485 469 return error; ··· 490 470 static int pci_pm_resume_noirq(struct device *dev) 491 471 { 492 472 struct pci_dev *pci_dev = to_pci_dev(dev); 493 - struct pci_driver *drv = pci_dev->driver; 473 + struct device_driver *drv = dev->driver; 494 474 int error = 0; 495 475 496 - pci_fixup_device(pci_fixup_resume_early, pci_dev); 476 + pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev)); 497 477 498 478 if (drv && drv->pm) { 499 479 if (drv->pm->resume_noirq) 500 480 error = drv->pm->resume_noirq(dev); 501 - } else { 481 + } else if (pci_has_legacy_pm_support(pci_dev)) { 502 482 error = pci_legacy_resume_early(dev); 483 + } else { 484 + pci_default_pm_resume_early(pci_dev); 503 485 } 504 486 505 487 return error; ··· 528 506 if (drv->pm->freeze) { 529 507 error = drv->pm->freeze(dev); 530 508 suspend_report_result(drv->pm->freeze, error); 531 - } else { 532 - pci_default_pm_suspend(pci_dev); 533 509 } 534 - } else { 510 + } else if (pci_has_legacy_pm_support(pci_dev)) { 535 511 error = pci_legacy_suspend(dev, PMSG_FREEZE); 536 512 pci_fixup_device(pci_fixup_suspend, pci_dev); 537 513 } ··· 540 520 static int pci_pm_freeze_noirq(struct device *dev) 541 521 { 542 522 struct pci_dev *pci_dev = to_pci_dev(dev); 543 - struct pci_driver *drv = pci_dev->driver; 523 + struct device_driver *drv = dev->driver; 544 524 int error = 0; 545 525 546 526 if (drv && drv->pm) { ··· 548 528 error = drv->pm->freeze_noirq(dev); 549 529 suspend_report_result(drv->pm->freeze_noirq, error); 550 530 } 551 - } else { 531 + } else if (pci_has_legacy_pm_support(pci_dev)) { 552 532 error = pci_legacy_suspend_late(dev, PMSG_FREEZE); 533 + } else { 534 + pci_default_pm_suspend(pci_dev); 553 535 } 554 536 555 537 return error; ··· 559 537 560 538 static int pci_pm_thaw(struct device *dev) 561 539 { 540 + struct pci_dev *pci_dev = to_pci_dev(dev); 562 541 struct device_driver *drv = dev->driver; 563 542 int error = 0; 564 543 565 544 if (drv && drv->pm) { 566 545 if (drv->pm->thaw) 567 546 error = drv->pm->thaw(dev); 568 - } else { 569 - pci_fixup_device(pci_fixup_resume, to_pci_dev(dev)); 547 + } else if (pci_has_legacy_pm_support(pci_dev)) { 548 + pci_fixup_device(pci_fixup_resume, pci_dev); 570 549 error = pci_legacy_resume(dev); 571 550 } 572 551 ··· 577 554 static int pci_pm_thaw_noirq(struct device *dev) 578 555 { 579 556 struct pci_dev *pci_dev = to_pci_dev(dev); 580 - struct pci_driver *drv = pci_dev->driver; 557 + struct device_driver *drv = dev->driver; 581 558 int error = 0; 582 559 583 560 if (drv && drv->pm) { 584 561 if (drv->pm->thaw_noirq) 585 562 error = drv->pm->thaw_noirq(dev); 586 - } else { 587 - pci_fixup_device(pci_fixup_resume_early, pci_dev); 563 + } else if (pci_has_legacy_pm_support(pci_dev)) { 564 + pci_fixup_device(pci_fixup_resume_early, to_pci_dev(dev)); 588 565 error = pci_legacy_resume_early(dev); 589 566 } 590 567 ··· 593 570 594 571 static int pci_pm_poweroff(struct device *dev) 595 572 { 573 + struct pci_dev *pci_dev = to_pci_dev(dev); 596 574 struct device_driver *drv = dev->driver; 597 575 int error = 0; 598 576 599 - pci_fixup_device(pci_fixup_suspend, to_pci_dev(dev)); 577 + pci_fixup_device(pci_fixup_suspend, pci_dev); 600 578 601 579 if (drv && drv->pm) { 602 580 if (drv->pm->poweroff) { 603 581 error = drv->pm->poweroff(dev); 604 582 suspend_report_result(drv->pm->poweroff, error); 605 583 } 606 - } else { 584 + } else if (pci_has_legacy_pm_support(pci_dev)) { 607 585 error = pci_legacy_suspend(dev, PMSG_HIBERNATE); 608 586 } 609 587 ··· 613 589 614 590 static int pci_pm_poweroff_noirq(struct device *dev) 615 591 { 616 - struct pci_dev *pci_dev = to_pci_dev(dev); 617 - struct pci_driver *drv = pci_dev->driver; 592 + struct device_driver *drv = dev->driver; 618 593 int error = 0; 619 594 620 595 if (drv && drv->pm) { ··· 621 598 error = drv->pm->poweroff_noirq(dev); 622 599 suspend_report_result(drv->pm->poweroff_noirq, error); 623 600 } 624 - } else { 601 + } else if (pci_has_legacy_pm_support(to_pci_dev(dev))) { 625 602 error = pci_legacy_suspend_late(dev, PMSG_HIBERNATE); 626 603 } 627 604 ··· 632 609 { 633 610 struct pci_dev *pci_dev = to_pci_dev(dev); 634 611 struct device_driver *drv = dev->driver; 635 - int error; 612 + int error = 0; 636 613 637 614 if (drv && drv->pm) { 638 - error = drv->pm->restore ? drv->pm->restore(dev) : 639 - pci_default_pm_resume(pci_dev); 640 - } else { 615 + if (drv->pm->restore) 616 + error = drv->pm->restore(dev); 617 + } else if (pci_has_legacy_pm_support(pci_dev)) { 641 618 error = pci_legacy_resume(dev); 619 + } else { 620 + error = pci_default_pm_resume_late(pci_dev); 642 621 } 643 622 pci_fixup_device(pci_fixup_resume, pci_dev); 644 623 ··· 650 625 static int pci_pm_restore_noirq(struct device *dev) 651 626 { 652 627 struct pci_dev *pci_dev = to_pci_dev(dev); 653 - struct pci_driver *drv = pci_dev->driver; 628 + struct device_driver *drv = dev->driver; 654 629 int error = 0; 655 630 656 631 pci_fixup_device(pci_fixup_resume, pci_dev); ··· 658 633 if (drv && drv->pm) { 659 634 if (drv->pm->restore_noirq) 660 635 error = drv->pm->restore_noirq(dev); 661 - } else { 636 + } else if (pci_has_legacy_pm_support(pci_dev)) { 662 637 error = pci_legacy_resume_early(dev); 638 + } else { 639 + pci_default_pm_resume_early(pci_dev); 663 640 } 664 641 pci_fixup_device(pci_fixup_resume_early, pci_dev); 665 642 ··· 681 654 682 655 #endif /* !CONFIG_HIBERNATION */ 683 656 684 - struct pm_ext_ops pci_pm_ops = { 685 - .base = { 686 - .prepare = pci_pm_prepare, 687 - .complete = pci_pm_complete, 688 - .suspend = pci_pm_suspend, 689 - .resume = pci_pm_resume, 690 - .freeze = pci_pm_freeze, 691 - .thaw = pci_pm_thaw, 692 - .poweroff = pci_pm_poweroff, 693 - .restore = pci_pm_restore, 694 - }, 657 + struct dev_pm_ops pci_dev_pm_ops = { 658 + .prepare = pci_pm_prepare, 659 + .complete = pci_pm_complete, 660 + .suspend = pci_pm_suspend, 661 + .resume = pci_pm_resume, 662 + .freeze = pci_pm_freeze, 663 + .thaw = pci_pm_thaw, 664 + .poweroff = pci_pm_poweroff, 665 + .restore = pci_pm_restore, 695 666 .suspend_noirq = pci_pm_suspend_noirq, 696 667 .resume_noirq = pci_pm_resume_noirq, 697 668 .freeze_noirq = pci_pm_freeze_noirq, ··· 698 673 .restore_noirq = pci_pm_restore_noirq, 699 674 }; 700 675 701 - #define PCI_PM_OPS_PTR &pci_pm_ops 676 + #define PCI_PM_OPS_PTR (&pci_dev_pm_ops) 702 677 703 678 #else /* !CONFIG_PM_SLEEP */ 704 679 ··· 727 702 drv->driver.bus = &pci_bus_type; 728 703 drv->driver.owner = owner; 729 704 drv->driver.mod_name = mod_name; 730 - 731 - if (drv->pm) 732 - drv->driver.pm = &drv->pm->base; 733 705 734 706 spin_lock_init(&drv->dynids.lock); 735 707 INIT_LIST_HEAD(&drv->dynids.list);
+3 -4
drivers/pnp/card.c
··· 165 165 card->number = id; 166 166 167 167 card->dev.parent = &card->protocol->dev; 168 - sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, 169 - card->number); 168 + dev_set_name(&card->dev, "%02x:%02x", card->protocol->number, card->number); 170 169 171 170 card->dev.coherent_dma_mask = DMA_24BIT_MASK; 172 171 card->dev.dma_mask = &card->dev.coherent_dma_mask; ··· 294 295 { 295 296 dev->dev.parent = &card->dev; 296 297 dev->card_link = NULL; 297 - snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", 298 - dev->protocol->number, card->number, dev->number); 298 + dev_set_name(&dev->dev, "%02x:%02x.%02x", 299 + dev->protocol->number, card->number, dev->number); 299 300 spin_lock(&pnp_lock); 300 301 dev->card = card; 301 302 list_add_tail(&dev->card_list, &card->devices);
+2 -3
drivers/pnp/core.c
··· 70 70 spin_unlock(&pnp_lock); 71 71 72 72 protocol->number = nodenum; 73 - sprintf(protocol->dev.bus_id, "pnp%d", nodenum); 73 + dev_set_name(&protocol->dev, "pnp%d", nodenum); 74 74 return device_register(&protocol->dev); 75 75 } 76 76 ··· 145 145 dev->dev.coherent_dma_mask = dev->dma_mask; 146 146 dev->dev.release = &pnp_release_device; 147 147 148 - sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 149 - dev->number); 148 + dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number); 150 149 151 150 dev_id = pnp_add_id(dev, pnpid); 152 151 if (!dev_id) {
+1 -1
drivers/pnp/system.c
··· 26 26 resource_size_t end, int port) 27 27 { 28 28 char *regionid; 29 - const char *pnpid = dev->dev.bus_id; 29 + const char *pnpid = dev_name(&dev->dev); 30 30 struct resource *res; 31 31 32 32 regionid = kmalloc(16, GFP_KERNEL);
+2 -2
drivers/power/ds2760_battery.c
··· 354 354 pdata = pdev->dev.platform_data; 355 355 di->dev = &pdev->dev; 356 356 di->w1_dev = pdev->dev.parent; 357 - di->bat.name = pdev->dev.bus_id; 357 + di->bat.name = dev_name(&pdev->dev); 358 358 di->bat.type = POWER_SUPPLY_TYPE_BATTERY; 359 359 di->bat.properties = ds2760_battery_props; 360 360 di->bat.num_properties = ARRAY_SIZE(ds2760_battery_props); ··· 371 371 } 372 372 373 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 375 if (!di->monitor_wqueue) { 376 376 retval = -ESRCH; 377 377 goto workqueue_failed;
+1 -1
drivers/s390/Makefile
··· 4 4 5 5 CFLAGS_sysinfo.o += -Iinclude/math-emu -Iarch/s390/math-emu -w 6 6 7 - obj-y += s390mach.o sysinfo.o s390_rdev.o 7 + obj-y += s390mach.o sysinfo.o 8 8 obj-y += cio/ block/ char/ crypto/ net/ scsi/ kvm/ 9 9 10 10 drivers-y += drivers/s390/built-in.o
+5 -6
drivers/s390/block/dcssblk.c
··· 18 18 #include <asm/io.h> 19 19 #include <linux/completion.h> 20 20 #include <linux/interrupt.h> 21 - #include <asm/s390_rdev.h> 22 21 23 22 #define DCSSBLK_NAME "dcssblk" 24 23 #define DCSSBLK_MINORS_PER_DISK 1 ··· 945 946 static void __exit 946 947 dcssblk_exit(void) 947 948 { 948 - s390_root_dev_unregister(dcssblk_root_dev); 949 + root_device_unregister(dcssblk_root_dev); 949 950 unregister_blkdev(dcssblk_major, DCSSBLK_NAME); 950 951 } 951 952 ··· 954 955 { 955 956 int rc; 956 957 957 - dcssblk_root_dev = s390_root_dev_register("dcssblk"); 958 + dcssblk_root_dev = root_device_register("dcssblk"); 958 959 if (IS_ERR(dcssblk_root_dev)) 959 960 return PTR_ERR(dcssblk_root_dev); 960 961 rc = device_create_file(dcssblk_root_dev, &dev_attr_add); 961 962 if (rc) { 962 - s390_root_dev_unregister(dcssblk_root_dev); 963 + root_device_unregister(dcssblk_root_dev); 963 964 return rc; 964 965 } 965 966 rc = device_create_file(dcssblk_root_dev, &dev_attr_remove); 966 967 if (rc) { 967 - s390_root_dev_unregister(dcssblk_root_dev); 968 + root_device_unregister(dcssblk_root_dev); 968 969 return rc; 969 970 } 970 971 rc = register_blkdev(0, DCSSBLK_NAME); 971 972 if (rc < 0) { 972 - s390_root_dev_unregister(dcssblk_root_dev); 973 + root_device_unregister(dcssblk_root_dev); 973 974 return rc; 974 975 } 975 976 dcssblk_major = rc;
+3 -4
drivers/s390/crypto/ap_bus.c
··· 36 36 #include <linux/notifier.h> 37 37 #include <linux/kthread.h> 38 38 #include <linux/mutex.h> 39 - #include <asm/s390_rdev.h> 40 39 #include <asm/reset.h> 41 40 #include <asm/airq.h> 42 41 #include <asm/atomic.h> ··· 1521 1522 } 1522 1523 1523 1524 /* Create /sys/devices/ap. */ 1524 - ap_root_device = s390_root_dev_register("ap"); 1525 + ap_root_device = root_device_register("ap"); 1525 1526 rc = IS_ERR(ap_root_device) ? PTR_ERR(ap_root_device) : 0; 1526 1527 if (rc) 1527 1528 goto out_bus; ··· 1564 1565 hrtimer_cancel(&ap_poll_timer); 1565 1566 destroy_workqueue(ap_work_queue); 1566 1567 out_root: 1567 - s390_root_dev_unregister(ap_root_device); 1568 + root_device_unregister(ap_root_device); 1568 1569 out_bus: 1569 1570 while (i--) 1570 1571 bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); ··· 1599 1600 hrtimer_cancel(&ap_poll_timer); 1600 1601 destroy_workqueue(ap_work_queue); 1601 1602 tasklet_kill(&ap_tasklet); 1602 - s390_root_dev_unregister(ap_root_device); 1603 + root_device_unregister(ap_root_device); 1603 1604 while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, 1604 1605 __ap_match_all))) 1605 1606 {
+2 -3
drivers/s390/kvm/kvm_virtio.c
··· 24 24 #include <asm/kvm_virtio.h> 25 25 #include <asm/setup.h> 26 26 #include <asm/s390_ext.h> 27 - #include <asm/s390_rdev.h> 28 27 29 28 #define VIRTIO_SUBCODE_64 0x0D00 30 29 ··· 334 335 if (!MACHINE_IS_KVM) 335 336 return -ENODEV; 336 337 337 - kvm_root = s390_root_dev_register("kvm_s390"); 338 + kvm_root = root_device_register("kvm_s390"); 338 339 if (IS_ERR(kvm_root)) { 339 340 rc = PTR_ERR(kvm_root); 340 341 printk(KERN_ERR "Could not register kvm_s390 root device"); ··· 343 344 344 345 rc = vmem_add_mapping(real_memory_size, PAGE_SIZE); 345 346 if (rc) { 346 - s390_root_dev_unregister(kvm_root); 347 + root_device_unregister(kvm_root); 347 348 return rc; 348 349 } 349 350
+3 -4
drivers/s390/net/cu3088.c
··· 25 25 #include <linux/module.h> 26 26 #include <linux/err.h> 27 27 28 - #include <asm/s390_rdev.h> 29 28 #include <asm/ccwdev.h> 30 29 #include <asm/ccwgroup.h> 31 30 ··· 119 120 { 120 121 int rc; 121 122 122 - cu3088_root_dev = s390_root_dev_register("cu3088"); 123 + cu3088_root_dev = root_device_register("cu3088"); 123 124 if (IS_ERR(cu3088_root_dev)) 124 125 return PTR_ERR(cu3088_root_dev); 125 126 rc = ccw_driver_register(&cu3088_driver); 126 127 if (rc) 127 - s390_root_dev_unregister(cu3088_root_dev); 128 + root_device_unregister(cu3088_root_dev); 128 129 129 130 return rc; 130 131 } ··· 133 134 cu3088_exit (void) 134 135 { 135 136 ccw_driver_unregister(&cu3088_driver); 136 - s390_root_dev_unregister(cu3088_root_dev); 137 + root_device_unregister(cu3088_root_dev); 137 138 } 138 139 139 140 MODULE_DEVICE_TABLE(ccw,cu3088_ids);
+3 -4
drivers/s390/net/qeth_core_main.c
··· 24 24 25 25 #include <asm/ebcdic.h> 26 26 #include <asm/io.h> 27 - #include <asm/s390_rdev.h> 28 27 29 28 #include "qeth_core.h" 30 29 #include "qeth_core_offl.h" ··· 4524 4525 &driver_attr_group); 4525 4526 if (rc) 4526 4527 goto driver_err; 4527 - qeth_core_root_dev = s390_root_dev_register("qeth"); 4528 + qeth_core_root_dev = root_device_register("qeth"); 4528 4529 rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; 4529 4530 if (rc) 4530 4531 goto register_err; ··· 4538 4539 4539 4540 return 0; 4540 4541 slab_err: 4541 - s390_root_dev_unregister(qeth_core_root_dev); 4542 + root_device_unregister(qeth_core_root_dev); 4542 4543 register_err: 4543 4544 driver_remove_file(&qeth_core_ccwgroup_driver.driver, 4544 4545 &driver_attr_group); ··· 4556 4557 4557 4558 static void __exit qeth_core_exit(void) 4558 4559 { 4559 - s390_root_dev_unregister(qeth_core_root_dev); 4560 + root_device_unregister(qeth_core_root_dev); 4560 4561 driver_remove_file(&qeth_core_ccwgroup_driver.driver, 4561 4562 &driver_attr_group); 4562 4563 ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver);
-2
drivers/s390/net/qeth_l2_main.c
··· 20 20 #include <linux/mii.h> 21 21 #include <linux/ip.h> 22 22 23 - #include <asm/s390_rdev.h> 24 - 25 23 #include "qeth_core.h" 26 24 #include "qeth_core_offl.h" 27 25
-2
drivers/s390/net/qeth_l3_main.c
··· 26 26 #include <net/ip.h> 27 27 #include <net/arp.h> 28 28 29 - #include <asm/s390_rdev.h> 30 - 31 29 #include "qeth_l3.h" 32 30 #include "qeth_core_offl.h" 33 31
-51
drivers/s390/s390_rdev.c
··· 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 - 16 - static void 17 - s390_root_dev_release(struct device *dev) 18 - { 19 - kfree(dev); 20 - } 21 - 22 - struct device * 23 - s390_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 - 43 - void 44 - s390_root_dev_unregister(struct device *dev) 45 - { 46 - if (dev) 47 - device_unregister(dev); 48 - } 49 - 50 - EXPORT_SYMBOL(s390_root_dev_register); 51 - EXPORT_SYMBOL(s390_root_dev_unregister);
+2 -2
drivers/serial/serial_core.c
··· 2030 2030 if (!tries) 2031 2031 printk(KERN_ERR "%s%s%s%d: Unable to drain " 2032 2032 "transmitter\n", 2033 - port->dev ? port->dev->bus_id : "", 2033 + port->dev ? dev_name(port->dev) : "", 2034 2034 port->dev ? ": " : "", 2035 2035 drv->dev_name, 2036 2036 drv->tty_driver->name_base + port->line); ··· 2156 2156 } 2157 2157 2158 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 2160 port->dev ? ": " : "", 2161 2161 drv->dev_name, 2162 2162 drv->tty_driver->name_base + port->line,
+9 -11
drivers/spi/spi.c
··· 47 47 { 48 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 53 53 static struct device_attribute spi_dev_attrs[] = { ··· 63 63 { 64 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 69 69 static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) ··· 243 243 } 244 244 245 245 /* Set the bus ID string */ 246 - snprintf(spi->dev.bus_id, sizeof spi->dev.bus_id, 247 - "%s.%u", spi->master->dev.bus_id, 246 + dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), 248 247 spi->chip_select); 249 248 250 249 ··· 253 254 */ 254 255 mutex_lock(&spi_add_lock); 255 256 256 - if (bus_find_device_by_name(&spi_bus_type, NULL, spi->dev.bus_id) 257 + if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) 257 258 != NULL) { 258 259 dev_err(dev, "chipselect %d already in use\n", 259 260 spi->chip_select); ··· 268 269 status = spi->master->setup(spi); 269 270 if (status < 0) { 270 271 dev_err(dev, "can't %s %s, status %d\n", 271 - "setup", spi->dev.bus_id, status); 272 + "setup", dev_name(&spi->dev), status); 272 273 goto done; 273 274 } 274 275 ··· 276 277 status = device_add(&spi->dev); 277 278 if (status < 0) 278 279 dev_err(dev, "can't %s %s, status %d\n", 279 - "add", spi->dev.bus_id, status); 280 + "add", dev_name(&spi->dev), status); 280 281 else 281 - dev_dbg(dev, "registered child %s\n", spi->dev.bus_id); 282 + dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); 282 283 283 284 done: 284 285 mutex_unlock(&spi_add_lock); ··· 503 504 /* register the device, then userspace will see it. 504 505 * registration fails if the bus ID is in use. 505 506 */ 506 - snprintf(master->dev.bus_id, sizeof master->dev.bus_id, 507 - "spi%u", master->bus_num); 507 + dev_set_name(&master->dev, "spi%u", master->bus_num); 508 508 status = device_add(&master->dev); 509 509 if (status < 0) 510 510 goto done; 511 - dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, 511 + dev_dbg(dev, "registered master %s%s\n", dev_name(&master->dev), 512 512 dynamic ? " (dynamic)" : ""); 513 513 514 514 /* populate children from any spi device tables */
+1 -1
drivers/spi/spi_bitbang.c
··· 475 475 /* this task is the only thing to touch the SPI bits */ 476 476 bitbang->busy = 0; 477 477 bitbang->workqueue = create_singlethread_workqueue( 478 - bitbang->master->dev.parent->bus_id); 478 + dev_name(bitbang->master->dev.parent)); 479 479 if (bitbang->workqueue == NULL) { 480 480 status = -EBUSY; 481 481 goto err1;
+1 -1
drivers/spi/spi_butterfly.c
··· 287 287 pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]); 288 288 if (pp->dataflash) 289 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 292 // dev_info(_what?_, ...) 293 293 pr_info("%s: AVR Butterfly\n", p->name);
+1 -1
drivers/spi/spi_lm70llp.c
··· 287 287 pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info); 288 288 if (pp->spidev_lm70) 289 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 291 else { 292 292 printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME); 293 293 status = -ENODEV;
+3 -3
drivers/thermal/thermal_sys.c
··· 579 579 struct thermal_zone_device *tz; 580 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 583 tz = to_thermal_zone(dev); 584 584 kfree(tz); 585 585 } else { ··· 630 630 cdev->ops = ops; 631 631 cdev->device.class = &thermal_class; 632 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 634 result = device_register(&cdev->device); 635 635 if (result) { 636 636 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); ··· 769 769 tz->device.class = &thermal_class; 770 770 tz->devdata = devdata; 771 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 773 result = device_register(&tz->device); 774 774 if (result) { 775 775 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
+142 -17
drivers/uio/uio.c
··· 35 35 int vma_count; 36 36 struct uio_info *info; 37 37 struct kobject *map_dir; 38 + struct kobject *portio_dir; 38 39 }; 39 40 40 41 static int uio_major; ··· 76 75 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK); 77 76 } 78 77 79 - struct uio_sysfs_entry { 78 + struct map_sysfs_entry { 80 79 struct attribute attr; 81 80 ssize_t (*show)(struct uio_mem *, char *); 82 81 ssize_t (*store)(struct uio_mem *, const char *, size_t); 83 82 }; 84 83 85 - static struct uio_sysfs_entry addr_attribute = 84 + static struct map_sysfs_entry addr_attribute = 86 85 __ATTR(addr, S_IRUGO, map_addr_show, NULL); 87 - static struct uio_sysfs_entry size_attribute = 86 + static struct map_sysfs_entry size_attribute = 88 87 __ATTR(size, S_IRUGO, map_size_show, NULL); 89 - static struct uio_sysfs_entry offset_attribute = 88 + static struct map_sysfs_entry offset_attribute = 90 89 __ATTR(offset, S_IRUGO, map_offset_show, NULL); 91 90 92 91 static struct attribute *attrs[] = { ··· 107 106 { 108 107 struct uio_map *map = to_map(kobj); 109 108 struct uio_mem *mem = map->mem; 110 - struct uio_sysfs_entry *entry; 109 + struct map_sysfs_entry *entry; 111 110 112 - entry = container_of(attr, struct uio_sysfs_entry, attr); 111 + entry = container_of(attr, struct map_sysfs_entry, attr); 113 112 114 113 if (!entry->show) 115 114 return -EIO; ··· 117 116 return entry->show(mem, buf); 118 117 } 119 118 120 - static struct sysfs_ops uio_sysfs_ops = { 119 + static struct sysfs_ops map_sysfs_ops = { 121 120 .show = map_type_show, 122 121 }; 123 122 124 123 static struct kobj_type map_attr_type = { 125 124 .release = map_release, 126 - .sysfs_ops = &uio_sysfs_ops, 125 + .sysfs_ops = &map_sysfs_ops, 127 126 .default_attrs = attrs, 127 + }; 128 + 129 + struct uio_portio { 130 + struct kobject kobj; 131 + struct uio_port *port; 132 + }; 133 + #define to_portio(portio) container_of(portio, struct uio_portio, kobj) 134 + 135 + static ssize_t portio_start_show(struct uio_port *port, char *buf) 136 + { 137 + return sprintf(buf, "0x%lx\n", port->start); 138 + } 139 + 140 + static ssize_t portio_size_show(struct uio_port *port, char *buf) 141 + { 142 + return sprintf(buf, "0x%lx\n", port->size); 143 + } 144 + 145 + static ssize_t portio_porttype_show(struct uio_port *port, char *buf) 146 + { 147 + const char *porttypes[] = {"none", "x86", "gpio", "other"}; 148 + 149 + if ((port->porttype < 0) || (port->porttype > UIO_PORT_OTHER)) 150 + return -EINVAL; 151 + 152 + return sprintf(buf, "port_%s\n", porttypes[port->porttype]); 153 + } 154 + 155 + struct portio_sysfs_entry { 156 + struct attribute attr; 157 + ssize_t (*show)(struct uio_port *, char *); 158 + ssize_t (*store)(struct uio_port *, const char *, size_t); 159 + }; 160 + 161 + static struct portio_sysfs_entry portio_start_attribute = 162 + __ATTR(start, S_IRUGO, portio_start_show, NULL); 163 + static struct portio_sysfs_entry portio_size_attribute = 164 + __ATTR(size, S_IRUGO, portio_size_show, NULL); 165 + static struct portio_sysfs_entry portio_porttype_attribute = 166 + __ATTR(porttype, S_IRUGO, portio_porttype_show, NULL); 167 + 168 + static struct attribute *portio_attrs[] = { 169 + &portio_start_attribute.attr, 170 + &portio_size_attribute.attr, 171 + &portio_porttype_attribute.attr, 172 + NULL, 173 + }; 174 + 175 + static void portio_release(struct kobject *kobj) 176 + { 177 + struct uio_portio *portio = to_portio(kobj); 178 + kfree(portio); 179 + } 180 + 181 + static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr, 182 + char *buf) 183 + { 184 + struct uio_portio *portio = to_portio(kobj); 185 + struct uio_port *port = portio->port; 186 + struct portio_sysfs_entry *entry; 187 + 188 + entry = container_of(attr, struct portio_sysfs_entry, attr); 189 + 190 + if (!entry->show) 191 + return -EIO; 192 + 193 + return entry->show(port, buf); 194 + } 195 + 196 + static struct sysfs_ops portio_sysfs_ops = { 197 + .show = portio_type_show, 198 + }; 199 + 200 + static struct kobj_type portio_attr_type = { 201 + .release = portio_release, 202 + .sysfs_ops = &portio_sysfs_ops, 203 + .default_attrs = portio_attrs, 128 204 }; 129 205 130 206 static ssize_t show_name(struct device *dev, ··· 255 177 static int uio_dev_add_attributes(struct uio_device *idev) 256 178 { 257 179 int ret; 258 - int mi; 180 + int mi, pi; 259 181 int map_found = 0; 182 + int portio_found = 0; 260 183 struct uio_mem *mem; 261 184 struct uio_map *map; 185 + struct uio_port *port; 186 + struct uio_portio *portio; 262 187 263 188 ret = sysfs_create_group(&idev->dev->kobj, &uio_attr_grp); 264 189 if (ret) ··· 276 195 idev->map_dir = kobject_create_and_add("maps", 277 196 &idev->dev->kobj); 278 197 if (!idev->map_dir) 279 - goto err; 198 + goto err_map; 280 199 } 281 200 map = kzalloc(sizeof(*map), GFP_KERNEL); 282 201 if (!map) 283 - goto err; 202 + goto err_map; 284 203 kobject_init(&map->kobj, &map_attr_type); 285 204 map->mem = mem; 286 205 mem->map = map; 287 206 ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); 288 207 if (ret) 289 - goto err; 208 + goto err_map; 290 209 ret = kobject_uevent(&map->kobj, KOBJ_ADD); 291 210 if (ret) 292 - goto err; 211 + goto err_map; 212 + } 213 + 214 + for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) { 215 + port = &idev->info->port[pi]; 216 + if (port->size == 0) 217 + break; 218 + if (!portio_found) { 219 + portio_found = 1; 220 + idev->portio_dir = kobject_create_and_add("portio", 221 + &idev->dev->kobj); 222 + if (!idev->portio_dir) 223 + goto err_portio; 224 + } 225 + portio = kzalloc(sizeof(*portio), GFP_KERNEL); 226 + if (!portio) 227 + goto err_portio; 228 + kobject_init(&portio->kobj, &portio_attr_type); 229 + portio->port = port; 230 + port->portio = portio; 231 + ret = kobject_add(&portio->kobj, idev->portio_dir, 232 + "port%d", pi); 233 + if (ret) 234 + goto err_portio; 235 + ret = kobject_uevent(&portio->kobj, KOBJ_ADD); 236 + if (ret) 237 + goto err_portio; 293 238 } 294 239 295 240 return 0; 296 241 297 - err: 242 + err_portio: 243 + for (pi--; pi >= 0; pi--) { 244 + port = &idev->info->port[pi]; 245 + portio = port->portio; 246 + kobject_put(&portio->kobj); 247 + } 248 + kobject_put(idev->portio_dir); 249 + err_map: 298 250 for (mi--; mi>=0; mi--) { 299 251 mem = &idev->info->mem[mi]; 300 252 map = mem->map; ··· 342 228 343 229 static void uio_dev_del_attributes(struct uio_device *idev) 344 230 { 345 - int mi; 231 + int i; 346 232 struct uio_mem *mem; 347 - for (mi = 0; mi < MAX_UIO_MAPS; mi++) { 348 - mem = &idev->info->mem[mi]; 233 + struct uio_port *port; 234 + 235 + for (i = 0; i < MAX_UIO_MAPS; i++) { 236 + mem = &idev->info->mem[i]; 349 237 if (mem->size == 0) 350 238 break; 351 239 kobject_put(&mem->map->kobj); 352 240 } 353 241 kobject_put(idev->map_dir); 242 + 243 + for (i = 0; i < MAX_UIO_PORT_REGIONS; i++) { 244 + port = &idev->info->port[i]; 245 + if (port->size == 0) 246 + break; 247 + kobject_put(&port->portio->kobj); 248 + } 249 + kobject_put(idev->portio_dir); 250 + 354 251 sysfs_remove_group(&idev->dev->kobj, &uio_attr_grp); 355 252 } 356 253
+1 -2
drivers/uio/uio_cif.c
··· 57 57 info->mem[0].addr = pci_resource_start(dev, 0); 58 58 if (!info->mem[0].addr) 59 59 goto out_release; 60 - info->mem[0].internal_addr = ioremap(pci_resource_start(dev, 0), 61 - pci_resource_len(dev, 0)); 60 + info->mem[0].internal_addr = pci_ioremap_bar(dev, 0); 62 61 if (!info->mem[0].internal_addr) 63 62 goto out_release; 64 63
+3 -2
drivers/uio/uio_pdrv_genirq.c
··· 81 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 86 dev_err(&pdev->dev, "interrupt configuration error\n"); 86 87 goto bad0; 87 88 } ··· 133 132 * Interrupt sharing is not supported. 134 133 */ 135 134 136 - uioinfo->irq_flags = IRQF_DISABLED; 135 + uioinfo->irq_flags |= IRQF_DISABLED; 137 136 uioinfo->handler = uio_pdrv_genirq_handler; 138 137 uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol; 139 138 uioinfo->priv = priv;
+2 -2
drivers/usb/core/usb.c
··· 286 286 return usb_resume(dev); 287 287 } 288 288 289 - static struct pm_ops usb_device_pm_ops = { 289 + static struct dev_pm_ops usb_device_pm_ops = { 290 290 .prepare = usb_dev_prepare, 291 291 .complete = usb_dev_complete, 292 292 .suspend = usb_dev_suspend, ··· 301 301 302 302 #define ksuspend_usb_init() 0 303 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 306 #endif /* CONFIG_PM */ 307 307
+1 -1
drivers/usb/gadget/at91_udc.c
··· 1474 1474 .ep0 = &controller.ep[0].ep, 1475 1475 .name = driver_name, 1476 1476 .dev = { 1477 - .bus_id = "gadget", 1477 + .init_name = "gadget", 1478 1478 .release = nop_release, 1479 1479 } 1480 1480 },
+1 -1
drivers/usb/gadget/atmel_usba_udc.c
··· 1034 1034 .is_dualspeed = 1, 1035 1035 .name = "atmel_usba_udc", 1036 1036 .dev = { 1037 - .bus_id = "gadget", 1037 + .init_name = "gadget", 1038 1038 .release = nop_release, 1039 1039 }, 1040 1040 },
+1 -1
drivers/usb/gadget/fsl_qe_udc.c
··· 2545 2545 2546 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 2550 udc_controller->gadget.dev.release = qe_udc_release; 2551 2551 udc_controller->gadget.dev.parent = &ofdev->dev;
+1 -1
drivers/usb/gadget/lh7a40x_udc.c
··· 1981 1981 .ep0 = &memory.ep[0].ep, 1982 1982 .name = driver_name, 1983 1983 .dev = { 1984 - .bus_id = "gadget", 1984 + .init_name = "gadget", 1985 1985 .release = nop_release, 1986 1986 }, 1987 1987 },
+1 -1
drivers/usb/gadget/pxa25x_udc.c
··· 1833 1833 .ep0 = &memory.ep[0].ep, 1834 1834 .name = driver_name, 1835 1835 .dev = { 1836 - .bus_id = "gadget", 1836 + .init_name = "gadget", 1837 1837 .release = nop_release, 1838 1838 }, 1839 1839 },
+1 -1
drivers/usb/gadget/pxa27x_udc.c
··· 2162 2162 .ep0 = &memory.udc_usb_ep[0].usb_ep, 2163 2163 .name = driver_name, 2164 2164 .dev = { 2165 - .bus_id = "gadget", 2165 + .init_name = "gadget", 2166 2166 }, 2167 2167 }, 2168 2168
+1 -1
drivers/usb/gadget/s3c2410_udc.c
··· 1727 1727 .ep0 = &memory.ep[0].ep, 1728 1728 .name = gadget_name, 1729 1729 .dev = { 1730 - .bus_id = "gadget", 1730 + .init_name = "gadget", 1731 1731 }, 1732 1732 }, 1733 1733
+1 -1
drivers/video/backlight/backlight.c
··· 217 217 new_bd->dev.class = backlight_class; 218 218 new_bd->dev.parent = parent; 219 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 221 dev_set_drvdata(&new_bd->dev, devdata); 222 222 223 223 rc = device_register(&new_bd->dev);
+1 -1
drivers/video/backlight/lcd.c
··· 208 208 new_ld->dev.class = lcd_class; 209 209 new_ld->dev.parent = parent; 210 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 212 dev_set_drvdata(&new_ld->dev, devdata); 213 213 214 214 rc = device_register(&new_ld->dev);
+1 -1
drivers/video/output.c
··· 96 96 new_dev->props = op; 97 97 new_dev->dev.class = &video_output_class; 98 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 100 dev_set_drvdata(&new_dev->dev, devdata); 101 101 ret_code = device_register(&new_dev->dev); 102 102 if (ret_code) {
+7 -10
drivers/virtio/virtio_pci.c
··· 73 73 /* A PCI device has it's own struct device and so does a virtio device so 74 74 * we create a place for the virtio devices to show up in sysfs. I think it 75 75 * would make more sense for virtio to not insist on having it's own device. */ 76 - static struct device virtio_pci_root = { 77 - .parent = NULL, 78 - .init_name = "virtio-pci", 79 - }; 76 + static struct device *virtio_pci_root; 80 77 81 78 /* Convert a generic virtio device to our structure */ 82 79 static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) ··· 340 343 if (vp_dev == NULL) 341 344 return -ENOMEM; 342 345 343 - vp_dev->vdev.dev.parent = &virtio_pci_root; 346 + vp_dev->vdev.dev.parent = virtio_pci_root; 344 347 vp_dev->vdev.dev.release = virtio_pci_release_dev; 345 348 vp_dev->vdev.config = &virtio_pci_config_ops; 346 349 vp_dev->pci_dev = pci_dev; ··· 434 437 { 435 438 int err; 436 439 437 - err = device_register(&virtio_pci_root); 438 - if (err) 439 - return err; 440 + virtio_pci_root = root_device_register("virtio-pci"); 441 + if (IS_ERR(virtio_pci_root)) 442 + return PTR_ERR(virtio_pci_root); 440 443 441 444 err = pci_register_driver(&virtio_pci_driver); 442 445 if (err) 443 - device_unregister(&virtio_pci_root); 446 + device_unregister(virtio_pci_root); 444 447 445 448 return err; 446 449 } ··· 449 452 450 453 static void __exit virtio_pci_exit(void) 451 454 { 452 - device_unregister(&virtio_pci_root); 453 455 pci_unregister_driver(&virtio_pci_driver); 456 + root_device_unregister(virtio_pci_root); 454 457 } 455 458 456 459 module_exit(virtio_pci_exit);
+9 -10
drivers/w1/w1.c
··· 197 197 struct device w1_master_device = { 198 198 .parent = NULL, 199 199 .bus = &w1_bus_type, 200 - .bus_id = "w1 bus master", 200 + .init_name = "w1 bus master", 201 201 .driver = &w1_master_driver, 202 202 .release = &w1_master_release 203 203 }; ··· 211 211 struct device w1_slave_device = { 212 212 .parent = NULL, 213 213 .bus = &w1_bus_type, 214 - .bus_id = "w1 bus slave", 214 + .init_name = "w1 bus slave", 215 215 .driver = &w1_slave_driver, 216 216 .release = &w1_slave_release 217 217 }; ··· 573 573 } 574 574 575 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 578 if (dev->driver != &w1_slave_driver || !sl) 579 579 return 0; ··· 605 605 sl->dev.bus = &w1_bus_type; 606 606 sl->dev.release = &w1_slave_release; 607 607 608 - snprintf(&sl->dev.bus_id[0], sizeof(sl->dev.bus_id), 609 - "%02x-%012llx", 608 + dev_set_name(&sl->dev, "%02x-%012llx", 610 609 (unsigned int) sl->reg_num.family, 611 610 (unsigned long long) sl->reg_num.id); 612 611 snprintf(&sl->name[0], sizeof(sl->name), ··· 614 615 (unsigned long long) sl->reg_num.id); 615 616 616 617 dev_dbg(&sl->dev, "%s: registering %s as %p.\n", __func__, 617 - &sl->dev.bus_id[0], sl); 618 + dev_name(&sl->dev), sl); 618 619 619 620 err = device_register(&sl->dev); 620 621 if (err < 0) { 621 622 dev_err(&sl->dev, 622 623 "Device registration [%s] failed. err=%d\n", 623 - sl->dev.bus_id, err); 624 + dev_name(&sl->dev), err); 624 625 return err; 625 626 } 626 627 ··· 629 630 if (err < 0) { 630 631 dev_err(&sl->dev, 631 632 "sysfs file creation for [%s] failed. err=%d\n", 632 - sl->dev.bus_id, err); 633 + dev_name(&sl->dev), err); 633 634 goto out_unreg; 634 635 } 635 636 ··· 638 639 if (err < 0) { 639 640 dev_err(&sl->dev, 640 641 "sysfs file creation for [%s] failed. err=%d\n", 641 - sl->dev.bus_id, err); 642 + dev_name(&sl->dev), err); 642 643 goto out_rem1; 643 644 } 644 645 ··· 647 648 ((err = sl->family->fops->add_slave(sl)) < 0)) { 648 649 dev_err(&sl->dev, 649 650 "sysfs file creation for [%s] failed. err=%d\n", 650 - sl->dev.bus_id, err); 651 + dev_name(&sl->dev), err); 651 652 goto out_rem2; 652 653 } 653 654
+1 -2
drivers/w1/w1_int.c
··· 75 75 mutex_init(&dev->mutex); 76 76 77 77 memcpy(&dev->dev, device, sizeof(struct device)); 78 - snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), 79 - "w1_bus_master%u", dev->id); 78 + dev_set_name(&dev->dev, "w1_bus_master%u", dev->id); 80 79 snprintf(dev->name, sizeof(dev->name), "w1_bus_master%u", dev->id); 81 80 82 81 dev->driver = driver;
+15 -12
drivers/xen/xenbus/xenbus_probe.c
··· 99 99 } 100 100 101 101 /* device/<type>/<id> => <type>-<id> */ 102 - static int frontend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename) 102 + static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) 103 103 { 104 104 nodename = strchr(nodename, '/'); 105 - if (!nodename || strlen(nodename + 1) >= BUS_ID_SIZE) { 105 + if (!nodename || strlen(nodename + 1) >= XEN_BUS_ID_SIZE) { 106 106 printk(KERN_WARNING "XENBUS: bad frontend %s\n", nodename); 107 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 111 if (!strchr(bus_id, '/')) { 112 112 printk(KERN_WARNING "XENBUS: bus_id %s no slash\n", bus_id); 113 113 return -EINVAL; ··· 460 460 const char *type, 461 461 const char *nodename) 462 462 { 463 + char devname[XEN_BUS_ID_SIZE]; 463 464 int err; 464 465 struct xenbus_device *xendev; 465 466 size_t stringlen; ··· 495 494 xendev->dev.bus = &bus->bus; 496 495 xendev->dev.release = xenbus_dev_release; 497 496 498 - err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); 497 + err = bus->get_bus_id(devname, xendev->nodename); 499 498 if (err) 500 499 goto fail; 500 + 501 + dev_set_name(&xendev->dev, devname); 501 502 502 503 /* Register with generic device framework. */ 503 504 err = device_register(&xendev->dev); ··· 614 611 { 615 612 int exists, rootlen; 616 613 struct xenbus_device *dev; 617 - char type[BUS_ID_SIZE]; 614 + char type[XEN_BUS_ID_SIZE]; 618 615 const char *p, *root; 619 616 620 617 if (char_count(node, '/') < 2) ··· 628 625 629 626 /* backend/<type>/... or device/<type>/... */ 630 627 p = strchr(node, '/') + 1; 631 - snprintf(type, BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); 632 - type[BUS_ID_SIZE-1] = '\0'; 628 + snprintf(type, XEN_BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); 629 + type[XEN_BUS_ID_SIZE-1] = '\0'; 633 630 634 631 rootlen = strsep_len(node, '/', bus->levels); 635 632 if (rootlen < 0) ··· 677 674 err = drv->suspend(xdev); 678 675 if (err) 679 676 printk(KERN_WARNING 680 - "xenbus: suspend %s failed: %i\n", dev->bus_id, err); 677 + "xenbus: suspend %s failed: %i\n", dev_name(dev), err); 681 678 return 0; 682 679 } 683 680 ··· 698 695 if (err) 699 696 printk(KERN_WARNING 700 697 "xenbus: suspend_cancel %s failed: %i\n", 701 - dev->bus_id, err); 698 + dev_name(dev), err); 702 699 return 0; 703 700 } 704 701 ··· 720 717 if (err) { 721 718 printk(KERN_WARNING 722 719 "xenbus: resume (talk_to_otherend) %s failed: %i\n", 723 - dev->bus_id, err); 720 + dev_name(dev), err); 724 721 return err; 725 722 } 726 723 ··· 731 728 if (err) { 732 729 printk(KERN_WARNING 733 730 "xenbus: resume %s failed: %i\n", 734 - dev->bus_id, err); 731 + dev_name(dev), err); 735 732 return err; 736 733 } 737 734 } ··· 740 737 if (err) { 741 738 printk(KERN_WARNING 742 739 "xenbus_probe: resume (watch_otherend) %s failed: " 743 - "%d.\n", dev->bus_id, err); 740 + "%d.\n", dev_name(dev), err); 744 741 return err; 745 742 } 746 743
+3 -1
drivers/xen/xenbus/xenbus_probe.h
··· 34 34 #ifndef _XENBUS_PROBE_H 35 35 #define _XENBUS_PROBE_H 36 36 37 + #define XEN_BUS_ID_SIZE 20 38 + 37 39 #ifdef CONFIG_XEN_BACKEND 38 40 extern void xenbus_backend_suspend(int (*fn)(struct device *, void *)); 39 41 extern void xenbus_backend_resume(int (*fn)(struct device *, void *)); ··· 54 52 { 55 53 char *root; 56 54 unsigned int levels; 57 - int (*get_bus_id)(char bus_id[BUS_ID_SIZE], const char *nodename); 55 + int (*get_bus_id)(char bus_id[XEN_BUS_ID_SIZE], const char *nodename); 58 56 int (*probe)(const char *type, const char *dir); 59 57 struct bus_type bus; 60 58 };
+3 -8
fs/partitions/check.c
··· 384 384 385 385 dname = dev_name(ddev); 386 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 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 391 device_initialize(pdev); 392 392 pdev->class = &block_class; ··· 447 447 struct block_device *bdev; 448 448 struct disk_part_iter piter; 449 449 struct hd_struct *part; 450 - char *s; 451 450 int err; 452 451 453 452 ddev->parent = disk->driverfs_dev; 454 453 455 - strlcpy(ddev->bus_id, disk->disk_name, BUS_ID_SIZE); 456 - /* ewww... some of these buggers have / in the name... */ 457 - s = strchr(ddev->bus_id, '/'); 458 - if (s) 459 - *s = '!'; 454 + dev_set_name(ddev, disk->disk_name); 460 455 461 456 /* delay uevents, until we scanned partition table */ 462 457 ddev->uevent_suppress = 1;
+25 -14
include/linux/device.h
··· 28 28 #define BUS_ID_SIZE 20 29 29 30 30 struct device; 31 + struct device_private; 31 32 struct device_driver; 32 33 struct driver_private; 33 34 struct class; ··· 66 65 int (*resume_early)(struct device *dev); 67 66 int (*resume)(struct device *dev); 68 67 69 - struct pm_ext_ops *pm; 68 + struct dev_pm_ops *pm; 70 69 71 70 struct bus_type_private *p; 72 71 }; ··· 134 133 int (*resume) (struct device *dev); 135 134 struct attribute_group **groups; 136 135 137 - struct pm_ops *pm; 136 + struct dev_pm_ops *pm; 138 137 139 138 struct driver_private *p; 140 139 }; ··· 199 198 int (*suspend)(struct device *dev, pm_message_t state); 200 199 int (*resume)(struct device *dev); 201 200 202 - struct pm_ops *pm; 201 + struct dev_pm_ops *pm; 203 202 struct class_private *p; 204 203 }; 205 204 ··· 292 291 int (*suspend)(struct device *dev, pm_message_t state); 293 292 int (*resume)(struct device *dev); 294 293 295 - struct pm_ops *pm; 294 + struct dev_pm_ops *pm; 296 295 }; 297 296 298 297 /* interface for exporting device attributes */ ··· 366 365 }; 367 366 368 367 struct device { 369 - struct klist klist_children; 370 - struct klist_node knode_parent; /* node in sibling list */ 371 - struct klist_node knode_driver; 372 - struct klist_node knode_bus; 373 368 struct device *parent; 369 + 370 + struct device_private *p; 374 371 375 372 struct kobject kobj; 376 373 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 374 + unsigned uevent_suppress:1; 377 375 const char *init_name; /* initial name of the device */ 378 376 struct device_type *type; 379 - unsigned uevent_suppress:1; 380 377 381 378 struct semaphore sem; /* semaphore to synchronize calls to 382 379 * its driver. ··· 407 408 /* arch specific additions */ 408 409 struct dev_archdata archdata; 409 410 411 + dev_t devt; /* dev_t, creates the sysfs "dev" */ 412 + 410 413 spinlock_t devres_lock; 411 414 struct list_head devres_head; 412 415 413 416 struct klist_node knode_class; 414 417 struct class *class; 415 - dev_t devt; /* dev_t, creates the sysfs "dev" */ 416 418 struct attribute_group **groups; /* optional groups */ 417 419 418 420 void (*release)(struct device *dev); ··· 481 481 int (*match)(struct device *dev, void *data)); 482 482 extern int device_rename(struct device *dev, char *new_name); 483 483 extern int device_move(struct device *dev, struct device *new_parent); 484 + 485 + /* 486 + * Root device objects for grouping under /sys/devices 487 + */ 488 + extern struct device *__root_device_register(const char *name, 489 + struct module *owner); 490 + static inline struct device *root_device_register(const char *name) 491 + { 492 + return __root_device_register(name, THIS_MODULE); 493 + } 494 + extern void root_device_unregister(struct device *root); 484 495 485 496 /* 486 497 * Manual binding of a device to driver. See drivers/base/bus.c ··· 564 553 #define dev_info(dev, format, arg...) \ 565 554 dev_printk(KERN_INFO , dev , format , ## arg) 566 555 567 - #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 556 + #if defined(DEBUG) 557 + #define dev_dbg(dev, format, arg...) \ 558 + dev_printk(KERN_DEBUG , dev , format , ## arg) 559 + #elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 568 560 #define dev_dbg(dev, format, ...) do { \ 569 561 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 570 562 } while (0) 571 - #elif defined(DEBUG) 572 - #define dev_dbg(dev, format, arg...) \ 573 - dev_printk(KERN_DEBUG , dev , format , ## arg) 574 563 #else 575 564 #define dev_dbg(dev, format, arg...) \ 576 565 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
+4 -4
include/linux/kernel.h
··· 355 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 356 356 357 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 362 #define pr_debug(fmt, ...) do { \ 360 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 361 364 } while (0) 362 - #elif defined(DEBUG) 363 - #define pr_debug(fmt, ...) \ 364 - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 365 365 #else 366 366 #define pr_debug(fmt, ...) \ 367 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
-2
include/linux/klist.h
··· 13 13 #define _LINUX_KLIST_H 14 14 15 15 #include <linux/spinlock.h> 16 - #include <linux/completion.h> 17 16 #include <linux/kref.h> 18 17 #include <linux/list.h> 19 18 ··· 40 41 void *n_klist; /* never access directly */ 41 42 struct list_head n_node; 42 43 struct kref n_ref; 43 - struct completion n_removed; 44 44 }; 45 45 46 46 extern void klist_add_tail(struct klist_node *n, struct klist *k);
+1 -1
include/linux/mtd/concat.h
··· 13 13 struct mtd_info *mtd_concat_create( 14 14 struct mtd_info *subdev[], /* subdevices to concatenate */ 15 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 18 18 void mtd_concat_destroy(struct mtd_info *mtd); 19 19
-1
include/linux/pci.h
··· 421 421 int (*resume_early) (struct pci_dev *dev); 422 422 int (*resume) (struct pci_dev *dev); /* Device woken up */ 423 423 void (*shutdown) (struct pci_dev *dev); 424 - struct pm_ext_ops *pm; 425 424 struct pci_error_handlers *err_handler; 426 425 struct device_driver driver; 427 426 struct pci_dynids dynids;
-1
include/linux/platform_device.h
··· 55 55 int (*suspend_late)(struct platform_device *, pm_message_t state); 56 56 int (*resume_early)(struct platform_device *); 57 57 int (*resume)(struct platform_device *); 58 - struct pm_ext_ops *pm; 59 58 struct device_driver driver; 60 59 }; 61 60
+31 -57
include/linux/pm.h
··· 41 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 46 * Several driver power state transitions are externally visible, affecting 47 47 * the state of pending I/O queues and (for drivers that touch hardware) ··· 126 126 * On most platforms, there are no restrictions on availability of 127 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 - 145 - struct 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 129 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 170 130 * actions required for suspending the device that need interrupts to be 171 131 * disabled ··· 150 190 * actions required for restoring the operations of the device that need 151 191 * interrupts to be disabled 152 192 * 153 - * All of the above callbacks return error codes, but the error codes returned 154 - * by the resume operations, @resume_noirq(), @thaw_noirq(), and 155 - * @restore_noirq(), do not cause the PM core to abort the resume transition 156 - * during which they are returned. The error codes returned in that cases are 157 - * only printed by the PM core to the system logs for debugging purposes. 158 - * Still, as stated above, it is recommended that drivers only return error 159 - * codes from their resume methods if the device being handled fails to resume 160 - * and is not usable any more. 193 + * All of the above callbacks, except for @complete(), return error codes. 194 + * However, the error codes returned by the resume operations, @resume(), 195 + * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do 196 + * not cause the PM core to abort the resume transition during which they are 197 + * returned. The error codes returned in that cases are only printed by the PM 198 + * core to the system logs for debugging purposes. Still, it is recommended 199 + * that drivers only return error codes from their resume methods in case of an 200 + * unrecoverable failure (i.e. when the device being handled refuses to resume 201 + * and becomes unusable) to allow us to modify the PM core in the future, so 202 + * that it can avoid attempting to handle devices that failed to resume and 203 + * their children. 204 + * 205 + * It is allowed to unregister devices while the above callbacks are being 206 + * executed. However, it is not allowed to unregister a device from within any 207 + * of its own callbacks. 161 208 */ 162 209 163 - struct pm_ext_ops { 164 - struct pm_ops base; 210 + struct dev_pm_ops { 211 + int (*prepare)(struct device *dev); 212 + void (*complete)(struct device *dev); 213 + int (*suspend)(struct device *dev); 214 + int (*resume)(struct device *dev); 215 + int (*freeze)(struct device *dev); 216 + int (*thaw)(struct device *dev); 217 + int (*poweroff)(struct device *dev); 218 + int (*restore)(struct device *dev); 165 219 int (*suspend_noirq)(struct device *dev); 166 220 int (*resume_noirq)(struct device *dev); 167 221 int (*freeze_noirq)(struct device *dev); ··· 252 278 #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) 253 279 #define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) 254 280 #define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) 255 - #define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) 281 + #define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME) 256 282 #define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) 257 283 #define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) 258 284 ··· 265 291 #define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) 266 292 #define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) 267 293 #define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) 268 - #define PMSG_USER_SUSPEND ((struct pm_messge) \ 294 + #define PMSG_USER_SUSPEND ((struct pm_message) \ 269 295 { .event = PM_EVENT_USER_SUSPEND, }) 270 - #define PMSG_USER_RESUME ((struct pm_messge) \ 296 + #define PMSG_USER_RESUME ((struct pm_message) \ 271 297 { .event = PM_EVENT_USER_RESUME, }) 272 - #define PMSG_REMOTE_RESUME ((struct pm_messge) \ 298 + #define PMSG_REMOTE_RESUME ((struct pm_message) \ 273 299 { .event = PM_EVENT_REMOTE_RESUME, }) 274 - #define PMSG_AUTO_SUSPEND ((struct pm_messge) \ 300 + #define PMSG_AUTO_SUSPEND ((struct pm_message) \ 275 301 { .event = PM_EVENT_AUTO_SUSPEND, }) 276 - #define PMSG_AUTO_RESUME ((struct pm_messge) \ 302 + #define PMSG_AUTO_RESUME ((struct pm_message) \ 277 303 { .event = PM_EVENT_AUTO_RESUME, }) 278 304 279 305 /**
+28 -2
include/linux/uio_driver.h
··· 38 38 39 39 #define MAX_UIO_MAPS 5 40 40 41 + struct 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 + */ 50 + struct 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 + 41 59 struct uio_device; 42 60 43 61 /** ··· 64 46 * @name: device name 65 47 * @version: device driver version 66 48 * @mem: list of mappable memory regions, size==0 for end of list 49 + * @port: list of port regions, size==0 for end of list 67 50 * @irq: interrupt number or UIO_IRQ_CUSTOM 68 51 * @irq_flags: flags for request_irq() 69 52 * @priv: optional private data ··· 76 57 */ 77 58 struct uio_info { 78 59 struct uio_device *uio_dev; 79 - char *name; 80 - char *version; 60 + const char *name; 61 + const char *version; 81 62 struct uio_mem mem[MAX_UIO_MAPS]; 63 + struct uio_port port[MAX_UIO_PORT_REGIONS]; 82 64 long irq; 83 65 unsigned long irq_flags; 84 66 void *priv; ··· 111 91 #define UIO_MEM_PHYS 1 112 92 #define UIO_MEM_LOGICAL 2 113 93 #define UIO_MEM_VIRTUAL 3 94 + 95 + /* defines for uio_port->porttype */ 96 + #define UIO_PORT_NONE 0 97 + #define UIO_PORT_X86 1 98 + #define UIO_PORT_GPIO 2 99 + #define UIO_PORT_OTHER 3 114 100 115 101 #endif /* _LINUX_UIO_DRIVER_H_ */
+25 -15
init/Kconfig
··· 423 423 bool 424 424 425 425 config SYSFS_DEPRECATED_V2 426 - bool "Create deprecated sysfs files" 426 + bool "Create deprecated sysfs layout for older userspace tools" 427 427 depends on SYSFS 428 428 default y 429 429 select SYSFS_DEPRECATED 430 430 help 431 - This option creates deprecated symlinks such as the 432 - "device"-link, the <subsystem>:<name>-link, and the 433 - "bus"-link. It may also add deprecated key in the 434 - uevent environment. 435 - None of these features or values should be used today, as 436 - they export driver core implementation details to userspace 437 - or export properties which can't be kept stable across kernel 438 - releases. 431 + This option switches the layout of sysfs to the deprecated 432 + version. 439 433 440 - If enabled, this option will also move any device structures 441 - that belong to a class, back into the /sys/class hierarchy, in 442 - order to support older versions of udev and some userspace 443 - programs. 434 + The current sysfs layout features a unified device tree at 435 + /sys/devices/, which is able to express a hierarchy between 436 + class devices. If the deprecated option is set to Y, the 437 + unified device tree is split into a bus device tree at 438 + /sys/devices/ and several individual class device trees at 439 + /sys/class/. The class and bus devices will be connected by 440 + "<subsystem>:<name>" and the "device" links. The "block" 441 + class devices, will not show up in /sys/class/block/. Some 442 + subsystems will suppress the creation of some devices which 443 + depend on the unified device tree. 444 444 445 - If you are using a distro with the most recent userspace 446 - packages, it should be safe to say N here. 445 + This option is not a pure compatibility option that can 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 448 458 config PROC_PID_CPUSET 449 459 bool "Include legacy /proc/<pid>/cpuset file"
+2 -2
kernel/ksysfs.c
··· 24 24 static struct kobj_attribute _name##_attr = \ 25 25 __ATTR(_name, 0644, _name##_show, _name##_store) 26 26 27 - #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 27 + #if defined(CONFIG_HOTPLUG) 28 28 /* current uevent sequence number */ 29 29 static ssize_t uevent_seqnum_show(struct kobject *kobj, 30 30 struct kobj_attribute *attr, char *buf) ··· 137 137 EXPORT_SYMBOL_GPL(kernel_kobj); 138 138 139 139 static struct attribute * kernel_attrs[] = { 140 - #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 140 + #if defined(CONFIG_HOTPLUG) 141 141 &uevent_seqnum_attr.attr, 142 142 &uevent_helper_attr.attr, 143 143 #endif
+3 -3
kernel/power/main.c
··· 615 615 /* this may fail if the RTC hasn't been initialized */ 616 616 status = rtc_read_time(rtc, &alm.time); 617 617 if (status < 0) { 618 - printk(err_readtime, rtc->dev.bus_id, status); 618 + printk(err_readtime, dev_name(&rtc->dev), status); 619 619 return; 620 620 } 621 621 rtc_tm_to_time(&alm.time, &now); ··· 626 626 627 627 status = rtc_set_alarm(rtc, &alm); 628 628 if (status < 0) { 629 - printk(err_wakealarm, rtc->dev.bus_id, status); 629 + printk(err_wakealarm, dev_name(&rtc->dev), status); 630 630 return; 631 631 } 632 632 ··· 660 660 if (!device_may_wakeup(candidate->dev.parent)) 661 661 return 0; 662 662 663 - *(char **)name_ptr = dev->bus_id; 663 + *(const char **)name_ptr = dev_name(dev); 664 664 return 1; 665 665 } 666 666
+26 -32
lib/dynamic_printk.c
··· 277 277 dynamic_enabled = DYNAMIC_ENABLED_NONE; 278 278 } 279 279 err = 0; 280 - } else { 281 - if (elem) { 282 - if (value && (elem->enable == 0)) { 283 - dynamic_printk_enabled |= 284 - (1LL << elem->hash1); 285 - dynamic_printk_enabled2 |= 286 - (1LL << elem->hash2); 287 - elem->enable = 1; 288 - num_enabled++; 289 - dynamic_enabled = DYNAMIC_ENABLED_SOME; 290 - err = 0; 291 - printk(KERN_DEBUG 292 - "debugging enabled for module %s\n", 293 - elem->name); 294 - } else if (!value && (elem->enable == 1)) { 295 - elem->enable = 0; 296 - num_enabled--; 297 - if (disabled_hash(elem->hash1, true)) 298 - dynamic_printk_enabled &= 280 + } else if (elem) { 281 + if (value && (elem->enable == 0)) { 282 + dynamic_printk_enabled |= (1LL << elem->hash1); 283 + dynamic_printk_enabled2 |= (1LL << elem->hash2); 284 + elem->enable = 1; 285 + num_enabled++; 286 + dynamic_enabled = DYNAMIC_ENABLED_SOME; 287 + err = 0; 288 + printk(KERN_DEBUG 289 + "debugging enabled for module %s\n", 290 + elem->name); 291 + } else if (!value && (elem->enable == 1)) { 292 + elem->enable = 0; 293 + num_enabled--; 294 + if (disabled_hash(elem->hash1, true)) 295 + dynamic_printk_enabled &= 299 296 ~(1LL << elem->hash1); 300 - if (disabled_hash(elem->hash2, false)) 301 - dynamic_printk_enabled2 &= 297 + if (disabled_hash(elem->hash2, false)) 298 + dynamic_printk_enabled2 &= 302 299 ~(1LL << elem->hash2); 303 - if (num_enabled) 304 - dynamic_enabled = 305 - DYNAMIC_ENABLED_SOME; 306 - else 307 - dynamic_enabled = 308 - DYNAMIC_ENABLED_NONE; 309 - err = 0; 310 - printk(KERN_DEBUG 311 - "debugging disabled for module " 312 - "%s\n", elem->name); 313 - } 300 + if (num_enabled) 301 + dynamic_enabled = DYNAMIC_ENABLED_SOME; 302 + else 303 + dynamic_enabled = DYNAMIC_ENABLED_NONE; 304 + err = 0; 305 + printk(KERN_DEBUG 306 + "debugging disabled for module %s\n", 307 + elem->name); 314 308 } 315 309 } 316 310 }
+40 -3
lib/klist.c
··· 36 36 37 37 #include <linux/klist.h> 38 38 #include <linux/module.h> 39 + #include <linux/sched.h> 39 40 40 41 /* 41 42 * Use the lowest bit of n_klist to mark deleted nodes and exclude ··· 109 108 static void klist_node_init(struct klist *k, struct klist_node *n) 110 109 { 111 110 INIT_LIST_HEAD(&n->n_node); 112 - init_completion(&n->n_removed); 113 111 kref_init(&n->n_ref); 114 112 knode_set_klist(n, k); 115 113 if (k->get) ··· 171 171 } 172 172 EXPORT_SYMBOL_GPL(klist_add_before); 173 173 174 + struct klist_waiter { 175 + struct list_head list; 176 + struct klist_node *node; 177 + struct task_struct *process; 178 + int woken; 179 + }; 180 + 181 + static DEFINE_SPINLOCK(klist_remove_lock); 182 + static LIST_HEAD(klist_remove_waiters); 183 + 174 184 static void klist_release(struct kref *kref) 175 185 { 186 + struct klist_waiter *waiter, *tmp; 176 187 struct klist_node *n = container_of(kref, struct klist_node, n_ref); 177 188 178 189 WARN_ON(!knode_dead(n)); 179 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 202 knode_set_klist(n, NULL); 182 203 } 183 204 ··· 238 217 */ 239 218 void klist_remove(struct klist_node *n) 240 219 { 220 + struct klist_waiter waiter; 221 + 222 + waiter.node = n; 223 + waiter.process = current; 224 + waiter.woken = 0; 225 + spin_lock(&klist_remove_lock); 226 + list_add(&waiter.list, &klist_remove_waiters); 227 + spin_unlock(&klist_remove_lock); 228 + 241 229 klist_del(n); 242 - wait_for_completion(&n->n_removed); 230 + 231 + for (;;) { 232 + set_current_state(TASK_UNINTERRUPTIBLE); 233 + if (waiter.woken) 234 + break; 235 + schedule(); 236 + } 237 + __set_current_state(TASK_RUNNING); 243 238 } 244 239 EXPORT_SYMBOL_GPL(klist_remove); 245 240
+5 -3
lib/kobject_uevent.c
··· 165 165 /* keys passed in from the caller */ 166 166 if (envp_ext) { 167 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 169 if (retval) 170 170 goto exit; 171 171 } ··· 225 225 } 226 226 227 227 NETLINK_CB(skb).dst_group = 1; 228 - netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL); 229 - } 228 + retval = netlink_broadcast(uevent_sock, skb, 0, 1, 229 + GFP_KERNEL); 230 + } else 231 + retval = -ENOMEM; 230 232 } 231 233 #endif 232 234
+1 -1
lib/swiotlb.c
··· 647 647 * the damage, or panic when the transfer is too big. 648 648 */ 649 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 652 if (size > io_tlb_overflow && do_panic) { 653 653 if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL)
+3 -4
net/iucv/iucv.c
··· 50 50 #include <asm/ebcdic.h> 51 51 #include <asm/io.h> 52 52 #include <asm/s390_ext.h> 53 - #include <asm/s390_rdev.h> 54 53 #include <asm/smp.h> 55 54 56 55 /* ··· 1695 1696 rc = register_external_interrupt(0x4000, iucv_external_interrupt); 1696 1697 if (rc) 1697 1698 goto out; 1698 - iucv_root = s390_root_dev_register("iucv"); 1699 + iucv_root = root_device_register("iucv"); 1699 1700 if (IS_ERR(iucv_root)) { 1700 1701 rc = PTR_ERR(iucv_root); 1701 1702 goto out_int; ··· 1739 1740 kfree(iucv_irq_data[cpu]); 1740 1741 iucv_irq_data[cpu] = NULL; 1741 1742 } 1742 - s390_root_dev_unregister(iucv_root); 1743 + root_device_unregister(iucv_root); 1743 1744 out_int: 1744 1745 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1745 1746 out: ··· 1769 1770 kfree(iucv_irq_data[cpu]); 1770 1771 iucv_irq_data[cpu] = NULL; 1771 1772 } 1772 - s390_root_dev_unregister(iucv_root); 1773 + root_device_unregister(iucv_root); 1773 1774 bus_unregister(&iucv_bus); 1774 1775 unregister_external_interrupt(0x4000, iucv_external_interrupt); 1775 1776 }