diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:13:47 -0400 |
| commit | 53baaaa9682c230410a057263d1ce2922f43ddc4 (patch) | |
| tree | f5cced5622130f780d76953b284a631c3d226488 | |
| parent | f10140fbe5f97ecfeda986a12d0f1bad75642779 (diff) | |
| parent | 3f9787046ea37a26170dc4439efa21f8d23a9978 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (79 commits)
arm: bus_id -> dev_name() and dev_set_name() conversions
sparc64: fix up bus_id changes in sparc core code
3c59x: handle pci_name() being const
MTD: handle pci_name() being const
HP iLO driver
sysdev: Convert the x86 mce tolerant sysdev attribute to generic attribute
sysdev: Add utility functions for simple int/ulong variable sysdev attributes
sysdev: Pass the attribute to the low level sysdev show/store function
driver core: Suppress sysfs warnings for device_rename().
kobject: Transmit return value of call_usermodehelper() to caller
sysfs-rules.txt: reword API stability statement
debugfs: Implement debugfs_remove_recursive()
HOWTO: change email addresses of James in HOWTO
always enable FW_LOADER unless EMBEDDED=y
uio-howto.tmpl: use unique output names
uio-howto.tmpl: use standard copyright/legal markings
sysfs: don't call notify_change
sysdev: fix debugging statements in registration code.
kobject: should use kobject_put() in kset-example
kobject: reorder kobject to save space on 64 bit builds
...
173 files changed, 2508 insertions, 751 deletions
diff --git a/Documentation/ABI/testing/sysfs-dev b/Documentation/ABI/testing/sysfs-dev new file mode 100644 index 000000000000..a9f2b8b0530f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-dev | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | What: /sys/dev | ||
| 2 | Date: April 2008 | ||
| 3 | KernelVersion: 2.6.26 | ||
| 4 | Contact: Dan Williams <dan.j.williams@intel.com> | ||
| 5 | Description: The /sys/dev tree provides a method to look up the sysfs | ||
| 6 | path for a device using the information returned from | ||
| 7 | stat(2). There are two directories, 'block' and 'char', | ||
| 8 | beneath /sys/dev containing symbolic links with names of | ||
| 9 | the form "<major>:<minor>". These links point to the | ||
| 10 | corresponding sysfs path for the given device. | ||
| 11 | |||
| 12 | Example: | ||
| 13 | $ readlink /sys/dev/block/8:32 | ||
| 14 | ../../block/sdc | ||
| 15 | |||
| 16 | Entries in /sys/dev/char and /sys/dev/block will be | ||
| 17 | dynamically created and destroyed as devices enter and | ||
| 18 | leave the system. | ||
| 19 | |||
| 20 | Users: mdadm <linux-raid@vger.kernel.org> | ||
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index fdd7f4f887b7..df87d1b93605 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
| @@ -21,6 +21,18 @@ | |||
| 21 | </affiliation> | 21 | </affiliation> |
| 22 | </author> | 22 | </author> |
| 23 | 23 | ||
| 24 | <copyright> | ||
| 25 | <year>2006-2008</year> | ||
| 26 | <holder>Hans-Jürgen Koch.</holder> | ||
| 27 | </copyright> | ||
| 28 | |||
| 29 | <legalnotice> | ||
| 30 | <para> | ||
| 31 | This documentation is Free Software licensed under the terms of the | ||
| 32 | GPL version 2. | ||
| 33 | </para> | ||
| 34 | </legalnotice> | ||
| 35 | |||
| 24 | <pubdate>2006-12-11</pubdate> | 36 | <pubdate>2006-12-11</pubdate> |
| 25 | 37 | ||
| 26 | <abstract> | 38 | <abstract> |
| @@ -30,6 +42,12 @@ | |||
| 30 | 42 | ||
| 31 | <revhistory> | 43 | <revhistory> |
| 32 | <revision> | 44 | <revision> |
| 45 | <revnumber>0.5</revnumber> | ||
| 46 | <date>2008-05-22</date> | ||
| 47 | <authorinitials>hjk</authorinitials> | ||
| 48 | <revremark>Added description of write() function.</revremark> | ||
| 49 | </revision> | ||
| 50 | <revision> | ||
| 33 | <revnumber>0.4</revnumber> | 51 | <revnumber>0.4</revnumber> |
| 34 | <date>2007-11-26</date> | 52 | <date>2007-11-26</date> |
| 35 | <authorinitials>hjk</authorinitials> | 53 | <authorinitials>hjk</authorinitials> |
| @@ -57,20 +75,9 @@ | |||
| 57 | </bookinfo> | 75 | </bookinfo> |
| 58 | 76 | ||
| 59 | <chapter id="aboutthisdoc"> | 77 | <chapter id="aboutthisdoc"> |
| 60 | <?dbhtml filename="about.html"?> | 78 | <?dbhtml filename="aboutthis.html"?> |
| 61 | <title>About this document</title> | 79 | <title>About this document</title> |
| 62 | 80 | ||
| 63 | <sect1 id="copyright"> | ||
| 64 | <?dbhtml filename="copyright.html"?> | ||
| 65 | <title>Copyright and License</title> | ||
| 66 | <para> | ||
| 67 | Copyright (c) 2006 by Hans-Jürgen Koch.</para> | ||
| 68 | <para> | ||
| 69 | This documentation is Free Software licensed under the terms of the | ||
| 70 | GPL version 2. | ||
| 71 | </para> | ||
| 72 | </sect1> | ||
| 73 | |||
| 74 | <sect1 id="translations"> | 81 | <sect1 id="translations"> |
| 75 | <?dbhtml filename="translations.html"?> | 82 | <?dbhtml filename="translations.html"?> |
| 76 | <title>Translations</title> | 83 | <title>Translations</title> |
| @@ -189,6 +196,30 @@ interested in translating it, please email me | |||
| 189 | represents the total interrupt count. You can use this number | 196 | represents the total interrupt count. You can use this number |
| 190 | to figure out if you missed some interrupts. | 197 | to figure out if you missed some interrupts. |
| 191 | </para> | 198 | </para> |
| 199 | <para> | ||
| 200 | For some hardware that has more than one interrupt source internally, | ||
| 201 | but not separate IRQ mask and status registers, there might be | ||
| 202 | situations where userspace cannot determine what the interrupt source | ||
| 203 | was if the kernel handler disables them by writing to the chip's IRQ | ||
| 204 | register. In such a case, the kernel has to disable the IRQ completely | ||
| 205 | to leave the chip's register untouched. Now the userspace part can | ||
| 206 | determine the cause of the interrupt, but it cannot re-enable | ||
| 207 | interrupts. Another cornercase is chips where re-enabling interrupts | ||
| 208 | is a read-modify-write operation to a combined IRQ status/acknowledge | ||
| 209 | register. This would be racy if a new interrupt occurred | ||
| 210 | simultaneously. | ||
| 211 | </para> | ||
| 212 | <para> | ||
| 213 | To address these problems, UIO also implements a write() function. It | ||
| 214 | is normally not used and can be ignored for hardware that has only a | ||
| 215 | single interrupt source or has separate IRQ mask and status registers. | ||
| 216 | If you need it, however, a write to <filename>/dev/uioX</filename> | ||
| 217 | will call the <function>irqcontrol()</function> function implemented | ||
| 218 | by the driver. You have to write a 32-bit value that is usually either | ||
| 219 | 0 or 1 to disable or enable interrupts. If a driver does not implement | ||
| 220 | <function>irqcontrol()</function>, <function>write()</function> will | ||
| 221 | return with <varname>-ENOSYS</varname>. | ||
| 222 | </para> | ||
| 192 | 223 | ||
| 193 | <para> | 224 | <para> |
| 194 | To handle interrupts properly, your custom kernel module can | 225 | To handle interrupts properly, your custom kernel module can |
| @@ -362,6 +393,14 @@ device is actually used. | |||
| 362 | <function>open()</function>, you will probably also want a custom | 393 | <function>open()</function>, you will probably also want a custom |
| 363 | <function>release()</function> function. | 394 | <function>release()</function> function. |
| 364 | </para></listitem> | 395 | </para></listitem> |
| 396 | |||
| 397 | <listitem><para> | ||
| 398 | <varname>int (*irqcontrol)(struct uio_info *info, s32 irq_on) | ||
| 399 | </varname>: Optional. If you need to be able to enable or disable | ||
| 400 | interrupts from userspace by writing to <filename>/dev/uioX</filename>, | ||
| 401 | you can implement this function. The parameter <varname>irq_on</varname> | ||
| 402 | will be 0 to disable interrupts and 1 to enable them. | ||
| 403 | </para></listitem> | ||
| 365 | </itemizedlist> | 404 | </itemizedlist> |
| 366 | 405 | ||
| 367 | <para> | 406 | <para> |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 619e8caf30db..c2371c5a98f9 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
| @@ -358,7 +358,7 @@ Here is a list of some of the different kernel trees available: | |||
| 358 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 358 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
| 359 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 359 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
| 360 | 360 | ||
| 361 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 361 | - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com> |
| 362 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 362 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
| 363 | 363 | ||
| 364 | - x86, Ingo Molnar <mingo@elte.hu> | 364 | - x86, Ingo Molnar <mingo@elte.hu> |
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index 7f27b8f840d0..9e9c348275a9 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt | |||
| @@ -248,6 +248,7 @@ The top level sysfs directory looks like: | |||
| 248 | block/ | 248 | block/ |
| 249 | bus/ | 249 | bus/ |
| 250 | class/ | 250 | class/ |
| 251 | dev/ | ||
| 251 | devices/ | 252 | devices/ |
| 252 | firmware/ | 253 | firmware/ |
| 253 | net/ | 254 | net/ |
| @@ -274,6 +275,11 @@ fs/ contains a directory for some filesystems. Currently each | |||
| 274 | filesystem wanting to export attributes must create its own hierarchy | 275 | filesystem wanting to export attributes must create its own hierarchy |
| 275 | below fs/ (see ./fuse.txt for an example). | 276 | below fs/ (see ./fuse.txt for an example). |
| 276 | 277 | ||
| 278 | dev/ contains two directories char/ and block/. Inside these two | ||
| 279 | directories there are symlinks named <major>:<minor>. These symlinks | ||
| 280 | point to the sysfs directory for the given device. /sys/dev provides a | ||
| 281 | quick way to lookup the sysfs interface for a device from the result of | ||
| 282 | a stat(2) operation. | ||
| 277 | 283 | ||
| 278 | More information can driver-model specific features can be found in | 284 | More information can driver-model specific features can be found in |
| 279 | Documentation/driver-model/. | 285 | Documentation/driver-model/. |
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt index 80ef562160bb..6049a2a84dda 100644 --- a/Documentation/sysfs-rules.txt +++ b/Documentation/sysfs-rules.txt | |||
| @@ -3,9 +3,8 @@ Rules on how to access information in the Linux kernel sysfs | |||
| 3 | The kernel-exported sysfs exports internal kernel implementation details | 3 | The kernel-exported sysfs exports internal kernel implementation details |
| 4 | and depends on internal kernel structures and layout. It is agreed upon | 4 | and depends on internal kernel structures and layout. It is agreed upon |
| 5 | by the kernel developers that the Linux kernel does not provide a stable | 5 | by the kernel developers that the Linux kernel does not provide a stable |
| 6 | internal API. As sysfs is a direct export of kernel internal | 6 | internal API. Therefore, there are aspects of the sysfs interface that |
| 7 | structures, the sysfs interface cannot provide a stable interface either; | 7 | may not be stable across kernel releases. |
| 8 | it may always change along with internal kernel changes. | ||
| 9 | 8 | ||
| 10 | To minimize the risk of breaking users of sysfs, which are in most cases | 9 | To minimize the risk of breaking users of sysfs, which are in most cases |
| 11 | low-level userspace applications, with a new kernel release, the users | 10 | low-level userspace applications, with a new kernel release, the users |
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 2744673314b4..dd2947342604 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
| @@ -554,9 +554,8 @@ dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size, | |||
| 554 | 554 | ||
| 555 | device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC); | 555 | device_info = kmalloc(sizeof(struct dmabounce_device_info), GFP_ATOMIC); |
| 556 | if (!device_info) { | 556 | if (!device_info) { |
| 557 | printk(KERN_ERR | 557 | dev_err(dev, |
| 558 | "Could not allocated dmabounce_device_info for %s", | 558 | "Could not allocated dmabounce_device_info\n"); |
| 559 | dev->bus_id); | ||
| 560 | return -ENOMEM; | 559 | return -ENOMEM; |
| 561 | } | 560 | } |
| 562 | 561 | ||
| @@ -594,8 +593,7 @@ dmabounce_register_dev(struct device *dev, unsigned long small_buffer_size, | |||
| 594 | 593 | ||
| 595 | dev->archdata.dmabounce = device_info; | 594 | dev->archdata.dmabounce = device_info; |
| 596 | 595 | ||
| 597 | printk(KERN_INFO "dmabounce: registered device %s on %s bus\n", | 596 | dev_info(dev, "dmabounce: registered device\n"); |
| 598 | dev->bus_id, dev->bus->name); | ||
| 599 | 597 | ||
| 600 | return 0; | 598 | return 0; |
| 601 | 599 | ||
| @@ -614,16 +612,15 @@ dmabounce_unregister_dev(struct device *dev) | |||
| 614 | dev->archdata.dmabounce = NULL; | 612 | dev->archdata.dmabounce = NULL; |
| 615 | 613 | ||
| 616 | if (!device_info) { | 614 | if (!device_info) { |
| 617 | printk(KERN_WARNING | 615 | dev_warn(dev, |
| 618 | "%s: Never registered with dmabounce but attempting" \ | 616 | "Never registered with dmabounce but attempting" |
| 619 | "to unregister!\n", dev->bus_id); | 617 | "to unregister!\n"); |
| 620 | return; | 618 | return; |
| 621 | } | 619 | } |
| 622 | 620 | ||
| 623 | if (!list_empty(&device_info->safe_buffers)) { | 621 | if (!list_empty(&device_info->safe_buffers)) { |
| 624 | printk(KERN_ERR | 622 | dev_err(dev, |
| 625 | "%s: Removing from dmabounce with pending buffers!\n", | 623 | "Removing from dmabounce with pending buffers!\n"); |
| 626 | dev->bus_id); | ||
| 627 | BUG(); | 624 | BUG(); |
| 628 | } | 625 | } |
| 629 | 626 | ||
| @@ -639,8 +636,7 @@ dmabounce_unregister_dev(struct device *dev) | |||
| 639 | 636 | ||
| 640 | kfree(device_info); | 637 | kfree(device_info); |
| 641 | 638 | ||
| 642 | printk(KERN_INFO "dmabounce: device %s on %s bus unregistered\n", | 639 | dev_info(dev, "dmabounce: device unregistered\n"); |
| 643 | dev->bus_id, dev->bus->name); | ||
| 644 | } | 640 | } |
| 645 | 641 | ||
| 646 | 642 | ||
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index d973c986f721..c3c3a3339049 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
| @@ -543,7 +543,6 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info) | |||
| 543 | goto out; | 543 | goto out; |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | strncpy(dev->dev.bus_id, info->name, sizeof(dev->dev.bus_id)); | ||
| 547 | /* | 546 | /* |
| 548 | * If the parent device has a DMA mask associated with it, | 547 | * If the parent device has a DMA mask associated with it, |
| 549 | * propagate it down to the children. | 548 | * propagate it down to the children. |
| @@ -553,6 +552,7 @@ locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info) | |||
| 553 | dev->dev.dma_mask = &dev->dma_mask; | 552 | dev->dev.dma_mask = &dev->dma_mask; |
| 554 | } | 553 | } |
| 555 | 554 | ||
| 555 | dev_set_name(&dev->dev, "%s", info->name); | ||
| 556 | dev->devid = info->devid; | 556 | dev->devid = info->devid; |
| 557 | dev->dev.parent = lchip->dev; | 557 | dev->dev.parent = lchip->dev; |
| 558 | dev->dev.bus = &locomo_bus_type; | 558 | dev->dev.bus = &locomo_bus_type; |
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index eb06d0b2cb74..c8e8f0ea59e1 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
| @@ -550,9 +550,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
| 550 | goto out; | 550 | goto out; |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), | 553 | dev_set_name(&dev->dev, "%4.4lx", info->offset); |
| 554 | "%4.4lx", info->offset); | ||
| 555 | |||
| 556 | dev->devid = info->devid; | 554 | dev->devid = info->devid; |
| 557 | dev->dev.parent = sachip->dev; | 555 | dev->dev.parent = sachip->dev; |
| 558 | dev->dev.bus = &sa1111_bus_type; | 556 | dev->dev.bus = &sa1111_bus_type; |
| @@ -560,7 +558,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
| 560 | dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask; | 558 | dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask; |
| 561 | dev->res.start = sachip->phys + info->offset; | 559 | dev->res.start = sachip->phys + info->offset; |
| 562 | dev->res.end = dev->res.start + 511; | 560 | dev->res.end = dev->res.start + 511; |
| 563 | dev->res.name = dev->dev.bus_id; | 561 | dev->res.name = dev_name(&dev->dev); |
| 564 | dev->res.flags = IORESOURCE_MEM; | 562 | dev->res.flags = IORESOURCE_MEM; |
| 565 | dev->mapbase = sachip->base + info->offset; | 563 | dev->mapbase = sachip->base + info->offset; |
| 566 | dev->skpcr_mask = info->skpcr_mask; | 564 | dev->skpcr_mask = info->skpcr_mask; |
| @@ -570,6 +568,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
| 570 | if (ret) { | 568 | if (ret) { |
| 571 | printk("SA1111: failed to allocate resource for %s\n", | 569 | printk("SA1111: failed to allocate resource for %s\n", |
| 572 | dev->res.name); | 570 | dev->res.name); |
| 571 | dev_set_name(&dev->dev, NULL); | ||
| 573 | kfree(dev); | 572 | kfree(dev); |
| 574 | goto out; | 573 | goto out; |
| 575 | } | 574 | } |
| @@ -593,7 +592,8 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
| 593 | if (dev->dma_mask != 0xffffffffUL) { | 592 | if (dev->dma_mask != 0xffffffffUL) { |
| 594 | ret = dmabounce_register_dev(&dev->dev, 1024, 4096); | 593 | ret = dmabounce_register_dev(&dev->dev, 1024, 4096); |
| 595 | if (ret) { | 594 | if (ret) { |
| 596 | printk("SA1111: Failed to register %s with dmabounce", dev->dev.bus_id); | 595 | dev_err(&dev->dev, "SA1111: Failed to register" |
| 596 | " with dmabounce\n"); | ||
| 597 | device_unregister(&dev->dev); | 597 | device_unregister(&dev->dev); |
| 598 | } | 598 | } |
| 599 | } | 599 | } |
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index bc299b07a6fa..ae39553589dd 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c | |||
| @@ -247,7 +247,7 @@ static int __devinit scoop_probe(struct platform_device *pdev) | |||
| 247 | devptr->gpio.base = -1; | 247 | devptr->gpio.base = -1; |
| 248 | 248 | ||
| 249 | if (inf->gpio_base != 0) { | 249 | if (inf->gpio_base != 0) { |
| 250 | devptr->gpio.label = pdev->dev.bus_id; | 250 | devptr->gpio.label = dev_name(&pdev->dev); |
| 251 | devptr->gpio.base = inf->gpio_base; | 251 | devptr->gpio.base = inf->gpio_base; |
| 252 | devptr->gpio.ngpio = 12; /* PA11 = 0, PA12 = 1, etc. up to PA22 = 11 */ | 252 | devptr->gpio.ngpio = 12; /* PA11 = 0, PA12 = 1, etc. up to PA22 = 11 */ |
| 253 | devptr->gpio.set = scoop_gpio_set; | 253 | devptr->gpio.set = scoop_gpio_set; |
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index 8bfd299bfe77..f5cfdabcb87d 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
| @@ -783,7 +783,7 @@ static void ecard_proc_init(void) | |||
| 783 | 783 | ||
| 784 | #define ec_set_resource(ec,nr,st,sz) \ | 784 | #define ec_set_resource(ec,nr,st,sz) \ |
| 785 | do { \ | 785 | do { \ |
| 786 | (ec)->resource[nr].name = ec->dev.bus_id; \ | 786 | (ec)->resource[nr].name = dev_name(&ec->dev); \ |
| 787 | (ec)->resource[nr].start = st; \ | 787 | (ec)->resource[nr].start = st; \ |
| 788 | (ec)->resource[nr].end = (st) + (sz) - 1; \ | 788 | (ec)->resource[nr].end = (st) + (sz) - 1; \ |
| 789 | (ec)->resource[nr].flags = IORESOURCE_MEM; \ | 789 | (ec)->resource[nr].flags = IORESOURCE_MEM; \ |
| @@ -853,8 +853,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot) | |||
| 853 | for (i = 0; i < ECARD_NUM_RESOURCES; i++) { | 853 | for (i = 0; i < ECARD_NUM_RESOURCES; i++) { |
| 854 | if (ec->resource[i].flags && | 854 | if (ec->resource[i].flags && |
| 855 | request_resource(&iomem_resource, &ec->resource[i])) { | 855 | request_resource(&iomem_resource, &ec->resource[i])) { |
| 856 | printk(KERN_ERR "%s: resource(s) not available\n", | 856 | dev_err(&ec->dev, "resource(s) not available\n"); |
| 857 | ec->dev.bus_id); | ||
| 858 | ec->resource[i].end -= ec->resource[i].start; | 857 | ec->resource[i].end -= ec->resource[i].start; |
| 859 | ec->resource[i].start = 0; | 858 | ec->resource[i].start = 0; |
| 860 | ec->resource[i].flags = 0; | 859 | ec->resource[i].flags = 0; |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index cc5145b28e7f..368d171754cf 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
| @@ -130,7 +130,9 @@ static const struct leds_evt_name evt_names[] = { | |||
| 130 | { "red", led_red_on, led_red_off }, | 130 | { "red", led_red_on, led_red_off }, |
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | static ssize_t leds_store(struct sys_device *dev, const char *buf, size_t size) | 133 | static ssize_t leds_store(struct sys_device *dev, |
| 134 | struct sysdev_attribute *attr, | ||
| 135 | const char *buf, size_t size) | ||
| 134 | { | 136 | { |
| 135 | int ret = -EINVAL, len = strcspn(buf, " "); | 137 | int ret = -EINVAL, len = strcspn(buf, " "); |
| 136 | 138 | ||
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 62e653a3ea1a..5a1588cf8242 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c | |||
| @@ -393,9 +393,7 @@ static int impd1_probe(struct lm_device *dev) | |||
| 393 | if (!d) | 393 | if (!d) |
| 394 | continue; | 394 | continue; |
| 395 | 395 | ||
| 396 | snprintf(d->dev.bus_id, sizeof(d->dev.bus_id), | 396 | dev_set_name(&d->dev, "lm%x:%5.5lx", dev->id, idev->offset >> 12); |
| 397 | "lm%x:%5.5lx", dev->id, idev->offset >> 12); | ||
| 398 | |||
| 399 | d->dev.parent = &dev->dev; | 397 | d->dev.parent = &dev->dev; |
| 400 | d->res.start = dev->resource.start + idev->offset; | 398 | d->res.start = dev->resource.start + idev->offset; |
| 401 | d->res.end = d->res.start + SZ_4K - 1; | 399 | d->res.end = d->res.start + SZ_4K - 1; |
| @@ -407,8 +405,7 @@ static int impd1_probe(struct lm_device *dev) | |||
| 407 | 405 | ||
| 408 | ret = amba_device_register(d, &dev->resource); | 406 | ret = amba_device_register(d, &dev->resource); |
| 409 | if (ret) { | 407 | if (ret) { |
| 410 | printk("unable to register device %s: %d\n", | 408 | dev_err(&d->dev, "unable to register device: %d\n"); |
| 411 | d->dev.bus_id, ret); | ||
| 412 | kfree(d); | 409 | kfree(d); |
| 413 | } | 410 | } |
| 414 | } | 411 | } |
diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c index 622cdc4212dd..f939c5091405 100644 --- a/arch/arm/mach-integrator/lm.c +++ b/arch/arm/mach-integrator/lm.c | |||
| @@ -81,8 +81,10 @@ int lm_device_register(struct lm_device *dev) | |||
| 81 | dev->dev.release = lm_device_release; | 81 | dev->dev.release = lm_device_release; |
| 82 | dev->dev.bus = &lm_bustype; | 82 | dev->dev.bus = &lm_bustype; |
| 83 | 83 | ||
| 84 | snprintf(dev->dev.bus_id, sizeof(dev->dev.bus_id), "lm%d", dev->id); | 84 | ret = dev_set_name(&dev->dev, "lm%d", dev->id); |
| 85 | dev->resource.name = dev->dev.bus_id; | 85 | if (ret) |
| 86 | return ret; | ||
| 87 | dev->resource.name = dev_name(&dev->dev); | ||
| 86 | 88 | ||
| 87 | ret = request_resource(&iomem_resource, &dev->resource); | 89 | ret = request_resource(&iomem_resource, &dev->resource); |
| 88 | if (ret == 0) { | 90 | if (ret == 0) { |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 6f33f58bca45..ff1413eae0b8 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
| @@ -334,7 +334,7 @@ static int omap_mbox_init(struct omap_mbox *mbox) | |||
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | mbox->dev.class = &omap_mbox_class; | 336 | mbox->dev.class = &omap_mbox_class; |
| 337 | strlcpy(mbox->dev.bus_id, mbox->name, KOBJ_NAME_LEN); | 337 | dev_set_name(&mbox->dev, "%s", mbox->name); |
| 338 | dev_set_drvdata(&mbox->dev, mbox); | 338 | dev_set_drvdata(&mbox->dev, mbox); |
| 339 | 339 | ||
| 340 | ret = device_register(&mbox->dev); | 340 | ret = device_register(&mbox->dev); |
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c index b8409caeb23d..e84faffbbeca 100644 --- a/arch/avr32/kernel/cpu.c +++ b/arch/avr32/kernel/cpu.c | |||
| @@ -26,14 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
| 26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be | 26 | * XXX: If/when a SMP-capable implementation of AVR32 will ever be |
| 27 | * made, we must make sure that the code executes on the correct CPU. | 27 | * made, we must make sure that the code executes on the correct CPU. |
| 28 | */ | 28 | */ |
| 29 | static ssize_t show_pc0event(struct sys_device *dev, char *buf) | 29 | static ssize_t show_pc0event(struct sys_device *dev, |
| 30 | struct sysdev_attribute *attr, char *buf) | ||
| 30 | { | 31 | { |
| 31 | unsigned long pccr; | 32 | unsigned long pccr; |
| 32 | 33 | ||
| 33 | pccr = sysreg_read(PCCR); | 34 | pccr = sysreg_read(PCCR); |
| 34 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); | 35 | return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); |
| 35 | } | 36 | } |
| 36 | static ssize_t store_pc0event(struct sys_device *dev, const char *buf, | 37 | static ssize_t store_pc0event(struct sys_device *dev, |
| 38 | struct sysdev_attribute *attr, const char *buf, | ||
| 37 | size_t count) | 39 | size_t count) |
| 38 | { | 40 | { |
| 39 | unsigned long val; | 41 | unsigned long val; |
| @@ -46,15 +48,17 @@ static ssize_t store_pc0event(struct sys_device *dev, const char *buf, | |||
| 46 | sysreg_write(PCCR, val); | 48 | sysreg_write(PCCR, val); |
| 47 | return count; | 49 | return count; |
| 48 | } | 50 | } |
| 49 | static ssize_t show_pc0count(struct sys_device *dev, char *buf) | 51 | static ssize_t show_pc0count(struct sys_device *dev, |
| 52 | struct sysdev_attribute *attr, char *buf) | ||
| 50 | { | 53 | { |
| 51 | unsigned long pcnt0; | 54 | unsigned long pcnt0; |
| 52 | 55 | ||
| 53 | pcnt0 = sysreg_read(PCNT0); | 56 | pcnt0 = sysreg_read(PCNT0); |
| 54 | return sprintf(buf, "%lu\n", pcnt0); | 57 | return sprintf(buf, "%lu\n", pcnt0); |
| 55 | } | 58 | } |
| 56 | static ssize_t store_pc0count(struct sys_device *dev, const char *buf, | 59 | static ssize_t store_pc0count(struct sys_device *dev, |
| 57 | size_t count) | 60 | struct sysdev_attribute *attr, |
| 61 | const char *buf, size_t count) | ||
| 58 | { | 62 | { |
| 59 | unsigned long val; | 63 | unsigned long val; |
| 60 | char *endp; | 64 | char *endp; |
| @@ -67,14 +71,16 @@ static ssize_t store_pc0count(struct sys_device *dev, const char *buf, | |||
| 67 | return count; | 71 | return count; |
| 68 | } | 72 | } |
| 69 | 73 | ||
| 70 | static ssize_t show_pc1event(struct sys_device *dev, char *buf) | 74 | static ssize_t show_pc1event(struct sys_device *dev, |
| 75 | struct sysdev_attribute *attr, char *buf) | ||
| 71 | { | 76 | { |
| 72 | unsigned long pccr; | 77 | unsigned long pccr; |
| 73 | 78 | ||
| 74 | pccr = sysreg_read(PCCR); | 79 | pccr = sysreg_read(PCCR); |
| 75 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); | 80 | return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); |
| 76 | } | 81 | } |
| 77 | static ssize_t store_pc1event(struct sys_device *dev, const char *buf, | 82 | static ssize_t store_pc1event(struct sys_device *dev, |
| 83 | struct sysdev_attribute *attr, const char *buf, | ||
| 78 | size_t count) | 84 | size_t count) |
| 79 | { | 85 | { |
| 80 | unsigned long val; | 86 | unsigned long val; |
| @@ -87,14 +93,16 @@ static ssize_t store_pc1event(struct sys_device *dev, const char *buf, | |||
| 87 | sysreg_write(PCCR, val); | 93 | sysreg_write(PCCR, val); |
| 88 | return count; | 94 | return count; |
| 89 | } | 95 | } |
| 90 | static ssize_t show_pc1count(struct sys_device *dev, char *buf) | 96 | static ssize_t show_pc1count(struct sys_device *dev, |
| 97 | struct sysdev_attribute *attr, char *buf) | ||
| 91 | { | 98 | { |
| 92 | unsigned long pcnt1; | 99 | unsigned long pcnt1; |
| 93 | 100 | ||
| 94 | pcnt1 = sysreg_read(PCNT1); | 101 | pcnt1 = sysreg_read(PCNT1); |
| 95 | return sprintf(buf, "%lu\n", pcnt1); | 102 | return sprintf(buf, "%lu\n", pcnt1); |
| 96 | } | 103 | } |
| 97 | static ssize_t store_pc1count(struct sys_device *dev, const char *buf, | 104 | static ssize_t store_pc1count(struct sys_device *dev, |
| 105 | struct sysdev_attribute *attr, const char *buf, | ||
| 98 | size_t count) | 106 | size_t count) |
| 99 | { | 107 | { |
| 100 | unsigned long val; | 108 | unsigned long val; |
| @@ -108,14 +116,16 @@ static ssize_t store_pc1count(struct sys_device *dev, const char *buf, | |||
| 108 | return count; | 116 | return count; |
| 109 | } | 117 | } |
| 110 | 118 | ||
| 111 | static ssize_t show_pccycles(struct sys_device *dev, char *buf) | 119 | static ssize_t show_pccycles(struct sys_device *dev, |
| 120 | struct sysdev_attribute *attr, char *buf) | ||
| 112 | { | 121 | { |
| 113 | unsigned long pccnt; | 122 | unsigned long pccnt; |
| 114 | 123 | ||
| 115 | pccnt = sysreg_read(PCCNT); | 124 | pccnt = sysreg_read(PCCNT); |
| 116 | return sprintf(buf, "%lu\n", pccnt); | 125 | return sprintf(buf, "%lu\n", pccnt); |
| 117 | } | 126 | } |
| 118 | static ssize_t store_pccycles(struct sys_device *dev, const char *buf, | 127 | static ssize_t store_pccycles(struct sys_device *dev, |
| 128 | struct sysdev_attribute *attr, const char *buf, | ||
| 119 | size_t count) | 129 | size_t count) |
| 120 | { | 130 | { |
| 121 | unsigned long val; | 131 | unsigned long val; |
| @@ -129,14 +139,16 @@ static ssize_t store_pccycles(struct sys_device *dev, const char *buf, | |||
| 129 | return count; | 139 | return count; |
| 130 | } | 140 | } |
| 131 | 141 | ||
| 132 | static ssize_t show_pcenable(struct sys_device *dev, char *buf) | 142 | static ssize_t show_pcenable(struct sys_device *dev, |
| 143 | struct sysdev_attribute *attr, char *buf) | ||
| 133 | { | 144 | { |
| 134 | unsigned long pccr; | 145 | unsigned long pccr; |
| 135 | 146 | ||
| 136 | pccr = sysreg_read(PCCR); | 147 | pccr = sysreg_read(PCCR); |
| 137 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); | 148 | return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); |
| 138 | } | 149 | } |
| 139 | static ssize_t store_pcenable(struct sys_device *dev, const char *buf, | 150 | static ssize_t store_pcenable(struct sys_device *dev, |
| 151 | struct sysdev_attribute *attr, const char *buf, | ||
| 140 | size_t count) | 152 | size_t count) |
| 141 | { | 153 | { |
| 142 | unsigned long pccr, val; | 154 | unsigned long pccr, val; |
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index b642648cc2ac..c539c689493b 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c | |||
| @@ -55,7 +55,8 @@ static u64 resources[NR_CPUS]; | |||
| 55 | 55 | ||
| 56 | #define show(name) \ | 56 | #define show(name) \ |
| 57 | static ssize_t \ | 57 | static ssize_t \ |
| 58 | show_##name(struct sys_device *dev, char *buf) \ | 58 | show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
| 59 | char *buf) \ | ||
| 59 | { \ | 60 | { \ |
| 60 | u32 cpu=dev->id; \ | 61 | u32 cpu=dev->id; \ |
| 61 | return sprintf(buf, "%lx\n", name[cpu]); \ | 62 | return sprintf(buf, "%lx\n", name[cpu]); \ |
| @@ -63,7 +64,8 @@ show_##name(struct sys_device *dev, char *buf) \ | |||
| 63 | 64 | ||
| 64 | #define store(name) \ | 65 | #define store(name) \ |
| 65 | static ssize_t \ | 66 | static ssize_t \ |
| 66 | store_##name(struct sys_device *dev, const char *buf, size_t size) \ | 67 | store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
| 68 | const char *buf, size_t size) \ | ||
| 67 | { \ | 69 | { \ |
| 68 | unsigned int cpu=dev->id; \ | 70 | unsigned int cpu=dev->id; \ |
| 69 | name[cpu] = simple_strtoull(buf, NULL, 16); \ | 71 | name[cpu] = simple_strtoull(buf, NULL, 16); \ |
| @@ -76,7 +78,8 @@ show(call_start) | |||
| 76 | * processor. The cpu number in driver is only used for storing data. | 78 | * processor. The cpu number in driver is only used for storing data. |
| 77 | */ | 79 | */ |
| 78 | static ssize_t | 80 | static ssize_t |
| 79 | store_call_start(struct sys_device *dev, const char *buf, size_t size) | 81 | store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, |
| 82 | const char *buf, size_t size) | ||
| 80 | { | 83 | { |
| 81 | unsigned int cpu=dev->id; | 84 | unsigned int cpu=dev->id; |
| 82 | unsigned long call_start = simple_strtoull(buf, NULL, 16); | 85 | unsigned long call_start = simple_strtoull(buf, NULL, 16); |
| @@ -124,14 +127,16 @@ show(err_type_info) | |||
| 124 | store(err_type_info) | 127 | store(err_type_info) |
| 125 | 128 | ||
| 126 | static ssize_t | 129 | static ssize_t |
| 127 | show_virtual_to_phys(struct sys_device *dev, char *buf) | 130 | show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
| 131 | char *buf) | ||
| 128 | { | 132 | { |
| 129 | unsigned int cpu=dev->id; | 133 | unsigned int cpu=dev->id; |
| 130 | return sprintf(buf, "%lx\n", phys_addr[cpu]); | 134 | return sprintf(buf, "%lx\n", phys_addr[cpu]); |
| 131 | } | 135 | } |
| 132 | 136 | ||
| 133 | static ssize_t | 137 | static ssize_t |
| 134 | store_virtual_to_phys(struct sys_device *dev, const char *buf, size_t size) | 138 | store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
| 139 | const char *buf, size_t size) | ||
| 135 | { | 140 | { |
| 136 | unsigned int cpu=dev->id; | 141 | unsigned int cpu=dev->id; |
| 137 | u64 virt_addr=simple_strtoull(buf, NULL, 16); | 142 | u64 virt_addr=simple_strtoull(buf, NULL, 16); |
| @@ -154,7 +159,8 @@ show(err_struct_info) | |||
| 154 | store(err_struct_info) | 159 | store(err_struct_info) |
| 155 | 160 | ||
| 156 | static ssize_t | 161 | static ssize_t |
| 157 | show_err_data_buffer(struct sys_device *dev, char *buf) | 162 | show_err_data_buffer(struct sys_device *dev, |
| 163 | struct sysdev_attribute *attr, char *buf) | ||
| 158 | { | 164 | { |
| 159 | unsigned int cpu=dev->id; | 165 | unsigned int cpu=dev->id; |
| 160 | 166 | ||
| @@ -165,7 +171,9 @@ show_err_data_buffer(struct sys_device *dev, char *buf) | |||
| 165 | } | 171 | } |
| 166 | 172 | ||
| 167 | static ssize_t | 173 | static ssize_t |
| 168 | store_err_data_buffer(struct sys_device *dev, const char *buf, size_t size) | 174 | store_err_data_buffer(struct sys_device *dev, |
| 175 | struct sysdev_attribute *attr, | ||
| 176 | const char *buf, size_t size) | ||
| 169 | { | 177 | { |
| 170 | unsigned int cpu=dev->id; | 178 | unsigned int cpu=dev->id; |
| 171 | int ret; | 179 | int ret; |
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c index b55641961232..dfd868b68364 100644 --- a/arch/mips/kernel/rtlx.c +++ b/arch/mips/kernel/rtlx.c | |||
| @@ -522,8 +522,8 @@ static int __init rtlx_module_init(void) | |||
| 522 | atomic_set(&channel_wqs[i].in_open, 0); | 522 | atomic_set(&channel_wqs[i].in_open, 0); |
| 523 | mutex_init(&channel_wqs[i].mutex); | 523 | mutex_init(&channel_wqs[i].mutex); |
| 524 | 524 | ||
| 525 | dev = device_create(mt_class, NULL, MKDEV(major, i), | 525 | dev = device_create_drvdata(mt_class, NULL, MKDEV(major, i), |
| 526 | "%s%d", module_name, i); | 526 | NULL, "%s%d", module_name, i); |
| 527 | if (IS_ERR(dev)) { | 527 | if (IS_ERR(dev)) { |
| 528 | err = PTR_ERR(dev); | 528 | err = PTR_ERR(dev); |
| 529 | goto out_chrdev; | 529 | goto out_chrdev; |
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c index 28b012ab8dcb..66e3e3fb311f 100644 --- a/arch/mips/sibyte/common/sb_tbprof.c +++ b/arch/mips/sibyte/common/sb_tbprof.c | |||
| @@ -576,7 +576,8 @@ static int __init sbprof_tb_init(void) | |||
| 576 | 576 | ||
| 577 | tb_class = tbc; | 577 | tb_class = tbc; |
| 578 | 578 | ||
| 579 | dev = device_create(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), "tb"); | 579 | dev = device_create_drvdata(tbc, NULL, MKDEV(SBPROF_TB_MAJOR, 0), |
| 580 | NULL, "tb"); | ||
| 580 | if (IS_ERR(dev)) { | 581 | if (IS_ERR(dev)) { |
| 581 | err = PTR_ERR(dev); | 582 | err = PTR_ERR(dev); |
| 582 | goto out_class; | 583 | goto out_class; |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index c8127f832df0..aba0ba95f062 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
| @@ -28,7 +28,9 @@ static DEFINE_PER_CPU(struct cpu, cpu_devices); | |||
| 28 | /* Time in microseconds we delay before sleeping in the idle loop */ | 28 | /* Time in microseconds we delay before sleeping in the idle loop */ |
| 29 | DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; | 29 | DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; |
| 30 | 30 | ||
| 31 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, const char *buf, | 31 | static ssize_t store_smt_snooze_delay(struct sys_device *dev, |
| 32 | struct sysdev_attribute *attr, | ||
| 33 | const char *buf, | ||
| 32 | size_t count) | 34 | size_t count) |
| 33 | { | 35 | { |
| 34 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 36 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| @@ -44,7 +46,9 @@ static ssize_t store_smt_snooze_delay(struct sys_device *dev, const char *buf, | |||
| 44 | return count; | 46 | return count; |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, char *buf) | 49 | static ssize_t show_smt_snooze_delay(struct sys_device *dev, |
| 50 | struct sysdev_attribute *attr, | ||
| 51 | char *buf) | ||
| 48 | { | 52 | { |
| 49 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 53 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| 50 | 54 | ||
| @@ -152,14 +156,17 @@ static unsigned long write_##NAME(unsigned long val) \ | |||
| 152 | mtspr(ADDRESS, val); \ | 156 | mtspr(ADDRESS, val); \ |
| 153 | return 0; \ | 157 | return 0; \ |
| 154 | } \ | 158 | } \ |
| 155 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 159 | static ssize_t show_##NAME(struct sys_device *dev, \ |
| 160 | struct sysdev_attribute *attr, \ | ||
| 161 | char *buf) \ | ||
| 156 | { \ | 162 | { \ |
| 157 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 163 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ |
| 158 | unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ | 164 | unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ |
| 159 | return sprintf(buf, "%lx\n", val); \ | 165 | return sprintf(buf, "%lx\n", val); \ |
| 160 | } \ | 166 | } \ |
| 161 | static ssize_t __used \ | 167 | static ssize_t __used \ |
| 162 | store_##NAME(struct sys_device *dev, const char *buf, size_t count) \ | 168 | store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ |
| 169 | const char *buf, size_t count) \ | ||
| 163 | { \ | 170 | { \ |
| 164 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ | 171 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ |
| 165 | unsigned long val; \ | 172 | unsigned long val; \ |
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 4852bf312d83..4d4c8c169124 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
| @@ -97,7 +97,8 @@ static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iom | |||
| 97 | return value.spe[spu->spe_id]; | 97 | return value.spe[spu->spe_id]; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) | 100 | static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, |
| 101 | char *buf) | ||
| 101 | { | 102 | { |
| 102 | u8 value; | 103 | u8 value; |
| 103 | struct cbe_pmd_regs __iomem *pmd_regs; | 104 | struct cbe_pmd_regs __iomem *pmd_regs; |
| @@ -146,32 +147,38 @@ static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char | |||
| 146 | return size; | 147 | return size; |
| 147 | } | 148 | } |
| 148 | 149 | ||
| 149 | static ssize_t spu_show_throttle_end(struct sys_device *sysdev, char *buf) | 150 | static ssize_t spu_show_throttle_end(struct sys_device *sysdev, |
| 151 | struct sysdev_attribute *attr, char *buf) | ||
| 150 | { | 152 | { |
| 151 | return show_throttle(get_pmd_regs(sysdev), buf, 0); | 153 | return show_throttle(get_pmd_regs(sysdev), buf, 0); |
| 152 | } | 154 | } |
| 153 | 155 | ||
| 154 | static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, char *buf) | 156 | static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, |
| 157 | struct sysdev_attribute *attr, char *buf) | ||
| 155 | { | 158 | { |
| 156 | return show_throttle(get_pmd_regs(sysdev), buf, 8); | 159 | return show_throttle(get_pmd_regs(sysdev), buf, 8); |
| 157 | } | 160 | } |
| 158 | 161 | ||
| 159 | static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | 162 | static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, |
| 163 | struct sysdev_attribute *attr, char *buf) | ||
| 160 | { | 164 | { |
| 161 | return show_throttle(get_pmd_regs(sysdev), buf, 16); | 165 | return show_throttle(get_pmd_regs(sysdev), buf, 16); |
| 162 | } | 166 | } |
| 163 | 167 | ||
| 164 | static ssize_t spu_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | 168 | static ssize_t spu_store_throttle_end(struct sys_device *sysdev, |
| 169 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 165 | { | 170 | { |
| 166 | return store_throttle(get_pmd_regs(sysdev), buf, size, 0); | 171 | return store_throttle(get_pmd_regs(sysdev), buf, size, 0); |
| 167 | } | 172 | } |
| 168 | 173 | ||
| 169 | static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | 174 | static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, |
| 175 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 170 | { | 176 | { |
| 171 | return store_throttle(get_pmd_regs(sysdev), buf, size, 8); | 177 | return store_throttle(get_pmd_regs(sysdev), buf, size, 8); |
| 172 | } | 178 | } |
| 173 | 179 | ||
| 174 | static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | 180 | static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, |
| 181 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 175 | { | 182 | { |
| 176 | return store_throttle(get_pmd_regs(sysdev), buf, size, 16); | 183 | return store_throttle(get_pmd_regs(sysdev), buf, size, 16); |
| 177 | } | 184 | } |
| @@ -192,43 +199,51 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) | |||
| 192 | 199 | ||
| 193 | /* shows the temperature of the DTS on the PPE, | 200 | /* shows the temperature of the DTS on the PPE, |
| 194 | * located near the linear thermal sensor */ | 201 | * located near the linear thermal sensor */ |
| 195 | static ssize_t ppe_show_temp0(struct sys_device *sysdev, char *buf) | 202 | static ssize_t ppe_show_temp0(struct sys_device *sysdev, |
| 203 | struct sysdev_attribute *attr, char *buf) | ||
| 196 | { | 204 | { |
| 197 | return ppe_show_temp(sysdev, buf, 32); | 205 | return ppe_show_temp(sysdev, buf, 32); |
| 198 | } | 206 | } |
| 199 | 207 | ||
| 200 | /* shows the temperature of the second DTS on the PPE */ | 208 | /* shows the temperature of the second DTS on the PPE */ |
| 201 | static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf) | 209 | static ssize_t ppe_show_temp1(struct sys_device *sysdev, |
| 210 | struct sysdev_attribute *attr, char *buf) | ||
| 202 | { | 211 | { |
| 203 | return ppe_show_temp(sysdev, buf, 0); | 212 | return ppe_show_temp(sysdev, buf, 0); |
| 204 | } | 213 | } |
| 205 | 214 | ||
| 206 | static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, char *buf) | 215 | static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, |
| 216 | struct sysdev_attribute *attr, char *buf) | ||
| 207 | { | 217 | { |
| 208 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); | 218 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); |
| 209 | } | 219 | } |
| 210 | 220 | ||
| 211 | static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, char *buf) | 221 | static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, |
| 222 | struct sysdev_attribute *attr, char *buf) | ||
| 212 | { | 223 | { |
| 213 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); | 224 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); |
| 214 | } | 225 | } |
| 215 | 226 | ||
| 216 | static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | 227 | static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, |
| 228 | struct sysdev_attribute *attr, char *buf) | ||
| 217 | { | 229 | { |
| 218 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); | 230 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); |
| 219 | } | 231 | } |
| 220 | 232 | ||
| 221 | static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | 233 | static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, |
| 234 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 222 | { | 235 | { |
| 223 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); | 236 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); |
| 224 | } | 237 | } |
| 225 | 238 | ||
| 226 | static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | 239 | static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, |
| 240 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 227 | { | 241 | { |
| 228 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); | 242 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); |
| 229 | } | 243 | } |
| 230 | 244 | ||
| 231 | static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | 245 | static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, |
| 246 | struct sysdev_attribute *attr, const char *buf, size_t size) | ||
| 232 | { | 247 | { |
| 233 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); | 248 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); |
| 234 | } | 249 | } |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 78f905bc6a42..a5bdb89a17c3 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
| @@ -703,7 +703,8 @@ static unsigned long long spu_acct_time(struct spu *spu, | |||
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | 705 | ||
| 706 | static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf) | 706 | static ssize_t spu_stat_show(struct sys_device *sysdev, |
| 707 | struct sysdev_attribute *attr, char *buf) | ||
| 707 | { | 708 | { |
| 708 | struct spu *spu = container_of(sysdev, struct spu, sysdev); | 709 | struct spu *spu = container_of(sysdev, struct spu, sysdev); |
| 709 | 710 | ||
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index 609c46db4a1b..768c262b9368 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
| @@ -367,7 +367,7 @@ static void chrp_pci_fixup_vt8231_ata(struct pci_dev *viaide) | |||
| 367 | viaisa = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); | 367 | viaisa = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, NULL); |
| 368 | if (!viaisa) | 368 | if (!viaisa) |
| 369 | return; | 369 | return; |
| 370 | printk("Fixing VIA IDE, force legacy mode on '%s'\n", viaide->dev.bus_id); | 370 | dev_info(&viaide->dev, "Fixing VIA IDE, force legacy mode on\n"); |
| 371 | 371 | ||
| 372 | pci_read_config_byte(viaide, PCI_CLASS_PROG, &progif); | 372 | pci_read_config_byte(viaide, PCI_CLASS_PROG, &progif); |
| 373 | pci_write_config_byte(viaide, PCI_CLASS_PROG, progif & ~0x5); | 373 | pci_write_config_byte(viaide, PCI_CLASS_PROG, progif & ~0x5); |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index b6781030cfbd..b795b3e24afd 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
| @@ -864,7 +864,8 @@ int setup_profiling_timer(unsigned int multiplier) | |||
| 864 | } | 864 | } |
| 865 | 865 | ||
| 866 | #ifdef CONFIG_HOTPLUG_CPU | 866 | #ifdef CONFIG_HOTPLUG_CPU |
| 867 | static ssize_t cpu_configure_show(struct sys_device *dev, char *buf) | 867 | static ssize_t cpu_configure_show(struct sys_device *dev, |
| 868 | struct sysdev_attribute *attr, char *buf) | ||
| 868 | { | 869 | { |
| 869 | ssize_t count; | 870 | ssize_t count; |
| 870 | 871 | ||
| @@ -874,8 +875,9 @@ static ssize_t cpu_configure_show(struct sys_device *dev, char *buf) | |||
| 874 | return count; | 875 | return count; |
| 875 | } | 876 | } |
| 876 | 877 | ||
| 877 | static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf, | 878 | static ssize_t cpu_configure_store(struct sys_device *dev, |
| 878 | size_t count) | 879 | struct sysdev_attribute *attr, |
| 880 | const char *buf, size_t count) | ||
| 879 | { | 881 | { |
| 880 | int cpu = dev->id; | 882 | int cpu = dev->id; |
| 881 | int val, rc; | 883 | int val, rc; |
| @@ -922,7 +924,8 @@ out: | |||
| 922 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); | 924 | static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); |
| 923 | #endif /* CONFIG_HOTPLUG_CPU */ | 925 | #endif /* CONFIG_HOTPLUG_CPU */ |
| 924 | 926 | ||
| 925 | static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf) | 927 | static ssize_t cpu_polarization_show(struct sys_device *dev, |
| 928 | struct sysdev_attribute *attr, char *buf) | ||
| 926 | { | 929 | { |
| 927 | int cpu = dev->id; | 930 | int cpu = dev->id; |
| 928 | ssize_t count; | 931 | ssize_t count; |
| @@ -950,7 +953,8 @@ static ssize_t cpu_polarization_show(struct sys_device *dev, char *buf) | |||
| 950 | } | 953 | } |
| 951 | static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); | 954 | static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); |
| 952 | 955 | ||
| 953 | static ssize_t show_cpu_address(struct sys_device *dev, char *buf) | 956 | static ssize_t show_cpu_address(struct sys_device *dev, |
| 957 | struct sysdev_attribute *attr, char *buf) | ||
| 954 | { | 958 | { |
| 955 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); | 959 | return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); |
| 956 | } | 960 | } |
| @@ -970,7 +974,8 @@ static struct attribute_group cpu_common_attr_group = { | |||
| 970 | .attrs = cpu_common_attrs, | 974 | .attrs = cpu_common_attrs, |
| 971 | }; | 975 | }; |
| 972 | 976 | ||
| 973 | static ssize_t show_capability(struct sys_device *dev, char *buf) | 977 | static ssize_t show_capability(struct sys_device *dev, |
| 978 | struct sysdev_attribute *attr, char *buf) | ||
| 974 | { | 979 | { |
| 975 | unsigned int capability; | 980 | unsigned int capability; |
| 976 | int rc; | 981 | int rc; |
| @@ -982,7 +987,8 @@ static ssize_t show_capability(struct sys_device *dev, char *buf) | |||
| 982 | } | 987 | } |
| 983 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); | 988 | static SYSDEV_ATTR(capability, 0444, show_capability, NULL); |
| 984 | 989 | ||
| 985 | static ssize_t show_idle_count(struct sys_device *dev, char *buf) | 990 | static ssize_t show_idle_count(struct sys_device *dev, |
| 991 | struct sysdev_attribute *attr, char *buf) | ||
| 986 | { | 992 | { |
| 987 | struct s390_idle_data *idle; | 993 | struct s390_idle_data *idle; |
| 988 | unsigned long long idle_count; | 994 | unsigned long long idle_count; |
| @@ -995,7 +1001,8 @@ static ssize_t show_idle_count(struct sys_device *dev, char *buf) | |||
| 995 | } | 1001 | } |
| 996 | static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); | 1002 | static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); |
| 997 | 1003 | ||
| 998 | static ssize_t show_idle_time(struct sys_device *dev, char *buf) | 1004 | static ssize_t show_idle_time(struct sys_device *dev, |
| 1005 | struct sysdev_attribute *attr, char *buf) | ||
| 999 | { | 1006 | { |
| 1000 | struct s390_idle_data *idle; | 1007 | struct s390_idle_data *idle; |
| 1001 | unsigned long long new_time; | 1008 | unsigned long long new_time; |
| @@ -1112,7 +1119,9 @@ out: | |||
| 1112 | return rc; | 1119 | return rc; |
| 1113 | } | 1120 | } |
| 1114 | 1121 | ||
| 1115 | static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, | 1122 | static ssize_t __ref rescan_store(struct sys_device *dev, |
| 1123 | struct sysdev_attribute *attr, | ||
| 1124 | const char *buf, | ||
| 1116 | size_t count) | 1125 | size_t count) |
| 1117 | { | 1126 | { |
| 1118 | int rc; | 1127 | int rc; |
| @@ -1123,7 +1132,9 @@ static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf, | |||
| 1123 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); | 1132 | static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store); |
| 1124 | #endif /* CONFIG_HOTPLUG_CPU */ | 1133 | #endif /* CONFIG_HOTPLUG_CPU */ |
| 1125 | 1134 | ||
| 1126 | static ssize_t dispatching_show(struct sys_device *dev, char *buf) | 1135 | static ssize_t dispatching_show(struct sys_device *dev, |
| 1136 | struct sysdev_attribute *attr, | ||
| 1137 | char *buf) | ||
| 1127 | { | 1138 | { |
| 1128 | ssize_t count; | 1139 | ssize_t count; |
| 1129 | 1140 | ||
| @@ -1133,8 +1144,9 @@ static ssize_t dispatching_show(struct sys_device *dev, char *buf) | |||
| 1133 | return count; | 1144 | return count; |
| 1134 | } | 1145 | } |
| 1135 | 1146 | ||
| 1136 | static ssize_t dispatching_store(struct sys_device *dev, const char *buf, | 1147 | static ssize_t dispatching_store(struct sys_device *dev, |
| 1137 | size_t count) | 1148 | struct sysdev_attribute *attr, |
| 1149 | const char *buf, size_t count) | ||
| 1138 | { | 1150 | { |
| 1139 | int val, rc; | 1151 | int val, rc; |
| 1140 | char delim; | 1152 | char delim; |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index f2cede3947b2..ab70d9bd9261 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
| @@ -1100,7 +1100,9 @@ static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) | |||
| 1100 | return etr_port1_online ? &etr_port1 : NULL; | 1100 | return etr_port1_online ? &etr_port1 : NULL; |
| 1101 | } | 1101 | } |
| 1102 | 1102 | ||
| 1103 | static ssize_t etr_online_show(struct sys_device *dev, char *buf) | 1103 | static ssize_t etr_online_show(struct sys_device *dev, |
| 1104 | struct sysdev_attribute *attr, | ||
| 1105 | char *buf) | ||
| 1104 | { | 1106 | { |
| 1105 | unsigned int online; | 1107 | unsigned int online; |
| 1106 | 1108 | ||
| @@ -1109,7 +1111,8 @@ static ssize_t etr_online_show(struct sys_device *dev, char *buf) | |||
| 1109 | } | 1111 | } |
| 1110 | 1112 | ||
| 1111 | static ssize_t etr_online_store(struct sys_device *dev, | 1113 | static ssize_t etr_online_store(struct sys_device *dev, |
| 1112 | const char *buf, size_t count) | 1114 | struct sysdev_attribute *attr, |
| 1115 | const char *buf, size_t count) | ||
| 1113 | { | 1116 | { |
| 1114 | unsigned int value; | 1117 | unsigned int value; |
| 1115 | 1118 | ||
| @@ -1136,7 +1139,9 @@ static ssize_t etr_online_store(struct sys_device *dev, | |||
| 1136 | 1139 | ||
| 1137 | static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); | 1140 | static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); |
| 1138 | 1141 | ||
| 1139 | static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf) | 1142 | static ssize_t etr_stepping_control_show(struct sys_device *dev, |
| 1143 | struct sysdev_attribute *attr, | ||
| 1144 | char *buf) | ||
| 1140 | { | 1145 | { |
| 1141 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? | 1146 | return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? |
| 1142 | etr_eacr.e0 : etr_eacr.e1); | 1147 | etr_eacr.e0 : etr_eacr.e1); |
| @@ -1144,7 +1149,8 @@ static ssize_t etr_stepping_control_show(struct sys_device *dev, char *buf) | |||
| 1144 | 1149 | ||
| 1145 | static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); | 1150 | static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); |
| 1146 | 1151 | ||
| 1147 | static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf) | 1152 | static ssize_t etr_mode_code_show(struct sys_device *dev, |
| 1153 | struct sysdev_attribute *attr, char *buf) | ||
| 1148 | { | 1154 | { |
| 1149 | if (!etr_port0_online && !etr_port1_online) | 1155 | if (!etr_port0_online && !etr_port1_online) |
| 1150 | /* Status word is not uptodate if both ports are offline. */ | 1156 | /* Status word is not uptodate if both ports are offline. */ |
| @@ -1155,7 +1161,8 @@ static ssize_t etr_mode_code_show(struct sys_device *dev, char *buf) | |||
| 1155 | 1161 | ||
| 1156 | static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); | 1162 | static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); |
| 1157 | 1163 | ||
| 1158 | static ssize_t etr_untuned_show(struct sys_device *dev, char *buf) | 1164 | static ssize_t etr_untuned_show(struct sys_device *dev, |
| 1165 | struct sysdev_attribute *attr, char *buf) | ||
| 1159 | { | 1166 | { |
| 1160 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1167 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1161 | 1168 | ||
| @@ -1166,7 +1173,8 @@ static ssize_t etr_untuned_show(struct sys_device *dev, char *buf) | |||
| 1166 | 1173 | ||
| 1167 | static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); | 1174 | static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); |
| 1168 | 1175 | ||
| 1169 | static ssize_t etr_network_id_show(struct sys_device *dev, char *buf) | 1176 | static ssize_t etr_network_id_show(struct sys_device *dev, |
| 1177 | struct sysdev_attribute *attr, char *buf) | ||
| 1170 | { | 1178 | { |
| 1171 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1179 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1172 | 1180 | ||
| @@ -1177,7 +1185,8 @@ static ssize_t etr_network_id_show(struct sys_device *dev, char *buf) | |||
| 1177 | 1185 | ||
| 1178 | static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); | 1186 | static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); |
| 1179 | 1187 | ||
| 1180 | static ssize_t etr_id_show(struct sys_device *dev, char *buf) | 1188 | static ssize_t etr_id_show(struct sys_device *dev, |
| 1189 | struct sysdev_attribute *attr, char *buf) | ||
| 1181 | { | 1190 | { |
| 1182 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1191 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1183 | 1192 | ||
| @@ -1188,7 +1197,8 @@ static ssize_t etr_id_show(struct sys_device *dev, char *buf) | |||
| 1188 | 1197 | ||
| 1189 | static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); | 1198 | static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); |
| 1190 | 1199 | ||
| 1191 | static ssize_t etr_port_number_show(struct sys_device *dev, char *buf) | 1200 | static ssize_t etr_port_number_show(struct sys_device *dev, |
| 1201 | struct sysdev_attribute *attr, char *buf) | ||
| 1192 | { | 1202 | { |
| 1193 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1203 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1194 | 1204 | ||
| @@ -1199,7 +1209,8 @@ static ssize_t etr_port_number_show(struct sys_device *dev, char *buf) | |||
| 1199 | 1209 | ||
| 1200 | static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); | 1210 | static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); |
| 1201 | 1211 | ||
| 1202 | static ssize_t etr_coupled_show(struct sys_device *dev, char *buf) | 1212 | static ssize_t etr_coupled_show(struct sys_device *dev, |
| 1213 | struct sysdev_attribute *attr, char *buf) | ||
| 1203 | { | 1214 | { |
| 1204 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1215 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1205 | 1216 | ||
| @@ -1210,7 +1221,8 @@ static ssize_t etr_coupled_show(struct sys_device *dev, char *buf) | |||
| 1210 | 1221 | ||
| 1211 | static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); | 1222 | static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); |
| 1212 | 1223 | ||
| 1213 | static ssize_t etr_local_time_show(struct sys_device *dev, char *buf) | 1224 | static ssize_t etr_local_time_show(struct sys_device *dev, |
| 1225 | struct sysdev_attribute *attr, char *buf) | ||
| 1214 | { | 1226 | { |
| 1215 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1227 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1216 | 1228 | ||
| @@ -1221,7 +1233,8 @@ static ssize_t etr_local_time_show(struct sys_device *dev, char *buf) | |||
| 1221 | 1233 | ||
| 1222 | static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); | 1234 | static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); |
| 1223 | 1235 | ||
| 1224 | static ssize_t etr_utc_offset_show(struct sys_device *dev, char *buf) | 1236 | static ssize_t etr_utc_offset_show(struct sys_device *dev, |
| 1237 | struct sysdev_attribute *attr, char *buf) | ||
| 1225 | { | 1238 | { |
| 1226 | struct etr_aib *aib = etr_aib_from_dev(dev); | 1239 | struct etr_aib *aib = etr_aib_from_dev(dev); |
| 1227 | 1240 | ||
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c index 51b57c0d1a3c..347ee11351ec 100644 --- a/arch/sh/drivers/dma/dma-sysfs.c +++ b/arch/sh/drivers/dma/dma-sysfs.c | |||
| @@ -23,7 +23,8 @@ static struct sysdev_class dma_sysclass = { | |||
| 23 | }; | 23 | }; |
| 24 | EXPORT_SYMBOL(dma_sysclass); | 24 | EXPORT_SYMBOL(dma_sysclass); |
| 25 | 25 | ||
| 26 | static ssize_t dma_show_devices(struct sys_device *dev, char *buf) | 26 | static ssize_t dma_show_devices(struct sys_device *dev, |
| 27 | struct sysdev_attribute *attr, char *buf) | ||
| 27 | { | 28 | { |
| 28 | ssize_t len = 0; | 29 | ssize_t len = 0; |
| 29 | int i; | 30 | int i; |
| @@ -57,13 +58,15 @@ static int __init dma_sysclass_init(void) | |||
| 57 | } | 58 | } |
| 58 | postcore_initcall(dma_sysclass_init); | 59 | postcore_initcall(dma_sysclass_init); |
| 59 | 60 | ||
| 60 | static ssize_t dma_show_dev_id(struct sys_device *dev, char *buf) | 61 | static ssize_t dma_show_dev_id(struct sys_device *dev, |
| 62 | struct sysdev_attribute *attr, char *buf) | ||
| 61 | { | 63 | { |
| 62 | struct dma_channel *channel = to_dma_channel(dev); | 64 | struct dma_channel *channel = to_dma_channel(dev); |
| 63 | return sprintf(buf, "%s\n", channel->dev_id); | 65 | return sprintf(buf, "%s\n", channel->dev_id); |
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | static ssize_t dma_store_dev_id(struct sys_device *dev, | 68 | static ssize_t dma_store_dev_id(struct sys_device *dev, |
| 69 | struct sysdev_attribute *attr, | ||
| 67 | const char *buf, size_t count) | 70 | const char *buf, size_t count) |
| 68 | { | 71 | { |
| 69 | struct dma_channel *channel = to_dma_channel(dev); | 72 | struct dma_channel *channel = to_dma_channel(dev); |
| @@ -74,6 +77,7 @@ static ssize_t dma_store_dev_id(struct sys_device *dev, | |||
| 74 | static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); | 77 | static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); |
| 75 | 78 | ||
| 76 | static ssize_t dma_store_config(struct sys_device *dev, | 79 | static ssize_t dma_store_config(struct sys_device *dev, |
| 80 | struct sysdev_attribute *attr, | ||
| 77 | const char *buf, size_t count) | 81 | const char *buf, size_t count) |
| 78 | { | 82 | { |
| 79 | struct dma_channel *channel = to_dma_channel(dev); | 83 | struct dma_channel *channel = to_dma_channel(dev); |
| @@ -87,13 +91,15 @@ static ssize_t dma_store_config(struct sys_device *dev, | |||
| 87 | 91 | ||
| 88 | static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); | 92 | static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); |
| 89 | 93 | ||
| 90 | static ssize_t dma_show_mode(struct sys_device *dev, char *buf) | 94 | static ssize_t dma_show_mode(struct sys_device *dev, |
| 95 | struct sysdev_attribute *attr, char *buf) | ||
| 91 | { | 96 | { |
| 92 | struct dma_channel *channel = to_dma_channel(dev); | 97 | struct dma_channel *channel = to_dma_channel(dev); |
| 93 | return sprintf(buf, "0x%08x\n", channel->mode); | 98 | return sprintf(buf, "0x%08x\n", channel->mode); |
| 94 | } | 99 | } |
| 95 | 100 | ||
| 96 | static ssize_t dma_store_mode(struct sys_device *dev, | 101 | static ssize_t dma_store_mode(struct sys_device *dev, |
| 102 | struct sysdev_attribute *attr, | ||
| 97 | const char *buf, size_t count) | 103 | const char *buf, size_t count) |
| 98 | { | 104 | { |
| 99 | struct dma_channel *channel = to_dma_channel(dev); | 105 | struct dma_channel *channel = to_dma_channel(dev); |
| @@ -104,7 +110,8 @@ static ssize_t dma_store_mode(struct sys_device *dev, | |||
| 104 | static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); | 110 | static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); |
| 105 | 111 | ||
| 106 | #define dma_ro_attr(field, fmt) \ | 112 | #define dma_ro_attr(field, fmt) \ |
| 107 | static ssize_t dma_show_##field(struct sys_device *dev, char *buf) \ | 113 | static ssize_t dma_show_##field(struct sys_device *dev, \ |
| 114 | struct sysdev_attribute *attr, char *buf)\ | ||
| 108 | { \ | 115 | { \ |
| 109 | struct dma_channel *channel = to_dma_channel(dev); \ | 116 | struct dma_channel *channel = to_dma_channel(dev); \ |
| 110 | return sprintf(buf, fmt, channel->field); \ | 117 | return sprintf(buf, fmt, channel->field); \ |
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c index c49d0388b793..4d58d7ce708d 100644 --- a/arch/sparc64/kernel/ebus.c +++ b/arch/sparc64/kernel/ebus.c | |||
| @@ -401,7 +401,7 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de | |||
| 401 | dev->ofdev.node = dp; | 401 | dev->ofdev.node = dp; |
| 402 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; | 402 | dev->ofdev.dev.parent = &dev->bus->ofdev.dev; |
| 403 | dev->ofdev.dev.bus = &ebus_bus_type; | 403 | dev->ofdev.dev.bus = &ebus_bus_type; |
| 404 | sprintf(dev->ofdev.dev.bus_id, "ebus[%08x]", dp->node); | 404 | dev_set_name(&dev->ofdev.dev, "ebus[%08x]", dp->node); |
| 405 | 405 | ||
| 406 | /* Register with core */ | 406 | /* Register with core */ |
| 407 | if (of_device_register(&dev->ofdev) != 0) | 407 | if (of_device_register(&dev->ofdev) != 0) |
| @@ -501,7 +501,7 @@ void __init ebus_init(void) | |||
| 501 | ebus->ofdev.node = dp; | 501 | ebus->ofdev.node = dp; |
| 502 | ebus->ofdev.dev.parent = &pdev->dev; | 502 | ebus->ofdev.dev.parent = &pdev->dev; |
| 503 | ebus->ofdev.dev.bus = &ebus_bus_type; | 503 | ebus->ofdev.dev.bus = &ebus_bus_type; |
| 504 | sprintf(ebus->ofdev.dev.bus_id, "ebus%d", num_ebus); | 504 | dev_set_name(&ebus->ofdev.dev, "ebus%d", num_ebus); |
| 505 | 505 | ||
| 506 | /* Register with core */ | 506 | /* Register with core */ |
| 507 | if (of_device_register(&ebus->ofdev) != 0) | 507 | if (of_device_register(&ebus->ofdev) != 0) |
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index d569f60c24b8..4fd48ab7dda4 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
| @@ -797,9 +797,9 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
| 797 | op->dev.parent = parent; | 797 | op->dev.parent = parent; |
| 798 | op->dev.bus = &of_platform_bus_type; | 798 | op->dev.bus = &of_platform_bus_type; |
| 799 | if (!parent) | 799 | if (!parent) |
| 800 | strcpy(op->dev.bus_id, "root"); | 800 | dev_set_name(&op->dev, "root"); |
| 801 | else | 801 | else |
| 802 | sprintf(op->dev.bus_id, "%08x", dp->node); | 802 | dev_set_name(&op->dev, "%08x", dp->node); |
| 803 | 803 | ||
| 804 | if (of_device_register(op)) { | 804 | if (of_device_register(op)) { |
| 805 | printk("%s: Could not register of device.\n", | 805 | printk("%s: Could not register of device.\n", |
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index d00a3656c287..55096195458f 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c | |||
| @@ -408,7 +408,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, | |||
| 408 | dev->class = class >> 8; | 408 | dev->class = class >> 8; |
| 409 | dev->revision = class & 0xff; | 409 | dev->revision = class & 0xff; |
| 410 | 410 | ||
| 411 | sprintf(dev->dev.bus_id, "%04x:%02x:%02x.%d", pci_domain_nr(bus), | 411 | dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus), |
| 412 | dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); | 412 | dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
| 413 | 413 | ||
| 414 | if (ofpci_verbose) | 414 | if (ofpci_verbose) |
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c index e885034a6b73..84e5ce146713 100644 --- a/arch/sparc64/kernel/sysfs.c +++ b/arch/sparc64/kernel/sysfs.c | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); | 14 | static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); |
| 15 | 15 | ||
| 16 | #define SHOW_MMUSTAT_ULONG(NAME) \ | 16 | #define SHOW_MMUSTAT_ULONG(NAME) \ |
| 17 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 17 | static ssize_t show_##NAME(struct sys_device *dev, \ |
| 18 | struct sysdev_attribute *attr, char *buf) \ | ||
| 18 | { \ | 19 | { \ |
| 19 | struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ | 20 | struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ |
| 20 | return sprintf(buf, "%lu\n", p->NAME); \ | 21 | return sprintf(buf, "%lu\n", p->NAME); \ |
| @@ -135,13 +136,16 @@ static unsigned long write_mmustat_enable(unsigned long val) | |||
| 135 | return sun4v_mmustat_conf(ra, &orig_ra); | 136 | return sun4v_mmustat_conf(ra, &orig_ra); |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 138 | static ssize_t show_mmustat_enable(struct sys_device *s, char *buf) | 139 | static ssize_t show_mmustat_enable(struct sys_device *s, |
| 140 | struct sysdev_attribute *attr, char *buf) | ||
| 139 | { | 141 | { |
| 140 | unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); | 142 | unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); |
| 141 | return sprintf(buf, "%lx\n", val); | 143 | return sprintf(buf, "%lx\n", val); |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count) | 146 | static ssize_t store_mmustat_enable(struct sys_device *s, |
| 147 | struct sysdev_attribute *attr, const char *buf, | ||
| 148 | size_t count) | ||
| 145 | { | 149 | { |
| 146 | unsigned long val, err; | 150 | unsigned long val, err; |
| 147 | int ret = sscanf(buf, "%ld", &val); | 151 | int ret = sscanf(buf, "%ld", &val); |
| @@ -179,14 +183,16 @@ static void unregister_mmu_stats(struct sys_device *s) | |||
| 179 | #endif | 183 | #endif |
| 180 | 184 | ||
| 181 | #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ | 185 | #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ |
| 182 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 186 | static ssize_t show_##NAME(struct sys_device *dev, \ |
| 187 | struct sysdev_attribute *attr, char *buf) \ | ||
| 183 | { \ | 188 | { \ |
| 184 | cpuinfo_sparc *c = &cpu_data(dev->id); \ | 189 | cpuinfo_sparc *c = &cpu_data(dev->id); \ |
| 185 | return sprintf(buf, "%lu\n", c->MEMBER); \ | 190 | return sprintf(buf, "%lu\n", c->MEMBER); \ |
| 186 | } | 191 | } |
| 187 | 192 | ||
| 188 | #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ | 193 | #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ |
| 189 | static ssize_t show_##NAME(struct sys_device *dev, char *buf) \ | 194 | static ssize_t show_##NAME(struct sys_device *dev, \ |
| 195 | struct sysdev_attribute *attr, char *buf) \ | ||
| 190 | { \ | 196 | { \ |
| 191 | cpuinfo_sparc *c = &cpu_data(dev->id); \ | 197 | cpuinfo_sparc *c = &cpu_data(dev->id); \ |
| 192 | return sprintf(buf, "%u\n", c->MEMBER); \ | 198 | return sprintf(buf, "%u\n", c->MEMBER); \ |
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc64/kernel/vio.c index e78b3517940b..a490077891a4 100644 --- a/arch/sparc64/kernel/vio.c +++ b/arch/sparc64/kernel/vio.c | |||
| @@ -224,7 +224,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
| 224 | if (!strcmp(type, "domain-services-port")) | 224 | if (!strcmp(type, "domain-services-port")) |
| 225 | bus_id_name = "ds"; | 225 | bus_id_name = "ds"; |
| 226 | 226 | ||
| 227 | if (strlen(bus_id_name) >= KOBJ_NAME_LEN - 4) { | 227 | if (strlen(bus_id_name) >= BUS_ID_SIZE - 4) { |
| 228 | printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n", | 228 | printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n", |
| 229 | bus_id_name); | 229 | bus_id_name); |
| 230 | return NULL; | 230 | return NULL; |
| @@ -260,16 +260,14 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
| 260 | vio_fill_channel_info(hp, mp, vdev); | 260 | vio_fill_channel_info(hp, mp, vdev); |
| 261 | 261 | ||
| 262 | if (!id) { | 262 | if (!id) { |
| 263 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s", | 263 | dev_set_name(&vdev->dev, "%s", bus_id_name); |
| 264 | bus_id_name); | ||
| 265 | vdev->dev_no = ~(u64)0; | 264 | vdev->dev_no = ~(u64)0; |
| 266 | } else if (!cfg_handle) { | 265 | } else if (!cfg_handle) { |
| 267 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu", | 266 | dev_set_name(&vdev->dev, "%s-%lu", bus_id_name, *id); |
| 268 | bus_id_name, *id); | ||
| 269 | vdev->dev_no = *id; | 267 | vdev->dev_no = *id; |
| 270 | } else { | 268 | } else { |
| 271 | snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu-%lu", | 269 | dev_set_name(&vdev->dev, "%s-%lu-%lu", bus_id_name, |
| 272 | bus_id_name, *cfg_handle, *id); | 270 | *cfg_handle, *id); |
| 273 | vdev->dev_no = *cfg_handle; | 271 | vdev->dev_no = *cfg_handle; |
| 274 | } | 272 | } |
| 275 | 273 | ||
| @@ -292,12 +290,12 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
| 292 | } | 290 | } |
| 293 | vdev->dp = dp; | 291 | vdev->dp = dp; |
| 294 | 292 | ||
| 295 | printk(KERN_INFO "VIO: Adding device %s\n", vdev->dev.bus_id); | 293 | printk(KERN_INFO "VIO: Adding device %s\n", dev_name(&vdev->dev)); |
| 296 | 294 | ||
| 297 | err = device_register(&vdev->dev); | 295 | err = device_register(&vdev->dev); |
| 298 | if (err) { | 296 | if (err) { |
| 299 | printk(KERN_ERR "VIO: Could not register device %s, err=%d\n", | 297 | printk(KERN_ERR "VIO: Could not register device %s, err=%d\n", |
| 300 | vdev->dev.bus_id, err); | 298 | dev_name(&vdev->dev), err); |
| 301 | kfree(vdev); | 299 | kfree(vdev); |
| 302 | return NULL; | 300 | return NULL; |
| 303 | } | 301 | } |
| @@ -330,7 +328,7 @@ static void vio_remove(struct mdesc_handle *hp, u64 node) | |||
| 330 | dev = device_find_child(&root_vdev->dev, (void *) node, | 328 | dev = device_find_child(&root_vdev->dev, (void *) node, |
| 331 | vio_md_node_match); | 329 | vio_md_node_match); |
| 332 | if (dev) { | 330 | if (dev) { |
| 333 | printk(KERN_INFO "VIO: Removing device %s\n", dev->bus_id); | 331 | printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev)); |
| 334 | 332 | ||
| 335 | device_unregister(dev); | 333 | device_unregister(dev); |
| 336 | } | 334 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index c4a7ec31394c..9ab65be82427 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
| @@ -762,10 +762,14 @@ DEFINE_PER_CPU(struct sys_device, device_mce); | |||
| 762 | 762 | ||
| 763 | /* Why are there no generic functions for this? */ | 763 | /* Why are there no generic functions for this? */ |
| 764 | #define ACCESSOR(name, var, start) \ | 764 | #define ACCESSOR(name, var, start) \ |
| 765 | static ssize_t show_ ## name(struct sys_device *s, char *buf) { \ | 765 | static ssize_t show_ ## name(struct sys_device *s, \ |
| 766 | struct sysdev_attribute *attr, \ | ||
| 767 | char *buf) { \ | ||
| 766 | return sprintf(buf, "%lx\n", (unsigned long)var); \ | 768 | return sprintf(buf, "%lx\n", (unsigned long)var); \ |
| 767 | } \ | 769 | } \ |
| 768 | static ssize_t set_ ## name(struct sys_device *s,const char *buf,size_t siz) { \ | 770 | static ssize_t set_ ## name(struct sys_device *s, \ |
| 771 | struct sysdev_attribute *attr, \ | ||
| 772 | const char *buf, size_t siz) { \ | ||
| 769 | char *end; \ | 773 | char *end; \ |
| 770 | unsigned long new = simple_strtoul(buf, &end, 0); \ | 774 | unsigned long new = simple_strtoul(buf, &end, 0); \ |
| 771 | if (end == buf) return -EINVAL; \ | 775 | if (end == buf) return -EINVAL; \ |
| @@ -786,14 +790,16 @@ ACCESSOR(bank3ctl,bank[3],mce_restart()) | |||
| 786 | ACCESSOR(bank4ctl,bank[4],mce_restart()) | 790 | ACCESSOR(bank4ctl,bank[4],mce_restart()) |
| 787 | ACCESSOR(bank5ctl,bank[5],mce_restart()) | 791 | ACCESSOR(bank5ctl,bank[5],mce_restart()) |
| 788 | 792 | ||
| 789 | static ssize_t show_trigger(struct sys_device *s, char *buf) | 793 | static ssize_t show_trigger(struct sys_device *s, struct sysdev_attribute *attr, |
| 794 | char *buf) | ||
| 790 | { | 795 | { |
| 791 | strcpy(buf, trigger); | 796 | strcpy(buf, trigger); |
| 792 | strcat(buf, "\n"); | 797 | strcat(buf, "\n"); |
| 793 | return strlen(trigger) + 1; | 798 | return strlen(trigger) + 1; |
| 794 | } | 799 | } |
| 795 | 800 | ||
| 796 | static ssize_t set_trigger(struct sys_device *s,const char *buf,size_t siz) | 801 | static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, |
| 802 | const char *buf,size_t siz) | ||
| 797 | { | 803 | { |
| 798 | char *p; | 804 | char *p; |
| 799 | int len; | 805 | int len; |
| @@ -806,12 +812,12 @@ static ssize_t set_trigger(struct sys_device *s,const char *buf,size_t siz) | |||
| 806 | } | 812 | } |
| 807 | 813 | ||
| 808 | static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); | 814 | static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); |
| 809 | ACCESSOR(tolerant,tolerant,) | 815 | static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); |
| 810 | ACCESSOR(check_interval,check_interval,mce_restart()) | 816 | ACCESSOR(check_interval,check_interval,mce_restart()) |
| 811 | static struct sysdev_attribute *mce_attributes[] = { | 817 | static struct sysdev_attribute *mce_attributes[] = { |
| 812 | &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl, | 818 | &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl, |
| 813 | &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl, | 819 | &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl, |
| 814 | &attr_tolerant, &attr_check_interval, &attr_trigger, | 820 | &attr_tolerant.attr, &attr_check_interval, &attr_trigger, |
| 815 | NULL | 821 | NULL |
| 816 | }; | 822 | }; |
| 817 | 823 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 1f4cc48c14c6..d5ae2243f0b9 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
| @@ -35,6 +35,7 @@ atomic_t therm_throt_en = ATOMIC_INIT(0); | |||
| 35 | 35 | ||
| 36 | #define define_therm_throt_sysdev_show_func(name) \ | 36 | #define define_therm_throt_sysdev_show_func(name) \ |
| 37 | static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \ | 37 | static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \ |
| 38 | struct sysdev_attribute *attr, \ | ||
| 38 | char *buf) \ | 39 | char *buf) \ |
| 39 | { \ | 40 | { \ |
| 40 | unsigned int cpu = dev->id; \ | 41 | unsigned int cpu = dev->id; \ |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 2de5fa2bbf77..14b11b3be31c 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
| @@ -141,8 +141,8 @@ static __cpuinit int cpuid_device_create(int cpu) | |||
| 141 | { | 141 | { |
| 142 | struct device *dev; | 142 | struct device *dev; |
| 143 | 143 | ||
| 144 | dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), | 144 | dev = device_create_drvdata(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu), |
| 145 | "cpu%d", cpu); | 145 | NULL, "cpu%d", cpu); |
| 146 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | 146 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 147 | } | 147 | } |
| 148 | 148 | ||
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 56b933119a04..fc4790638b69 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c | |||
| @@ -644,7 +644,9 @@ static void microcode_fini_cpu(int cpu) | |||
| 644 | mutex_unlock(µcode_mutex); | 644 | mutex_unlock(µcode_mutex); |
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | 647 | static ssize_t reload_store(struct sys_device *dev, |
| 648 | struct sysdev_attribute *attr, | ||
| 649 | const char *buf, size_t sz) | ||
| 648 | { | 650 | { |
| 649 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 651 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 650 | char *end; | 652 | char *end; |
| @@ -674,14 +676,16 @@ static ssize_t reload_store(struct sys_device *dev, const char *buf, size_t sz) | |||
| 674 | return sz; | 676 | return sz; |
| 675 | } | 677 | } |
| 676 | 678 | ||
| 677 | static ssize_t version_show(struct sys_device *dev, char *buf) | 679 | static ssize_t version_show(struct sys_device *dev, |
| 680 | struct sysdev_attribute *attr, char *buf) | ||
| 678 | { | 681 | { |
| 679 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 682 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 680 | 683 | ||
| 681 | return sprintf(buf, "0x%x\n", uci->rev); | 684 | return sprintf(buf, "0x%x\n", uci->rev); |
| 682 | } | 685 | } |
| 683 | 686 | ||
| 684 | static ssize_t pf_show(struct sys_device *dev, char *buf) | 687 | static ssize_t pf_show(struct sys_device *dev, |
| 688 | struct sysdev_attribute *attr, char *buf) | ||
| 685 | { | 689 | { |
| 686 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; | 690 | struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; |
| 687 | 691 | ||
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index a153b3905f60..9fd809552447 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
| @@ -149,8 +149,8 @@ static int __cpuinit msr_device_create(int cpu) | |||
| 149 | { | 149 | { |
| 150 | struct device *dev; | 150 | struct device *dev; |
| 151 | 151 | ||
| 152 | dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu), | 152 | dev = device_create_drvdata(msr_class, NULL, MKDEV(MSR_MAJOR, cpu), |
| 153 | "msr%d", cpu); | 153 | NULL, "msr%d", cpu); |
| 154 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | 154 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| 155 | } | 155 | } |
| 156 | 156 | ||
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index a4213c00dffc..cbecb05551bb 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
| @@ -314,8 +314,7 @@ int dma_supported(struct device *dev, u64 mask) | |||
| 314 | { | 314 | { |
| 315 | #ifdef CONFIG_PCI | 315 | #ifdef CONFIG_PCI |
| 316 | if (mask > 0xffffffff && forbid_dac > 0) { | 316 | if (mask > 0xffffffff && forbid_dac > 0) { |
| 317 | printk(KERN_INFO "PCI: Disallowing DAC for device %s\n", | 317 | dev_info(dev, "PCI: Disallowing DAC for device\n"); |
| 318 | dev->bus_id); | ||
| 319 | return 0; | 318 | return 0; |
| 320 | } | 319 | } |
| 321 | #endif | 320 | #endif |
| @@ -342,8 +341,7 @@ int dma_supported(struct device *dev, u64 mask) | |||
| 342 | type. Normally this doesn't make any difference, but gives | 341 | type. Normally this doesn't make any difference, but gives |
| 343 | more gentle handling of IOMMU overflow. */ | 342 | more gentle handling of IOMMU overflow. */ |
| 344 | if (iommu_sac_force && (mask >= DMA_40BIT_MASK)) { | 343 | if (iommu_sac_force && (mask >= DMA_40BIT_MASK)) { |
| 345 | printk(KERN_INFO "%s: Force SAC with mask %Lx\n", | 344 | dev_info(dev, "Force SAC with mask %Lx\n", mask); |
| 346 | dev->bus_id, mask); | ||
| 347 | return 0; | 345 | return 0; |
| 348 | } | 346 | } |
| 349 | 347 | ||
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index be60961f8695..df5f142657d2 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
| @@ -198,9 +198,7 @@ static void iommu_full(struct device *dev, size_t size, int dir) | |||
| 198 | * out. Hopefully no network devices use single mappings that big. | 198 | * out. Hopefully no network devices use single mappings that big. |
| 199 | */ | 199 | */ |
| 200 | 200 | ||
| 201 | printk(KERN_ERR | 201 | dev_err(dev, "PCI-DMA: Out of IOMMU space for %lu bytes\n", size); |
| 202 | "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n", | ||
| 203 | size, dev->bus_id); | ||
| 204 | 202 | ||
| 205 | if (size > PAGE_SIZE*EMERGENCY_PAGES) { | 203 | if (size > PAGE_SIZE*EMERGENCY_PAGES) { |
| 206 | if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) | 204 | if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) |
diff --git a/block/bsg.c b/block/bsg.c index 5fb9b0bdbe85..5a68b09a69ba 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
| @@ -1044,7 +1044,8 @@ int bsg_register_queue(struct request_queue *q, struct device *parent, | |||
| 1044 | bcd->release = release; | 1044 | bcd->release = release; |
| 1045 | kref_init(&bcd->ref); | 1045 | kref_init(&bcd->ref); |
| 1046 | dev = MKDEV(bsg_major, bcd->minor); | 1046 | dev = MKDEV(bsg_major, bcd->minor); |
| 1047 | class_dev = device_create(bsg_class, parent, dev, "%s", devname); | 1047 | class_dev = device_create_drvdata(bsg_class, parent, dev, NULL, |
| 1048 | "%s", devname); | ||
| 1048 | if (IS_ERR(class_dev)) { | 1049 | if (IS_ERR(class_dev)) { |
| 1049 | ret = PTR_ERR(class_dev); | 1050 | ret = PTR_ERR(class_dev); |
| 1050 | goto put_dev; | 1051 | goto put_dev; |
diff --git a/block/genhd.c b/block/genhd.c index 9074f384b097..c13cc77291af 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
| @@ -183,6 +183,7 @@ static int exact_lock(dev_t devt, void *data) | |||
| 183 | void add_disk(struct gendisk *disk) | 183 | void add_disk(struct gendisk *disk) |
| 184 | { | 184 | { |
| 185 | struct backing_dev_info *bdi; | 185 | struct backing_dev_info *bdi; |
| 186 | int retval; | ||
| 186 | 187 | ||
| 187 | disk->flags |= GENHD_FL_UP; | 188 | disk->flags |= GENHD_FL_UP; |
| 188 | blk_register_region(MKDEV(disk->major, disk->first_minor), | 189 | blk_register_region(MKDEV(disk->major, disk->first_minor), |
| @@ -193,7 +194,8 @@ void add_disk(struct gendisk *disk) | |||
| 193 | 194 | ||
| 194 | bdi = &disk->queue->backing_dev_info; | 195 | bdi = &disk->queue->backing_dev_info; |
| 195 | bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor)); | 196 | bdi_register_dev(bdi, MKDEV(disk->major, disk->first_minor)); |
| 196 | sysfs_create_link(&disk->dev.kobj, &bdi->dev->kobj, "bdi"); | 197 | retval = sysfs_create_link(&disk->dev.kobj, &bdi->dev->kobj, "bdi"); |
| 198 | WARN_ON(retval); | ||
| 197 | } | 199 | } |
| 198 | 200 | ||
| 199 | EXPORT_SYMBOL(add_disk); | 201 | EXPORT_SYMBOL(add_disk); |
| @@ -225,89 +227,111 @@ struct gendisk *get_gendisk(dev_t devt, int *part) | |||
| 225 | } | 227 | } |
| 226 | 228 | ||
| 227 | /* | 229 | /* |
| 228 | * print a full list of all partitions - intended for places where the root | 230 | * print a partitions - intended for places where the root filesystem can't be |
| 229 | * filesystem can't be mounted and thus to give the victim some idea of what | 231 | * mounted and thus to give the victim some idea of what went wrong |
| 230 | * went wrong | ||
| 231 | */ | 232 | */ |
| 232 | void __init printk_all_partitions(void) | 233 | static int printk_partition(struct device *dev, void *data) |
| 233 | { | 234 | { |
| 234 | struct device *dev; | ||
| 235 | struct gendisk *sgp; | 235 | struct gendisk *sgp; |
| 236 | char buf[BDEVNAME_SIZE]; | 236 | char buf[BDEVNAME_SIZE]; |
| 237 | int n; | 237 | int n; |
| 238 | 238 | ||
| 239 | mutex_lock(&block_class_lock); | 239 | if (dev->type != &disk_type) |
| 240 | /* For each block device... */ | 240 | goto exit; |
| 241 | list_for_each_entry(dev, &block_class.devices, node) { | ||
| 242 | if (dev->type != &disk_type) | ||
| 243 | continue; | ||
| 244 | sgp = dev_to_disk(dev); | ||
| 245 | /* | ||
| 246 | * Don't show empty devices or things that have been surpressed | ||
| 247 | */ | ||
| 248 | if (get_capacity(sgp) == 0 || | ||
| 249 | (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) | ||
| 250 | continue; | ||
| 251 | 241 | ||
| 252 | /* | 242 | sgp = dev_to_disk(dev); |
| 253 | * Note, unlike /proc/partitions, I am showing the numbers in | 243 | /* |
| 254 | * hex - the same format as the root= option takes. | 244 | * Don't show empty devices or things that have been surpressed |
| 255 | */ | 245 | */ |
| 256 | printk("%02x%02x %10llu %s", | 246 | if (get_capacity(sgp) == 0 || |
| 257 | sgp->major, sgp->first_minor, | 247 | (sgp->flags & GENHD_FL_SUPPRESS_PARTITION_INFO)) |
| 258 | (unsigned long long)get_capacity(sgp) >> 1, | 248 | goto exit; |
| 259 | disk_name(sgp, 0, buf)); | 249 | |
| 260 | if (sgp->driverfs_dev != NULL && | 250 | /* |
| 261 | sgp->driverfs_dev->driver != NULL) | 251 | * Note, unlike /proc/partitions, I am showing the numbers in |
| 262 | printk(" driver: %s\n", | 252 | * hex - the same format as the root= option takes. |
| 263 | sgp->driverfs_dev->driver->name); | 253 | */ |
| 264 | else | 254 | printk("%02x%02x %10llu %s", |
| 265 | printk(" (driver?)\n"); | 255 | sgp->major, sgp->first_minor, |
| 266 | 256 | (unsigned long long)get_capacity(sgp) >> 1, | |
| 267 | /* now show the partitions */ | 257 | disk_name(sgp, 0, buf)); |
| 268 | for (n = 0; n < sgp->minors - 1; ++n) { | 258 | if (sgp->driverfs_dev != NULL && |
| 269 | if (sgp->part[n] == NULL) | 259 | sgp->driverfs_dev->driver != NULL) |
| 270 | continue; | 260 | printk(" driver: %s\n", |
| 271 | if (sgp->part[n]->nr_sects == 0) | 261 | sgp->driverfs_dev->driver->name); |
| 272 | continue; | 262 | else |
| 273 | printk(" %02x%02x %10llu %s\n", | 263 | printk(" (driver?)\n"); |
| 274 | sgp->major, n + 1 + sgp->first_minor, | 264 | |
| 275 | (unsigned long long)sgp->part[n]->nr_sects >> 1, | 265 | /* now show the partitions */ |
| 276 | disk_name(sgp, n + 1, buf)); | 266 | for (n = 0; n < sgp->minors - 1; ++n) { |
| 277 | } | 267 | if (sgp->part[n] == NULL) |
| 268 | goto exit; | ||
| 269 | if (sgp->part[n]->nr_sects == 0) | ||
| 270 | goto exit; | ||
| 271 | printk(" %02x%02x %10llu %s\n", | ||
| 272 | sgp->major, n + 1 + sgp->first_minor, | ||
| 273 | (unsigned long long)sgp->part[n]->nr_sects >> 1, | ||
| 274 | disk_name(sgp, n + 1, buf)); | ||
| 278 | } | 275 | } |
| 276 | exit: | ||
| 277 | return 0; | ||
| 278 | } | ||
| 279 | 279 | ||
| 280 | /* | ||
| 281 | * print a full list of all partitions - intended for places where the root | ||
| 282 | * filesystem can't be mounted and thus to give the victim some idea of what | ||
| 283 | * went wrong | ||
| 284 | */ | ||
| 285 | void __init printk_all_partitions(void) | ||
| 286 | { | ||
| 287 | mutex_lock(&block_class_lock); | ||
| 288 | class_for_each_device(&block_class, NULL, NULL, printk_partition); | ||
| 280 | mutex_unlock(&block_class_lock); | 289 | mutex_unlock(&block_class_lock); |
| 281 | } | 290 | } |
| 282 | 291 | ||
| 283 | #ifdef CONFIG_PROC_FS | 292 | #ifdef CONFIG_PROC_FS |
| 284 | /* iterator */ | 293 | /* iterator */ |
| 294 | static int find_start(struct device *dev, void *data) | ||
| 295 | { | ||
| 296 | loff_t k = *(loff_t *)data; | ||
| 297 | |||
| 298 | if (dev->type != &disk_type) | ||
| 299 | return 0; | ||
| 300 | if (!k--) | ||
| 301 | return 1; | ||
| 302 | return 0; | ||
| 303 | } | ||
| 304 | |||
| 285 | static void *part_start(struct seq_file *part, loff_t *pos) | 305 | static void *part_start(struct seq_file *part, loff_t *pos) |
| 286 | { | 306 | { |
| 287 | loff_t k = *pos; | ||
| 288 | struct device *dev; | 307 | struct device *dev; |
| 308 | loff_t n = *pos; | ||
| 309 | |||
| 310 | if (!n) | ||
| 311 | seq_puts(part, "major minor #blocks name\n\n"); | ||
| 289 | 312 | ||
| 290 | mutex_lock(&block_class_lock); | 313 | mutex_lock(&block_class_lock); |
| 291 | list_for_each_entry(dev, &block_class.devices, node) { | 314 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); |
| 292 | if (dev->type != &disk_type) | 315 | if (dev) |
| 293 | continue; | 316 | return dev_to_disk(dev); |
| 294 | if (!k--) | ||
| 295 | return dev_to_disk(dev); | ||
| 296 | } | ||
| 297 | return NULL; | 317 | return NULL; |
| 298 | } | 318 | } |
| 299 | 319 | ||
| 320 | static int find_next(struct device *dev, void *data) | ||
| 321 | { | ||
| 322 | if (dev->type == &disk_type) | ||
| 323 | return 1; | ||
| 324 | return 0; | ||
| 325 | } | ||
| 326 | |||
| 300 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) | 327 | static void *part_next(struct seq_file *part, void *v, loff_t *pos) |
| 301 | { | 328 | { |
| 302 | struct gendisk *gp = v; | 329 | struct gendisk *gp = v; |
| 303 | struct device *dev; | 330 | struct device *dev; |
| 304 | ++*pos; | 331 | ++*pos; |
| 305 | list_for_each_entry(dev, &gp->dev.node, node) { | 332 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
| 306 | if (&dev->node == &block_class.devices) | 333 | if (dev) |
| 307 | return NULL; | 334 | return dev_to_disk(dev); |
| 308 | if (dev->type == &disk_type) | ||
| 309 | return dev_to_disk(dev); | ||
| 310 | } | ||
| 311 | return NULL; | 335 | return NULL; |
| 312 | } | 336 | } |
| 313 | 337 | ||
| @@ -322,9 +346,6 @@ static int show_partition(struct seq_file *part, void *v) | |||
| 322 | int n; | 346 | int n; |
| 323 | char buf[BDEVNAME_SIZE]; | 347 | char buf[BDEVNAME_SIZE]; |
| 324 | 348 | ||
| 325 | if (&sgp->dev.node == block_class.devices.next) | ||
| 326 | seq_puts(part, "major minor #blocks name\n\n"); | ||
| 327 | |||
| 328 | /* Don't show non-partitionable removeable devices or empty devices */ | 349 | /* Don't show non-partitionable removeable devices or empty devices */ |
| 329 | if (!get_capacity(sgp) || | 350 | if (!get_capacity(sgp) || |
| 330 | (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) | 351 | (sgp->minors == 1 && (sgp->flags & GENHD_FL_REMOVABLE))) |
| @@ -370,7 +391,10 @@ static struct kobject *base_probe(dev_t devt, int *part, void *data) | |||
| 370 | 391 | ||
| 371 | static int __init genhd_device_init(void) | 392 | static int __init genhd_device_init(void) |
| 372 | { | 393 | { |
| 373 | int error = class_register(&block_class); | 394 | int error; |
| 395 | |||
| 396 | block_class.dev_kobj = sysfs_dev_block_kobj; | ||
| 397 | error = class_register(&block_class); | ||
| 374 | if (unlikely(error)) | 398 | if (unlikely(error)) |
| 375 | return error; | 399 | return error; |
| 376 | bdev_map = kobj_map_init(base_probe, &block_class_lock); | 400 | bdev_map = kobj_map_init(base_probe, &block_class_lock); |
| @@ -532,6 +556,7 @@ static struct device_type disk_type = { | |||
| 532 | .release = disk_release, | 556 | .release = disk_release, |
| 533 | }; | 557 | }; |
| 534 | 558 | ||
| 559 | #ifdef CONFIG_PROC_FS | ||
| 535 | /* | 560 | /* |
| 536 | * aggregate disk stat collector. Uses the same stats that the sysfs | 561 | * aggregate disk stat collector. Uses the same stats that the sysfs |
| 537 | * entries do, above, but makes them available through one seq_file. | 562 | * entries do, above, but makes them available through one seq_file. |
| @@ -542,16 +567,12 @@ static struct device_type disk_type = { | |||
| 542 | 567 | ||
| 543 | static void *diskstats_start(struct seq_file *part, loff_t *pos) | 568 | static void *diskstats_start(struct seq_file *part, loff_t *pos) |
| 544 | { | 569 | { |
| 545 | loff_t k = *pos; | ||
| 546 | struct device *dev; | 570 | struct device *dev; |
| 547 | 571 | ||
| 548 | mutex_lock(&block_class_lock); | 572 | mutex_lock(&block_class_lock); |
| 549 | list_for_each_entry(dev, &block_class.devices, node) { | 573 | dev = class_find_device(&block_class, NULL, (void *)pos, find_start); |
| 550 | if (dev->type != &disk_type) | 574 | if (dev) |
| 551 | continue; | 575 | return dev_to_disk(dev); |
| 552 | if (!k--) | ||
| 553 | return dev_to_disk(dev); | ||
| 554 | } | ||
| 555 | return NULL; | 576 | return NULL; |
| 556 | } | 577 | } |
| 557 | 578 | ||
| @@ -561,12 +582,9 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
| 561 | struct device *dev; | 582 | struct device *dev; |
| 562 | 583 | ||
| 563 | ++*pos; | 584 | ++*pos; |
| 564 | list_for_each_entry(dev, &gp->dev.node, node) { | 585 | dev = class_find_device(&block_class, &gp->dev, NULL, find_next); |
| 565 | if (&dev->node == &block_class.devices) | 586 | if (dev) |
| 566 | return NULL; | 587 | return dev_to_disk(dev); |
| 567 | if (dev->type == &disk_type) | ||
| 568 | return dev_to_disk(dev); | ||
| 569 | } | ||
| 570 | return NULL; | 588 | return NULL; |
| 571 | } | 589 | } |
| 572 | 590 | ||
| @@ -641,6 +659,7 @@ const struct seq_operations diskstats_op = { | |||
| 641 | .stop = diskstats_stop, | 659 | .stop = diskstats_stop, |
| 642 | .show = diskstats_show | 660 | .show = diskstats_show |
| 643 | }; | 661 | }; |
| 662 | #endif /* CONFIG_PROC_FS */ | ||
| 644 | 663 | ||
| 645 | static void media_change_notify_thread(struct work_struct *work) | 664 | static void media_change_notify_thread(struct work_struct *work) |
| 646 | { | 665 | { |
| @@ -665,24 +684,38 @@ void genhd_media_change_notify(struct gendisk *disk) | |||
| 665 | EXPORT_SYMBOL_GPL(genhd_media_change_notify); | 684 | EXPORT_SYMBOL_GPL(genhd_media_change_notify); |
| 666 | #endif /* 0 */ | 685 | #endif /* 0 */ |
| 667 | 686 | ||
| 687 | struct find_block { | ||
| 688 | const char *name; | ||
| 689 | int part; | ||
| 690 | }; | ||
| 691 | |||
| 692 | static int match_id(struct device *dev, void *data) | ||
| 693 | { | ||
| 694 | struct find_block *find = data; | ||
| 695 | |||
| 696 | if (dev->type != &disk_type) | ||
| 697 | return 0; | ||
| 698 | if (strcmp(dev->bus_id, find->name) == 0) { | ||
| 699 | struct gendisk *disk = dev_to_disk(dev); | ||
| 700 | if (find->part < disk->minors) | ||
| 701 | return 1; | ||
| 702 | } | ||
| 703 | return 0; | ||
| 704 | } | ||
| 705 | |||
| 668 | dev_t blk_lookup_devt(const char *name, int part) | 706 | dev_t blk_lookup_devt(const char *name, int part) |
| 669 | { | 707 | { |
| 670 | struct device *dev; | 708 | struct device *dev; |
| 671 | dev_t devt = MKDEV(0, 0); | 709 | dev_t devt = MKDEV(0, 0); |
| 710 | struct find_block find; | ||
| 672 | 711 | ||
| 673 | mutex_lock(&block_class_lock); | 712 | mutex_lock(&block_class_lock); |
| 674 | list_for_each_entry(dev, &block_class.devices, node) { | 713 | find.name = name; |
| 675 | if (dev->type != &disk_type) | 714 | find.part = part; |
| 676 | continue; | 715 | dev = class_find_device(&block_class, NULL, (void *)&find, match_id); |
| 677 | if (strcmp(dev->bus_id, name) == 0) { | 716 | if (dev) |
| 678 | struct gendisk *disk = dev_to_disk(dev); | 717 | devt = MKDEV(MAJOR(dev->devt), |
| 679 | 718 | MINOR(dev->devt) + part); | |
| 680 | if (part < disk->minors) | ||
| 681 | devt = MKDEV(MAJOR(dev->devt), | ||
| 682 | MINOR(dev->devt) + part); | ||
| 683 | break; | ||
| 684 | } | ||
| 685 | } | ||
| 686 | mutex_unlock(&block_class_lock); | 719 | mutex_unlock(&block_class_lock); |
| 687 | 720 | ||
| 688 | return devt; | 721 | return devt; |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 55c17afbe669..2655bc1b4eeb 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -263,22 +263,22 @@ static int acpi_fan_add(struct acpi_device *device) | |||
| 263 | goto end; | 263 | goto end; |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | printk(KERN_INFO PREFIX | 266 | dev_info(&device->dev, "registered as cooling_device%d\n", cdev->id); |
| 267 | "%s is registered as cooling_device%d\n", | ||
| 268 | device->dev.bus_id, cdev->id); | ||
| 269 | 267 | ||
| 270 | acpi_driver_data(device) = cdev; | 268 | acpi_driver_data(device) = cdev; |
| 271 | result = sysfs_create_link(&device->dev.kobj, | 269 | result = sysfs_create_link(&device->dev.kobj, |
| 272 | &cdev->device.kobj, | 270 | &cdev->device.kobj, |
| 273 | "thermal_cooling"); | 271 | "thermal_cooling"); |
| 274 | if (result) | 272 | if (result) |
| 275 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 273 | dev_err(&device->dev, "Failed to create sysfs link " |
| 274 | "'thermal_cooling'\n"); | ||
| 276 | 275 | ||
| 277 | result = sysfs_create_link(&cdev->device.kobj, | 276 | result = sysfs_create_link(&cdev->device.kobj, |
| 278 | &device->dev.kobj, | 277 | &device->dev.kobj, |
| 279 | "device"); | 278 | "device"); |
| 280 | if (result) | 279 | if (result) |
| 281 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 280 | dev_err(&device->dev, "Failed to create sysfs link " |
| 281 | "'device'\n"); | ||
| 282 | 282 | ||
| 283 | result = acpi_fan_add_fs(device); | 283 | result = acpi_fan_add_fs(device); |
| 284 | if (result) | 284 | if (result) |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 2f173e83f8a7..084109507c9f 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
| @@ -146,8 +146,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
| 146 | acpi_status status; | 146 | acpi_status status; |
| 147 | 147 | ||
| 148 | if (dev->archdata.acpi_handle) { | 148 | if (dev->archdata.acpi_handle) { |
| 149 | printk(KERN_WARNING PREFIX | 149 | dev_warn(dev, "Drivers changed 'acpi_handle'\n"); |
| 150 | "Drivers changed 'acpi_handle' for %s\n", dev->bus_id); | ||
| 151 | return -EINVAL; | 150 | return -EINVAL; |
| 152 | } | 151 | } |
| 153 | get_device(dev); | 152 | get_device(dev); |
| @@ -195,8 +194,7 @@ static int acpi_unbind_one(struct device *dev) | |||
| 195 | /* acpi_bind_one increase refcnt by one */ | 194 | /* acpi_bind_one increase refcnt by one */ |
| 196 | put_device(dev); | 195 | put_device(dev); |
| 197 | } else { | 196 | } else { |
| 198 | printk(KERN_ERR PREFIX | 197 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); |
| 199 | "Oops, 'acpi_handle' corrupt for %s\n", dev->bus_id); | ||
| 200 | } | 198 | } |
| 201 | return 0; | 199 | return 0; |
| 202 | } | 200 | } |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index ec0f2d581ece..e36422a7122c 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -714,9 +714,8 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
| 714 | goto end; | 714 | goto end; |
| 715 | } | 715 | } |
| 716 | 716 | ||
| 717 | printk(KERN_INFO PREFIX | 717 | dev_info(&device->dev, "registered as cooling_device%d\n", |
| 718 | "%s is registered as cooling_device%d\n", | 718 | pr->cdev->id); |
| 719 | device->dev.bus_id, pr->cdev->id); | ||
| 720 | 719 | ||
| 721 | result = sysfs_create_link(&device->dev.kobj, | 720 | result = sysfs_create_link(&device->dev.kobj, |
| 722 | &pr->cdev->device.kobj, | 721 | &pr->cdev->device.kobj, |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f3132aa47a69..f6f52c1a2aba 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -471,7 +471,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
| 471 | device->dev.release = &acpi_device_release; | 471 | device->dev.release = &acpi_device_release; |
| 472 | result = device_add(&device->dev); | 472 | result = device_add(&device->dev); |
| 473 | if(result) { | 473 | if(result) { |
| 474 | printk(KERN_ERR PREFIX "Error adding device %s", device->dev.bus_id); | 474 | dev_err(&device->dev, "Error adding device\n"); |
| 475 | goto end; | 475 | goto end; |
| 476 | } | 476 | } |
| 477 | 477 | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 84c795fb9b1e..30a341337933 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -1179,8 +1179,8 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
| 1179 | 1179 | ||
| 1180 | tz->tz_enabled = 1; | 1180 | tz->tz_enabled = 1; |
| 1181 | 1181 | ||
| 1182 | printk(KERN_INFO PREFIX "%s is registered as thermal_zone%d\n", | 1182 | dev_info(&tz->device->dev, "registered as thermal_zone%d\n", |
| 1183 | tz->device->dev.bus_id, tz->thermal_zone->id); | 1183 | tz->thermal_zone->id); |
| 1184 | return 0; | 1184 | return 0; |
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 64c889331f3b..37b9e16710d6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -762,9 +762,8 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
| 762 | if (IS_ERR(device->cdev)) | 762 | if (IS_ERR(device->cdev)) |
| 763 | return; | 763 | return; |
| 764 | 764 | ||
| 765 | printk(KERN_INFO PREFIX | 765 | dev_info(&device->dev->dev, "registered as cooling_device%d\n", |
| 766 | "%s is registered as cooling_device%d\n", | 766 | device->cdev->id); |
| 767 | device->dev->dev.bus_id, device->cdev->id); | ||
| 768 | result = sysfs_create_link(&device->dev->dev.kobj, | 767 | result = sysfs_create_link(&device->dev->dev.kobj, |
| 769 | &device->cdev->device.kobj, | 768 | &device->cdev->device.kobj, |
| 770 | "thermal_cooling"); | 769 | "thermal_cooling"); |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index d47482fa1d21..6318f6b57360 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
| @@ -27,8 +27,9 @@ config PREVENT_FIRMWARE_BUILD | |||
| 27 | If unsure say Y here. | 27 | If unsure say Y here. |
| 28 | 28 | ||
| 29 | config FW_LOADER | 29 | config FW_LOADER |
| 30 | tristate "Userspace firmware loading support" | 30 | tristate "Userspace firmware loading support" if EMBEDDED |
| 31 | depends on HOTPLUG | 31 | depends on HOTPLUG |
| 32 | default y | ||
| 32 | ---help--- | 33 | ---help--- |
| 33 | This option is provided for the case where no in-kernel-tree modules | 34 | This option is provided for the case where no in-kernel-tree modules |
| 34 | require userspace firmware loading support, but a module built outside | 35 | require userspace firmware loading support, but a module built outside |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 2c9ae43e2219..31dc0cd84afa 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -36,6 +36,33 @@ struct driver_private { | |||
| 36 | }; | 36 | }; |
| 37 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) | 37 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) |
| 38 | 38 | ||
| 39 | |||
| 40 | /** | ||
| 41 | * struct class_private - structure to hold the private to the driver core portions of the class structure. | ||
| 42 | * | ||
| 43 | * @class_subsys - the struct kset that defines this class. This is the main kobject | ||
| 44 | * @class_devices - list of devices associated with this class | ||
| 45 | * @class_interfaces - list of class_interfaces associated with this class | ||
| 46 | * @class_dirs - "glue" directory for virtual devices associated with this class | ||
| 47 | * @class_mutex - mutex to protect the children, devices, and interfaces lists. | ||
| 48 | * @class - pointer back to the struct class that this structure is associated | ||
| 49 | * with. | ||
| 50 | * | ||
| 51 | * This structure is the one that is the actual kobject allowing struct | ||
| 52 | * class to be statically allocated safely. Nothing outside of the driver | ||
| 53 | * core should ever touch these fields. | ||
| 54 | */ | ||
| 55 | struct class_private { | ||
| 56 | struct kset class_subsys; | ||
| 57 | struct list_head class_devices; | ||
| 58 | struct list_head class_interfaces; | ||
| 59 | struct kset class_dirs; | ||
| 60 | struct mutex class_mutex; | ||
| 61 | struct class *class; | ||
| 62 | }; | ||
| 63 | #define to_class(obj) \ | ||
| 64 | container_of(obj, struct class_private, class_subsys.kobj) | ||
| 65 | |||
| 39 | /* initialisation functions */ | 66 | /* initialisation functions */ |
| 40 | extern int devices_init(void); | 67 | extern int devices_init(void); |
| 41 | extern int buses_init(void); | 68 | extern int buses_init(void); |
diff --git a/drivers/base/class.c b/drivers/base/class.c index e085af0ff94f..839d27cecb36 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
| @@ -18,20 +18,20 @@ | |||
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/genhd.h> | 20 | #include <linux/genhd.h> |
| 21 | #include <linux/mutex.h> | ||
| 21 | #include "base.h" | 22 | #include "base.h" |
| 22 | 23 | ||
| 23 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) | 24 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) |
| 24 | #define to_class(obj) container_of(obj, struct class, subsys.kobj) | ||
| 25 | 25 | ||
| 26 | static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, | 26 | static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr, |
| 27 | char *buf) | 27 | char *buf) |
| 28 | { | 28 | { |
| 29 | struct class_attribute *class_attr = to_class_attr(attr); | 29 | struct class_attribute *class_attr = to_class_attr(attr); |
| 30 | struct class *dc = to_class(kobj); | 30 | struct class_private *cp = to_class(kobj); |
| 31 | ssize_t ret = -EIO; | 31 | ssize_t ret = -EIO; |
| 32 | 32 | ||
| 33 | if (class_attr->show) | 33 | if (class_attr->show) |
| 34 | ret = class_attr->show(dc, buf); | 34 | ret = class_attr->show(cp->class, buf); |
| 35 | return ret; | 35 | return ret; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| @@ -39,17 +39,18 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, | |||
| 39 | const char *buf, size_t count) | 39 | const char *buf, size_t count) |
| 40 | { | 40 | { |
| 41 | struct class_attribute *class_attr = to_class_attr(attr); | 41 | struct class_attribute *class_attr = to_class_attr(attr); |
| 42 | struct class *dc = to_class(kobj); | 42 | struct class_private *cp = to_class(kobj); |
| 43 | ssize_t ret = -EIO; | 43 | ssize_t ret = -EIO; |
| 44 | 44 | ||
| 45 | if (class_attr->store) | 45 | if (class_attr->store) |
| 46 | ret = class_attr->store(dc, buf, count); | 46 | ret = class_attr->store(cp->class, buf, count); |
| 47 | return ret; | 47 | return ret; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static void class_release(struct kobject *kobj) | 50 | static void class_release(struct kobject *kobj) |
| 51 | { | 51 | { |
| 52 | struct class *class = to_class(kobj); | 52 | struct class_private *cp = to_class(kobj); |
| 53 | struct class *class = cp->class; | ||
| 53 | 54 | ||
| 54 | pr_debug("class '%s': release.\n", class->name); | 55 | pr_debug("class '%s': release.\n", class->name); |
| 55 | 56 | ||
| @@ -70,7 +71,7 @@ static struct kobj_type class_ktype = { | |||
| 70 | .release = class_release, | 71 | .release = class_release, |
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 73 | /* Hotplug events for classes go to the class_obj subsys */ | 74 | /* Hotplug events for classes go to the class class_subsys */ |
| 74 | static struct kset *class_kset; | 75 | static struct kset *class_kset; |
| 75 | 76 | ||
| 76 | 77 | ||
| @@ -78,7 +79,8 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
| 78 | { | 79 | { |
| 79 | int error; | 80 | int error; |
| 80 | if (cls) | 81 | if (cls) |
| 81 | error = sysfs_create_file(&cls->subsys.kobj, &attr->attr); | 82 | error = sysfs_create_file(&cls->p->class_subsys.kobj, |
| 83 | &attr->attr); | ||
| 82 | else | 84 | else |
| 83 | error = -EINVAL; | 85 | error = -EINVAL; |
| 84 | return error; | 86 | return error; |
| @@ -87,21 +89,20 @@ int class_create_file(struct class *cls, const struct class_attribute *attr) | |||
| 87 | void class_remove_file(struct class *cls, const struct class_attribute *attr) | 89 | void class_remove_file(struct class *cls, const struct class_attribute *attr) |
| 88 | { | 90 | { |
| 89 | if (cls) | 91 | if (cls) |
| 90 | sysfs_remove_file(&cls->subsys.kobj, &attr->attr); | 92 | sysfs_remove_file(&cls->p->class_subsys.kobj, &attr->attr); |
| 91 | } | 93 | } |
| 92 | 94 | ||
| 93 | static struct class *class_get(struct class *cls) | 95 | static struct class *class_get(struct class *cls) |
| 94 | { | 96 | { |
| 95 | if (cls) | 97 | if (cls) |
| 96 | return container_of(kset_get(&cls->subsys), | 98 | kset_get(&cls->p->class_subsys); |
| 97 | struct class, subsys); | 99 | return cls; |
| 98 | return NULL; | ||
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | static void class_put(struct class *cls) | 102 | static void class_put(struct class *cls) |
| 102 | { | 103 | { |
| 103 | if (cls) | 104 | if (cls) |
| 104 | kset_put(&cls->subsys); | 105 | kset_put(&cls->p->class_subsys); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | static int add_class_attrs(struct class *cls) | 108 | static int add_class_attrs(struct class *cls) |
| @@ -134,42 +135,57 @@ static void remove_class_attrs(struct class *cls) | |||
| 134 | } | 135 | } |
| 135 | } | 136 | } |
| 136 | 137 | ||
| 137 | int class_register(struct class *cls) | 138 | int __class_register(struct class *cls, struct lock_class_key *key) |
| 138 | { | 139 | { |
| 140 | struct class_private *cp; | ||
| 139 | int error; | 141 | int error; |
| 140 | 142 | ||
| 141 | pr_debug("device class '%s': registering\n", cls->name); | 143 | pr_debug("device class '%s': registering\n", cls->name); |
| 142 | 144 | ||
| 143 | INIT_LIST_HEAD(&cls->devices); | 145 | cp = kzalloc(sizeof(*cp), GFP_KERNEL); |
| 144 | INIT_LIST_HEAD(&cls->interfaces); | 146 | if (!cp) |
| 145 | kset_init(&cls->class_dirs); | 147 | return -ENOMEM; |
| 146 | init_MUTEX(&cls->sem); | 148 | INIT_LIST_HEAD(&cp->class_devices); |
| 147 | error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name); | 149 | INIT_LIST_HEAD(&cp->class_interfaces); |
| 148 | if (error) | 150 | kset_init(&cp->class_dirs); |
| 151 | __mutex_init(&cp->class_mutex, "struct class mutex", key); | ||
| 152 | error = kobject_set_name(&cp->class_subsys.kobj, "%s", cls->name); | ||
| 153 | if (error) { | ||
| 154 | kfree(cp); | ||
| 149 | return error; | 155 | return error; |
| 156 | } | ||
| 157 | |||
| 158 | /* set the default /sys/dev directory for devices of this class */ | ||
| 159 | if (!cls->dev_kobj) | ||
| 160 | cls->dev_kobj = sysfs_dev_char_kobj; | ||
| 150 | 161 | ||
| 151 | #if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK) | 162 | #if defined(CONFIG_SYSFS_DEPRECATED) && defined(CONFIG_BLOCK) |
| 152 | /* let the block class directory show up in the root of sysfs */ | 163 | /* let the block class directory show up in the root of sysfs */ |
| 153 | if (cls != &block_class) | 164 | if (cls != &block_class) |
| 154 | cls->subsys.kobj.kset = class_kset; | 165 | cp->class_subsys.kobj.kset = class_kset; |
| 155 | #else | 166 | #else |
| 156 | cls->subsys.kobj.kset = class_kset; | 167 | cp->class_subsys.kobj.kset = class_kset; |
| 157 | #endif | 168 | #endif |
| 158 | cls->subsys.kobj.ktype = &class_ktype; | 169 | cp->class_subsys.kobj.ktype = &class_ktype; |
| 170 | cp->class = cls; | ||
| 171 | cls->p = cp; | ||
| 159 | 172 | ||
| 160 | error = kset_register(&cls->subsys); | 173 | error = kset_register(&cp->class_subsys); |
| 161 | if (!error) { | 174 | if (error) { |
| 162 | error = add_class_attrs(class_get(cls)); | 175 | kfree(cp); |
| 163 | class_put(cls); | 176 | return error; |
| 164 | } | 177 | } |
| 178 | error = add_class_attrs(class_get(cls)); | ||
| 179 | class_put(cls); | ||
| 165 | return error; | 180 | return error; |
| 166 | } | 181 | } |
| 182 | EXPORT_SYMBOL_GPL(__class_register); | ||
| 167 | 183 | ||
| 168 | void class_unregister(struct class *cls) | 184 | void class_unregister(struct class *cls) |
| 169 | { | 185 | { |
| 170 | pr_debug("device class '%s': unregistering\n", cls->name); | 186 | pr_debug("device class '%s': unregistering\n", cls->name); |
| 171 | remove_class_attrs(cls); | 187 | remove_class_attrs(cls); |
| 172 | kset_unregister(&cls->subsys); | 188 | kset_unregister(&cls->p->class_subsys); |
| 173 | } | 189 | } |
| 174 | 190 | ||
| 175 | static void class_create_release(struct class *cls) | 191 | static void class_create_release(struct class *cls) |
| @@ -189,7 +205,8 @@ static void class_create_release(struct class *cls) | |||
| 189 | * Note, the pointer created here is to be destroyed when finished by | 205 | * Note, the pointer created here is to be destroyed when finished by |
| 190 | * making a call to class_destroy(). | 206 | * making a call to class_destroy(). |
| 191 | */ | 207 | */ |
| 192 | struct class *class_create(struct module *owner, const char *name) | 208 | struct class *__class_create(struct module *owner, const char *name, |
| 209 | struct lock_class_key *key) | ||
| 193 | { | 210 | { |
| 194 | struct class *cls; | 211 | struct class *cls; |
| 195 | int retval; | 212 | int retval; |
| @@ -204,7 +221,7 @@ struct class *class_create(struct module *owner, const char *name) | |||
| 204 | cls->owner = owner; | 221 | cls->owner = owner; |
| 205 | cls->class_release = class_create_release; | 222 | cls->class_release = class_create_release; |
| 206 | 223 | ||
| 207 | retval = class_register(cls); | 224 | retval = __class_register(cls, key); |
| 208 | if (retval) | 225 | if (retval) |
| 209 | goto error; | 226 | goto error; |
| 210 | 227 | ||
| @@ -214,6 +231,7 @@ error: | |||
| 214 | kfree(cls); | 231 | kfree(cls); |
| 215 | return ERR_PTR(retval); | 232 | return ERR_PTR(retval); |
| 216 | } | 233 | } |
| 234 | EXPORT_SYMBOL_GPL(__class_create); | ||
| 217 | 235 | ||
| 218 | /** | 236 | /** |
| 219 | * class_destroy - destroys a struct class structure | 237 | * class_destroy - destroys a struct class structure |
| @@ -252,39 +270,44 @@ char *make_class_name(const char *name, struct kobject *kobj) | |||
| 252 | /** | 270 | /** |
| 253 | * class_for_each_device - device iterator | 271 | * class_for_each_device - device iterator |
| 254 | * @class: the class we're iterating | 272 | * @class: the class we're iterating |
| 273 | * @start: the device to start with in the list, if any. | ||
| 255 | * @data: data for the callback | 274 | * @data: data for the callback |
| 256 | * @fn: function to be called for each device | 275 | * @fn: function to be called for each device |
| 257 | * | 276 | * |
| 258 | * Iterate over @class's list of devices, and call @fn for each, | 277 | * Iterate over @class's list of devices, and call @fn for each, |
| 259 | * passing it @data. | 278 | * passing it @data. If @start is set, the list iteration will start |
| 279 | * there, otherwise if it is NULL, the iteration starts at the | ||
| 280 | * beginning of the list. | ||
| 260 | * | 281 | * |
| 261 | * We check the return of @fn each time. If it returns anything | 282 | * We check the return of @fn each time. If it returns anything |
| 262 | * other than 0, we break out and return that value. | 283 | * other than 0, we break out and return that value. |
| 263 | * | 284 | * |
| 264 | * Note, we hold class->sem in this function, so it can not be | 285 | * Note, we hold class->class_mutex in this function, so it can not be |
| 265 | * re-acquired in @fn, otherwise it will self-deadlocking. For | 286 | * re-acquired in @fn, otherwise it will self-deadlocking. For |
| 266 | * example, calls to add or remove class members would be verboten. | 287 | * example, calls to add or remove class members would be verboten. |
| 267 | */ | 288 | */ |
| 268 | int class_for_each_device(struct class *class, void *data, | 289 | int class_for_each_device(struct class *class, struct device *start, |
| 269 | int (*fn)(struct device *, void *)) | 290 | void *data, int (*fn)(struct device *, void *)) |
| 270 | { | 291 | { |
| 271 | struct device *dev; | 292 | struct device *dev; |
| 272 | int error = 0; | 293 | int error = 0; |
| 273 | 294 | ||
| 274 | if (!class) | 295 | if (!class) |
| 275 | return -EINVAL; | 296 | return -EINVAL; |
| 276 | down(&class->sem); | 297 | mutex_lock(&class->p->class_mutex); |
| 277 | list_for_each_entry(dev, &class->devices, node) { | 298 | list_for_each_entry(dev, &class->p->class_devices, node) { |
| 299 | if (start) { | ||
| 300 | if (start == dev) | ||
| 301 | start = NULL; | ||
| 302 | continue; | ||
| 303 | } | ||
| 278 | dev = get_device(dev); | 304 | dev = get_device(dev); |
| 279 | if (dev) { | 305 | error = fn(dev, data); |
| 280 | error = fn(dev, data); | 306 | put_device(dev); |
| 281 | put_device(dev); | ||
| 282 | } else | ||
| 283 | error = -ENODEV; | ||
| 284 | if (error) | 307 | if (error) |
| 285 | break; | 308 | break; |
| 286 | } | 309 | } |
| 287 | up(&class->sem); | 310 | mutex_unlock(&class->p->class_mutex); |
| 288 | 311 | ||
| 289 | return error; | 312 | return error; |
| 290 | } | 313 | } |
| @@ -293,6 +316,7 @@ EXPORT_SYMBOL_GPL(class_for_each_device); | |||
| 293 | /** | 316 | /** |
| 294 | * class_find_device - device iterator for locating a particular device | 317 | * class_find_device - device iterator for locating a particular device |
| 295 | * @class: the class we're iterating | 318 | * @class: the class we're iterating |
| 319 | * @start: Device to begin with | ||
| 296 | * @data: data for the match function | 320 | * @data: data for the match function |
| 297 | * @match: function to check device | 321 | * @match: function to check device |
| 298 | * | 322 | * |
| @@ -306,12 +330,13 @@ EXPORT_SYMBOL_GPL(class_for_each_device); | |||
| 306 | * | 330 | * |
| 307 | * Note, you will need to drop the reference with put_device() after use. | 331 | * Note, you will need to drop the reference with put_device() after use. |
| 308 | * | 332 | * |
| 309 | * We hold class->sem in this function, so it can not be | 333 | * We hold class->class_mutex in this function, so it can not be |
| 310 | * re-acquired in @match, otherwise it will self-deadlocking. For | 334 | * re-acquired in @match, otherwise it will self-deadlocking. For |
| 311 | * example, calls to add or remove class members would be verboten. | 335 | * example, calls to add or remove class members would be verboten. |
| 312 | */ | 336 | */ |
| 313 | struct device *class_find_device(struct class *class, void *data, | 337 | struct device *class_find_device(struct class *class, struct device *start, |
| 314 | int (*match)(struct device *, void *)) | 338 | void *data, |
| 339 | int (*match)(struct device *, void *)) | ||
| 315 | { | 340 | { |
| 316 | struct device *dev; | 341 | struct device *dev; |
| 317 | int found = 0; | 342 | int found = 0; |
| @@ -319,19 +344,21 @@ struct device *class_find_device(struct class *class, void *data, | |||
| 319 | if (!class) | 344 | if (!class) |
| 320 | return NULL; | 345 | return NULL; |
| 321 | 346 | ||
| 322 | down(&class->sem); | 347 | mutex_lock(&class->p->class_mutex); |
| 323 | list_for_each_entry(dev, &class->devices, node) { | 348 | list_for_each_entry(dev, &class->p->class_devices, node) { |
| 349 | if (start) { | ||
| 350 | if (start == dev) | ||
| 351 | start = NULL; | ||
| 352 | continue; | ||
| 353 | } | ||
| 324 | dev = get_device(dev); | 354 | dev = get_device(dev); |
| 325 | if (dev) { | 355 | if (match(dev, data)) { |
| 326 | if (match(dev, data)) { | 356 | found = 1; |
| 327 | found = 1; | ||
| 328 | break; | ||
| 329 | } else | ||
| 330 | put_device(dev); | ||
| 331 | } else | ||
| 332 | break; | 357 | break; |
| 358 | } else | ||
| 359 | put_device(dev); | ||
| 333 | } | 360 | } |
| 334 | up(&class->sem); | 361 | mutex_unlock(&class->p->class_mutex); |
| 335 | 362 | ||
| 336 | return found ? dev : NULL; | 363 | return found ? dev : NULL; |
| 337 | } | 364 | } |
| @@ -349,13 +376,13 @@ int class_interface_register(struct class_interface *class_intf) | |||
| 349 | if (!parent) | 376 | if (!parent) |
| 350 | return -EINVAL; | 377 | return -EINVAL; |
| 351 | 378 | ||
| 352 | down(&parent->sem); | 379 | mutex_lock(&parent->p->class_mutex); |
| 353 | list_add_tail(&class_intf->node, &parent->interfaces); | 380 | list_add_tail(&class_intf->node, &parent->p->class_interfaces); |
| 354 | if (class_intf->add_dev) { | 381 | if (class_intf->add_dev) { |
| 355 | list_for_each_entry(dev, &parent->devices, node) | 382 | list_for_each_entry(dev, &parent->p->class_devices, node) |
| 356 | class_intf->add_dev(dev, class_intf); | 383 | class_intf->add_dev(dev, class_intf); |
| 357 | } | 384 | } |
| 358 | up(&parent->sem); | 385 | mutex_unlock(&parent->p->class_mutex); |
| 359 | 386 | ||
| 360 | return 0; | 387 | return 0; |
| 361 | } | 388 | } |
| @@ -368,13 +395,13 @@ void class_interface_unregister(struct class_interface *class_intf) | |||
| 368 | if (!parent) | 395 | if (!parent) |
| 369 | return; | 396 | return; |
| 370 | 397 | ||
| 371 | down(&parent->sem); | 398 | mutex_lock(&parent->p->class_mutex); |
| 372 | list_del_init(&class_intf->node); | 399 | list_del_init(&class_intf->node); |
| 373 | if (class_intf->remove_dev) { | 400 | if (class_intf->remove_dev) { |
| 374 | list_for_each_entry(dev, &parent->devices, node) | 401 | list_for_each_entry(dev, &parent->p->class_devices, node) |
| 375 | class_intf->remove_dev(dev, class_intf); | 402 | class_intf->remove_dev(dev, class_intf); |
| 376 | } | 403 | } |
| 377 | up(&parent->sem); | 404 | mutex_unlock(&parent->p->class_mutex); |
| 378 | 405 | ||
| 379 | class_put(parent); | 406 | class_put(parent); |
| 380 | } | 407 | } |
| @@ -389,9 +416,7 @@ int __init classes_init(void) | |||
| 389 | 416 | ||
| 390 | EXPORT_SYMBOL_GPL(class_create_file); | 417 | EXPORT_SYMBOL_GPL(class_create_file); |
| 391 | EXPORT_SYMBOL_GPL(class_remove_file); | 418 | EXPORT_SYMBOL_GPL(class_remove_file); |
| 392 | EXPORT_SYMBOL_GPL(class_register); | ||
| 393 | EXPORT_SYMBOL_GPL(class_unregister); | 419 | EXPORT_SYMBOL_GPL(class_unregister); |
| 394 | EXPORT_SYMBOL_GPL(class_create); | ||
| 395 | EXPORT_SYMBOL_GPL(class_destroy); | 420 | EXPORT_SYMBOL_GPL(class_destroy); |
| 396 | 421 | ||
| 397 | EXPORT_SYMBOL_GPL(class_interface_register); | 422 | EXPORT_SYMBOL_GPL(class_interface_register); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index ee0a51a3a41d..7d5c63c81a59 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -21,12 +21,16 @@ | |||
| 21 | #include <linux/genhd.h> | 21 | #include <linux/genhd.h> |
| 22 | #include <linux/kallsyms.h> | 22 | #include <linux/kallsyms.h> |
| 23 | #include <linux/semaphore.h> | 23 | #include <linux/semaphore.h> |
| 24 | #include <linux/mutex.h> | ||
| 24 | 25 | ||
| 25 | #include "base.h" | 26 | #include "base.h" |
| 26 | #include "power/power.h" | 27 | #include "power/power.h" |
| 27 | 28 | ||
| 28 | int (*platform_notify)(struct device *dev) = NULL; | 29 | int (*platform_notify)(struct device *dev) = NULL; |
| 29 | int (*platform_notify_remove)(struct device *dev) = NULL; | 30 | int (*platform_notify_remove)(struct device *dev) = NULL; |
| 31 | static struct kobject *dev_kobj; | ||
| 32 | struct kobject *sysfs_dev_char_kobj; | ||
| 33 | struct kobject *sysfs_dev_block_kobj; | ||
| 30 | 34 | ||
| 31 | #ifdef CONFIG_BLOCK | 35 | #ifdef CONFIG_BLOCK |
| 32 | static inline int device_is_not_partition(struct device *dev) | 36 | static inline int device_is_not_partition(struct device *dev) |
| @@ -548,7 +552,7 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 548 | { | 552 | { |
| 549 | /* class devices without a parent live in /sys/class/<classname>/ */ | 553 | /* class devices without a parent live in /sys/class/<classname>/ */ |
| 550 | if (dev->class && (!parent || parent->class != dev->class)) | 554 | if (dev->class && (!parent || parent->class != dev->class)) |
| 551 | return &dev->class->subsys.kobj; | 555 | return &dev->class->p->class_subsys.kobj; |
| 552 | /* all other devices keep their parent */ | 556 | /* all other devices keep their parent */ |
| 553 | else if (parent) | 557 | else if (parent) |
| 554 | return &parent->kobj; | 558 | return &parent->kobj; |
| @@ -594,13 +598,13 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 594 | parent_kobj = &parent->kobj; | 598 | parent_kobj = &parent->kobj; |
| 595 | 599 | ||
| 596 | /* find our class-directory at the parent and reference it */ | 600 | /* find our class-directory at the parent and reference it */ |
| 597 | spin_lock(&dev->class->class_dirs.list_lock); | 601 | spin_lock(&dev->class->p->class_dirs.list_lock); |
| 598 | list_for_each_entry(k, &dev->class->class_dirs.list, entry) | 602 | list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) |
| 599 | if (k->parent == parent_kobj) { | 603 | if (k->parent == parent_kobj) { |
| 600 | kobj = kobject_get(k); | 604 | kobj = kobject_get(k); |
| 601 | break; | 605 | break; |
| 602 | } | 606 | } |
| 603 | spin_unlock(&dev->class->class_dirs.list_lock); | 607 | spin_unlock(&dev->class->p->class_dirs.list_lock); |
| 604 | if (kobj) | 608 | if (kobj) |
| 605 | return kobj; | 609 | return kobj; |
| 606 | 610 | ||
| @@ -608,7 +612,7 @@ static struct kobject *get_device_parent(struct device *dev, | |||
| 608 | k = kobject_create(); | 612 | k = kobject_create(); |
| 609 | if (!k) | 613 | if (!k) |
| 610 | return NULL; | 614 | return NULL; |
| 611 | k->kset = &dev->class->class_dirs; | 615 | k->kset = &dev->class->p->class_dirs; |
| 612 | retval = kobject_add(k, parent_kobj, "%s", dev->class->name); | 616 | retval = kobject_add(k, parent_kobj, "%s", dev->class->name); |
| 613 | if (retval < 0) { | 617 | if (retval < 0) { |
| 614 | kobject_put(k); | 618 | kobject_put(k); |
| @@ -627,7 +631,7 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) | |||
| 627 | { | 631 | { |
| 628 | /* see if we live in a "glue" directory */ | 632 | /* see if we live in a "glue" directory */ |
| 629 | if (!glue_dir || !dev->class || | 633 | if (!glue_dir || !dev->class || |
| 630 | glue_dir->kset != &dev->class->class_dirs) | 634 | glue_dir->kset != &dev->class->p->class_dirs) |
| 631 | return; | 635 | return; |
| 632 | 636 | ||
| 633 | kobject_put(glue_dir); | 637 | kobject_put(glue_dir); |
| @@ -654,17 +658,18 @@ static int device_add_class_symlinks(struct device *dev) | |||
| 654 | if (!dev->class) | 658 | if (!dev->class) |
| 655 | return 0; | 659 | return 0; |
| 656 | 660 | ||
| 657 | error = sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj, | 661 | error = sysfs_create_link(&dev->kobj, |
| 662 | &dev->class->p->class_subsys.kobj, | ||
| 658 | "subsystem"); | 663 | "subsystem"); |
| 659 | if (error) | 664 | if (error) |
| 660 | goto out; | 665 | goto out; |
| 661 | 666 | ||
| 662 | #ifdef CONFIG_SYSFS_DEPRECATED | 667 | #ifdef CONFIG_SYSFS_DEPRECATED |
| 663 | /* stacked class devices need a symlink in the class directory */ | 668 | /* stacked class devices need a symlink in the class directory */ |
| 664 | if (dev->kobj.parent != &dev->class->subsys.kobj && | 669 | if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && |
| 665 | device_is_not_partition(dev)) { | 670 | device_is_not_partition(dev)) { |
| 666 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, | 671 | error = sysfs_create_link(&dev->class->p->class_subsys.kobj, |
| 667 | dev->bus_id); | 672 | &dev->kobj, dev->bus_id); |
| 668 | if (error) | 673 | if (error) |
| 669 | goto out_subsys; | 674 | goto out_subsys; |
| 670 | } | 675 | } |
| @@ -701,13 +706,14 @@ out_device: | |||
| 701 | if (dev->parent && device_is_not_partition(dev)) | 706 | if (dev->parent && device_is_not_partition(dev)) |
| 702 | sysfs_remove_link(&dev->kobj, "device"); | 707 | sysfs_remove_link(&dev->kobj, "device"); |
| 703 | out_busid: | 708 | out_busid: |
| 704 | if (dev->kobj.parent != &dev->class->subsys.kobj && | 709 | if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && |
| 705 | device_is_not_partition(dev)) | 710 | device_is_not_partition(dev)) |
| 706 | sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); | 711 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, |
| 712 | dev->bus_id); | ||
| 707 | #else | 713 | #else |
| 708 | /* link in the class directory pointing to the device */ | 714 | /* link in the class directory pointing to the device */ |
| 709 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, | 715 | error = sysfs_create_link(&dev->class->p->class_subsys.kobj, |
| 710 | dev->bus_id); | 716 | &dev->kobj, dev->bus_id); |
| 711 | if (error) | 717 | if (error) |
| 712 | goto out_subsys; | 718 | goto out_subsys; |
| 713 | 719 | ||
| @@ -720,7 +726,7 @@ out_busid: | |||
| 720 | return 0; | 726 | return 0; |
| 721 | 727 | ||
| 722 | out_busid: | 728 | out_busid: |
| 723 | sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); | 729 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); |
| 724 | #endif | 730 | #endif |
| 725 | 731 | ||
| 726 | out_subsys: | 732 | out_subsys: |
| @@ -746,14 +752,15 @@ static void device_remove_class_symlinks(struct device *dev) | |||
| 746 | sysfs_remove_link(&dev->kobj, "device"); | 752 | sysfs_remove_link(&dev->kobj, "device"); |
| 747 | } | 753 | } |
| 748 | 754 | ||
| 749 | if (dev->kobj.parent != &dev->class->subsys.kobj && | 755 | if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && |
| 750 | device_is_not_partition(dev)) | 756 | device_is_not_partition(dev)) |
| 751 | sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); | 757 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, |
| 758 | dev->bus_id); | ||
| 752 | #else | 759 | #else |
| 753 | if (dev->parent && device_is_not_partition(dev)) | 760 | if (dev->parent && device_is_not_partition(dev)) |
| 754 | sysfs_remove_link(&dev->kobj, "device"); | 761 | sysfs_remove_link(&dev->kobj, "device"); |
| 755 | 762 | ||
| 756 | sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id); | 763 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev->bus_id); |
| 757 | #endif | 764 | #endif |
| 758 | 765 | ||
| 759 | sysfs_remove_link(&dev->kobj, "subsystem"); | 766 | sysfs_remove_link(&dev->kobj, "subsystem"); |
| @@ -776,6 +783,54 @@ int dev_set_name(struct device *dev, const char *fmt, ...) | |||
| 776 | EXPORT_SYMBOL_GPL(dev_set_name); | 783 | EXPORT_SYMBOL_GPL(dev_set_name); |
| 777 | 784 | ||
| 778 | /** | 785 | /** |
| 786 | * device_to_dev_kobj - select a /sys/dev/ directory for the device | ||
| 787 | * @dev: device | ||
| 788 | * | ||
| 789 | * By default we select char/ for new entries. Setting class->dev_obj | ||
| 790 | * to NULL prevents an entry from being created. class->dev_kobj must | ||
| 791 | * be set (or cleared) before any devices are registered to the class | ||
| 792 | * otherwise device_create_sys_dev_entry() and | ||
| 793 | * device_remove_sys_dev_entry() will disagree about the the presence | ||
| 794 | * of the link. | ||
| 795 | */ | ||
| 796 | static struct kobject *device_to_dev_kobj(struct device *dev) | ||
| 797 | { | ||
| 798 | struct kobject *kobj; | ||
| 799 | |||
| 800 | if (dev->class) | ||
| 801 | kobj = dev->class->dev_kobj; | ||
| 802 | else | ||
| 803 | kobj = sysfs_dev_char_kobj; | ||
| 804 | |||
| 805 | return kobj; | ||
| 806 | } | ||
| 807 | |||
| 808 | static int device_create_sys_dev_entry(struct device *dev) | ||
| 809 | { | ||
| 810 | struct kobject *kobj = device_to_dev_kobj(dev); | ||
| 811 | int error = 0; | ||
| 812 | char devt_str[15]; | ||
| 813 | |||
| 814 | if (kobj) { | ||
| 815 | format_dev_t(devt_str, dev->devt); | ||
| 816 | error = sysfs_create_link(kobj, &dev->kobj, devt_str); | ||
| 817 | } | ||
| 818 | |||
| 819 | return error; | ||
| 820 | } | ||
| 821 | |||
| 822 | static void device_remove_sys_dev_entry(struct device *dev) | ||
| 823 | { | ||
| 824 | struct kobject *kobj = device_to_dev_kobj(dev); | ||
| 825 | char devt_str[15]; | ||
| 826 | |||
| 827 | if (kobj) { | ||
| 828 | format_dev_t(devt_str, dev->devt); | ||
| 829 | sysfs_remove_link(kobj, devt_str); | ||
| 830 | } | ||
| 831 | } | ||
| 832 | |||
| 833 | /** | ||
| 779 | * device_add - add device to device hierarchy. | 834 | * device_add - add device to device hierarchy. |
| 780 | * @dev: device. | 835 | * @dev: device. |
| 781 | * | 836 | * |
| @@ -829,6 +884,10 @@ int device_add(struct device *dev) | |||
| 829 | error = device_create_file(dev, &devt_attr); | 884 | error = device_create_file(dev, &devt_attr); |
| 830 | if (error) | 885 | if (error) |
| 831 | goto ueventattrError; | 886 | goto ueventattrError; |
| 887 | |||
| 888 | error = device_create_sys_dev_entry(dev); | ||
| 889 | if (error) | ||
| 890 | goto devtattrError; | ||
| 832 | } | 891 | } |
| 833 | 892 | ||
| 834 | error = device_add_class_symlinks(dev); | 893 | error = device_add_class_symlinks(dev); |
| @@ -849,15 +908,16 @@ int device_add(struct device *dev) | |||
| 849 | klist_add_tail(&dev->knode_parent, &parent->klist_children); | 908 | klist_add_tail(&dev->knode_parent, &parent->klist_children); |
| 850 | 909 | ||
| 851 | if (dev->class) { | 910 | if (dev->class) { |
| 852 | down(&dev->class->sem); | 911 | mutex_lock(&dev->class->p->class_mutex); |
| 853 | /* tie the class to the device */ | 912 | /* tie the class to the device */ |
| 854 | list_add_tail(&dev->node, &dev->class->devices); | 913 | list_add_tail(&dev->node, &dev->class->p->class_devices); |
| 855 | 914 | ||
| 856 | /* notify any interfaces that the device is here */ | 915 | /* notify any interfaces that the device is here */ |
| 857 | list_for_each_entry(class_intf, &dev->class->interfaces, node) | 916 | list_for_each_entry(class_intf, |
| 917 | &dev->class->p->class_interfaces, node) | ||
| 858 | if (class_intf->add_dev) | 918 | if (class_intf->add_dev) |
| 859 | class_intf->add_dev(dev, class_intf); | 919 | class_intf->add_dev(dev, class_intf); |
| 860 | up(&dev->class->sem); | 920 | mutex_unlock(&dev->class->p->class_mutex); |
| 861 | } | 921 | } |
| 862 | Done: | 922 | Done: |
| 863 | put_device(dev); | 923 | put_device(dev); |
| @@ -873,6 +933,9 @@ int device_add(struct device *dev) | |||
| 873 | device_remove_class_symlinks(dev); | 933 | device_remove_class_symlinks(dev); |
| 874 | SymlinkError: | 934 | SymlinkError: |
| 875 | if (MAJOR(dev->devt)) | 935 | if (MAJOR(dev->devt)) |
| 936 | device_remove_sys_dev_entry(dev); | ||
| 937 | devtattrError: | ||
| 938 | if (MAJOR(dev->devt)) | ||
| 876 | device_remove_file(dev, &devt_attr); | 939 | device_remove_file(dev, &devt_attr); |
| 877 | ueventattrError: | 940 | ueventattrError: |
| 878 | device_remove_file(dev, &uevent_attr); | 941 | device_remove_file(dev, &uevent_attr); |
| @@ -948,19 +1011,22 @@ void device_del(struct device *dev) | |||
| 948 | device_pm_remove(dev); | 1011 | device_pm_remove(dev); |
| 949 | if (parent) | 1012 | if (parent) |
| 950 | klist_del(&dev->knode_parent); | 1013 | klist_del(&dev->knode_parent); |
| 951 | if (MAJOR(dev->devt)) | 1014 | if (MAJOR(dev->devt)) { |
| 1015 | device_remove_sys_dev_entry(dev); | ||
| 952 | device_remove_file(dev, &devt_attr); | 1016 | device_remove_file(dev, &devt_attr); |
| 1017 | } | ||
| 953 | if (dev->class) { | 1018 | if (dev->class) { |
| 954 | device_remove_class_symlinks(dev); | 1019 | device_remove_class_symlinks(dev); |
| 955 | 1020 | ||
| 956 | down(&dev->class->sem); | 1021 | mutex_lock(&dev->class->p->class_mutex); |
| 957 | /* notify any interfaces that the device is now gone */ | 1022 | /* notify any interfaces that the device is now gone */ |
| 958 | list_for_each_entry(class_intf, &dev->class->interfaces, node) | 1023 | list_for_each_entry(class_intf, |
| 1024 | &dev->class->p->class_interfaces, node) | ||
| 959 | if (class_intf->remove_dev) | 1025 | if (class_intf->remove_dev) |
| 960 | class_intf->remove_dev(dev, class_intf); | 1026 | class_intf->remove_dev(dev, class_intf); |
| 961 | /* remove the device from the class list */ | 1027 | /* remove the device from the class list */ |
| 962 | list_del_init(&dev->node); | 1028 | list_del_init(&dev->node); |
| 963 | up(&dev->class->sem); | 1029 | mutex_unlock(&dev->class->p->class_mutex); |
| 964 | } | 1030 | } |
| 965 | device_remove_file(dev, &uevent_attr); | 1031 | device_remove_file(dev, &uevent_attr); |
| 966 | device_remove_attrs(dev); | 1032 | device_remove_attrs(dev); |
| @@ -1074,7 +1140,25 @@ int __init devices_init(void) | |||
| 1074 | devices_kset = kset_create_and_add("devices", &device_uevent_ops, NULL); | 1140 | devices_kset = kset_create_and_add("devices", &device_uevent_ops, NULL); |
| 1075 | if (!devices_kset) | 1141 | if (!devices_kset) |
| 1076 | return -ENOMEM; | 1142 | return -ENOMEM; |
| 1143 | dev_kobj = kobject_create_and_add("dev", NULL); | ||
| 1144 | if (!dev_kobj) | ||
| 1145 | goto dev_kobj_err; | ||
| 1146 | sysfs_dev_block_kobj = kobject_create_and_add("block", dev_kobj); | ||
| 1147 | if (!sysfs_dev_block_kobj) | ||
| 1148 | goto block_kobj_err; | ||
| 1149 | sysfs_dev_char_kobj = kobject_create_and_add("char", dev_kobj); | ||
| 1150 | if (!sysfs_dev_char_kobj) | ||
| 1151 | goto char_kobj_err; | ||
| 1152 | |||
| 1077 | return 0; | 1153 | return 0; |
| 1154 | |||
| 1155 | char_kobj_err: | ||
| 1156 | kobject_put(sysfs_dev_block_kobj); | ||
| 1157 | block_kobj_err: | ||
| 1158 | kobject_put(dev_kobj); | ||
| 1159 | dev_kobj_err: | ||
| 1160 | kset_unregister(devices_kset); | ||
| 1161 | return -ENOMEM; | ||
| 1078 | } | 1162 | } |
| 1079 | 1163 | ||
| 1080 | EXPORT_SYMBOL_GPL(device_for_each_child); | 1164 | EXPORT_SYMBOL_GPL(device_for_each_child); |
| @@ -1158,48 +1242,11 @@ error: | |||
| 1158 | EXPORT_SYMBOL_GPL(device_create_vargs); | 1242 | EXPORT_SYMBOL_GPL(device_create_vargs); |
| 1159 | 1243 | ||
| 1160 | /** | 1244 | /** |
| 1161 | * device_create_drvdata - creates a device and registers it with sysfs | ||
| 1162 | * @class: pointer to the struct class that this device should be registered to | ||
| 1163 | * @parent: pointer to the parent struct device of this new device, if any | ||
| 1164 | * @devt: the dev_t for the char device to be added | ||
| 1165 | * @drvdata: the data to be added to the device for callbacks | ||
| 1166 | * @fmt: string for the device's name | ||
| 1167 | * | ||
| 1168 | * This function can be used by char device classes. A struct device | ||
| 1169 | * will be created in sysfs, registered to the specified class. | ||
| 1170 | * | ||
| 1171 | * A "dev" file will be created, showing the dev_t for the device, if | ||
| 1172 | * the dev_t is not 0,0. | ||
| 1173 | * If a pointer to a parent struct device is passed in, the newly created | ||
| 1174 | * struct device will be a child of that device in sysfs. | ||
| 1175 | * The pointer to the struct device will be returned from the call. | ||
| 1176 | * Any further sysfs files that might be required can be created using this | ||
| 1177 | * pointer. | ||
| 1178 | * | ||
| 1179 | * Note: the struct class passed to this function must have previously | ||
| 1180 | * been created with a call to class_create(). | ||
| 1181 | */ | ||
| 1182 | struct device *device_create_drvdata(struct class *class, | ||
| 1183 | struct device *parent, | ||
| 1184 | dev_t devt, | ||
| 1185 | void *drvdata, | ||
| 1186 | const char *fmt, ...) | ||
| 1187 | { | ||
| 1188 | va_list vargs; | ||
| 1189 | struct device *dev; | ||
| 1190 | |||
| 1191 | va_start(vargs, fmt); | ||
| 1192 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); | ||
| 1193 | va_end(vargs); | ||
| 1194 | return dev; | ||
| 1195 | } | ||
| 1196 | EXPORT_SYMBOL_GPL(device_create_drvdata); | ||
| 1197 | |||
| 1198 | /** | ||
| 1199 | * device_create - creates a device and registers it with sysfs | 1245 | * device_create - creates a device and registers it with sysfs |
| 1200 | * @class: pointer to the struct class that this device should be registered to | 1246 | * @class: pointer to the struct class that this device should be registered to |
| 1201 | * @parent: pointer to the parent struct device of this new device, if any | 1247 | * @parent: pointer to the parent struct device of this new device, if any |
| 1202 | * @devt: the dev_t for the char device to be added | 1248 | * @devt: the dev_t for the char device to be added |
| 1249 | * @drvdata: the data to be added to the device for callbacks | ||
| 1203 | * @fmt: string for the device's name | 1250 | * @fmt: string for the device's name |
| 1204 | * | 1251 | * |
| 1205 | * This function can be used by char device classes. A struct device | 1252 | * This function can be used by char device classes. A struct device |
| @@ -1217,13 +1264,13 @@ EXPORT_SYMBOL_GPL(device_create_drvdata); | |||
| 1217 | * been created with a call to class_create(). | 1264 | * been created with a call to class_create(). |
| 1218 | */ | 1265 | */ |
| 1219 | struct device *device_create(struct class *class, struct device *parent, | 1266 | struct device *device_create(struct class *class, struct device *parent, |
| 1220 | dev_t devt, const char *fmt, ...) | 1267 | dev_t devt, void *drvdata, const char *fmt, ...) |
| 1221 | { | 1268 | { |
| 1222 | va_list vargs; | 1269 | va_list vargs; |
| 1223 | struct device *dev; | 1270 | struct device *dev; |
| 1224 | 1271 | ||
| 1225 | va_start(vargs, fmt); | 1272 | va_start(vargs, fmt); |
| 1226 | dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs); | 1273 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); |
| 1227 | va_end(vargs); | 1274 | va_end(vargs); |
| 1228 | return dev; | 1275 | return dev; |
| 1229 | } | 1276 | } |
| @@ -1248,7 +1295,7 @@ void device_destroy(struct class *class, dev_t devt) | |||
| 1248 | { | 1295 | { |
| 1249 | struct device *dev; | 1296 | struct device *dev; |
| 1250 | 1297 | ||
| 1251 | dev = class_find_device(class, &devt, __match_devt); | 1298 | dev = class_find_device(class, NULL, &devt, __match_devt); |
| 1252 | if (dev) { | 1299 | if (dev) { |
| 1253 | put_device(dev); | 1300 | put_device(dev); |
| 1254 | device_unregister(dev); | 1301 | device_unregister(dev); |
| @@ -1298,8 +1345,9 @@ int device_rename(struct device *dev, char *new_name) | |||
| 1298 | if (old_class_name) { | 1345 | if (old_class_name) { |
| 1299 | new_class_name = make_class_name(dev->class->name, &dev->kobj); | 1346 | new_class_name = make_class_name(dev->class->name, &dev->kobj); |
| 1300 | if (new_class_name) { | 1347 | if (new_class_name) { |
| 1301 | error = sysfs_create_link(&dev->parent->kobj, | 1348 | error = sysfs_create_link_nowarn(&dev->parent->kobj, |
| 1302 | &dev->kobj, new_class_name); | 1349 | &dev->kobj, |
| 1350 | new_class_name); | ||
| 1303 | if (error) | 1351 | if (error) |
| 1304 | goto out; | 1352 | goto out; |
| 1305 | sysfs_remove_link(&dev->parent->kobj, old_class_name); | 1353 | sysfs_remove_link(&dev->parent->kobj, old_class_name); |
| @@ -1307,11 +1355,12 @@ int device_rename(struct device *dev, char *new_name) | |||
| 1307 | } | 1355 | } |
| 1308 | #else | 1356 | #else |
| 1309 | if (dev->class) { | 1357 | if (dev->class) { |
| 1310 | error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj, | 1358 | error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, |
| 1311 | dev->bus_id); | 1359 | &dev->kobj, dev->bus_id); |
| 1312 | if (error) | 1360 | if (error) |
| 1313 | goto out; | 1361 | goto out; |
| 1314 | sysfs_remove_link(&dev->class->subsys.kobj, old_device_name); | 1362 | sysfs_remove_link(&dev->class->p->class_subsys.kobj, |
| 1363 | old_device_name); | ||
| 1315 | } | 1364 | } |
| 1316 | #endif | 1365 | #endif |
| 1317 | 1366 | ||
| @@ -1447,4 +1496,7 @@ void device_shutdown(void) | |||
| 1447 | dev->driver->shutdown(dev); | 1496 | dev->driver->shutdown(dev); |
| 1448 | } | 1497 | } |
| 1449 | } | 1498 | } |
| 1499 | kobject_put(sysfs_dev_char_kobj); | ||
| 1500 | kobject_put(sysfs_dev_block_kobj); | ||
| 1501 | kobject_put(dev_kobj); | ||
| 1450 | } | 1502 | } |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index e38dfed41d80..20537d507909 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
| @@ -21,15 +21,16 @@ EXPORT_SYMBOL(cpu_sysdev_class); | |||
| 21 | static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); | 21 | static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); |
| 22 | 22 | ||
| 23 | #ifdef CONFIG_HOTPLUG_CPU | 23 | #ifdef CONFIG_HOTPLUG_CPU |
| 24 | static ssize_t show_online(struct sys_device *dev, char *buf) | 24 | static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, |
| 25 | char *buf) | ||
| 25 | { | 26 | { |
| 26 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 27 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| 27 | 28 | ||
| 28 | return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); | 29 | return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | static ssize_t __ref store_online(struct sys_device *dev, const char *buf, | 32 | static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, |
| 32 | size_t count) | 33 | const char *buf, size_t count) |
| 33 | { | 34 | { |
| 34 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 35 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| 35 | ssize_t ret; | 36 | ssize_t ret; |
| @@ -80,7 +81,8 @@ static inline void register_cpu_control(struct cpu *cpu) | |||
| 80 | #ifdef CONFIG_KEXEC | 81 | #ifdef CONFIG_KEXEC |
| 81 | #include <linux/kexec.h> | 82 | #include <linux/kexec.h> |
| 82 | 83 | ||
| 83 | static ssize_t show_crash_notes(struct sys_device *dev, char *buf) | 84 | static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, |
| 85 | char *buf) | ||
| 84 | { | 86 | { |
| 85 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 87 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
| 86 | ssize_t rc; | 88 | ssize_t rc; |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 937e8258981d..4d4e0e7b6e92 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
| @@ -92,7 +92,8 @@ unregister_memory(struct memory_block *memory, struct mem_section *section) | |||
| 92 | * uses. | 92 | * uses. |
| 93 | */ | 93 | */ |
| 94 | 94 | ||
| 95 | static ssize_t show_mem_phys_index(struct sys_device *dev, char *buf) | 95 | static ssize_t show_mem_phys_index(struct sys_device *dev, |
| 96 | struct sysdev_attribute *attr, char *buf) | ||
| 96 | { | 97 | { |
| 97 | struct memory_block *mem = | 98 | struct memory_block *mem = |
| 98 | container_of(dev, struct memory_block, sysdev); | 99 | container_of(dev, struct memory_block, sysdev); |
| @@ -102,7 +103,8 @@ static ssize_t show_mem_phys_index(struct sys_device *dev, char *buf) | |||
| 102 | /* | 103 | /* |
| 103 | * online, offline, going offline, etc. | 104 | * online, offline, going offline, etc. |
| 104 | */ | 105 | */ |
| 105 | static ssize_t show_mem_state(struct sys_device *dev, char *buf) | 106 | static ssize_t show_mem_state(struct sys_device *dev, |
| 107 | struct sysdev_attribute *attr, char *buf) | ||
| 106 | { | 108 | { |
| 107 | struct memory_block *mem = | 109 | struct memory_block *mem = |
| 108 | container_of(dev, struct memory_block, sysdev); | 110 | container_of(dev, struct memory_block, sysdev); |
| @@ -217,7 +219,8 @@ out: | |||
| 217 | } | 219 | } |
| 218 | 220 | ||
| 219 | static ssize_t | 221 | static ssize_t |
| 220 | store_mem_state(struct sys_device *dev, const char *buf, size_t count) | 222 | store_mem_state(struct sys_device *dev, |
| 223 | struct sysdev_attribute *attr, const char *buf, size_t count) | ||
| 221 | { | 224 | { |
| 222 | struct memory_block *mem; | 225 | struct memory_block *mem; |
| 223 | unsigned int phys_section_nr; | 226 | unsigned int phys_section_nr; |
| @@ -248,7 +251,8 @@ out: | |||
| 248 | * s.t. if I offline all of these sections I can then | 251 | * s.t. if I offline all of these sections I can then |
| 249 | * remove the physical device? | 252 | * remove the physical device? |
| 250 | */ | 253 | */ |
| 251 | static ssize_t show_phys_device(struct sys_device *dev, char *buf) | 254 | static ssize_t show_phys_device(struct sys_device *dev, |
| 255 | struct sysdev_attribute *attr, char *buf) | ||
| 252 | { | 256 | { |
| 253 | struct memory_block *mem = | 257 | struct memory_block *mem = |
| 254 | container_of(dev, struct memory_block, sysdev); | 258 | container_of(dev, struct memory_block, sysdev); |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 0f867a083338..5116b78c6325 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
| @@ -36,11 +36,13 @@ static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) | |||
| 36 | return len; | 36 | return len; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static inline ssize_t node_read_cpumask(struct sys_device *dev, char *buf) | 39 | static inline ssize_t node_read_cpumask(struct sys_device *dev, |
| 40 | struct sysdev_attribute *attr, char *buf) | ||
| 40 | { | 41 | { |
| 41 | return node_read_cpumap(dev, 0, buf); | 42 | return node_read_cpumap(dev, 0, buf); |
| 42 | } | 43 | } |
| 43 | static inline ssize_t node_read_cpulist(struct sys_device *dev, char *buf) | 44 | static inline ssize_t node_read_cpulist(struct sys_device *dev, |
| 45 | struct sysdev_attribute *attr, char *buf) | ||
| 44 | { | 46 | { |
| 45 | return node_read_cpumap(dev, 1, buf); | 47 | return node_read_cpumap(dev, 1, buf); |
| 46 | } | 48 | } |
| @@ -49,7 +51,8 @@ static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); | |||
| 49 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); | 51 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); |
| 50 | 52 | ||
| 51 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 53 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
| 52 | static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | 54 | static ssize_t node_read_meminfo(struct sys_device * dev, |
| 55 | struct sysdev_attribute *attr, char * buf) | ||
| 53 | { | 56 | { |
| 54 | int n; | 57 | int n; |
| 55 | int nid = dev->id; | 58 | int nid = dev->id; |
| @@ -112,7 +115,8 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | |||
| 112 | #undef K | 115 | #undef K |
| 113 | static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); | 116 | static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); |
| 114 | 117 | ||
| 115 | static ssize_t node_read_numastat(struct sys_device * dev, char * buf) | 118 | static ssize_t node_read_numastat(struct sys_device * dev, |
| 119 | struct sysdev_attribute *attr, char * buf) | ||
| 116 | { | 120 | { |
| 117 | return sprintf(buf, | 121 | return sprintf(buf, |
| 118 | "numa_hit %lu\n" | 122 | "numa_hit %lu\n" |
| @@ -130,7 +134,8 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf) | |||
| 130 | } | 134 | } |
| 131 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); | 135 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); |
| 132 | 136 | ||
| 133 | static ssize_t node_read_distance(struct sys_device * dev, char * buf) | 137 | static ssize_t node_read_distance(struct sys_device * dev, |
| 138 | struct sysdev_attribute *attr, char * buf) | ||
| 134 | { | 139 | { |
| 135 | int nid = dev->id; | 140 | int nid = dev->id; |
| 136 | int len = 0; | 141 | int len = 0; |
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index 9b1b20b59e0a..2aa6e8fc4def 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c | |||
| @@ -194,7 +194,7 @@ static int show_dev_hash(unsigned int value) | |||
| 194 | struct device * dev = to_device(entry); | 194 | struct device * dev = to_device(entry); |
| 195 | unsigned int hash = hash_string(DEVSEED, dev->bus_id, DEVHASH); | 195 | unsigned int hash = hash_string(DEVSEED, dev->bus_id, DEVHASH); |
| 196 | if (hash == value) { | 196 | if (hash == value) { |
| 197 | printk(" hash matches device %s\n", dev->bus_id); | 197 | dev_info(dev, "hash matches\n"); |
| 198 | match++; | 198 | match++; |
| 199 | } | 199 | } |
| 200 | entry = entry->prev; | 200 | entry = entry->prev; |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 358bb0be3c08..40fc14f03540 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
| @@ -36,7 +36,7 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) | |||
| 36 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 36 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); |
| 37 | 37 | ||
| 38 | if (sysdev_attr->show) | 38 | if (sysdev_attr->show) |
| 39 | return sysdev_attr->show(sysdev, buffer); | 39 | return sysdev_attr->show(sysdev, sysdev_attr, buffer); |
| 40 | return -EIO; | 40 | return -EIO; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -49,7 +49,7 @@ sysdev_store(struct kobject * kobj, struct attribute * attr, | |||
| 49 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); | 49 | struct sysdev_attribute * sysdev_attr = to_sysdev_attr(attr); |
| 50 | 50 | ||
| 51 | if (sysdev_attr->store) | 51 | if (sysdev_attr->store) |
| 52 | return sysdev_attr->store(sysdev, buffer, count); | 52 | return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); |
| 53 | return -EIO; | 53 | return -EIO; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -130,8 +130,8 @@ static struct kset *system_kset; | |||
| 130 | 130 | ||
| 131 | int sysdev_class_register(struct sysdev_class * cls) | 131 | int sysdev_class_register(struct sysdev_class * cls) |
| 132 | { | 132 | { |
| 133 | pr_debug("Registering sysdev class '%s'\n", | 133 | pr_debug("Registering sysdev class '%s'\n", cls->name); |
| 134 | kobject_name(&cls->kset.kobj)); | 134 | |
| 135 | INIT_LIST_HEAD(&cls->drivers); | 135 | INIT_LIST_HEAD(&cls->drivers); |
| 136 | memset(&cls->kset.kobj, 0x00, sizeof(struct kobject)); | 136 | memset(&cls->kset.kobj, 0x00, sizeof(struct kobject)); |
| 137 | cls->kset.kobj.parent = &system_kset->kobj; | 137 | cls->kset.kobj.parent = &system_kset->kobj; |
| @@ -241,7 +241,8 @@ int sysdev_register(struct sys_device * sysdev) | |||
| 241 | if (!cls) | 241 | if (!cls) |
| 242 | return -EINVAL; | 242 | return -EINVAL; |
| 243 | 243 | ||
| 244 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | 244 | pr_debug("Registering sys device of class '%s'\n", |
| 245 | kobject_name(&cls->kset.kobj)); | ||
| 245 | 246 | ||
| 246 | /* initialize the kobject to 0, in case it had previously been used */ | 247 | /* initialize the kobject to 0, in case it had previously been used */ |
| 247 | memset(&sysdev->kobj, 0x00, sizeof(struct kobject)); | 248 | memset(&sysdev->kobj, 0x00, sizeof(struct kobject)); |
| @@ -257,6 +258,9 @@ int sysdev_register(struct sys_device * sysdev) | |||
| 257 | if (!error) { | 258 | if (!error) { |
| 258 | struct sysdev_driver * drv; | 259 | struct sysdev_driver * drv; |
| 259 | 260 | ||
| 261 | pr_debug("Registering sys device '%s'\n", | ||
| 262 | kobject_name(&sysdev->kobj)); | ||
| 263 | |||
| 260 | mutex_lock(&sysdev_drivers_lock); | 264 | mutex_lock(&sysdev_drivers_lock); |
| 261 | /* Generic notification is implicit, because it's that | 265 | /* Generic notification is implicit, because it's that |
| 262 | * code that should have called us. | 266 | * code that should have called us. |
| @@ -269,6 +273,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
| 269 | } | 273 | } |
| 270 | mutex_unlock(&sysdev_drivers_lock); | 274 | mutex_unlock(&sysdev_drivers_lock); |
| 271 | } | 275 | } |
| 276 | |||
| 272 | kobject_uevent(&sysdev->kobj, KOBJ_ADD); | 277 | kobject_uevent(&sysdev->kobj, KOBJ_ADD); |
| 273 | return error; | 278 | return error; |
| 274 | } | 279 | } |
| @@ -474,3 +479,52 @@ int __init system_bus_init(void) | |||
| 474 | 479 | ||
| 475 | EXPORT_SYMBOL_GPL(sysdev_register); | 480 | EXPORT_SYMBOL_GPL(sysdev_register); |
| 476 | EXPORT_SYMBOL_GPL(sysdev_unregister); | 481 | EXPORT_SYMBOL_GPL(sysdev_unregister); |
| 482 | |||
| 483 | #define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr) | ||
| 484 | |||
| 485 | ssize_t sysdev_store_ulong(struct sys_device *sysdev, | ||
| 486 | struct sysdev_attribute *attr, | ||
| 487 | const char *buf, size_t size) | ||
| 488 | { | ||
| 489 | struct sysdev_ext_attribute *ea = to_ext_attr(attr); | ||
| 490 | char *end; | ||
| 491 | unsigned long new = simple_strtoul(buf, &end, 0); | ||
| 492 | if (end == buf) | ||
| 493 | return -EINVAL; | ||
| 494 | *(unsigned long *)(ea->var) = new; | ||
| 495 | return end - buf; | ||
| 496 | } | ||
| 497 | EXPORT_SYMBOL_GPL(sysdev_store_ulong); | ||
| 498 | |||
| 499 | ssize_t sysdev_show_ulong(struct sys_device *sysdev, | ||
| 500 | struct sysdev_attribute *attr, | ||
| 501 | char *buf) | ||
| 502 | { | ||
| 503 | struct sysdev_ext_attribute *ea = to_ext_attr(attr); | ||
| 504 | return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var)); | ||
| 505 | } | ||
| 506 | EXPORT_SYMBOL_GPL(sysdev_show_ulong); | ||
| 507 | |||
| 508 | ssize_t sysdev_store_int(struct sys_device *sysdev, | ||
| 509 | struct sysdev_attribute *attr, | ||
| 510 | const char *buf, size_t size) | ||
| 511 | { | ||
| 512 | struct sysdev_ext_attribute *ea = to_ext_attr(attr); | ||
| 513 | char *end; | ||
| 514 | long new = simple_strtol(buf, &end, 0); | ||
| 515 | if (end == buf || new > INT_MAX || new < INT_MIN) | ||
| 516 | return -EINVAL; | ||
| 517 | *(int *)(ea->var) = new; | ||
| 518 | return end - buf; | ||
| 519 | } | ||
| 520 | EXPORT_SYMBOL_GPL(sysdev_store_int); | ||
| 521 | |||
| 522 | ssize_t sysdev_show_int(struct sys_device *sysdev, | ||
| 523 | struct sysdev_attribute *attr, | ||
| 524 | char *buf) | ||
| 525 | { | ||
| 526 | struct sysdev_ext_attribute *ea = to_ext_attr(attr); | ||
| 527 | return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var)); | ||
| 528 | } | ||
| 529 | EXPORT_SYMBOL_GPL(sysdev_show_int); | ||
| 530 | |||
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index 3f6d9b0a6abe..199cd97e32e6 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
| @@ -34,7 +34,8 @@ | |||
| 34 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) | 34 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) |
| 35 | 35 | ||
| 36 | #define define_id_show_func(name) \ | 36 | #define define_id_show_func(name) \ |
| 37 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 37 | static ssize_t show_##name(struct sys_device *dev, \ |
| 38 | struct sysdev_attribute *attr, char *buf) \ | ||
| 38 | { \ | 39 | { \ |
| 39 | unsigned int cpu = dev->id; \ | 40 | unsigned int cpu = dev->id; \ |
| 40 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ | 41 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ |
| @@ -59,14 +60,17 @@ static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf) | |||
| 59 | 60 | ||
| 60 | #ifdef arch_provides_topology_pointers | 61 | #ifdef arch_provides_topology_pointers |
| 61 | #define define_siblings_show_map(name) \ | 62 | #define define_siblings_show_map(name) \ |
| 62 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 63 | static ssize_t show_##name(struct sys_device *dev, \ |
| 64 | struct sysdev_attribute *attr, char *buf) \ | ||
| 63 | { \ | 65 | { \ |
| 64 | unsigned int cpu = dev->id; \ | 66 | unsigned int cpu = dev->id; \ |
| 65 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ | 67 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ |
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | #define define_siblings_show_list(name) \ | 70 | #define define_siblings_show_list(name) \ |
| 69 | static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | 71 | static ssize_t show_##name##_list(struct sys_device *dev, \ |
| 72 | struct sysdev_attribute *attr, \ | ||
| 73 | char *buf) \ | ||
| 70 | { \ | 74 | { \ |
| 71 | unsigned int cpu = dev->id; \ | 75 | unsigned int cpu = dev->id; \ |
| 72 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ | 76 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ |
| @@ -74,7 +78,8 @@ static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | |||
| 74 | 78 | ||
| 75 | #else | 79 | #else |
| 76 | #define define_siblings_show_map(name) \ | 80 | #define define_siblings_show_map(name) \ |
| 77 | static ssize_t show_##name(struct sys_device *dev, char *buf) \ | 81 | static ssize_t show_##name(struct sys_device *dev, \ |
| 82 | struct sysdev_attribute *attr, char *buf) \ | ||
| 78 | { \ | 83 | { \ |
| 79 | unsigned int cpu = dev->id; \ | 84 | unsigned int cpu = dev->id; \ |
| 80 | cpumask_t mask = topology_##name(cpu); \ | 85 | cpumask_t mask = topology_##name(cpu); \ |
| @@ -82,7 +87,9 @@ static ssize_t show_##name(struct sys_device *dev, char *buf) \ | |||
| 82 | } | 87 | } |
| 83 | 88 | ||
| 84 | #define define_siblings_show_list(name) \ | 89 | #define define_siblings_show_list(name) \ |
| 85 | static ssize_t show_##name##_list(struct sys_device *dev, char *buf) \ | 90 | static ssize_t show_##name##_list(struct sys_device *dev, \ |
| 91 | struct sysdev_attribute *attr, \ | ||
| 92 | char *buf) \ | ||
| 86 | { \ | 93 | { \ |
| 87 | unsigned int cpu = dev->id; \ | 94 | unsigned int cpu = dev->id; \ |
| 88 | cpumask_t mask = topology_##name(cpu); \ | 95 | cpumask_t mask = topology_##name(cpu); \ |
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index d1de68a31920..c04440cd6a32 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
| @@ -277,8 +277,9 @@ aoechr_init(void) | |||
| 277 | return PTR_ERR(aoe_class); | 277 | return PTR_ERR(aoe_class); |
| 278 | } | 278 | } |
| 279 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 279 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
| 280 | device_create(aoe_class, NULL, | 280 | device_create_drvdata(aoe_class, NULL, |
| 281 | MKDEV(AOE_MAJOR, chardevs[i].minor), chardevs[i].name); | 281 | MKDEV(AOE_MAJOR, chardevs[i].minor), |
| 282 | NULL, chardevs[i].name); | ||
| 282 | 283 | ||
| 283 | return 0; | 284 | return 0; |
| 284 | } | 285 | } |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 9d92636350e5..d731ca42f802 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
| @@ -686,8 +686,9 @@ static int __init pg_init(void) | |||
| 686 | for (unit = 0; unit < PG_UNITS; unit++) { | 686 | for (unit = 0; unit < PG_UNITS; unit++) { |
| 687 | struct pg *dev = &devices[unit]; | 687 | struct pg *dev = &devices[unit]; |
| 688 | if (dev->present) | 688 | if (dev->present) |
| 689 | device_create(pg_class, NULL, MKDEV(major, unit), | 689 | device_create_drvdata(pg_class, NULL, |
| 690 | "pg%u", unit); | 690 | MKDEV(major, unit), NULL, |
| 691 | "pg%u", unit); | ||
| 691 | } | 692 | } |
| 692 | err = 0; | 693 | err = 0; |
| 693 | goto out; | 694 | goto out; |
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 5c74c3574a5a..673b8b2fd337 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
| @@ -979,10 +979,12 @@ static int __init pt_init(void) | |||
| 979 | 979 | ||
| 980 | for (unit = 0; unit < PT_UNITS; unit++) | 980 | for (unit = 0; unit < PT_UNITS; unit++) |
| 981 | if (pt[unit].present) { | 981 | if (pt[unit].present) { |
| 982 | device_create(pt_class, NULL, MKDEV(major, unit), | 982 | device_create_drvdata(pt_class, NULL, |
| 983 | "pt%d", unit); | 983 | MKDEV(major, unit), NULL, |
| 984 | device_create(pt_class, NULL, MKDEV(major, unit + 128), | 984 | "pt%d", unit); |
| 985 | "pt%dn", unit); | 985 | device_create_drvdata(pt_class, NULL, |
| 986 | MKDEV(major, unit + 128), NULL, | ||
| 987 | "pt%dn", unit); | ||
| 986 | } | 988 | } |
| 987 | goto out; | 989 | goto out; |
| 988 | 990 | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 45bee918c46a..158eed4d5161 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
| @@ -303,7 +303,9 @@ static struct kobj_type kobj_pkt_type_wqueue = { | |||
| 303 | static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) | 303 | static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) |
| 304 | { | 304 | { |
| 305 | if (class_pktcdvd) { | 305 | if (class_pktcdvd) { |
| 306 | pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name); | 306 | pd->dev = device_create_drvdata(class_pktcdvd, NULL, |
| 307 | pd->pkt_dev, NULL, | ||
| 308 | "%s", pd->name); | ||
| 307 | if (IS_ERR(pd->dev)) | 309 | if (IS_ERR(pd->dev)) |
| 308 | pd->dev = NULL; | 310 | pd->dev = NULL; |
| 309 | } | 311 | } |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index b9a30c30e2b8..33c466a4888f 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
| @@ -500,7 +500,8 @@ static int __init dsp56k_init_driver(void) | |||
| 500 | err = PTR_ERR(dsp56k_class); | 500 | err = PTR_ERR(dsp56k_class); |
| 501 | goto out_chrdev; | 501 | goto out_chrdev; |
| 502 | } | 502 | } |
| 503 | device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), "dsp56k"); | 503 | device_create_drvdata(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), |
| 504 | NULL, "dsp56k"); | ||
| 504 | 505 | ||
| 505 | printk(banner); | 506 | printk(banner); |
| 506 | goto out; | 507 | goto out; |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 5dc74404058f..9cb48fcd316c 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
| @@ -718,12 +718,12 @@ ip2_loadmain(int *iop, int *irqp) | |||
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | if ( NULL != ( pB = i2BoardPtrTable[i] ) ) { | 720 | if ( NULL != ( pB = i2BoardPtrTable[i] ) ) { |
| 721 | device_create(ip2_class, NULL, | 721 | device_create_drvdata(ip2_class, NULL, |
| 722 | MKDEV(IP2_IPL_MAJOR, 4 * i), | 722 | MKDEV(IP2_IPL_MAJOR, 4 * i), |
| 723 | "ipl%d", i); | 723 | NULL, "ipl%d", i); |
| 724 | device_create(ip2_class, NULL, | 724 | device_create_drvdata(ip2_class, NULL, |
| 725 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), | 725 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), |
| 726 | "stat%d", i); | 726 | NULL, "stat%d", i); |
| 727 | 727 | ||
| 728 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) | 728 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) |
| 729 | { | 729 | { |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index c11a40483459..64e1c169e826 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
| @@ -871,7 +871,7 @@ static void ipmi_new_smi(int if_num, struct device *device) | |||
| 871 | entry->dev = dev; | 871 | entry->dev = dev; |
| 872 | 872 | ||
| 873 | mutex_lock(®_list_mutex); | 873 | mutex_lock(®_list_mutex); |
| 874 | device_create(ipmi_class, device, dev, "ipmi%d", if_num); | 874 | device_create_drvdata(ipmi_class, device, dev, NULL, "ipmi%d", if_num); |
| 875 | list_add(&entry->link, ®_list); | 875 | list_add(&entry->link, ®_list); |
| 876 | mutex_unlock(®_list_mutex); | 876 | mutex_unlock(®_list_mutex); |
| 877 | } | 877 | } |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index f9ebcd41d8e5..843a2afaf204 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
| @@ -4599,8 +4599,9 @@ static int __init istallion_module_init(void) | |||
| 4599 | 4599 | ||
| 4600 | istallion_class = class_create(THIS_MODULE, "staliomem"); | 4600 | istallion_class = class_create(THIS_MODULE, "staliomem"); |
| 4601 | for (i = 0; i < 4; i++) | 4601 | for (i = 0; i < 4; i++) |
| 4602 | device_create(istallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), | 4602 | device_create_drvdata(istallion_class, NULL, |
| 4603 | "staliomem%d", i); | 4603 | MKDEV(STL_SIOMEMMAJOR, i), |
| 4604 | NULL, "staliomem%d", i); | ||
| 4604 | 4605 | ||
| 4605 | return 0; | 4606 | return 0; |
| 4606 | err_deinit: | 4607 | err_deinit: |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 71abb4c33aa2..3f2719b9f77b 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
| @@ -813,7 +813,8 @@ static int lp_register(int nr, struct parport *port) | |||
| 813 | if (reset) | 813 | if (reset) |
| 814 | lp_reset(nr); | 814 | lp_reset(nr); |
| 815 | 815 | ||
| 816 | device_create(lp_class, port->dev, MKDEV(LP_MAJOR, nr), "lp%d", nr); | 816 | device_create_drvdata(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL, |
| 817 | "lp%d", nr); | ||
| 817 | 818 | ||
| 818 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, | 819 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, |
| 819 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); | 820 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index b6772d657547..c2dba82eb5f7 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
| @@ -989,9 +989,9 @@ static int __init chr_dev_init(void) | |||
| 989 | 989 | ||
| 990 | mem_class = class_create(THIS_MODULE, "mem"); | 990 | mem_class = class_create(THIS_MODULE, "mem"); |
| 991 | for (i = 0; i < ARRAY_SIZE(devlist); i++) | 991 | for (i = 0; i < ARRAY_SIZE(devlist); i++) |
| 992 | device_create(mem_class, NULL, | 992 | device_create_drvdata(mem_class, NULL, |
| 993 | MKDEV(MEM_MAJOR, devlist[i].minor), | 993 | MKDEV(MEM_MAJOR, devlist[i].minor), |
| 994 | devlist[i].name); | 994 | NULL, devlist[i].name); |
| 995 | 995 | ||
| 996 | return 0; | 996 | return 0; |
| 997 | } | 997 | } |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 6e1563c3d30a..999aa779c08a 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
| @@ -217,8 +217,8 @@ int misc_register(struct miscdevice * misc) | |||
| 217 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 217 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); |
| 218 | dev = MKDEV(MISC_MAJOR, misc->minor); | 218 | dev = MKDEV(MISC_MAJOR, misc->minor); |
| 219 | 219 | ||
| 220 | misc->this_device = device_create(misc_class, misc->parent, dev, | 220 | misc->this_device = device_create_drvdata(misc_class, misc->parent, |
| 221 | "%s", misc->name); | 221 | dev, NULL, "%s", misc->name); |
| 222 | if (IS_ERR(misc->this_device)) { | 222 | if (IS_ERR(misc->this_device)) { |
| 223 | err = PTR_ERR(misc->this_device); | 223 | err = PTR_ERR(misc->this_device); |
| 224 | goto out; | 224 | goto out; |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index e4a4fbd37d7a..f070ae7bd91a 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
| @@ -1896,7 +1896,7 @@ static int cm4000_probe(struct pcmcia_device *link) | |||
| 1896 | return ret; | 1896 | return ret; |
| 1897 | } | 1897 | } |
| 1898 | 1898 | ||
| 1899 | device_create(cmm_class, NULL, MKDEV(major, i), "cmm%d", i); | 1899 | device_create_drvdata(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i); |
| 1900 | 1900 | ||
| 1901 | return 0; | 1901 | return 0; |
| 1902 | } | 1902 | } |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 6181f8a9b0bd..0b5934bef7a4 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
| @@ -653,7 +653,8 @@ static int reader_probe(struct pcmcia_device *link) | |||
| 653 | return ret; | 653 | return ret; |
| 654 | } | 654 | } |
| 655 | 655 | ||
| 656 | device_create(cmx_class, NULL, MKDEV(major, i), "cmx%d", i); | 656 | device_create_drvdata(cmx_class, NULL, MKDEV(major, i), NULL, |
| 657 | "cmx%d", i); | ||
| 657 | 658 | ||
| 658 | return 0; | 659 | return 0; |
| 659 | } | 660 | } |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index f6e6acadd9a0..7af7a7e6b9c2 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
| @@ -752,8 +752,9 @@ static const struct file_operations pp_fops = { | |||
| 752 | 752 | ||
| 753 | static void pp_attach(struct parport *port) | 753 | static void pp_attach(struct parport *port) |
| 754 | { | 754 | { |
| 755 | device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number), | 755 | device_create_drvdata(ppdev_class, port->dev, |
| 756 | "parport%d", port->number); | 756 | MKDEV(PP_MAJOR, port->number), |
| 757 | NULL, "parport%d", port->number); | ||
| 757 | } | 758 | } |
| 758 | 759 | ||
| 759 | static void pp_detach(struct parport *port) | 760 | static void pp_detach(struct parport *port) |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 505fcbe884a4..47b8cf281d4a 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
| @@ -131,8 +131,8 @@ raw_ioctl(struct inode *inode, struct file *filp, | |||
| 131 | static void bind_device(struct raw_config_request *rq) | 131 | static void bind_device(struct raw_config_request *rq) |
| 132 | { | 132 | { |
| 133 | device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); | 133 | device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); |
| 134 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), | 134 | device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), |
| 135 | "raw%d", rq->raw_minor); | 135 | NULL, "raw%d", rq->raw_minor); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /* | 138 | /* |
| @@ -283,7 +283,8 @@ static int __init raw_init(void) | |||
| 283 | ret = PTR_ERR(raw_class); | 283 | ret = PTR_ERR(raw_class); |
| 284 | goto error_region; | 284 | goto error_region; |
| 285 | } | 285 | } |
| 286 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), "rawctl"); | 286 | device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, |
| 287 | "rawctl"); | ||
| 287 | 288 | ||
| 288 | return 0; | 289 | return 0; |
| 289 | 290 | ||
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 0b799ac1b049..3ce60df14c0a 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
| @@ -444,7 +444,8 @@ scdrv_init(void) | |||
| 444 | continue; | 444 | continue; |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | device_create(snsc_class, NULL, dev, "%s", devname); | 447 | device_create_drvdata(snsc_class, NULL, dev, NULL, |
| 448 | "%s", devname); | ||
| 448 | 449 | ||
| 449 | ia64_sn_irtr_intr_enable(scd->scd_nasid, | 450 | ia64_sn_irtr_intr_enable(scd->scd_nasid, |
| 450 | 0 /*ignored */ , | 451 | 0 /*ignored */ , |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index de5a725c3cc0..b976248e1072 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
| @@ -4755,8 +4755,8 @@ static int __init stallion_module_init(void) | |||
| 4755 | if (IS_ERR(stallion_class)) | 4755 | if (IS_ERR(stallion_class)) |
| 4756 | printk("STALLION: failed to create class\n"); | 4756 | printk("STALLION: failed to create class\n"); |
| 4757 | for (i = 0; i < 4; i++) | 4757 | for (i = 0; i < 4; i++) |
| 4758 | device_create(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), | 4758 | device_create_drvdata(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), |
| 4759 | "staliomem%d", i); | 4759 | NULL, "staliomem%d", i); |
| 4760 | 4760 | ||
| 4761 | return 0; | 4761 | return 0; |
| 4762 | err_unrtty: | 4762 | err_unrtty: |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index d94cd8410c53..15e597d03002 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -3412,7 +3412,7 @@ struct device *tty_register_device(struct tty_driver *driver, unsigned index, | |||
| 3412 | else | 3412 | else |
| 3413 | tty_line_name(driver, index, name); | 3413 | tty_line_name(driver, index, name); |
| 3414 | 3414 | ||
| 3415 | return device_create(tty_class, device, dev, name); | 3415 | return device_create_drvdata(tty_class, device, dev, NULL, name); |
| 3416 | } | 3416 | } |
| 3417 | 3417 | ||
| 3418 | /** | 3418 | /** |
| @@ -3690,20 +3690,22 @@ static int __init tty_init(void) | |||
| 3690 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || | 3690 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || |
| 3691 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 3691 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
| 3692 | panic("Couldn't register /dev/tty driver\n"); | 3692 | panic("Couldn't register /dev/tty driver\n"); |
| 3693 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty"); | 3693 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, |
| 3694 | "tty"); | ||
| 3694 | 3695 | ||
| 3695 | cdev_init(&console_cdev, &console_fops); | 3696 | cdev_init(&console_cdev, &console_fops); |
| 3696 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 3697 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
| 3697 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 3698 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
| 3698 | panic("Couldn't register /dev/console driver\n"); | 3699 | panic("Couldn't register /dev/console driver\n"); |
| 3699 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console"); | 3700 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, |
| 3701 | "console"); | ||
| 3700 | 3702 | ||
| 3701 | #ifdef CONFIG_UNIX98_PTYS | 3703 | #ifdef CONFIG_UNIX98_PTYS |
| 3702 | cdev_init(&ptmx_cdev, &ptmx_fops); | 3704 | cdev_init(&ptmx_cdev, &ptmx_fops); |
| 3703 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || | 3705 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || |
| 3704 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 3706 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
| 3705 | panic("Couldn't register /dev/ptmx driver\n"); | 3707 | panic("Couldn't register /dev/ptmx driver\n"); |
| 3706 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx"); | 3708 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); |
| 3707 | #endif | 3709 | #endif |
| 3708 | 3710 | ||
| 3709 | #ifdef CONFIG_VT | 3711 | #ifdef CONFIG_VT |
| @@ -3711,7 +3713,7 @@ static int __init tty_init(void) | |||
| 3711 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | 3713 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || |
| 3712 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 3714 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
| 3713 | panic("Couldn't register /dev/tty0 driver\n"); | 3715 | panic("Couldn't register /dev/tty0 driver\n"); |
| 3714 | device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0"); | 3716 | device_create_drvdata(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); |
| 3715 | 3717 | ||
| 3716 | vty_init(); | 3718 | vty_init(); |
| 3717 | #endif | 3719 | #endif |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index eebfad2777d2..c2ae52dd53d1 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
| @@ -481,10 +481,10 @@ static struct class *vc_class; | |||
| 481 | 481 | ||
| 482 | void vcs_make_sysfs(struct tty_struct *tty) | 482 | void vcs_make_sysfs(struct tty_struct *tty) |
| 483 | { | 483 | { |
| 484 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), | 484 | device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), |
| 485 | "vcs%u", tty->index + 1); | 485 | NULL, "vcs%u", tty->index + 1); |
| 486 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), | 486 | device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), |
| 487 | "vcsa%u", tty->index + 1); | 487 | NULL, "vcsa%u", tty->index + 1); |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | void vcs_remove_sysfs(struct tty_struct *tty) | 490 | void vcs_remove_sysfs(struct tty_struct *tty) |
| @@ -499,7 +499,7 @@ int __init vcs_init(void) | |||
| 499 | panic("unable to get major %d for vcs device", VCS_MAJOR); | 499 | panic("unable to get major %d for vcs device", VCS_MAJOR); |
| 500 | vc_class = class_create(THIS_MODULE, "vc"); | 500 | vc_class = class_create(THIS_MODULE, "vc"); |
| 501 | 501 | ||
| 502 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), "vcs"); | 502 | device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); |
| 503 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), "vcsa"); | 503 | device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); |
| 504 | return 0; | 504 | return 0; |
| 505 | } | 505 | } |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index e5da98d8f9cd..7a70a40ad639 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
| @@ -886,10 +886,10 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
| 886 | state[i].cur_part = 0; | 886 | state[i].cur_part = 0; |
| 887 | for (j = 0; j < MAX_PARTITIONS; ++j) | 887 | for (j = 0; j < MAX_PARTITIONS; ++j) |
| 888 | state[i].part_stat_rwi[j] = VIOT_IDLE; | 888 | state[i].part_stat_rwi[j] = VIOT_IDLE; |
| 889 | device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), | 889 | device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), |
| 890 | "iseries!vt%d", i); | 890 | NULL, "iseries!vt%d", i); |
| 891 | device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 891 | device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
| 892 | "iseries!nvt%d", i); | 892 | NULL, "iseries!nvt%d", i); |
| 893 | printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " | 893 | printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " |
| 894 | "resource %10.10s type %4.4s, model %3.3s\n", | 894 | "resource %10.10s type %4.4s, model %3.3s\n", |
| 895 | i, viotape_unitinfo[i].rsrcname, | 895 | i, viotape_unitinfo[i].rsrcname, |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 935f1c207a1f..e32a076d5f1f 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
| @@ -3425,9 +3425,10 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
| 3425 | if (retval) | 3425 | if (retval) |
| 3426 | goto err; | 3426 | goto err; |
| 3427 | 3427 | ||
| 3428 | con_driver->dev = device_create(vtconsole_class, NULL, | 3428 | con_driver->dev = device_create_drvdata(vtconsole_class, NULL, |
| 3429 | MKDEV(0, con_driver->node), | 3429 | MKDEV(0, con_driver->node), |
| 3430 | "vtcon%i", con_driver->node); | 3430 | NULL, "vtcon%i", |
| 3431 | con_driver->node); | ||
| 3431 | 3432 | ||
| 3432 | if (IS_ERR(con_driver->dev)) { | 3433 | if (IS_ERR(con_driver->dev)) { |
| 3433 | printk(KERN_WARNING "Unable to create device for %s; " | 3434 | printk(KERN_WARNING "Unable to create device for %s; " |
| @@ -3535,9 +3536,10 @@ static int __init vtconsole_class_init(void) | |||
| 3535 | struct con_driver *con = ®istered_con_driver[i]; | 3536 | struct con_driver *con = ®istered_con_driver[i]; |
| 3536 | 3537 | ||
| 3537 | if (con->con && !con->dev) { | 3538 | if (con->con && !con->dev) { |
| 3538 | con->dev = device_create(vtconsole_class, NULL, | 3539 | con->dev = device_create_drvdata(vtconsole_class, NULL, |
| 3539 | MKDEV(0, con->node), | 3540 | MKDEV(0, con->node), |
| 3540 | "vtcon%i", con->node); | 3541 | NULL, "vtcon%i", |
| 3542 | con->node); | ||
| 3541 | 3543 | ||
| 3542 | if (IS_ERR(con->dev)) { | 3544 | if (IS_ERR(con->dev)) { |
| 3543 | printk(KERN_WARNING "Unable to create " | 3545 | printk(KERN_WARNING "Unable to create " |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 1e1b81e57cdc..51966ccf4ea3 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
| @@ -658,8 +658,9 @@ static int __devinit hwicap_setup(struct device *dev, int id, | |||
| 658 | dev_err(dev, "cdev_add() failed\n"); | 658 | dev_err(dev, "cdev_add() failed\n"); |
| 659 | goto failed3; | 659 | goto failed3; |
| 660 | } | 660 | } |
| 661 | /* devfs_mk_cdev(devt, S_IFCHR|S_IRUGO|S_IWUGO, DRIVER_NAME); */ | 661 | |
| 662 | device_create(icap_class, dev, devt, "%s%d", DRIVER_NAME, id); | 662 | device_create_drvdata(icap_class, dev, devt, NULL, |
| 663 | "%s%d", DRIVER_NAME, id); | ||
| 663 | return 0; /* success */ | 664 | return 0; /* success */ |
| 664 | 665 | ||
| 665 | failed3: | 666 | failed3: |
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index e949618b9be0..31a0e0b455b6 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c | |||
| @@ -21,7 +21,8 @@ static int __init cpuidle_sysfs_setup(char *unused) | |||
| 21 | } | 21 | } |
| 22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); | 22 | __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); |
| 23 | 23 | ||
| 24 | static ssize_t show_available_governors(struct sys_device *dev, char *buf) | 24 | static ssize_t show_available_governors(struct sys_device *dev, |
| 25 | struct sysdev_attribute *attr, char *buf) | ||
| 25 | { | 26 | { |
| 26 | ssize_t i = 0; | 27 | ssize_t i = 0; |
| 27 | struct cpuidle_governor *tmp; | 28 | struct cpuidle_governor *tmp; |
| @@ -39,7 +40,8 @@ out: | |||
| 39 | return i; | 40 | return i; |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | static ssize_t show_current_driver(struct sys_device *dev, char *buf) | 43 | static ssize_t show_current_driver(struct sys_device *dev, |
| 44 | struct sysdev_attribute *attr, char *buf) | ||
| 43 | { | 45 | { |
| 44 | ssize_t ret; | 46 | ssize_t ret; |
| 45 | 47 | ||
| @@ -53,7 +55,8 @@ static ssize_t show_current_driver(struct sys_device *dev, char *buf) | |||
| 53 | return ret; | 55 | return ret; |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | static ssize_t show_current_governor(struct sys_device *dev, char *buf) | 58 | static ssize_t show_current_governor(struct sys_device *dev, |
| 59 | struct sysdev_attribute *attr, char *buf) | ||
| 57 | { | 60 | { |
| 58 | ssize_t ret; | 61 | ssize_t ret; |
| 59 | 62 | ||
| @@ -68,6 +71,7 @@ static ssize_t show_current_governor(struct sys_device *dev, char *buf) | |||
| 68 | } | 71 | } |
| 69 | 72 | ||
| 70 | static ssize_t store_current_governor(struct sys_device *dev, | 73 | static ssize_t store_current_governor(struct sys_device *dev, |
| 74 | struct sysdev_attribute *attr, | ||
| 71 | const char *buf, size_t count) | 75 | const char *buf, size_t count) |
| 72 | { | 76 | { |
| 73 | char gov_name[CPUIDLE_NAME_LEN]; | 77 | char gov_name[CPUIDLE_NAME_LEN]; |
diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c index 011328faa5f2..9a70377bfb34 100644 --- a/drivers/dca/dca-sysfs.c +++ b/drivers/dca/dca-sysfs.c | |||
| @@ -14,8 +14,9 @@ int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot) | |||
| 14 | { | 14 | { |
| 15 | struct device *cd; | 15 | struct device *cd; |
| 16 | 16 | ||
| 17 | cd = device_create(dca_class, dca->cd, MKDEV(0, slot + 1), | 17 | cd = device_create_drvdata(dca_class, dca->cd, |
| 18 | "requester%d", slot); | 18 | MKDEV(0, slot + 1), NULL, |
| 19 | "requester%d", slot); | ||
| 19 | if (IS_ERR(cd)) | 20 | if (IS_ERR(cd)) |
| 20 | return PTR_ERR(cd); | 21 | return PTR_ERR(cd); |
| 21 | return 0; | 22 | return 0; |
| @@ -46,7 +47,8 @@ idr_try_again: | |||
| 46 | return err; | 47 | return err; |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | cd = device_create(dca_class, dev, MKDEV(0, 0), "dca%d", dca->id); | 50 | cd = device_create_drvdata(dca_class, dev, MKDEV(0, 0), NULL, |
| 51 | "dca%d", dca->id); | ||
| 50 | if (IS_ERR(cd)) { | 52 | if (IS_ERR(cd)) { |
| 51 | spin_lock(&dca_idr_lock); | 53 | spin_lock(&dca_idr_lock); |
| 52 | idr_remove(&dca_idr, dca->id); | 54 | idr_remove(&dca_idr, dca->id); |
diff --git a/drivers/eisa/Makefile b/drivers/eisa/Makefile index 70abf93fe6b0..5369ce957c6d 100644 --- a/drivers/eisa/Makefile +++ b/drivers/eisa/Makefile | |||
| @@ -9,7 +9,7 @@ obj-${CONFIG_EISA_VIRTUAL_ROOT} += virtual_root.o | |||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | # Ugly hack to get DEVICE_NAME_SIZE value... | 11 | # Ugly hack to get DEVICE_NAME_SIZE value... |
| 12 | DEVICE_NAME_SIZE =$(shell awk '$$1=="\#define" && $$2=="DEVICE_NAME_SIZE" {print $$3-1}' $(srctree)/include/linux/device.h) | 12 | DEVICE_NAME_SIZE = 50 |
| 13 | 13 | ||
| 14 | $(obj)/eisa-bus.o: $(obj)/devlist.h | 14 | $(obj)/eisa-bus.o: $(obj)/devlist.h |
| 15 | 15 | ||
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 65dcf0432653..c950bf8606d9 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | struct eisa_device_info { | 23 | struct eisa_device_info { |
| 24 | struct eisa_device_id id; | 24 | struct eisa_device_id id; |
| 25 | char name[DEVICE_NAME_SIZE]; | 25 | char name[50]; |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_EISA_NAMES | 28 | #ifdef CONFIG_EISA_NAMES |
| @@ -63,7 +63,7 @@ static void __init eisa_name_device (struct eisa_device *edev) | |||
| 63 | if (!strcmp (edev->id.sig, eisa_table[i].id.sig)) { | 63 | if (!strcmp (edev->id.sig, eisa_table[i].id.sig)) { |
| 64 | strlcpy (edev->pretty_name, | 64 | strlcpy (edev->pretty_name, |
| 65 | eisa_table[i].name, | 65 | eisa_table[i].name, |
| 66 | DEVICE_NAME_SIZE); | 66 | sizeof(edev->pretty_name)); |
| 67 | return; | 67 | return; |
| 68 | } | 68 | } |
| 69 | } | 69 | } |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 2fde6c63f47d..0c6b4d4e7e27 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
| @@ -322,8 +322,9 @@ int hidraw_connect(struct hid_device *hid) | |||
| 322 | goto out; | 322 | goto out; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | dev->dev = device_create(hidraw_class, NULL, MKDEV(hidraw_major, minor), | 325 | dev->dev = device_create_drvdata(hidraw_class, NULL, |
| 326 | "%s%d", "hidraw", minor); | 326 | MKDEV(hidraw_major, minor), NULL, |
| 327 | "%s%d", "hidraw", minor); | ||
| 327 | 328 | ||
| 328 | if (IS_ERR(dev->dev)) { | 329 | if (IS_ERR(dev->dev)) { |
| 329 | spin_lock(&minors_lock); | 330 | spin_lock(&minors_lock); |
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 3db28450a3b3..7321a88a5112 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c | |||
| @@ -55,7 +55,8 @@ again: | |||
| 55 | return ERR_PTR(err); | 55 | return ERR_PTR(err); |
| 56 | 56 | ||
| 57 | id = id & MAX_ID_MASK; | 57 | id = id & MAX_ID_MASK; |
| 58 | hwdev = device_create(hwmon_class, dev, MKDEV(0,0), HWMON_ID_FORMAT, id); | 58 | hwdev = device_create_drvdata(hwmon_class, dev, MKDEV(0, 0), NULL, |
| 59 | HWMON_ID_FORMAT, id); | ||
| 59 | 60 | ||
| 60 | if (IS_ERR(hwdev)) { | 61 | if (IS_ERR(hwdev)) { |
| 61 | spin_lock(&idr_lock); | 62 | spin_lock(&idr_lock); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7608df83d6d1..7bf38c418086 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -722,7 +722,8 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) | |||
| 722 | 722 | ||
| 723 | INIT_LIST_HEAD(&driver->clients); | 723 | INIT_LIST_HEAD(&driver->clients); |
| 724 | /* Walk the adapters that are already present */ | 724 | /* Walk the adapters that are already present */ |
| 725 | class_for_each_device(&i2c_adapter_class, driver, __attach_adapter); | 725 | class_for_each_device(&i2c_adapter_class, NULL, driver, |
| 726 | __attach_adapter); | ||
| 726 | 727 | ||
| 727 | mutex_unlock(&core_lock); | 728 | mutex_unlock(&core_lock); |
| 728 | return 0; | 729 | return 0; |
| @@ -782,7 +783,8 @@ void i2c_del_driver(struct i2c_driver *driver) | |||
| 782 | { | 783 | { |
| 783 | mutex_lock(&core_lock); | 784 | mutex_lock(&core_lock); |
| 784 | 785 | ||
| 785 | class_for_each_device(&i2c_adapter_class, driver, __detach_adapter); | 786 | class_for_each_device(&i2c_adapter_class, NULL, driver, |
| 787 | __detach_adapter); | ||
| 786 | 788 | ||
| 787 | driver_unregister(&driver->driver); | 789 | driver_unregister(&driver->driver); |
| 788 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); | 790 | pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 86727fa8858f..9d55c6383b23 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
| @@ -521,9 +521,9 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) | |||
| 521 | return PTR_ERR(i2c_dev); | 521 | return PTR_ERR(i2c_dev); |
| 522 | 522 | ||
| 523 | /* register this i2c device with the driver core */ | 523 | /* register this i2c device with the driver core */ |
| 524 | i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, | 524 | i2c_dev->dev = device_create_drvdata(i2c_dev_class, &adap->dev, |
| 525 | MKDEV(I2C_MAJOR, adap->nr), | 525 | MKDEV(I2C_MAJOR, adap->nr), |
| 526 | "i2c-%d", adap->nr); | 526 | NULL, "i2c-%d", adap->nr); |
| 527 | if (IS_ERR(i2c_dev->dev)) { | 527 | if (IS_ERR(i2c_dev->dev)) { |
| 528 | res = PTR_ERR(i2c_dev->dev); | 528 | res = PTR_ERR(i2c_dev->dev); |
| 529 | goto error; | 529 | goto error; |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index b711ab96e287..353dd11b9283 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -2697,10 +2697,12 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
| 2697 | 2697 | ||
| 2698 | idetape_setup(drive, tape, minor); | 2698 | idetape_setup(drive, tape, minor); |
| 2699 | 2699 | ||
| 2700 | device_create(idetape_sysfs_class, &drive->gendev, | 2700 | device_create_drvdata(idetape_sysfs_class, &drive->gendev, |
| 2701 | MKDEV(IDETAPE_MAJOR, minor), "%s", tape->name); | 2701 | MKDEV(IDETAPE_MAJOR, minor), NULL, |
| 2702 | device_create(idetape_sysfs_class, &drive->gendev, | 2702 | "%s", tape->name); |
| 2703 | MKDEV(IDETAPE_MAJOR, minor + 128), "n%s", tape->name); | 2703 | device_create_drvdata(idetape_sysfs_class, &drive->gendev, |
| 2704 | MKDEV(IDETAPE_MAJOR, minor + 128), NULL, | ||
| 2705 | "n%s", tape->name); | ||
| 2704 | 2706 | ||
| 2705 | g->fops = &idetape_block_ops; | 2707 | g->fops = &idetape_block_ops; |
| 2706 | ide_register_region(g); | 2708 | ide_register_region(g); |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 9d19aec5820a..b6eb2cf25914 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
| @@ -2296,9 +2296,10 @@ static void dv1394_add_host(struct hpsb_host *host) | |||
| 2296 | 2296 | ||
| 2297 | ohci = (struct ti_ohci *)host->hostdata; | 2297 | ohci = (struct ti_ohci *)host->hostdata; |
| 2298 | 2298 | ||
| 2299 | device_create(hpsb_protocol_class, NULL, MKDEV( | 2299 | device_create_drvdata(hpsb_protocol_class, NULL, |
| 2300 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), | 2300 | MKDEV(IEEE1394_MAJOR, |
| 2301 | "dv1394-%d", id); | 2301 | IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), NULL, |
| 2302 | "dv1394-%d", id); | ||
| 2302 | 2303 | ||
| 2303 | dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); | 2304 | dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); |
| 2304 | dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); | 2305 | dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 05710c7c1220..994a21e5a0aa 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
| @@ -754,7 +754,8 @@ static void nodemgr_remove_uds(struct node_entry *ne) | |||
| 754 | */ | 754 | */ |
| 755 | mutex_lock(&nodemgr_serialize_remove_uds); | 755 | mutex_lock(&nodemgr_serialize_remove_uds); |
| 756 | for (;;) { | 756 | for (;;) { |
| 757 | dev = class_find_device(&nodemgr_ud_class, ne, __match_ne); | 757 | dev = class_find_device(&nodemgr_ud_class, NULL, ne, |
| 758 | __match_ne); | ||
| 758 | if (!dev) | 759 | if (!dev) |
| 759 | break; | 760 | break; |
| 760 | ud = container_of(dev, struct unit_directory, unit_dev); | 761 | ud = container_of(dev, struct unit_directory, unit_dev); |
| @@ -901,7 +902,8 @@ static struct node_entry *find_entry_by_guid(u64 guid) | |||
| 901 | struct device *dev; | 902 | struct device *dev; |
| 902 | struct node_entry *ne; | 903 | struct node_entry *ne; |
| 903 | 904 | ||
| 904 | dev = class_find_device(&nodemgr_ne_class, &guid, __match_ne_guid); | 905 | dev = class_find_device(&nodemgr_ne_class, NULL, &guid, |
| 906 | __match_ne_guid); | ||
| 905 | if (!dev) | 907 | if (!dev) |
| 906 | return NULL; | 908 | return NULL; |
| 907 | ne = container_of(dev, struct node_entry, node_dev); | 909 | ne = container_of(dev, struct node_entry, node_dev); |
| @@ -940,7 +942,8 @@ static struct node_entry *find_entry_by_nodeid(struct hpsb_host *host, | |||
| 940 | param.host = host; | 942 | param.host = host; |
| 941 | param.nodeid = nodeid; | 943 | param.nodeid = nodeid; |
| 942 | 944 | ||
| 943 | dev = class_find_device(&nodemgr_ne_class, ¶m, __match_ne_nodeid); | 945 | dev = class_find_device(&nodemgr_ne_class, NULL, ¶m, |
| 946 | __match_ne_nodeid); | ||
| 944 | if (!dev) | 947 | if (!dev) |
| 945 | return NULL; | 948 | return NULL; |
| 946 | ne = container_of(dev, struct node_entry, node_dev); | 949 | ne = container_of(dev, struct node_entry, node_dev); |
| @@ -1453,7 +1456,8 @@ static void nodemgr_suspend_ne(struct node_entry *ne) | |||
| 1453 | ne->in_limbo = 1; | 1456 | ne->in_limbo = 1; |
| 1454 | WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo)); | 1457 | WARN_ON(device_create_file(&ne->device, &dev_attr_ne_in_limbo)); |
| 1455 | 1458 | ||
| 1456 | class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_driver_suspend); | 1459 | class_for_each_device(&nodemgr_ud_class, NULL, ne, |
| 1460 | __nodemgr_driver_suspend); | ||
| 1457 | } | 1461 | } |
| 1458 | 1462 | ||
| 1459 | 1463 | ||
| @@ -1462,7 +1466,8 @@ static void nodemgr_resume_ne(struct node_entry *ne) | |||
| 1462 | ne->in_limbo = 0; | 1466 | ne->in_limbo = 0; |
| 1463 | device_remove_file(&ne->device, &dev_attr_ne_in_limbo); | 1467 | device_remove_file(&ne->device, &dev_attr_ne_in_limbo); |
| 1464 | 1468 | ||
| 1465 | class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_driver_resume); | 1469 | class_for_each_device(&nodemgr_ud_class, NULL, ne, |
| 1470 | __nodemgr_driver_resume); | ||
| 1466 | HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", | 1471 | HPSB_DEBUG("Node resumed: ID:BUS[" NODE_BUS_FMT "] GUID[%016Lx]", |
| 1467 | NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid); | 1472 | NODE_BUS_ARGS(ne->host, ne->nodeid), (unsigned long long)ne->guid); |
| 1468 | } | 1473 | } |
| @@ -1498,7 +1503,8 @@ static int __nodemgr_update_pdrv(struct device *dev, void *data) | |||
| 1498 | 1503 | ||
| 1499 | static void nodemgr_update_pdrv(struct node_entry *ne) | 1504 | static void nodemgr_update_pdrv(struct node_entry *ne) |
| 1500 | { | 1505 | { |
| 1501 | class_for_each_device(&nodemgr_ud_class, ne, __nodemgr_update_pdrv); | 1506 | class_for_each_device(&nodemgr_ud_class, NULL, ne, |
| 1507 | __nodemgr_update_pdrv); | ||
| 1502 | } | 1508 | } |
| 1503 | 1509 | ||
| 1504 | 1510 | ||
| @@ -1591,7 +1597,8 @@ static void nodemgr_node_probe(struct host_info *hi, int generation) | |||
| 1591 | * while probes are time-consuming. (Well, those probes need some | 1597 | * while probes are time-consuming. (Well, those probes need some |
| 1592 | * improvement...) */ | 1598 | * improvement...) */ |
| 1593 | 1599 | ||
| 1594 | class_for_each_device(&nodemgr_ne_class, ¶m, __nodemgr_node_probe); | 1600 | class_for_each_device(&nodemgr_ne_class, NULL, ¶m, |
| 1601 | __nodemgr_node_probe); | ||
| 1595 | 1602 | ||
| 1596 | /* If we had a bus reset while we were scanning the bus, it is | 1603 | /* If we had a bus reset while we were scanning the bus, it is |
| 1597 | * possible that we did not probe all nodes. In that case, we | 1604 | * possible that we did not probe all nodes. In that case, we |
| @@ -1826,7 +1833,7 @@ int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *)) | |||
| 1826 | 1833 | ||
| 1827 | hip.cb = cb; | 1834 | hip.cb = cb; |
| 1828 | hip.data = data; | 1835 | hip.data = data; |
| 1829 | error = class_for_each_device(&hpsb_host_class, &hip, | 1836 | error = class_for_each_device(&hpsb_host_class, NULL, &hip, |
| 1830 | __nodemgr_for_each_host); | 1837 | __nodemgr_for_each_host); |
| 1831 | 1838 | ||
| 1832 | return error; | 1839 | return error; |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 96f2847b0405..6fa9e4a21840 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
| @@ -3010,10 +3010,10 @@ static int __init init_raw1394(void) | |||
| 3010 | hpsb_register_highlevel(&raw1394_highlevel); | 3010 | hpsb_register_highlevel(&raw1394_highlevel); |
| 3011 | 3011 | ||
| 3012 | if (IS_ERR | 3012 | if (IS_ERR |
| 3013 | (device_create( | 3013 | (device_create_drvdata( |
| 3014 | hpsb_protocol_class, NULL, | 3014 | hpsb_protocol_class, NULL, |
| 3015 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), | 3015 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), |
| 3016 | RAW1394_DEVICE_NAME))) { | 3016 | NULL, RAW1394_DEVICE_NAME))) { |
| 3017 | ret = -EFAULT; | 3017 | ret = -EFAULT; |
| 3018 | goto out_unreg; | 3018 | goto out_unreg; |
| 3019 | } | 3019 | } |
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 069b9f6bf16d..25db6e67fa4e 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
| @@ -1341,9 +1341,9 @@ static void video1394_add_host (struct hpsb_host *host) | |||
| 1341 | hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); | 1341 | hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); |
| 1342 | 1342 | ||
| 1343 | minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; | 1343 | minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; |
| 1344 | device_create(hpsb_protocol_class, NULL, | 1344 | device_create_drvdata(hpsb_protocol_class, NULL, |
| 1345 | MKDEV(IEEE1394_MAJOR, minor), | 1345 | MKDEV(IEEE1394_MAJOR, minor), NULL, |
| 1346 | "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); | 1346 | "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); |
| 1347 | } | 1347 | } |
| 1348 | 1348 | ||
| 1349 | 1349 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 55738eead3bf..922d35f4fc08 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
| @@ -44,6 +44,7 @@ | |||
| 44 | #include <linux/spinlock.h> | 44 | #include <linux/spinlock.h> |
| 45 | #include <linux/sysfs.h> | 45 | #include <linux/sysfs.h> |
| 46 | #include <linux/workqueue.h> | 46 | #include <linux/workqueue.h> |
| 47 | #include <linux/kdev_t.h> | ||
| 47 | 48 | ||
| 48 | #include <rdma/ib_cache.h> | 49 | #include <rdma/ib_cache.h> |
| 49 | #include <rdma/ib_cm.h> | 50 | #include <rdma/ib_cm.h> |
| @@ -162,8 +163,8 @@ struct cm_port { | |||
| 162 | 163 | ||
| 163 | struct cm_device { | 164 | struct cm_device { |
| 164 | struct list_head list; | 165 | struct list_head list; |
| 165 | struct ib_device *device; | 166 | struct ib_device *ib_device; |
| 166 | struct kobject dev_obj; | 167 | struct device *device; |
| 167 | u8 ack_delay; | 168 | u8 ack_delay; |
| 168 | struct cm_port *port[0]; | 169 | struct cm_port *port[0]; |
| 169 | }; | 170 | }; |
| @@ -339,7 +340,7 @@ static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc, | |||
| 339 | { | 340 | { |
| 340 | av->port = port; | 341 | av->port = port; |
| 341 | av->pkey_index = wc->pkey_index; | 342 | av->pkey_index = wc->pkey_index; |
| 342 | ib_init_ah_from_wc(port->cm_dev->device, port->port_num, wc, | 343 | ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc, |
| 343 | grh, &av->ah_attr); | 344 | grh, &av->ah_attr); |
| 344 | } | 345 | } |
| 345 | 346 | ||
| @@ -353,7 +354,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) | |||
| 353 | 354 | ||
| 354 | read_lock_irqsave(&cm.device_lock, flags); | 355 | read_lock_irqsave(&cm.device_lock, flags); |
| 355 | list_for_each_entry(cm_dev, &cm.device_list, list) { | 356 | list_for_each_entry(cm_dev, &cm.device_list, list) { |
| 356 | if (!ib_find_cached_gid(cm_dev->device, &path->sgid, | 357 | if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid, |
| 357 | &p, NULL)) { | 358 | &p, NULL)) { |
| 358 | port = cm_dev->port[p-1]; | 359 | port = cm_dev->port[p-1]; |
| 359 | break; | 360 | break; |
| @@ -364,13 +365,13 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) | |||
| 364 | if (!port) | 365 | if (!port) |
| 365 | return -EINVAL; | 366 | return -EINVAL; |
| 366 | 367 | ||
| 367 | ret = ib_find_cached_pkey(cm_dev->device, port->port_num, | 368 | ret = ib_find_cached_pkey(cm_dev->ib_device, port->port_num, |
| 368 | be16_to_cpu(path->pkey), &av->pkey_index); | 369 | be16_to_cpu(path->pkey), &av->pkey_index); |
| 369 | if (ret) | 370 | if (ret) |
| 370 | return ret; | 371 | return ret; |
| 371 | 372 | ||
| 372 | av->port = port; | 373 | av->port = port; |
| 373 | ib_init_ah_from_path(cm_dev->device, port->port_num, path, | 374 | ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path, |
| 374 | &av->ah_attr); | 375 | &av->ah_attr); |
| 375 | av->timeout = path->packet_life_time + 1; | 376 | av->timeout = path->packet_life_time + 1; |
| 376 | return 0; | 377 | return 0; |
| @@ -1515,7 +1516,7 @@ static int cm_req_handler(struct cm_work *work) | |||
| 1515 | 1516 | ||
| 1516 | req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; | 1517 | req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; |
| 1517 | 1518 | ||
| 1518 | cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL); | 1519 | cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); |
| 1519 | if (IS_ERR(cm_id)) | 1520 | if (IS_ERR(cm_id)) |
| 1520 | return PTR_ERR(cm_id); | 1521 | return PTR_ERR(cm_id); |
| 1521 | 1522 | ||
| @@ -1550,7 +1551,7 @@ static int cm_req_handler(struct cm_work *work) | |||
| 1550 | cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]); | 1551 | cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]); |
| 1551 | ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); | 1552 | ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); |
| 1552 | if (ret) { | 1553 | if (ret) { |
| 1553 | ib_get_cached_gid(work->port->cm_dev->device, | 1554 | ib_get_cached_gid(work->port->cm_dev->ib_device, |
| 1554 | work->port->port_num, 0, &work->path[0].sgid); | 1555 | work->port->port_num, 0, &work->path[0].sgid); |
| 1555 | ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, | 1556 | ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, |
| 1556 | &work->path[0].sgid, sizeof work->path[0].sgid, | 1557 | &work->path[0].sgid, sizeof work->path[0].sgid, |
| @@ -2950,7 +2951,7 @@ static int cm_sidr_req_handler(struct cm_work *work) | |||
| 2950 | struct cm_sidr_req_msg *sidr_req_msg; | 2951 | struct cm_sidr_req_msg *sidr_req_msg; |
| 2951 | struct ib_wc *wc; | 2952 | struct ib_wc *wc; |
| 2952 | 2953 | ||
| 2953 | cm_id = ib_create_cm_id(work->port->cm_dev->device, NULL, NULL); | 2954 | cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL); |
| 2954 | if (IS_ERR(cm_id)) | 2955 | if (IS_ERR(cm_id)) |
| 2955 | return PTR_ERR(cm_id); | 2956 | return PTR_ERR(cm_id); |
| 2956 | cm_id_priv = container_of(cm_id, struct cm_id_private, id); | 2957 | cm_id_priv = container_of(cm_id, struct cm_id_private, id); |
| @@ -3578,7 +3579,7 @@ static void cm_get_ack_delay(struct cm_device *cm_dev) | |||
| 3578 | { | 3579 | { |
| 3579 | struct ib_device_attr attr; | 3580 | struct ib_device_attr attr; |
| 3580 | 3581 | ||
| 3581 | if (ib_query_device(cm_dev->device, &attr)) | 3582 | if (ib_query_device(cm_dev->ib_device, &attr)) |
| 3582 | cm_dev->ack_delay = 0; /* acks will rely on packet life time */ | 3583 | cm_dev->ack_delay = 0; /* acks will rely on packet life time */ |
| 3583 | else | 3584 | else |
| 3584 | cm_dev->ack_delay = attr.local_ca_ack_delay; | 3585 | cm_dev->ack_delay = attr.local_ca_ack_delay; |
| @@ -3618,18 +3619,6 @@ static struct kobj_type cm_port_obj_type = { | |||
| 3618 | .release = cm_release_port_obj | 3619 | .release = cm_release_port_obj |
| 3619 | }; | 3620 | }; |
| 3620 | 3621 | ||
| 3621 | static void cm_release_dev_obj(struct kobject *obj) | ||
| 3622 | { | ||
| 3623 | struct cm_device *cm_dev; | ||
| 3624 | |||
| 3625 | cm_dev = container_of(obj, struct cm_device, dev_obj); | ||
| 3626 | kfree(cm_dev); | ||
| 3627 | } | ||
| 3628 | |||
| 3629 | static struct kobj_type cm_dev_obj_type = { | ||
| 3630 | .release = cm_release_dev_obj | ||
| 3631 | }; | ||
| 3632 | |||
| 3633 | struct class cm_class = { | 3622 | struct class cm_class = { |
| 3634 | .name = "infiniband_cm", | 3623 | .name = "infiniband_cm", |
| 3635 | }; | 3624 | }; |
| @@ -3640,7 +3629,7 @@ static int cm_create_port_fs(struct cm_port *port) | |||
| 3640 | int i, ret; | 3629 | int i, ret; |
| 3641 | 3630 | ||
| 3642 | ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, | 3631 | ret = kobject_init_and_add(&port->port_obj, &cm_port_obj_type, |
| 3643 | &port->cm_dev->dev_obj, | 3632 | &port->cm_dev->device->kobj, |
| 3644 | "%d", port->port_num); | 3633 | "%d", port->port_num); |
| 3645 | if (ret) { | 3634 | if (ret) { |
| 3646 | kfree(port); | 3635 | kfree(port); |
| @@ -3676,7 +3665,7 @@ static void cm_remove_port_fs(struct cm_port *port) | |||
| 3676 | kobject_put(&port->port_obj); | 3665 | kobject_put(&port->port_obj); |
| 3677 | } | 3666 | } |
| 3678 | 3667 | ||
| 3679 | static void cm_add_one(struct ib_device *device) | 3668 | static void cm_add_one(struct ib_device *ib_device) |
| 3680 | { | 3669 | { |
| 3681 | struct cm_device *cm_dev; | 3670 | struct cm_device *cm_dev; |
| 3682 | struct cm_port *port; | 3671 | struct cm_port *port; |
| @@ -3691,26 +3680,27 @@ static void cm_add_one(struct ib_device *device) | |||
| 3691 | int ret; | 3680 | int ret; |
| 3692 | u8 i; | 3681 | u8 i; |
| 3693 | 3682 | ||
| 3694 | if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) | 3683 | if (rdma_node_get_transport(ib_device->node_type) != RDMA_TRANSPORT_IB) |
| 3695 | return; | 3684 | return; |
| 3696 | 3685 | ||
| 3697 | cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) * | 3686 | cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) * |
| 3698 | device->phys_port_cnt, GFP_KERNEL); | 3687 | ib_device->phys_port_cnt, GFP_KERNEL); |
| 3699 | if (!cm_dev) | 3688 | if (!cm_dev) |
| 3700 | return; | 3689 | return; |
| 3701 | 3690 | ||
| 3702 | cm_dev->device = device; | 3691 | cm_dev->ib_device = ib_device; |
| 3703 | cm_get_ack_delay(cm_dev); | 3692 | cm_get_ack_delay(cm_dev); |
| 3704 | 3693 | ||
| 3705 | ret = kobject_init_and_add(&cm_dev->dev_obj, &cm_dev_obj_type, | 3694 | cm_dev->device = device_create_drvdata(&cm_class, &ib_device->dev, |
| 3706 | &cm_class.subsys.kobj, "%s", device->name); | 3695 | MKDEV(0, 0), NULL, |
| 3707 | if (ret) { | 3696 | "%s", ib_device->name); |
| 3697 | if (!cm_dev->device) { | ||
| 3708 | kfree(cm_dev); | 3698 | kfree(cm_dev); |
| 3709 | return; | 3699 | return; |
| 3710 | } | 3700 | } |
| 3711 | 3701 | ||
| 3712 | set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); | 3702 | set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask); |
| 3713 | for (i = 1; i <= device->phys_port_cnt; i++) { | 3703 | for (i = 1; i <= ib_device->phys_port_cnt; i++) { |
| 3714 | port = kzalloc(sizeof *port, GFP_KERNEL); | 3704 | port = kzalloc(sizeof *port, GFP_KERNEL); |
| 3715 | if (!port) | 3705 | if (!port) |
| 3716 | goto error1; | 3706 | goto error1; |
| @@ -3723,7 +3713,7 @@ static void cm_add_one(struct ib_device *device) | |||
| 3723 | if (ret) | 3713 | if (ret) |
| 3724 | goto error1; | 3714 | goto error1; |
| 3725 | 3715 | ||
| 3726 | port->mad_agent = ib_register_mad_agent(device, i, | 3716 | port->mad_agent = ib_register_mad_agent(ib_device, i, |
| 3727 | IB_QPT_GSI, | 3717 | IB_QPT_GSI, |
| 3728 | ®_req, | 3718 | ®_req, |
| 3729 | 0, | 3719 | 0, |
| @@ -3733,11 +3723,11 @@ static void cm_add_one(struct ib_device *device) | |||
| 3733 | if (IS_ERR(port->mad_agent)) | 3723 | if (IS_ERR(port->mad_agent)) |
| 3734 | goto error2; | 3724 | goto error2; |
| 3735 | 3725 | ||
| 3736 | ret = ib_modify_port(device, i, 0, &port_modify); | 3726 | ret = ib_modify_port(ib_device, i, 0, &port_modify); |
| 3737 | if (ret) | 3727 | if (ret) |
| 3738 | goto error3; | 3728 | goto error3; |
| 3739 | } | 3729 | } |
| 3740 | ib_set_client_data(device, &cm_client, cm_dev); | 3730 | ib_set_client_data(ib_device, &cm_client, cm_dev); |
| 3741 | 3731 | ||
| 3742 | write_lock_irqsave(&cm.device_lock, flags); | 3732 | write_lock_irqsave(&cm.device_lock, flags); |
| 3743 | list_add_tail(&cm_dev->list, &cm.device_list); | 3733 | list_add_tail(&cm_dev->list, &cm.device_list); |
| @@ -3753,14 +3743,14 @@ error1: | |||
| 3753 | port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; | 3743 | port_modify.clr_port_cap_mask = IB_PORT_CM_SUP; |
| 3754 | while (--i) { | 3744 | while (--i) { |
| 3755 | port = cm_dev->port[i-1]; | 3745 | port = cm_dev->port[i-1]; |
| 3756 | ib_modify_port(device, port->port_num, 0, &port_modify); | 3746 | ib_modify_port(ib_device, port->port_num, 0, &port_modify); |
| 3757 | ib_unregister_mad_agent(port->mad_agent); | 3747 | ib_unregister_mad_agent(port->mad_agent); |
| 3758 | cm_remove_port_fs(port); | 3748 | cm_remove_port_fs(port); |
| 3759 | } | 3749 | } |
| 3760 | kobject_put(&cm_dev->dev_obj); | 3750 | device_unregister(cm_dev->device); |
| 3761 | } | 3751 | } |
| 3762 | 3752 | ||
| 3763 | static void cm_remove_one(struct ib_device *device) | 3753 | static void cm_remove_one(struct ib_device *ib_device) |
| 3764 | { | 3754 | { |
| 3765 | struct cm_device *cm_dev; | 3755 | struct cm_device *cm_dev; |
| 3766 | struct cm_port *port; | 3756 | struct cm_port *port; |
| @@ -3770,7 +3760,7 @@ static void cm_remove_one(struct ib_device *device) | |||
| 3770 | unsigned long flags; | 3760 | unsigned long flags; |
| 3771 | int i; | 3761 | int i; |
| 3772 | 3762 | ||
| 3773 | cm_dev = ib_get_client_data(device, &cm_client); | 3763 | cm_dev = ib_get_client_data(ib_device, &cm_client); |
| 3774 | if (!cm_dev) | 3764 | if (!cm_dev) |
| 3775 | return; | 3765 | return; |
| 3776 | 3766 | ||
| @@ -3778,14 +3768,14 @@ static void cm_remove_one(struct ib_device *device) | |||
| 3778 | list_del(&cm_dev->list); | 3768 | list_del(&cm_dev->list); |
| 3779 | write_unlock_irqrestore(&cm.device_lock, flags); | 3769 | write_unlock_irqrestore(&cm.device_lock, flags); |
| 3780 | 3770 | ||
| 3781 | for (i = 1; i <= device->phys_port_cnt; i++) { | 3771 | for (i = 1; i <= ib_device->phys_port_cnt; i++) { |
| 3782 | port = cm_dev->port[i-1]; | 3772 | port = cm_dev->port[i-1]; |
| 3783 | ib_modify_port(device, port->port_num, 0, &port_modify); | 3773 | ib_modify_port(ib_device, port->port_num, 0, &port_modify); |
| 3784 | ib_unregister_mad_agent(port->mad_agent); | 3774 | ib_unregister_mad_agent(port->mad_agent); |
| 3785 | flush_workqueue(cm.wq); | 3775 | flush_workqueue(cm.wq); |
| 3786 | cm_remove_port_fs(port); | 3776 | cm_remove_port_fs(port); |
| 3787 | } | 3777 | } |
| 3788 | kobject_put(&cm_dev->dev_obj); | 3778 | device_unregister(cm_dev->device); |
| 3789 | } | 3779 | } |
| 3790 | 3780 | ||
| 3791 | static int __init ib_cm_init(void) | 3781 | static int __init ib_cm_init(void) |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 35f301c88b57..56c0eda3c077 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
| @@ -2455,7 +2455,7 @@ static int init_cdev(int minor, char *name, const struct file_operations *fops, | |||
| 2455 | goto err_cdev; | 2455 | goto err_cdev; |
| 2456 | } | 2456 | } |
| 2457 | 2457 | ||
| 2458 | device = device_create(ipath_class, NULL, dev, name); | 2458 | device = device_create_drvdata(ipath_class, NULL, dev, NULL, name); |
| 2459 | 2459 | ||
| 2460 | if (IS_ERR(device)) { | 2460 | if (IS_ERR(device)) { |
| 2461 | ret = PTR_ERR(device); | 2461 | ret = PTR_ERR(device); |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 19e005e81fef..871b0cbca5e4 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
| @@ -1553,7 +1553,8 @@ static int __init capi_init(void) | |||
| 1553 | return PTR_ERR(capi_class); | 1553 | return PTR_ERR(capi_class); |
| 1554 | } | 1554 | } |
| 1555 | 1555 | ||
| 1556 | device_create(capi_class, NULL, MKDEV(capi_major, 0), "capi"); | 1556 | device_create_drvdata(capi_class, NULL, MKDEV(capi_major, 0), NULL, |
| 1557 | "capi"); | ||
| 1557 | 1558 | ||
| 1558 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 1559 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
| 1559 | if (capinc_tty_init() < 0) { | 1560 | if (capinc_tty_init() < 0) { |
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index e5d446804d32..cae52485208a 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
| @@ -862,7 +862,8 @@ adbdev_init(void) | |||
| 862 | adb_dev_class = class_create(THIS_MODULE, "adb"); | 862 | adb_dev_class = class_create(THIS_MODULE, "adb"); |
| 863 | if (IS_ERR(adb_dev_class)) | 863 | if (IS_ERR(adb_dev_class)) |
| 864 | return; | 864 | return; |
| 865 | device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), "adb"); | 865 | device_create_drvdata(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, |
| 866 | "adb"); | ||
| 866 | 867 | ||
| 867 | platform_device_register(&adb_pfdev); | 868 | platform_device_register(&adb_pfdev); |
| 868 | platform_driver_probe(&adb_pfdrv, adb_dummy_probe); | 869 | platform_driver_probe(&adb_pfdrv, adb_dummy_probe); |
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c index 67b8e9453b19..ef2dbfe74714 100644 --- a/drivers/mca/mca-bus.c +++ b/drivers/mca/mca-bus.c | |||
| @@ -40,7 +40,7 @@ static struct mca_bus *mca_root_busses[MAX_MCA_BUSSES]; | |||
| 40 | 40 | ||
| 41 | struct mca_device_info { | 41 | struct mca_device_info { |
| 42 | short pos_id; /* the 2 byte pos id for this card */ | 42 | short pos_id; /* the 2 byte pos id for this card */ |
| 43 | char name[DEVICE_NAME_SIZE]; | 43 | char name[50]; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static int mca_bus_match (struct device *dev, struct device_driver *drv) | 46 | static int mca_bus_match (struct device *dev, struct device_driver *drv) |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index e208a60c048a..e7132770a3bf 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
| @@ -233,9 +233,9 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
| 233 | 233 | ||
| 234 | mutex_unlock(&dvbdev_register_lock); | 234 | mutex_unlock(&dvbdev_register_lock); |
| 235 | 235 | ||
| 236 | clsdev = device_create(dvb_class, adap->device, | 236 | clsdev = device_create_drvdata(dvb_class, adap->device, |
| 237 | MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), | 237 | MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), |
| 238 | "dvb%d.%s%d", adap->num, dnames[type], id); | 238 | NULL, "dvb%d.%s%d", adap->num, dnames[type], id); |
| 239 | if (IS_ERR(clsdev)) { | 239 | if (IS_ERR(clsdev)) { |
| 240 | printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", | 240 | printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", |
| 241 | __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); | 241 | __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); |
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index a054668eda16..4e3bfbcdf155 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
| @@ -51,7 +51,7 @@ struct jmb38x_ms_host { | |||
| 51 | void __iomem *addr; | 51 | void __iomem *addr; |
| 52 | spinlock_t lock; | 52 | spinlock_t lock; |
| 53 | int id; | 53 | int id; |
| 54 | char host_id[DEVICE_ID_SIZE]; | 54 | char host_id[32]; |
| 55 | int irq; | 55 | int irq; |
| 56 | unsigned int block_pos; | 56 | unsigned int block_pos; |
| 57 | unsigned long timeout_jiffies; | 57 | unsigned long timeout_jiffies; |
| @@ -781,7 +781,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | |||
| 781 | 781 | ||
| 782 | spin_lock_init(&host->lock); | 782 | spin_lock_init(&host->lock); |
| 783 | host->id = cnt; | 783 | host->id = cnt; |
| 784 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", | 784 | snprintf(host->host_id, sizeof(host->host_id), DRIVER_NAME ":slot%d", |
| 785 | host->id); | 785 | host->id); |
| 786 | host->irq = jm->pdev->irq; | 786 | host->irq = jm->pdev->irq; |
| 787 | host->timeout_jiffies = msecs_to_jiffies(1000); | 787 | host->timeout_jiffies = msecs_to_jiffies(1000); |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 75e599b85b64..34402c47027e 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
| @@ -1670,7 +1670,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1670 | INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work); | 1670 | INIT_DELAYED_WORK(&ioc->fault_reset_work, mpt_fault_reset_work); |
| 1671 | spin_lock_init(&ioc->fault_reset_work_lock); | 1671 | spin_lock_init(&ioc->fault_reset_work_lock); |
| 1672 | 1672 | ||
| 1673 | snprintf(ioc->reset_work_q_name, KOBJ_NAME_LEN, "mpt_poll_%d", ioc->id); | 1673 | snprintf(ioc->reset_work_q_name, sizeof(ioc->reset_work_q_name), |
| 1674 | "mpt_poll_%d", ioc->id); | ||
| 1674 | ioc->reset_work_q = | 1675 | ioc->reset_work_q = |
| 1675 | create_singlethread_workqueue(ioc->reset_work_q_name); | 1676 | create_singlethread_workqueue(ioc->reset_work_q_name); |
| 1676 | if (!ioc->reset_work_q) { | 1677 | if (!ioc->reset_work_q) { |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 6adab648dbb9..dff048cfa101 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
| @@ -707,12 +707,12 @@ typedef struct _MPT_ADAPTER | |||
| 707 | u8 fc_link_speed[2]; | 707 | u8 fc_link_speed[2]; |
| 708 | spinlock_t fc_rescan_work_lock; | 708 | spinlock_t fc_rescan_work_lock; |
| 709 | struct work_struct fc_rescan_work; | 709 | struct work_struct fc_rescan_work; |
| 710 | char fc_rescan_work_q_name[KOBJ_NAME_LEN]; | 710 | char fc_rescan_work_q_name[20]; |
| 711 | struct workqueue_struct *fc_rescan_work_q; | 711 | struct workqueue_struct *fc_rescan_work_q; |
| 712 | struct scsi_cmnd **ScsiLookup; | 712 | struct scsi_cmnd **ScsiLookup; |
| 713 | spinlock_t scsi_lookup_lock; | 713 | spinlock_t scsi_lookup_lock; |
| 714 | 714 | ||
| 715 | char reset_work_q_name[KOBJ_NAME_LEN]; | 715 | char reset_work_q_name[20]; |
| 716 | struct workqueue_struct *reset_work_q; | 716 | struct workqueue_struct *reset_work_q; |
| 717 | struct delayed_work fault_reset_work; | 717 | struct delayed_work fault_reset_work; |
| 718 | spinlock_t fault_reset_work_lock; | 718 | spinlock_t fault_reset_work_lock; |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index fc31ca6829d8..b36cae9ec6db 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
| @@ -1326,8 +1326,8 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1326 | 1326 | ||
| 1327 | /* initialize workqueue */ | 1327 | /* initialize workqueue */ |
| 1328 | 1328 | ||
| 1329 | snprintf(ioc->fc_rescan_work_q_name, KOBJ_NAME_LEN, "mptfc_wq_%d", | 1329 | snprintf(ioc->fc_rescan_work_q_name, sizeof(ioc->fc_rescan_work_q_name), |
| 1330 | sh->host_no); | 1330 | "mptfc_wq_%d", sh->host_no); |
| 1331 | ioc->fc_rescan_work_q = | 1331 | ioc->fc_rescan_work_q = |
| 1332 | create_singlethread_workqueue(ioc->fc_rescan_work_q_name); | 1332 | create_singlethread_workqueue(ioc->fc_rescan_work_q_name); |
| 1333 | if (!ioc->fc_rescan_work_q) | 1333 | if (!ioc->fc_rescan_work_q) |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 1921b8dbb242..ce67d973d349 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -420,4 +420,17 @@ config SGI_XP | |||
| 420 | this feature will allow for direct communication between SSIs | 420 | this feature will allow for direct communication between SSIs |
| 421 | based on a network adapter and DMA messaging. | 421 | based on a network adapter and DMA messaging. |
| 422 | 422 | ||
| 423 | config HP_ILO | ||
| 424 | tristate "Channel interface driver for HP iLO/iLO2 processor" | ||
| 425 | default n | ||
| 426 | help | ||
| 427 | The channel interface driver allows applications to communicate | ||
| 428 | with iLO/iLO2 management processors present on HP ProLiant | ||
| 429 | servers. Upon loading, the driver creates /dev/hpilo/dXccbN files, | ||
| 430 | which can be used to gather data from the management processor, | ||
| 431 | via read and write system calls. | ||
| 432 | |||
| 433 | To compile this driver as a module, choose M here: the | ||
| 434 | module will be called hpilo. | ||
| 435 | |||
| 423 | endif # MISC_DEVICES | 436 | endif # MISC_DEVICES |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index a6dac6a2e7e5..688fe76135e0 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
| @@ -27,3 +27,4 @@ obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o | |||
| 27 | obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o | 27 | obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o |
| 28 | obj-$(CONFIG_KGDB_TESTS) += kgdbts.o | 28 | obj-$(CONFIG_KGDB_TESTS) += kgdbts.o |
| 29 | obj-$(CONFIG_SGI_XP) += sgi-xp/ | 29 | obj-$(CONFIG_SGI_XP) += sgi-xp/ |
| 30 | obj-$(CONFIG_HP_ILO) += hpilo.o | ||
diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c new file mode 100644 index 000000000000..05e298289238 --- /dev/null +++ b/drivers/misc/hpilo.c | |||
| @@ -0,0 +1,768 @@ | |||
| 1 | /* | ||
| 2 | * Driver for HP iLO/iLO2 management processor. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Hewlett-Packard Development Company, L.P. | ||
| 5 | * David Altobelli <david.altobelli@hp.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/kernel.h> | ||
| 12 | #include <linux/types.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/fs.h> | ||
| 15 | #include <linux/pci.h> | ||
| 16 | #include <linux/ioport.h> | ||
| 17 | #include <linux/device.h> | ||
| 18 | #include <linux/file.h> | ||
| 19 | #include <linux/cdev.h> | ||
| 20 | #include <linux/spinlock.h> | ||
| 21 | #include <linux/delay.h> | ||
| 22 | #include <linux/uaccess.h> | ||
| 23 | #include <linux/io.h> | ||
| 24 | #include "hpilo.h" | ||
| 25 | |||
| 26 | static struct class *ilo_class; | ||
| 27 | static unsigned int ilo_major; | ||
| 28 | static char ilo_hwdev[MAX_ILO_DEV]; | ||
| 29 | |||
| 30 | static inline int get_entry_id(int entry) | ||
| 31 | { | ||
| 32 | return (entry & ENTRY_MASK_DESCRIPTOR) >> ENTRY_BITPOS_DESCRIPTOR; | ||
| 33 | } | ||
| 34 | |||
| 35 | static inline int get_entry_len(int entry) | ||
| 36 | { | ||
| 37 | return ((entry & ENTRY_MASK_QWORDS) >> ENTRY_BITPOS_QWORDS) << 3; | ||
| 38 | } | ||
| 39 | |||
| 40 | static inline int mk_entry(int id, int len) | ||
| 41 | { | ||
| 42 | int qlen = len & 7 ? (len >> 3) + 1 : len >> 3; | ||
| 43 | return id << ENTRY_BITPOS_DESCRIPTOR | qlen << ENTRY_BITPOS_QWORDS; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline int desc_mem_sz(int nr_entry) | ||
| 47 | { | ||
| 48 | return nr_entry << L2_QENTRY_SZ; | ||
| 49 | } | ||
| 50 | |||
| 51 | /* | ||
| 52 | * FIFO queues, shared with hardware. | ||
| 53 | * | ||
| 54 | * If a queue has empty slots, an entry is added to the queue tail, | ||
| 55 | * and that entry is marked as occupied. | ||
| 56 | * Entries can be dequeued from the head of the list, when the device | ||
| 57 | * has marked the entry as consumed. | ||
| 58 | * | ||
| 59 | * Returns true on successful queue/dequeue, false on failure. | ||
| 60 | */ | ||
| 61 | static int fifo_enqueue(struct ilo_hwinfo *hw, char *fifobar, int entry) | ||
| 62 | { | ||
| 63 | struct fifo *fifo_q = FIFOBARTOHANDLE(fifobar); | ||
| 64 | int ret = 0; | ||
| 65 | |||
| 66 | spin_lock(&hw->fifo_lock); | ||
| 67 | if (!(fifo_q->fifobar[(fifo_q->tail + 1) & fifo_q->imask] | ||
| 68 | & ENTRY_MASK_O)) { | ||
| 69 | fifo_q->fifobar[fifo_q->tail & fifo_q->imask] |= | ||
| 70 | (entry & ENTRY_MASK_NOSTATE) | fifo_q->merge; | ||
| 71 | fifo_q->tail += 1; | ||
| 72 | ret = 1; | ||
| 73 | } | ||
| 74 | spin_unlock(&hw->fifo_lock); | ||
| 75 | |||
| 76 | return ret; | ||
| 77 | } | ||
| 78 | |||
| 79 | static int fifo_dequeue(struct ilo_hwinfo *hw, char *fifobar, int *entry) | ||
| 80 | { | ||
| 81 | struct fifo *fifo_q = FIFOBARTOHANDLE(fifobar); | ||
| 82 | int ret = 0; | ||
| 83 | u64 c; | ||
| 84 | |||
| 85 | spin_lock(&hw->fifo_lock); | ||
| 86 | c = fifo_q->fifobar[fifo_q->head & fifo_q->imask]; | ||
| 87 | if (c & ENTRY_MASK_C) { | ||
| 88 | if (entry) | ||
| 89 | *entry = c & ENTRY_MASK_NOSTATE; | ||
| 90 | |||
| 91 | fifo_q->fifobar[fifo_q->head & fifo_q->imask] = | ||
| 92 | (c | ENTRY_MASK) + 1; | ||
| 93 | fifo_q->head += 1; | ||
| 94 | ret = 1; | ||
| 95 | } | ||
| 96 | spin_unlock(&hw->fifo_lock); | ||
| 97 | |||
| 98 | return ret; | ||
| 99 | } | ||
| 100 | |||
| 101 | static int ilo_pkt_enqueue(struct ilo_hwinfo *hw, struct ccb *ccb, | ||
| 102 | int dir, int id, int len) | ||
| 103 | { | ||
| 104 | char *fifobar; | ||
| 105 | int entry; | ||
| 106 | |||
| 107 | if (dir == SENDQ) | ||
| 108 | fifobar = ccb->ccb_u1.send_fifobar; | ||
| 109 | else | ||
| 110 | fifobar = ccb->ccb_u3.recv_fifobar; | ||
| 111 | |||
| 112 | entry = mk_entry(id, len); | ||
| 113 | return fifo_enqueue(hw, fifobar, entry); | ||
| 114 | } | ||
| 115 | |||
| 116 | static int ilo_pkt_dequeue(struct ilo_hwinfo *hw, struct ccb *ccb, | ||
| 117 | int dir, int *id, int *len, void **pkt) | ||
| 118 | { | ||
| 119 | char *fifobar, *desc; | ||
| 120 | int entry = 0, pkt_id = 0; | ||
| 121 | int ret; | ||
| 122 | |||
| 123 | if (dir == SENDQ) { | ||
| 124 | fifobar = ccb->ccb_u1.send_fifobar; | ||
| 125 | desc = ccb->ccb_u2.send_desc; | ||
| 126 | } else { | ||
| 127 | fifobar = ccb->ccb_u3.recv_fifobar; | ||
| 128 | desc = ccb->ccb_u4.recv_desc; | ||
| 129 | } | ||
| 130 | |||
| 131 | ret = fifo_dequeue(hw, fifobar, &entry); | ||
| 132 | if (ret) { | ||
| 133 | pkt_id = get_entry_id(entry); | ||
| 134 | if (id) | ||
| 135 | *id = pkt_id; | ||
| 136 | if (len) | ||
| 137 | *len = get_entry_len(entry); | ||
| 138 | if (pkt) | ||
| 139 | *pkt = (void *)(desc + desc_mem_sz(pkt_id)); | ||
| 140 | } | ||
| 141 | |||
| 142 | return ret; | ||
| 143 | } | ||
| 144 | |||
| 145 | static inline void doorbell_set(struct ccb *ccb) | ||
| 146 | { | ||
| 147 | iowrite8(1, ccb->ccb_u5.db_base); | ||
| 148 | } | ||
| 149 | |||
| 150 | static inline void doorbell_clr(struct ccb *ccb) | ||
| 151 | { | ||
| 152 | iowrite8(2, ccb->ccb_u5.db_base); | ||
| 153 | } | ||
| 154 | static inline int ctrl_set(int l2sz, int idxmask, int desclim) | ||
| 155 | { | ||
| 156 | int active = 0, go = 1; | ||
| 157 | return l2sz << CTRL_BITPOS_L2SZ | | ||
| 158 | idxmask << CTRL_BITPOS_FIFOINDEXMASK | | ||
| 159 | desclim << CTRL_BITPOS_DESCLIMIT | | ||
| 160 | active << CTRL_BITPOS_A | | ||
| 161 | go << CTRL_BITPOS_G; | ||
| 162 | } | ||
| 163 | static void ctrl_setup(struct ccb *ccb, int nr_desc, int l2desc_sz) | ||
| 164 | { | ||
| 165 | /* for simplicity, use the same parameters for send and recv ctrls */ | ||
| 166 | ccb->send_ctrl = ctrl_set(l2desc_sz, nr_desc-1, nr_desc-1); | ||
| 167 | ccb->recv_ctrl = ctrl_set(l2desc_sz, nr_desc-1, nr_desc-1); | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline int fifo_sz(int nr_entry) | ||
| 171 | { | ||
| 172 | /* size of a fifo is determined by the number of entries it contains */ | ||
| 173 | return (nr_entry * sizeof(u64)) + FIFOHANDLESIZE; | ||
| 174 | } | ||
| 175 | |||
| 176 | static void fifo_setup(void *base_addr, int nr_entry) | ||
| 177 | { | ||
| 178 | struct fifo *fifo_q = base_addr; | ||
| 179 | int i; | ||
| 180 | |||
| 181 | /* set up an empty fifo */ | ||
| 182 | fifo_q->head = 0; | ||
| 183 | fifo_q->tail = 0; | ||
| 184 | fifo_q->reset = 0; | ||
| 185 | fifo_q->nrents = nr_entry; | ||
| 186 | fifo_q->imask = nr_entry - 1; | ||
| 187 | fifo_q->merge = ENTRY_MASK_O; | ||
| 188 | |||
| 189 | for (i = 0; i < nr_entry; i++) | ||
| 190 | fifo_q->fifobar[i] = 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data) | ||
| 194 | { | ||
| 195 | struct ccb *driver_ccb; | ||
| 196 | struct ccb __iomem *device_ccb; | ||
| 197 | int retries; | ||
| 198 | |||
| 199 | driver_ccb = &data->driver_ccb; | ||
| 200 | device_ccb = data->mapped_ccb; | ||
| 201 | |||
| 202 | /* complicated dance to tell the hw we are stopping */ | ||
| 203 | doorbell_clr(driver_ccb); | ||
| 204 | iowrite32(ioread32(&device_ccb->send_ctrl) & ~(1 << CTRL_BITPOS_G), | ||
| 205 | &device_ccb->send_ctrl); | ||
| 206 | iowrite32(ioread32(&device_ccb->recv_ctrl) & ~(1 << CTRL_BITPOS_G), | ||
| 207 | &device_ccb->recv_ctrl); | ||
| 208 | |||
| 209 | /* give iLO some time to process stop request */ | ||
| 210 | for (retries = 1000; retries > 0; retries--) { | ||
| 211 | doorbell_set(driver_ccb); | ||
| 212 | udelay(1); | ||
| 213 | if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A)) | ||
| 214 | && | ||
| 215 | !(ioread32(&device_ccb->recv_ctrl) & (1 << CTRL_BITPOS_A))) | ||
| 216 | break; | ||
| 217 | } | ||
| 218 | if (retries == 0) | ||
| 219 | dev_err(&pdev->dev, "Closing, but controller still active\n"); | ||
| 220 | |||
| 221 | /* clear the hw ccb */ | ||
| 222 | memset_io(device_ccb, 0, sizeof(struct ccb)); | ||
| 223 | |||
| 224 | /* free resources used to back send/recv queues */ | ||
| 225 | pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa); | ||
| 226 | } | ||
| 227 | |||
| 228 | static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot) | ||
| 229 | { | ||
| 230 | char *dma_va, *dma_pa; | ||
| 231 | int pkt_id, pkt_sz, i, error; | ||
| 232 | struct ccb *driver_ccb, *ilo_ccb; | ||
| 233 | struct pci_dev *pdev; | ||
| 234 | |||
| 235 | driver_ccb = &data->driver_ccb; | ||
| 236 | ilo_ccb = &data->ilo_ccb; | ||
| 237 | pdev = hw->ilo_dev; | ||
| 238 | |||
| 239 | data->dma_size = 2 * fifo_sz(NR_QENTRY) + | ||
| 240 | 2 * desc_mem_sz(NR_QENTRY) + | ||
| 241 | ILO_START_ALIGN + ILO_CACHE_SZ; | ||
| 242 | |||
| 243 | error = -ENOMEM; | ||
| 244 | data->dma_va = pci_alloc_consistent(pdev, data->dma_size, | ||
| 245 | &data->dma_pa); | ||
| 246 | if (!data->dma_va) | ||
| 247 | goto out; | ||
| 248 | |||
| 249 | dma_va = (char *)data->dma_va; | ||
| 250 | dma_pa = (char *)data->dma_pa; | ||
| 251 | |||
| 252 | memset(dma_va, 0, data->dma_size); | ||
| 253 | |||
| 254 | dma_va = (char *)roundup((unsigned long)dma_va, ILO_START_ALIGN); | ||
| 255 | dma_pa = (char *)roundup((unsigned long)dma_pa, ILO_START_ALIGN); | ||
| 256 | |||
| 257 | /* | ||
| 258 | * Create two ccb's, one with virt addrs, one with phys addrs. | ||
| 259 | * Copy the phys addr ccb to device shared mem. | ||
| 260 | */ | ||
| 261 | ctrl_setup(driver_ccb, NR_QENTRY, L2_QENTRY_SZ); | ||
| 262 | ctrl_setup(ilo_ccb, NR_QENTRY, L2_QENTRY_SZ); | ||
| 263 | |||
| 264 | fifo_setup(dma_va, NR_QENTRY); | ||
| 265 | driver_ccb->ccb_u1.send_fifobar = dma_va + FIFOHANDLESIZE; | ||
| 266 | ilo_ccb->ccb_u1.send_fifobar = dma_pa + FIFOHANDLESIZE; | ||
| 267 | dma_va += fifo_sz(NR_QENTRY); | ||
| 268 | dma_pa += fifo_sz(NR_QENTRY); | ||
| 269 | |||
| 270 | dma_va = (char *)roundup((unsigned long)dma_va, ILO_CACHE_SZ); | ||
| 271 | dma_pa = (char *)roundup((unsigned long)dma_pa, ILO_CACHE_SZ); | ||
| 272 | |||
| 273 | fifo_setup(dma_va, NR_QENTRY); | ||
| 274 | driver_ccb->ccb_u3.recv_fifobar = dma_va + FIFOHANDLESIZE; | ||
| 275 | ilo_ccb->ccb_u3.recv_fifobar = dma_pa + FIFOHANDLESIZE; | ||
| 276 | dma_va += fifo_sz(NR_QENTRY); | ||
| 277 | dma_pa += fifo_sz(NR_QENTRY); | ||
| 278 | |||
| 279 | driver_ccb->ccb_u2.send_desc = dma_va; | ||
| 280 | ilo_ccb->ccb_u2.send_desc = dma_pa; | ||
| 281 | dma_pa += desc_mem_sz(NR_QENTRY); | ||
| 282 | dma_va += desc_mem_sz(NR_QENTRY); | ||
| 283 | |||
| 284 | driver_ccb->ccb_u4.recv_desc = dma_va; | ||
| 285 | ilo_ccb->ccb_u4.recv_desc = dma_pa; | ||
| 286 | |||
| 287 | driver_ccb->channel = slot; | ||
| 288 | ilo_ccb->channel = slot; | ||
| 289 | |||
| 290 | driver_ccb->ccb_u5.db_base = hw->db_vaddr + (slot << L2_DB_SIZE); | ||
| 291 | ilo_ccb->ccb_u5.db_base = NULL; /* hw ccb's doorbell is not used */ | ||
| 292 | |||
| 293 | /* copy the ccb with physical addrs to device memory */ | ||
| 294 | data->mapped_ccb = (struct ccb __iomem *) | ||
| 295 | (hw->ram_vaddr + (slot * ILOHW_CCB_SZ)); | ||
| 296 | memcpy_toio(data->mapped_ccb, ilo_ccb, sizeof(struct ccb)); | ||
| 297 | |||
| 298 | /* put packets on the send and receive queues */ | ||
| 299 | pkt_sz = 0; | ||
| 300 | for (pkt_id = 0; pkt_id < NR_QENTRY; pkt_id++) { | ||
| 301 | ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, pkt_sz); | ||
| 302 | doorbell_set(driver_ccb); | ||
| 303 | } | ||
| 304 | |||
| 305 | pkt_sz = desc_mem_sz(1); | ||
| 306 | for (pkt_id = 0; pkt_id < NR_QENTRY; pkt_id++) | ||
| 307 | ilo_pkt_enqueue(hw, driver_ccb, RECVQ, pkt_id, pkt_sz); | ||
| 308 | |||
| 309 | doorbell_clr(driver_ccb); | ||
| 310 | |||
| 311 | /* make sure iLO is really handling requests */ | ||
| 312 | for (i = 1000; i > 0; i--) { | ||
| 313 | if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL)) | ||
| 314 | break; | ||
| 315 | udelay(1); | ||
| 316 | } | ||
| 317 | |||
| 318 | if (i) { | ||
| 319 | ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, 0); | ||
| 320 | doorbell_set(driver_ccb); | ||
| 321 | } else { | ||
| 322 | dev_err(&pdev->dev, "Open could not dequeue a packet\n"); | ||
| 323 | error = -EBUSY; | ||
| 324 | goto free; | ||
| 325 | } | ||
| 326 | |||
| 327 | return 0; | ||
| 328 | free: | ||
| 329 | pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa); | ||
| 330 | out: | ||
| 331 | return error; | ||
| 332 | } | ||
| 333 | |||
| 334 | static inline int is_channel_reset(struct ccb *ccb) | ||
| 335 | { | ||
| 336 | /* check for this particular channel needing a reset */ | ||
| 337 | return FIFOBARTOHANDLE(ccb->ccb_u1.send_fifobar)->reset; | ||
| 338 | } | ||
| 339 | |||
| 340 | static inline void set_channel_reset(struct ccb *ccb) | ||
| 341 | { | ||
| 342 | /* set a flag indicating this channel needs a reset */ | ||
| 343 | FIFOBARTOHANDLE(ccb->ccb_u1.send_fifobar)->reset = 1; | ||
| 344 | } | ||
| 345 | |||
| 346 | static inline int is_device_reset(struct ilo_hwinfo *hw) | ||
| 347 | { | ||
| 348 | /* check for global reset condition */ | ||
| 349 | return ioread32(&hw->mmio_vaddr[DB_OUT]) & (1 << DB_RESET); | ||
| 350 | } | ||
| 351 | |||
| 352 | static inline void clear_device(struct ilo_hwinfo *hw) | ||
| 353 | { | ||
| 354 | /* clear the device (reset bits, pending channel entries) */ | ||
| 355 | iowrite32(-1, &hw->mmio_vaddr[DB_OUT]); | ||
| 356 | } | ||
| 357 | |||
| 358 | static void ilo_locked_reset(struct ilo_hwinfo *hw) | ||
| 359 | { | ||
| 360 | int slot; | ||
| 361 | |||
| 362 | /* | ||
| 363 | * Mapped memory is zeroed on ilo reset, so set a per ccb flag | ||
| 364 | * to indicate that this ccb needs to be closed and reopened. | ||
| 365 | */ | ||
| 366 | for (slot = 0; slot < MAX_CCB; slot++) { | ||
| 367 | if (!hw->ccb_alloc[slot]) | ||
| 368 | continue; | ||
| 369 | set_channel_reset(&hw->ccb_alloc[slot]->driver_ccb); | ||
| 370 | } | ||
| 371 | |||
| 372 | clear_device(hw); | ||
| 373 | } | ||
| 374 | |||
| 375 | static void ilo_reset(struct ilo_hwinfo *hw) | ||
| 376 | { | ||
| 377 | spin_lock(&hw->alloc_lock); | ||
| 378 | |||
| 379 | /* reset might have been handled after lock was taken */ | ||
| 380 | if (is_device_reset(hw)) | ||
| 381 | ilo_locked_reset(hw); | ||
| 382 | |||
| 383 | spin_unlock(&hw->alloc_lock); | ||
| 384 | } | ||
| 385 | |||
| 386 | static ssize_t ilo_read(struct file *fp, char __user *buf, | ||
| 387 | size_t len, loff_t *off) | ||
| 388 | { | ||
| 389 | int err, found, cnt, pkt_id, pkt_len; | ||
| 390 | struct ccb_data *data; | ||
| 391 | struct ccb *driver_ccb; | ||
| 392 | struct ilo_hwinfo *hw; | ||
| 393 | void *pkt; | ||
| 394 | |||
| 395 | data = fp->private_data; | ||
| 396 | driver_ccb = &data->driver_ccb; | ||
| 397 | hw = data->ilo_hw; | ||
| 398 | |||
| 399 | if (is_device_reset(hw) || is_channel_reset(driver_ccb)) { | ||
| 400 | /* | ||
| 401 | * If the device has been reset, applications | ||
| 402 | * need to close and reopen all ccbs. | ||
| 403 | */ | ||
| 404 | ilo_reset(hw); | ||
| 405 | return -ENODEV; | ||
| 406 | } | ||
| 407 | |||
| 408 | /* | ||
| 409 | * This function is to be called when data is expected | ||
| 410 | * in the channel, and will return an error if no packet is found | ||
| 411 | * during the loop below. The sleep/retry logic is to allow | ||
| 412 | * applications to call read() immediately post write(), | ||
| 413 | * and give iLO some time to process the sent packet. | ||
| 414 | */ | ||
| 415 | cnt = 20; | ||
| 416 | do { | ||
| 417 | /* look for a received packet */ | ||
| 418 | found = ilo_pkt_dequeue(hw, driver_ccb, RECVQ, &pkt_id, | ||
| 419 | &pkt_len, &pkt); | ||
| 420 | if (found) | ||
| 421 | break; | ||
| 422 | cnt--; | ||
| 423 | msleep(100); | ||
| 424 | } while (!found && cnt); | ||
| 425 | |||
| 426 | if (!found) | ||
| 427 | return -EAGAIN; | ||
| 428 | |||
| 429 | /* only copy the length of the received packet */ | ||
| 430 | if (pkt_len < len) | ||
| 431 | len = pkt_len; | ||
| 432 | |||
| 433 | err = copy_to_user(buf, pkt, len); | ||
| 434 | |||
| 435 | /* return the received packet to the queue */ | ||
| 436 | ilo_pkt_enqueue(hw, driver_ccb, RECVQ, pkt_id, desc_mem_sz(1)); | ||
| 437 | |||
| 438 | return err ? -EFAULT : len; | ||
| 439 | } | ||
| 440 | |||
| 441 | static ssize_t ilo_write(struct file *fp, const char __user *buf, | ||
| 442 | size_t len, loff_t *off) | ||
| 443 | { | ||
| 444 | int err, pkt_id, pkt_len; | ||
| 445 | struct ccb_data *data; | ||
| 446 | struct ccb *driver_ccb; | ||
| 447 | struct ilo_hwinfo *hw; | ||
| 448 | void *pkt; | ||
| 449 | |||
| 450 | data = fp->private_data; | ||
| 451 | driver_ccb = &data->driver_ccb; | ||
| 452 | hw = data->ilo_hw; | ||
| 453 | |||
| 454 | if (is_device_reset(hw) || is_channel_reset(driver_ccb)) { | ||
| 455 | /* | ||
| 456 | * If the device has been reset, applications | ||
| 457 | * need to close and reopen all ccbs. | ||
| 458 | */ | ||
| 459 | ilo_reset(hw); | ||
| 460 | return -ENODEV; | ||
| 461 | } | ||
| 462 | |||
| 463 | /* get a packet to send the user command */ | ||
| 464 | if (!ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, &pkt_len, &pkt)) | ||
| 465 | return -EBUSY; | ||
| 466 | |||
| 467 | /* limit the length to the length of the packet */ | ||
| 468 | if (pkt_len < len) | ||
| 469 | len = pkt_len; | ||
| 470 | |||
| 471 | /* on failure, set the len to 0 to return empty packet to the device */ | ||
| 472 | err = copy_from_user(pkt, buf, len); | ||
| 473 | if (err) | ||
| 474 | len = 0; | ||
| 475 | |||
| 476 | /* send the packet */ | ||
| 477 | ilo_pkt_enqueue(hw, driver_ccb, SENDQ, pkt_id, len); | ||
| 478 | doorbell_set(driver_ccb); | ||
| 479 | |||
| 480 | return err ? -EFAULT : len; | ||
| 481 | } | ||
| 482 | |||
| 483 | static int ilo_close(struct inode *ip, struct file *fp) | ||
| 484 | { | ||
| 485 | int slot; | ||
| 486 | struct ccb_data *data; | ||
| 487 | struct ilo_hwinfo *hw; | ||
| 488 | |||
| 489 | slot = iminor(ip) % MAX_CCB; | ||
| 490 | hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); | ||
| 491 | |||
| 492 | spin_lock(&hw->alloc_lock); | ||
| 493 | |||
| 494 | if (is_device_reset(hw)) | ||
| 495 | ilo_locked_reset(hw); | ||
| 496 | |||
| 497 | if (hw->ccb_alloc[slot]->ccb_cnt == 1) { | ||
| 498 | |||
| 499 | data = fp->private_data; | ||
| 500 | |||
| 501 | ilo_ccb_close(hw->ilo_dev, data); | ||
| 502 | |||
| 503 | kfree(data); | ||
| 504 | hw->ccb_alloc[slot] = NULL; | ||
| 505 | } else | ||
| 506 | hw->ccb_alloc[slot]->ccb_cnt--; | ||
| 507 | |||
| 508 | spin_unlock(&hw->alloc_lock); | ||
| 509 | |||
| 510 | return 0; | ||
| 511 | } | ||
| 512 | |||
| 513 | static int ilo_open(struct inode *ip, struct file *fp) | ||
| 514 | { | ||
| 515 | int slot, error; | ||
| 516 | struct ccb_data *data; | ||
| 517 | struct ilo_hwinfo *hw; | ||
| 518 | |||
| 519 | slot = iminor(ip) % MAX_CCB; | ||
| 520 | hw = container_of(ip->i_cdev, struct ilo_hwinfo, cdev); | ||
| 521 | |||
| 522 | /* new ccb allocation */ | ||
| 523 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
| 524 | if (!data) | ||
| 525 | return -ENOMEM; | ||
| 526 | |||
| 527 | spin_lock(&hw->alloc_lock); | ||
| 528 | |||
| 529 | if (is_device_reset(hw)) | ||
| 530 | ilo_locked_reset(hw); | ||
| 531 | |||
| 532 | /* each fd private_data holds sw/hw view of ccb */ | ||
| 533 | if (hw->ccb_alloc[slot] == NULL) { | ||
| 534 | /* create a channel control block for this minor */ | ||
| 535 | error = ilo_ccb_open(hw, data, slot); | ||
| 536 | if (!error) { | ||
| 537 | hw->ccb_alloc[slot] = data; | ||
| 538 | hw->ccb_alloc[slot]->ccb_cnt = 1; | ||
| 539 | hw->ccb_alloc[slot]->ccb_excl = fp->f_flags & O_EXCL; | ||
| 540 | hw->ccb_alloc[slot]->ilo_hw = hw; | ||
| 541 | } else | ||
| 542 | kfree(data); | ||
| 543 | } else { | ||
| 544 | kfree(data); | ||
| 545 | if (fp->f_flags & O_EXCL || hw->ccb_alloc[slot]->ccb_excl) { | ||
| 546 | /* | ||
| 547 | * The channel exists, and either this open | ||
| 548 | * or a previous open of this channel wants | ||
| 549 | * exclusive access. | ||
| 550 | */ | ||
| 551 | error = -EBUSY; | ||
| 552 | } else { | ||
| 553 | hw->ccb_alloc[slot]->ccb_cnt++; | ||
| 554 | error = 0; | ||
| 555 | } | ||
| 556 | } | ||
| 557 | spin_unlock(&hw->alloc_lock); | ||
| 558 | |||
| 559 | if (!error) | ||
| 560 | fp->private_data = hw->ccb_alloc[slot]; | ||
| 561 | |||
| 562 | return error; | ||
| 563 | } | ||
| 564 | |||
| 565 | static const struct file_operations ilo_fops = { | ||
| 566 | .owner = THIS_MODULE, | ||
| 567 | .read = ilo_read, | ||
| 568 | .write = ilo_write, | ||
| 569 | .open = ilo_open, | ||
| 570 | .release = ilo_close, | ||
| 571 | }; | ||
| 572 | |||
| 573 | static void ilo_unmap_device(struct pci_dev *pdev, struct ilo_hwinfo *hw) | ||
| 574 | { | ||
| 575 | pci_iounmap(pdev, hw->db_vaddr); | ||
| 576 | pci_iounmap(pdev, hw->ram_vaddr); | ||
| 577 | pci_iounmap(pdev, hw->mmio_vaddr); | ||
| 578 | } | ||
| 579 | |||
| 580 | static int __devinit ilo_map_device(struct pci_dev *pdev, struct ilo_hwinfo *hw) | ||
| 581 | { | ||
| 582 | int error = -ENOMEM; | ||
| 583 | |||
| 584 | /* map the memory mapped i/o registers */ | ||
| 585 | hw->mmio_vaddr = pci_iomap(pdev, 1, 0); | ||
| 586 | if (hw->mmio_vaddr == NULL) { | ||
| 587 | dev_err(&pdev->dev, "Error mapping mmio\n"); | ||
| 588 | goto out; | ||
| 589 | } | ||
| 590 | |||
| 591 | /* map the adapter shared memory region */ | ||
| 592 | hw->ram_vaddr = pci_iomap(pdev, 2, MAX_CCB * ILOHW_CCB_SZ); | ||
| 593 | if (hw->ram_vaddr == NULL) { | ||
| 594 | dev_err(&pdev->dev, "Error mapping shared mem\n"); | ||
| 595 | goto mmio_free; | ||
| 596 | } | ||
| 597 | |||
| 598 | /* map the doorbell aperture */ | ||
| 599 | hw->db_vaddr = pci_iomap(pdev, 3, MAX_CCB * ONE_DB_SIZE); | ||
| 600 | if (hw->db_vaddr == NULL) { | ||
| 601 | dev_err(&pdev->dev, "Error mapping doorbell\n"); | ||
| 602 | goto ram_free; | ||
| 603 | } | ||
| 604 | |||
| 605 | return 0; | ||
| 606 | ram_free: | ||
| 607 | pci_iounmap(pdev, hw->ram_vaddr); | ||
| 608 | mmio_free: | ||
| 609 | pci_iounmap(pdev, hw->mmio_vaddr); | ||
| 610 | out: | ||
| 611 | return error; | ||
| 612 | } | ||
| 613 | |||
| 614 | static void ilo_remove(struct pci_dev *pdev) | ||
| 615 | { | ||
| 616 | int i, minor; | ||
| 617 | struct ilo_hwinfo *ilo_hw = pci_get_drvdata(pdev); | ||
| 618 | |||
| 619 | clear_device(ilo_hw); | ||
| 620 | |||
| 621 | minor = MINOR(ilo_hw->cdev.dev); | ||
| 622 | for (i = minor; i < minor + MAX_CCB; i++) | ||
| 623 | device_destroy(ilo_class, MKDEV(ilo_major, i)); | ||
| 624 | |||
| 625 | cdev_del(&ilo_hw->cdev); | ||
| 626 | ilo_unmap_device(pdev, ilo_hw); | ||
| 627 | pci_release_regions(pdev); | ||
| 628 | pci_disable_device(pdev); | ||
| 629 | kfree(ilo_hw); | ||
| 630 | ilo_hwdev[(minor / MAX_CCB)] = 0; | ||
| 631 | } | ||
| 632 | |||
| 633 | static int __devinit ilo_probe(struct pci_dev *pdev, | ||
| 634 | const struct pci_device_id *ent) | ||
| 635 | { | ||
| 636 | int devnum, minor, start, error; | ||
| 637 | struct ilo_hwinfo *ilo_hw; | ||
| 638 | |||
| 639 | /* find a free range for device files */ | ||
| 640 | for (devnum = 0; devnum < MAX_ILO_DEV; devnum++) { | ||
| 641 | if (ilo_hwdev[devnum] == 0) { | ||
| 642 | ilo_hwdev[devnum] = 1; | ||
| 643 | break; | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 647 | if (devnum == MAX_ILO_DEV) { | ||
| 648 | dev_err(&pdev->dev, "Error finding free device\n"); | ||
| 649 | return -ENODEV; | ||
| 650 | } | ||
| 651 | |||
| 652 | /* track global allocations for this device */ | ||
| 653 | error = -ENOMEM; | ||
| 654 | ilo_hw = kzalloc(sizeof(*ilo_hw), GFP_KERNEL); | ||
| 655 | if (!ilo_hw) | ||
| 656 | goto out; | ||
| 657 | |||
| 658 | ilo_hw->ilo_dev = pdev; | ||
| 659 | spin_lock_init(&ilo_hw->alloc_lock); | ||
| 660 | spin_lock_init(&ilo_hw->fifo_lock); | ||
| 661 | |||
| 662 | error = pci_enable_device(pdev); | ||
| 663 | if (error) | ||
| 664 | goto free; | ||
| 665 | |||
| 666 | pci_set_master(pdev); | ||
| 667 | |||
| 668 | error = pci_request_regions(pdev, ILO_NAME); | ||
| 669 | if (error) | ||
| 670 | goto disable; | ||
| 671 | |||
| 672 | error = ilo_map_device(pdev, ilo_hw); | ||
| 673 | if (error) | ||
| 674 | goto free_regions; | ||
| 675 | |||
| 676 | pci_set_drvdata(pdev, ilo_hw); | ||
| 677 | clear_device(ilo_hw); | ||
| 678 | |||
| 679 | cdev_init(&ilo_hw->cdev, &ilo_fops); | ||
| 680 | ilo_hw->cdev.owner = THIS_MODULE; | ||
| 681 | start = devnum * MAX_CCB; | ||
| 682 | error = cdev_add(&ilo_hw->cdev, MKDEV(ilo_major, start), MAX_CCB); | ||
| 683 | if (error) { | ||
| 684 | dev_err(&pdev->dev, "Could not add cdev\n"); | ||
| 685 | goto unmap; | ||
| 686 | } | ||
| 687 | |||
| 688 | for (minor = 0 ; minor < MAX_CCB; minor++) { | ||
| 689 | struct device *dev; | ||
| 690 | dev = device_create(ilo_class, &pdev->dev, | ||
| 691 | MKDEV(ilo_major, minor), NULL, | ||
| 692 | "hpilo!d%dccb%d", devnum, minor); | ||
| 693 | if (IS_ERR(dev)) | ||
| 694 | dev_err(&pdev->dev, "Could not create files\n"); | ||
| 695 | } | ||
| 696 | |||
| 697 | return 0; | ||
| 698 | unmap: | ||
| 699 | ilo_unmap_device(pdev, ilo_hw); | ||
| 700 | free_regions: | ||
| 701 | pci_release_regions(pdev); | ||
| 702 | disable: | ||
| 703 | pci_disable_device(pdev); | ||
| 704 | free: | ||
| 705 | kfree(ilo_hw); | ||
| 706 | out: | ||
| 707 | ilo_hwdev[devnum] = 0; | ||
| 708 | return error; | ||
| 709 | } | ||
| 710 | |||
| 711 | static struct pci_device_id ilo_devices[] = { | ||
| 712 | { PCI_DEVICE(PCI_VENDOR_ID_COMPAQ, 0xB204) }, | ||
| 713 | { } | ||
| 714 | }; | ||
| 715 | MODULE_DEVICE_TABLE(pci, ilo_devices); | ||
| 716 | |||
| 717 | static struct pci_driver ilo_driver = { | ||
| 718 | .name = ILO_NAME, | ||
| 719 | .id_table = ilo_devices, | ||
| 720 | .probe = ilo_probe, | ||
| 721 | .remove = __devexit_p(ilo_remove), | ||
| 722 | }; | ||
| 723 | |||
| 724 | static int __init ilo_init(void) | ||
| 725 | { | ||
| 726 | int error; | ||
| 727 | dev_t dev; | ||
| 728 | |||
| 729 | ilo_class = class_create(THIS_MODULE, "iLO"); | ||
| 730 | if (IS_ERR(ilo_class)) { | ||
| 731 | error = PTR_ERR(ilo_class); | ||
| 732 | goto out; | ||
| 733 | } | ||
| 734 | |||
| 735 | error = alloc_chrdev_region(&dev, 0, MAX_OPEN, ILO_NAME); | ||
| 736 | if (error) | ||
| 737 | goto class_destroy; | ||
| 738 | |||
| 739 | ilo_major = MAJOR(dev); | ||
| 740 | |||
| 741 | error = pci_register_driver(&ilo_driver); | ||
| 742 | if (error) | ||
| 743 | goto chr_remove; | ||
| 744 | |||
| 745 | return 0; | ||
| 746 | chr_remove: | ||
| 747 | unregister_chrdev_region(dev, MAX_OPEN); | ||
| 748 | class_destroy: | ||
| 749 | class_destroy(ilo_class); | ||
| 750 | out: | ||
| 751 | return error; | ||
| 752 | } | ||
| 753 | |||
| 754 | static void __exit ilo_exit(void) | ||
| 755 | { | ||
| 756 | pci_unregister_driver(&ilo_driver); | ||
| 757 | unregister_chrdev_region(MKDEV(ilo_major, 0), MAX_OPEN); | ||
| 758 | class_destroy(ilo_class); | ||
| 759 | } | ||
| 760 | |||
| 761 | MODULE_VERSION("0.05"); | ||
| 762 | MODULE_ALIAS(ILO_NAME); | ||
| 763 | MODULE_DESCRIPTION(ILO_NAME); | ||
| 764 | MODULE_AUTHOR("David Altobelli <david.altobelli@hp.com>"); | ||
| 765 | MODULE_LICENSE("GPL v2"); | ||
| 766 | |||
| 767 | module_init(ilo_init); | ||
| 768 | module_exit(ilo_exit); | ||
diff --git a/drivers/misc/hpilo.h b/drivers/misc/hpilo.h new file mode 100644 index 000000000000..a281207696c1 --- /dev/null +++ b/drivers/misc/hpilo.h | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | /* | ||
| 2 | * linux/drivers/char/hpilo.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Hewlett-Packard Development Company, L.P. | ||
| 5 | * David Altobelli <david.altobelli@hp.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef __HPILO_H | ||
| 12 | #define __HPILO_H | ||
| 13 | |||
| 14 | #define ILO_NAME "hpilo" | ||
| 15 | |||
| 16 | /* max number of open channel control blocks per device, hw limited to 32 */ | ||
| 17 | #define MAX_CCB 8 | ||
| 18 | /* max number of supported devices */ | ||
| 19 | #define MAX_ILO_DEV 1 | ||
| 20 | /* max number of files */ | ||
| 21 | #define MAX_OPEN (MAX_CCB * MAX_ILO_DEV) | ||
| 22 | |||
| 23 | /* | ||
| 24 | * Per device, used to track global memory allocations. | ||
| 25 | */ | ||
| 26 | struct ilo_hwinfo { | ||
| 27 | /* mmio registers on device */ | ||
| 28 | char __iomem *mmio_vaddr; | ||
| 29 | |||
| 30 | /* doorbell registers on device */ | ||
| 31 | char __iomem *db_vaddr; | ||
| 32 | |||
| 33 | /* shared memory on device used for channel control blocks */ | ||
| 34 | char __iomem *ram_vaddr; | ||
| 35 | |||
| 36 | /* files corresponding to this device */ | ||
| 37 | struct ccb_data *ccb_alloc[MAX_CCB]; | ||
| 38 | |||
| 39 | struct pci_dev *ilo_dev; | ||
| 40 | |||
| 41 | spinlock_t alloc_lock; | ||
| 42 | spinlock_t fifo_lock; | ||
| 43 | |||
| 44 | struct cdev cdev; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /* offset from mmio_vaddr */ | ||
| 48 | #define DB_OUT 0xD4 | ||
| 49 | /* DB_OUT reset bit */ | ||
| 50 | #define DB_RESET 26 | ||
| 51 | |||
| 52 | /* | ||
| 53 | * Channel control block. Used to manage hardware queues. | ||
| 54 | * The format must match hw's version. The hw ccb is 128 bytes, | ||
| 55 | * but the context area shouldn't be touched by the driver. | ||
| 56 | */ | ||
| 57 | #define ILOSW_CCB_SZ 64 | ||
| 58 | #define ILOHW_CCB_SZ 128 | ||
| 59 | struct ccb { | ||
| 60 | union { | ||
| 61 | char *send_fifobar; | ||
| 62 | u64 padding1; | ||
| 63 | } ccb_u1; | ||
| 64 | union { | ||
| 65 | char *send_desc; | ||
| 66 | u64 padding2; | ||
| 67 | } ccb_u2; | ||
| 68 | u64 send_ctrl; | ||
| 69 | |||
| 70 | union { | ||
| 71 | char *recv_fifobar; | ||
| 72 | u64 padding3; | ||
| 73 | } ccb_u3; | ||
| 74 | union { | ||
| 75 | char *recv_desc; | ||
| 76 | u64 padding4; | ||
| 77 | } ccb_u4; | ||
| 78 | u64 recv_ctrl; | ||
| 79 | |||
| 80 | union { | ||
| 81 | char __iomem *db_base; | ||
| 82 | u64 padding5; | ||
| 83 | } ccb_u5; | ||
| 84 | |||
| 85 | u64 channel; | ||
| 86 | |||
| 87 | /* unused context area (64 bytes) */ | ||
| 88 | }; | ||
| 89 | |||
| 90 | /* ccb queue parameters */ | ||
| 91 | #define SENDQ 1 | ||
| 92 | #define RECVQ 2 | ||
| 93 | #define NR_QENTRY 4 | ||
| 94 | #define L2_QENTRY_SZ 12 | ||
| 95 | |||
| 96 | /* ccb ctrl bitfields */ | ||
| 97 | #define CTRL_BITPOS_L2SZ 0 | ||
| 98 | #define CTRL_BITPOS_FIFOINDEXMASK 4 | ||
| 99 | #define CTRL_BITPOS_DESCLIMIT 18 | ||
| 100 | #define CTRL_BITPOS_A 30 | ||
| 101 | #define CTRL_BITPOS_G 31 | ||
| 102 | |||
| 103 | /* ccb doorbell macros */ | ||
| 104 | #define L2_DB_SIZE 14 | ||
| 105 | #define ONE_DB_SIZE (1 << L2_DB_SIZE) | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Per fd structure used to track the ccb allocated to that dev file. | ||
| 109 | */ | ||
| 110 | struct ccb_data { | ||
| 111 | /* software version of ccb, using virtual addrs */ | ||
| 112 | struct ccb driver_ccb; | ||
| 113 | |||
| 114 | /* hardware version of ccb, using physical addrs */ | ||
| 115 | struct ccb ilo_ccb; | ||
| 116 | |||
| 117 | /* hardware ccb is written to this shared mapped device memory */ | ||
| 118 | struct ccb __iomem *mapped_ccb; | ||
| 119 | |||
| 120 | /* dma'able memory used for send/recv queues */ | ||
| 121 | void *dma_va; | ||
| 122 | dma_addr_t dma_pa; | ||
| 123 | size_t dma_size; | ||
| 124 | |||
| 125 | /* pointer to hardware device info */ | ||
| 126 | struct ilo_hwinfo *ilo_hw; | ||
| 127 | |||
| 128 | /* usage count, to allow for shared ccb's */ | ||
| 129 | int ccb_cnt; | ||
| 130 | |||
| 131 | /* open wanted exclusive access to this ccb */ | ||
| 132 | int ccb_excl; | ||
| 133 | }; | ||
| 134 | |||
| 135 | /* | ||
| 136 | * FIFO queue structure, shared with hw. | ||
| 137 | */ | ||
| 138 | #define ILO_START_ALIGN 4096 | ||
| 139 | #define ILO_CACHE_SZ 128 | ||
| 140 | struct fifo { | ||
| 141 | u64 nrents; /* user requested number of fifo entries */ | ||
| 142 | u64 imask; /* mask to extract valid fifo index */ | ||
| 143 | u64 merge; /* O/C bits to merge in during enqueue operation */ | ||
| 144 | u64 reset; /* set to non-zero when the target device resets */ | ||
| 145 | u8 pad_0[ILO_CACHE_SZ - (sizeof(u64) * 4)]; | ||
| 146 | |||
| 147 | u64 head; | ||
| 148 | u8 pad_1[ILO_CACHE_SZ - (sizeof(u64))]; | ||
| 149 | |||
| 150 | u64 tail; | ||
| 151 | u8 pad_2[ILO_CACHE_SZ - (sizeof(u64))]; | ||
| 152 | |||
| 153 | u64 fifobar[1]; | ||
| 154 | }; | ||
| 155 | |||
| 156 | /* convert between struct fifo, and the fifobar, which is saved in the ccb */ | ||
| 157 | #define FIFOHANDLESIZE (sizeof(struct fifo) - sizeof(u64)) | ||
| 158 | #define FIFOBARTOHANDLE(_fifo) \ | ||
| 159 | ((struct fifo *)(((char *)(_fifo)) - FIFOHANDLESIZE)) | ||
| 160 | |||
| 161 | /* the number of qwords to consume from the entry descriptor */ | ||
| 162 | #define ENTRY_BITPOS_QWORDS 0 | ||
| 163 | /* descriptor index number (within a specified queue) */ | ||
| 164 | #define ENTRY_BITPOS_DESCRIPTOR 10 | ||
| 165 | /* state bit, fifo entry consumed by consumer */ | ||
| 166 | #define ENTRY_BITPOS_C 22 | ||
| 167 | /* state bit, fifo entry is occupied */ | ||
| 168 | #define ENTRY_BITPOS_O 23 | ||
| 169 | |||
| 170 | #define ENTRY_BITS_QWORDS 10 | ||
| 171 | #define ENTRY_BITS_DESCRIPTOR 12 | ||
| 172 | #define ENTRY_BITS_C 1 | ||
| 173 | #define ENTRY_BITS_O 1 | ||
| 174 | #define ENTRY_BITS_TOTAL \ | ||
| 175 | (ENTRY_BITS_C + ENTRY_BITS_O + \ | ||
| 176 | ENTRY_BITS_QWORDS + ENTRY_BITS_DESCRIPTOR) | ||
| 177 | |||
| 178 | /* extract various entry fields */ | ||
| 179 | #define ENTRY_MASK ((1 << ENTRY_BITS_TOTAL) - 1) | ||
| 180 | #define ENTRY_MASK_C (((1 << ENTRY_BITS_C) - 1) << ENTRY_BITPOS_C) | ||
| 181 | #define ENTRY_MASK_O (((1 << ENTRY_BITS_O) - 1) << ENTRY_BITPOS_O) | ||
| 182 | #define ENTRY_MASK_QWORDS \ | ||
| 183 | (((1 << ENTRY_BITS_QWORDS) - 1) << ENTRY_BITPOS_QWORDS) | ||
| 184 | #define ENTRY_MASK_DESCRIPTOR \ | ||
| 185 | (((1 << ENTRY_BITS_DESCRIPTOR) - 1) << ENTRY_BITPOS_DESCRIPTOR) | ||
| 186 | |||
| 187 | #define ENTRY_MASK_NOSTATE (ENTRY_MASK >> (ENTRY_BITS_C + ENTRY_BITS_O)) | ||
| 188 | |||
| 189 | #endif /* __HPILO_H */ | ||
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 186162470090..4ce3bdc2f959 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
| @@ -399,8 +399,9 @@ static int __devinit phantom_probe(struct pci_dev *pdev, | |||
| 399 | goto err_irq; | 399 | goto err_irq; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | if (IS_ERR(device_create(phantom_class, &pdev->dev, MKDEV(phantom_major, | 402 | if (IS_ERR(device_create_drvdata(phantom_class, &pdev->dev, |
| 403 | minor), "phantom%u", minor))) | 403 | MKDEV(phantom_major, minor), |
| 404 | NULL, "phantom%u", minor))) | ||
| 404 | dev_err(&pdev->dev, "can't create device\n"); | 405 | dev_err(&pdev->dev, "can't create device\n"); |
| 405 | 406 | ||
| 406 | pci_set_drvdata(pdev, pht); | 407 | pci_set_drvdata(pdev, pht); |
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index 519d942e7940..7b72a1b36115 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
| @@ -241,6 +241,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
| 241 | { | 241 | { |
| 242 | struct block_device *bdev; | 242 | struct block_device *bdev; |
| 243 | struct block2mtd_dev *dev; | 243 | struct block2mtd_dev *dev; |
| 244 | char *name; | ||
| 244 | 245 | ||
| 245 | if (!devname) | 246 | if (!devname) |
| 246 | return NULL; | 247 | return NULL; |
| @@ -279,12 +280,13 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) | |||
| 279 | 280 | ||
| 280 | /* Setup the MTD structure */ | 281 | /* Setup the MTD structure */ |
| 281 | /* make the name contain the block device in */ | 282 | /* make the name contain the block device in */ |
| 282 | dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), | 283 | name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1, |
| 283 | GFP_KERNEL); | 284 | GFP_KERNEL); |
| 284 | if (!dev->mtd.name) | 285 | if (!name) |
| 285 | goto devinit_err; | 286 | goto devinit_err; |
| 286 | 287 | ||
| 287 | sprintf(dev->mtd.name, "block2mtd: %s", devname); | 288 | sprintf(name, "block2mtd: %s", devname); |
| 289 | dev->mtd.name = name; | ||
| 288 | 290 | ||
| 289 | dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; | 291 | dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; |
| 290 | dev->mtd.erasesize = erase_size; | 292 | dev->mtd.erasesize = erase_size; |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 129d429cd2da..aef9f4b687c9 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
| @@ -28,10 +28,13 @@ static void mtd_notify_add(struct mtd_info* mtd) | |||
| 28 | if (!mtd) | 28 | if (!mtd) |
| 29 | return; | 29 | return; |
| 30 | 30 | ||
| 31 | device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2), "mtd%d", mtd->index); | 31 | device_create_drvdata(mtd_class, NULL, |
| 32 | MKDEV(MTD_CHAR_MAJOR, mtd->index*2), | ||
| 33 | NULL, "mtd%d", mtd->index); | ||
| 32 | 34 | ||
| 33 | device_create(mtd_class, NULL, | 35 | device_create_drvdata(mtd_class, NULL, |
| 34 | MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), "mtd%dro", mtd->index); | 36 | MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), |
| 37 | NULL, "mtd%dro", mtd->index); | ||
| 35 | } | 38 | } |
| 36 | 39 | ||
| 37 | static void mtd_notify_remove(struct mtd_info* mtd) | 40 | static void mtd_notify_remove(struct mtd_info* mtd) |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index aabad8ce7458..8db4e6b89482 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
| @@ -1010,7 +1010,7 @@ static int __devinit vortex_probe1(struct device *gendev, | |||
| 1010 | static int printed_version; | 1010 | static int printed_version; |
| 1011 | int retval, print_info; | 1011 | int retval, print_info; |
| 1012 | struct vortex_chip_info * const vci = &vortex_info_tbl[chip_idx]; | 1012 | struct vortex_chip_info * const vci = &vortex_info_tbl[chip_idx]; |
| 1013 | char *print_name = "3c59x"; | 1013 | const char *print_name = "3c59x"; |
| 1014 | struct pci_dev *pdev = NULL; | 1014 | struct pci_dev *pdev = NULL; |
| 1015 | struct eisa_device *edev = NULL; | 1015 | struct eisa_device *edev = NULL; |
| 1016 | DECLARE_MAC_BUF(mac); | 1016 | DECLARE_MAC_BUF(mac); |
diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 1e39e78f1778..71f7cec30911 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c | |||
| @@ -677,7 +677,7 @@ static void at91ether_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo | |||
| 677 | { | 677 | { |
| 678 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | 678 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 679 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | 679 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 680 | strlcpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info)); | 680 | strlcpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info)); |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | static const struct ethtool_ops at91ether_ethtool_ops = { | 683 | static const struct ethtool_ops at91ether_ethtool_ops = { |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index ecd8fc6146e9..7a14980f3472 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
| @@ -848,7 +848,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
| 848 | 848 | ||
| 849 | ep->res = request_mem_region(pdev->resource[0].start, | 849 | ep->res = request_mem_region(pdev->resource[0].start, |
| 850 | pdev->resource[0].end - pdev->resource[0].start + 1, | 850 | pdev->resource[0].end - pdev->resource[0].start + 1, |
| 851 | pdev->dev.bus_id); | 851 | dev_name(&pdev->dev)); |
| 852 | if (ep->res == NULL) { | 852 | if (ep->res == NULL) { |
| 853 | dev_err(&pdev->dev, "Could not reserve memory region\n"); | 853 | dev_err(&pdev->dev, "Could not reserve memory region\n"); |
| 854 | err = -ENOMEM; | 854 | err = -ENOMEM; |
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c index e9d15eccad08..5c5f1e470d3c 100644 --- a/drivers/net/arm/etherh.c +++ b/drivers/net/arm/etherh.c | |||
| @@ -535,7 +535,7 @@ static int __init etherh_addr(char *addr, struct expansion_card *ec) | |||
| 535 | 535 | ||
| 536 | if (!ecard_readchunk(&cd, ec, 0xf5, 0)) { | 536 | if (!ecard_readchunk(&cd, ec, 0xf5, 0)) { |
| 537 | printk(KERN_ERR "%s: unable to read podule description string\n", | 537 | printk(KERN_ERR "%s: unable to read podule description string\n", |
| 538 | ec->dev.bus_id); | 538 | dev_name(&ec->dev)); |
| 539 | goto no_addr; | 539 | goto no_addr; |
| 540 | } | 540 | } |
| 541 | 541 | ||
| @@ -554,7 +554,7 @@ static int __init etherh_addr(char *addr, struct expansion_card *ec) | |||
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | printk(KERN_ERR "%s: unable to parse MAC address: %s\n", | 556 | printk(KERN_ERR "%s: unable to parse MAC address: %s\n", |
| 557 | ec->dev.bus_id, cd.d.string); | 557 | dev_name(&ec->dev), cd.d.string); |
| 558 | 558 | ||
| 559 | no_addr: | 559 | no_addr: |
| 560 | return -ENODEV; | 560 | return -ENODEV; |
| @@ -585,7 +585,7 @@ static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i | |||
| 585 | { | 585 | { |
| 586 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | 586 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); |
| 587 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | 587 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); |
| 588 | strlcpy(info->bus_info, dev->dev.parent->bus_id, | 588 | strlcpy(info->bus_info, dev_name(dev->dev.parent), |
| 589 | sizeof(info->bus_info)); | 589 | sizeof(info->bus_info)); |
| 590 | } | 590 | } |
| 591 | 591 | ||
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 6b1d7a8edf15..739b3ab7bccc 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -866,7 +866,8 @@ static int __init ppp_init(void) | |||
| 866 | err = PTR_ERR(ppp_class); | 866 | err = PTR_ERR(ppp_class); |
| 867 | goto out_chrdev; | 867 | goto out_chrdev; |
| 868 | } | 868 | } |
| 869 | device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), "ppp"); | 869 | device_create_drvdata(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), |
| 870 | NULL, "ppp"); | ||
| 870 | } | 871 | } |
| 871 | 872 | ||
| 872 | out: | 873 | out: |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 5827324e9d9f..f7d3349dc3ec 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
| @@ -397,9 +397,9 @@ static int __init cosa_init(void) | |||
| 397 | err = PTR_ERR(cosa_class); | 397 | err = PTR_ERR(cosa_class); |
| 398 | goto out_chrdev; | 398 | goto out_chrdev; |
| 399 | } | 399 | } |
| 400 | for (i=0; i<nr_cards; i++) { | 400 | for (i = 0; i < nr_cards; i++) |
| 401 | device_create(cosa_class, NULL, MKDEV(cosa_major, i), "cosa%d", i); | 401 | device_create_drvdata(cosa_class, NULL, MKDEV(cosa_major, i), |
| 402 | } | 402 | NULL, "cosa%d", i); |
| 403 | err = 0; | 403 | err = 0; |
| 404 | goto out; | 404 | goto out; |
| 405 | 405 | ||
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index eecf7cbf4139..5a58b075dd8d 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | #define _ACPIPHP_H | 36 | #define _ACPIPHP_H |
| 37 | 37 | ||
| 38 | #include <linux/acpi.h> | 38 | #include <linux/acpi.h> |
| 39 | #include <linux/kobject.h> /* for KOBJ_NAME_LEN */ | 39 | #include <linux/kobject.h> |
| 40 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
| 41 | #include <linux/pci_hotplug.h> | 41 | #include <linux/pci_hotplug.h> |
| 42 | 42 | ||
| @@ -51,7 +51,7 @@ | |||
| 51 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) | 51 | #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) |
| 52 | 52 | ||
| 53 | /* name size which is used for entries in pcihpfs */ | 53 | /* name size which is used for entries in pcihpfs */ |
| 54 | #define SLOT_NAME_SIZE KOBJ_NAME_LEN /* {_SUN} */ | 54 | #define SLOT_NAME_SIZE 20 /* {_SUN} */ |
| 55 | 55 | ||
| 56 | struct acpiphp_bridge; | 56 | struct acpiphp_bridge; |
| 57 | struct acpiphp_slot; | 57 | struct acpiphp_slot; |
diff --git a/drivers/power/apm_power.c b/drivers/power/apm_power.c index a4892275659d..936bae560fa1 100644 --- a/drivers/power/apm_power.c +++ b/drivers/power/apm_power.c | |||
| @@ -78,7 +78,7 @@ static void find_main_battery(void) | |||
| 78 | main_battery = NULL; | 78 | main_battery = NULL; |
| 79 | bp.main = main_battery; | 79 | bp.main = main_battery; |
| 80 | 80 | ||
| 81 | error = class_for_each_device(power_supply_class, &bp, | 81 | error = class_for_each_device(power_supply_class, NULL, &bp, |
| 82 | __find_main_battery); | 82 | __find_main_battery); |
| 83 | if (error) { | 83 | if (error) { |
| 84 | main_battery = bp.main; | 84 | main_battery = bp.main; |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index af1633eb3b70..cb1ccb472921 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
| @@ -41,7 +41,7 @@ static void power_supply_changed_work(struct work_struct *work) | |||
| 41 | 41 | ||
| 42 | dev_dbg(psy->dev, "%s\n", __func__); | 42 | dev_dbg(psy->dev, "%s\n", __func__); |
| 43 | 43 | ||
| 44 | class_for_each_device(power_supply_class, psy, | 44 | class_for_each_device(power_supply_class, NULL, psy, |
| 45 | __power_supply_changed_work); | 45 | __power_supply_changed_work); |
| 46 | 46 | ||
| 47 | power_supply_update_leds(psy); | 47 | power_supply_update_leds(psy); |
| @@ -79,7 +79,7 @@ int power_supply_am_i_supplied(struct power_supply *psy) | |||
| 79 | { | 79 | { |
| 80 | int error; | 80 | int error; |
| 81 | 81 | ||
| 82 | error = class_for_each_device(power_supply_class, psy, | 82 | error = class_for_each_device(power_supply_class, NULL, psy, |
| 83 | __power_supply_am_i_supplied); | 83 | __power_supply_am_i_supplied); |
| 84 | 84 | ||
| 85 | dev_dbg(psy->dev, "%s %d\n", __func__, error); | 85 | dev_dbg(psy->dev, "%s %d\n", __func__, error); |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 58b7336640ff..d397fa5f3a91 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
| @@ -345,7 +345,7 @@ struct rtc_device *rtc_class_open(char *name) | |||
| 345 | struct device *dev; | 345 | struct device *dev; |
| 346 | struct rtc_device *rtc = NULL; | 346 | struct rtc_device *rtc = NULL; |
| 347 | 347 | ||
| 348 | dev = class_find_device(rtc_class, name, __rtc_match); | 348 | dev = class_find_device(rtc_class, NULL, name, __rtc_match); |
| 349 | if (dev) | 349 | if (dev) |
| 350 | rtc = to_rtc_device(dev); | 350 | rtc = to_rtc_device(dev); |
| 351 | 351 | ||
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 81a96e019080..c3dee900a5c8 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
| @@ -1168,17 +1168,19 @@ static int raw3270_create_attributes(struct raw3270 *rp) | |||
| 1168 | if (rc) | 1168 | if (rc) |
| 1169 | goto out; | 1169 | goto out; |
| 1170 | 1170 | ||
| 1171 | rp->clttydev = device_create(class3270, &rp->cdev->dev, | 1171 | rp->clttydev = device_create_drvdata(class3270, &rp->cdev->dev, |
| 1172 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), | 1172 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), |
| 1173 | "tty%s", rp->cdev->dev.bus_id); | 1173 | NULL, |
| 1174 | "tty%s", rp->cdev->dev.bus_id); | ||
| 1174 | if (IS_ERR(rp->clttydev)) { | 1175 | if (IS_ERR(rp->clttydev)) { |
| 1175 | rc = PTR_ERR(rp->clttydev); | 1176 | rc = PTR_ERR(rp->clttydev); |
| 1176 | goto out_ttydev; | 1177 | goto out_ttydev; |
| 1177 | } | 1178 | } |
| 1178 | 1179 | ||
| 1179 | rp->cltubdev = device_create(class3270, &rp->cdev->dev, | 1180 | rp->cltubdev = device_create_drvdata(class3270, &rp->cdev->dev, |
| 1180 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | 1181 | MKDEV(IBM_FS3270_MAJOR, rp->minor), |
| 1181 | "tub%s", rp->cdev->dev.bus_id); | 1182 | NULL, |
| 1183 | "tub%s", rp->cdev->dev.bus_id); | ||
| 1182 | if (!IS_ERR(rp->cltubdev)) | 1184 | if (!IS_ERR(rp->cltubdev)) |
| 1183 | goto out; | 1185 | goto out; |
| 1184 | 1186 | ||
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index 6dfdb7c17981..12c2a5aaf31b 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c | |||
| @@ -69,10 +69,9 @@ struct tape_class_device *register_tape_dev( | |||
| 69 | if (rc) | 69 | if (rc) |
| 70 | goto fail_with_cdev; | 70 | goto fail_with_cdev; |
| 71 | 71 | ||
| 72 | tcd->class_device = device_create(tape_class, device, | 72 | tcd->class_device = device_create_drvdata(tape_class, device, |
| 73 | tcd->char_device->dev, | 73 | tcd->char_device->dev, |
| 74 | "%s", tcd->device_name | 74 | NULL, "%s", tcd->device_name); |
| 75 | ); | ||
| 76 | rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; | 75 | rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; |
| 77 | if (rc) | 76 | if (rc) |
| 78 | goto fail_with_cdev; | 77 | goto fail_with_cdev; |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index b0ac44b27127..c1f352b84868 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
| @@ -896,8 +896,9 @@ static int ur_set_online(struct ccw_device *cdev) | |||
| 896 | goto fail_free_cdev; | 896 | goto fail_free_cdev; |
| 897 | } | 897 | } |
| 898 | 898 | ||
| 899 | urd->device = device_create(vmur_class, NULL, urd->char_device->dev, | 899 | urd->device = device_create_drvdata(vmur_class, NULL, |
| 900 | "%s", node_id); | 900 | urd->char_device->dev, NULL, |
| 901 | "%s", node_id); | ||
| 901 | if (IS_ERR(urd->device)) { | 902 | if (IS_ERR(urd->device)) { |
| 902 | rc = PTR_ERR(urd->device); | 903 | rc = PTR_ERR(urd->device); |
| 903 | TRACE("ur_set_online: device_create rc=%d\n", rc); | 904 | TRACE("ur_set_online: device_create rc=%d\n", rc); |
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c index c37d7c2587ff..73a86d09bba8 100644 --- a/drivers/sbus/sbus.c +++ b/drivers/sbus/sbus.c | |||
| @@ -78,7 +78,7 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde | |||
| 78 | else | 78 | else |
| 79 | sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev; | 79 | sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev; |
| 80 | sdev->ofdev.dev.bus = &sbus_bus_type; | 80 | sdev->ofdev.dev.bus = &sbus_bus_type; |
| 81 | sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node); | 81 | dev_set_name(&sdev->ofdev.dev, "sbus[%08x]", dp->node); |
| 82 | 82 | ||
| 83 | if (of_device_register(&sdev->ofdev) != 0) | 83 | if (of_device_register(&sdev->ofdev) != 0) |
| 84 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", | 84 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", |
| @@ -257,11 +257,11 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus) | |||
| 257 | sbus->ofdev.node = dp; | 257 | sbus->ofdev.node = dp; |
| 258 | sbus->ofdev.dev.parent = NULL; | 258 | sbus->ofdev.dev.parent = NULL; |
| 259 | sbus->ofdev.dev.bus = &sbus_bus_type; | 259 | sbus->ofdev.dev.bus = &sbus_bus_type; |
| 260 | sprintf(sbus->ofdev.dev.bus_id, "sbus%d", num_sbus); | 260 | dev_set_name(&sbus->ofdev.dev, "sbus%d", num_sbus); |
| 261 | 261 | ||
| 262 | if (of_device_register(&sbus->ofdev) != 0) | 262 | if (of_device_register(&sbus->ofdev) != 0) |
| 263 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", | 263 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", |
| 264 | sbus->ofdev.dev.bus_id); | 264 | dev_name(&sbus->ofdev.dev)); |
| 265 | 265 | ||
| 266 | dev_dp = dp->child; | 266 | dev_dp = dp->child; |
| 267 | while (dev_dp) { | 267 | while (dev_dp) { |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 2bc30e32b67a..1fe0901e8119 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
| @@ -271,8 +271,8 @@ rebuild_sys_tab: | |||
| 271 | pHba->initialized = TRUE; | 271 | pHba->initialized = TRUE; |
| 272 | pHba->state &= ~DPTI_STATE_RESET; | 272 | pHba->state &= ~DPTI_STATE_RESET; |
| 273 | if (adpt_sysfs_class) { | 273 | if (adpt_sysfs_class) { |
| 274 | struct device *dev = device_create(adpt_sysfs_class, | 274 | struct device *dev = device_create_drvdata(adpt_sysfs_class, |
| 275 | NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), | 275 | NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), NULL, |
| 276 | "dpti%d", pHba->unit); | 276 | "dpti%d", pHba->unit); |
| 277 | if (IS_ERR(dev)) { | 277 | if (IS_ERR(dev)) { |
| 278 | printk(KERN_WARNING"dpti%d: unable to " | 278 | printk(KERN_WARNING"dpti%d: unable to " |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 35cd892dce04..fed0b02ebc1d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
| @@ -232,8 +232,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) | |||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | if (shost->transportt->create_work_queue) { | 234 | if (shost->transportt->create_work_queue) { |
| 235 | snprintf(shost->work_q_name, KOBJ_NAME_LEN, "scsi_wq_%d", | 235 | snprintf(shost->work_q_name, sizeof(shost->work_q_name), |
| 236 | shost->host_no); | 236 | "scsi_wq_%d", shost->host_no); |
| 237 | shost->work_q = create_singlethread_workqueue( | 237 | shost->work_q = create_singlethread_workqueue( |
| 238 | shost->work_q_name); | 238 | shost->work_q_name); |
| 239 | if (!shost->work_q) { | 239 | if (!shost->work_q) { |
| @@ -466,7 +466,8 @@ struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) | |||
| 466 | struct device *cdev; | 466 | struct device *cdev; |
| 467 | struct Scsi_Host *shost = ERR_PTR(-ENXIO); | 467 | struct Scsi_Host *shost = ERR_PTR(-ENXIO); |
| 468 | 468 | ||
| 469 | cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match); | 469 | cdev = class_find_device(&shost_class, NULL, &hostnum, |
| 470 | __scsi_host_match); | ||
| 470 | if (cdev) { | 471 | if (cdev) { |
| 471 | shost = scsi_host_get(class_to_shost(cdev)); | 472 | shost = scsi_host_get(class_to_shost(cdev)); |
| 472 | put_device(cdev); | 473 | put_device(cdev); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 5fd64e70029d..a272b9a2c869 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
| @@ -417,15 +417,16 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, | |||
| 417 | fc_host->next_vport_number = 0; | 417 | fc_host->next_vport_number = 0; |
| 418 | fc_host->npiv_vports_inuse = 0; | 418 | fc_host->npiv_vports_inuse = 0; |
| 419 | 419 | ||
| 420 | snprintf(fc_host->work_q_name, KOBJ_NAME_LEN, "fc_wq_%d", | 420 | snprintf(fc_host->work_q_name, sizeof(fc_host->work_q_name), |
| 421 | shost->host_no); | 421 | "fc_wq_%d", shost->host_no); |
| 422 | fc_host->work_q = create_singlethread_workqueue( | 422 | fc_host->work_q = create_singlethread_workqueue( |
| 423 | fc_host->work_q_name); | 423 | fc_host->work_q_name); |
| 424 | if (!fc_host->work_q) | 424 | if (!fc_host->work_q) |
| 425 | return -ENOMEM; | 425 | return -ENOMEM; |
| 426 | 426 | ||
| 427 | snprintf(fc_host->devloss_work_q_name, KOBJ_NAME_LEN, "fc_dl_%d", | 427 | snprintf(fc_host->devloss_work_q_name, |
| 428 | shost->host_no); | 428 | sizeof(fc_host->devloss_work_q_name), |
| 429 | "fc_dl_%d", shost->host_no); | ||
| 429 | fc_host->devloss_work_q = create_singlethread_workqueue( | 430 | fc_host->devloss_work_q = create_singlethread_workqueue( |
| 430 | fc_host->devloss_work_q_name); | 431 | fc_host->devloss_work_q_name); |
| 431 | if (!fc_host->devloss_work_q) { | 432 | if (!fc_host->devloss_work_q) { |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 3af7cbcc5c5d..043c3921164f 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
| @@ -170,7 +170,7 @@ iscsi_create_endpoint(int dd_size) | |||
| 170 | int err; | 170 | int err; |
| 171 | 171 | ||
| 172 | for (id = 1; id < ISCSI_MAX_EPID; id++) { | 172 | for (id = 1; id < ISCSI_MAX_EPID; id++) { |
| 173 | dev = class_find_device(&iscsi_endpoint_class, &id, | 173 | dev = class_find_device(&iscsi_endpoint_class, NULL, &id, |
| 174 | iscsi_match_epid); | 174 | iscsi_match_epid); |
| 175 | if (!dev) | 175 | if (!dev) |
| 176 | break; | 176 | break; |
| @@ -222,7 +222,7 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) | |||
| 222 | struct iscsi_endpoint *ep; | 222 | struct iscsi_endpoint *ep; |
| 223 | struct device *dev; | 223 | struct device *dev; |
| 224 | 224 | ||
| 225 | dev = class_find_device(&iscsi_endpoint_class, &handle, | 225 | dev = class_find_device(&iscsi_endpoint_class, NULL, &handle, |
| 226 | iscsi_match_epid); | 226 | iscsi_match_epid); |
| 227 | if (!dev) | 227 | if (!dev) |
| 228 | return NULL; | 228 | return NULL; |
| @@ -247,8 +247,8 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, | |||
| 247 | atomic_set(&ihost->nr_scans, 0); | 247 | atomic_set(&ihost->nr_scans, 0); |
| 248 | mutex_init(&ihost->mutex); | 248 | mutex_init(&ihost->mutex); |
| 249 | 249 | ||
| 250 | snprintf(ihost->scan_workq_name, KOBJ_NAME_LEN, "iscsi_scan_%d", | 250 | snprintf(ihost->scan_workq_name, sizeof(ihost->scan_workq_name), |
| 251 | shost->host_no); | 251 | "iscsi_scan_%d", shost->host_no); |
| 252 | ihost->scan_workq = create_singlethread_workqueue( | 252 | ihost->scan_workq = create_singlethread_workqueue( |
| 253 | ihost->scan_workq_name); | 253 | ihost->scan_workq_name); |
| 254 | if (!ihost->scan_workq) | 254 | if (!ihost->scan_workq) |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 1ad12afc6ba0..1771b2456bfa 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -502,7 +502,7 @@ struct spi_master *spi_busnum_to_master(u16 bus_num) | |||
| 502 | struct device *dev; | 502 | struct device *dev; |
| 503 | struct spi_master *master = NULL; | 503 | struct spi_master *master = NULL; |
| 504 | 504 | ||
| 505 | dev = class_find_device(&spi_master_class, &bus_num, | 505 | dev = class_find_device(&spi_master_class, NULL, &bus_num, |
| 506 | __spi_master_match); | 506 | __spi_master_match); |
| 507 | if (dev) | 507 | if (dev) |
| 508 | master = container_of(dev, struct spi_master, dev); | 508 | master = container_of(dev, struct spi_master, dev); |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index ddbe1a5e970e..2833fd772a24 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
| @@ -576,7 +576,8 @@ static int spidev_probe(struct spi_device *spi) | |||
| 576 | struct device *dev; | 576 | struct device *dev; |
| 577 | 577 | ||
| 578 | spidev->devt = MKDEV(SPIDEV_MAJOR, minor); | 578 | spidev->devt = MKDEV(SPIDEV_MAJOR, minor); |
| 579 | dev = device_create(spidev_class, &spi->dev, spidev->devt, | 579 | dev = device_create_drvdata(spidev_class, &spi->dev, |
| 580 | spidev->devt, spidev, | ||
| 580 | "spidev%d.%d", | 581 | "spidev%d.%d", |
| 581 | spi->master->bus_num, spi->chip_select); | 582 | spi->master->bus_num, spi->chip_select); |
| 582 | status = IS_ERR(dev) ? PTR_ERR(dev) : 0; | 583 | status = IS_ERR(dev) ? PTR_ERR(dev) : 0; |
| @@ -586,7 +587,6 @@ static int spidev_probe(struct spi_device *spi) | |||
| 586 | } | 587 | } |
| 587 | if (status == 0) { | 588 | if (status == 0) { |
| 588 | set_bit(minor, minors); | 589 | set_bit(minor, minors); |
| 589 | spi_set_drvdata(spi, spidev); | ||
| 590 | list_add(&spidev->device_entry, &device_list); | 590 | list_add(&spidev->device_entry, &device_list); |
| 591 | } | 591 | } |
| 592 | mutex_unlock(&device_list_lock); | 592 | mutex_unlock(&device_list_lock); |
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index a4aaab9c7ddc..2e9079df26b3 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig | |||
| @@ -15,7 +15,7 @@ if UIO | |||
| 15 | 15 | ||
| 16 | config UIO_CIF | 16 | config UIO_CIF |
| 17 | tristate "generic Hilscher CIF Card driver" | 17 | tristate "generic Hilscher CIF Card driver" |
| 18 | depends on UIO && PCI | 18 | depends on PCI |
| 19 | default n | 19 | default n |
| 20 | help | 20 | help |
| 21 | Driver for Hilscher CIF DeviceNet and Profibus cards. This | 21 | Driver for Hilscher CIF DeviceNet and Profibus cards. This |
| @@ -26,9 +26,15 @@ config UIO_CIF | |||
| 26 | To compile this driver as a module, choose M here: the module | 26 | To compile this driver as a module, choose M here: the module |
| 27 | will be called uio_cif. | 27 | will be called uio_cif. |
| 28 | 28 | ||
| 29 | config UIO_PDRV | ||
| 30 | tristate "Userspace I/O platform driver" | ||
| 31 | help | ||
| 32 | Generic platform driver for Userspace I/O devices. | ||
| 33 | |||
| 34 | If you don't know what to do here, say N. | ||
| 35 | |||
| 29 | config UIO_SMX | 36 | config UIO_SMX |
| 30 | tristate "SMX cryptengine UIO interface" | 37 | tristate "SMX cryptengine UIO interface" |
| 31 | depends on UIO | ||
| 32 | default n | 38 | default n |
| 33 | help | 39 | help |
| 34 | Userspace IO interface to the Cryptography engine found on the | 40 | Userspace IO interface to the Cryptography engine found on the |
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index 18c45662431e..e00ce0def1a0 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | obj-$(CONFIG_UIO) += uio.o | 1 | obj-$(CONFIG_UIO) += uio.o |
| 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o | 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o |
| 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | ||
| 3 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | 4 | obj-$(CONFIG_UIO_SMX) += uio_smx.o |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 5a7ca2e6094d..3a6934bf7131 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
| @@ -427,6 +427,31 @@ static ssize_t uio_read(struct file *filep, char __user *buf, | |||
| 427 | return retval; | 427 | return retval; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | static ssize_t uio_write(struct file *filep, const char __user *buf, | ||
| 431 | size_t count, loff_t *ppos) | ||
| 432 | { | ||
| 433 | struct uio_listener *listener = filep->private_data; | ||
| 434 | struct uio_device *idev = listener->dev; | ||
| 435 | ssize_t retval; | ||
| 436 | s32 irq_on; | ||
| 437 | |||
| 438 | if (idev->info->irq == UIO_IRQ_NONE) | ||
| 439 | return -EIO; | ||
| 440 | |||
| 441 | if (count != sizeof(s32)) | ||
| 442 | return -EINVAL; | ||
| 443 | |||
| 444 | if (!idev->info->irqcontrol) | ||
| 445 | return -ENOSYS; | ||
| 446 | |||
| 447 | if (copy_from_user(&irq_on, buf, count)) | ||
| 448 | return -EFAULT; | ||
| 449 | |||
| 450 | retval = idev->info->irqcontrol(idev->info, irq_on); | ||
| 451 | |||
| 452 | return retval ? retval : sizeof(s32); | ||
| 453 | } | ||
| 454 | |||
| 430 | static int uio_find_mem_index(struct vm_area_struct *vma) | 455 | static int uio_find_mem_index(struct vm_area_struct *vma) |
| 431 | { | 456 | { |
| 432 | int mi; | 457 | int mi; |
| @@ -546,6 +571,7 @@ static const struct file_operations uio_fops = { | |||
| 546 | .open = uio_open, | 571 | .open = uio_open, |
| 547 | .release = uio_release, | 572 | .release = uio_release, |
| 548 | .read = uio_read, | 573 | .read = uio_read, |
| 574 | .write = uio_write, | ||
| 549 | .mmap = uio_mmap, | 575 | .mmap = uio_mmap, |
| 550 | .poll = uio_poll, | 576 | .poll = uio_poll, |
| 551 | .fasync = uio_fasync, | 577 | .fasync = uio_fasync, |
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c new file mode 100644 index 000000000000..5d0d2e85d982 --- /dev/null +++ b/drivers/uio/uio_pdrv.c | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | /* | ||
| 2 | * drivers/uio/uio_pdrv.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 by Digi International Inc. | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/platform_device.h> | ||
| 12 | #include <linux/uio_driver.h> | ||
| 13 | #include <linux/stringify.h> | ||
| 14 | |||
| 15 | #define DRIVER_NAME "uio" | ||
| 16 | |||
| 17 | struct uio_platdata { | ||
| 18 | struct uio_info *uioinfo; | ||
| 19 | }; | ||
| 20 | |||
| 21 | static int uio_pdrv_probe(struct platform_device *pdev) | ||
| 22 | { | ||
| 23 | struct uio_info *uioinfo = pdev->dev.platform_data; | ||
| 24 | struct uio_platdata *pdata; | ||
| 25 | struct uio_mem *uiomem; | ||
| 26 | int ret = -ENODEV; | ||
| 27 | int i; | ||
| 28 | |||
| 29 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { | ||
| 30 | dev_dbg(&pdev->dev, "%s: err_uioinfo\n", __func__); | ||
| 31 | goto err_uioinfo; | ||
| 32 | } | ||
| 33 | |||
| 34 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
| 35 | if (!pdata) { | ||
| 36 | ret = -ENOMEM; | ||
| 37 | dev_dbg(&pdev->dev, "%s: err_alloc_pdata\n", __func__); | ||
| 38 | goto err_alloc_pdata; | ||
| 39 | } | ||
| 40 | |||
| 41 | pdata->uioinfo = uioinfo; | ||
| 42 | |||
| 43 | uiomem = &uioinfo->mem[0]; | ||
| 44 | |||
| 45 | for (i = 0; i < pdev->num_resources; ++i) { | ||
| 46 | struct resource *r = &pdev->resource[i]; | ||
| 47 | |||
| 48 | if (r->flags != IORESOURCE_MEM) | ||
| 49 | continue; | ||
| 50 | |||
| 51 | if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) { | ||
| 52 | dev_warn(&pdev->dev, "device has more than " | ||
| 53 | __stringify(MAX_UIO_MAPS) | ||
| 54 | " I/O memory resources.\n"); | ||
| 55 | break; | ||
| 56 | } | ||
| 57 | |||
| 58 | uiomem->memtype = UIO_MEM_PHYS; | ||
| 59 | uiomem->addr = r->start; | ||
| 60 | uiomem->size = r->end - r->start + 1; | ||
| 61 | ++uiomem; | ||
| 62 | } | ||
| 63 | |||
| 64 | while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) { | ||
| 65 | uiomem->size = 0; | ||
| 66 | ++uiomem; | ||
| 67 | } | ||
| 68 | |||
| 69 | pdata->uioinfo->priv = pdata; | ||
| 70 | |||
| 71 | ret = uio_register_device(&pdev->dev, pdata->uioinfo); | ||
| 72 | |||
| 73 | if (ret) { | ||
| 74 | kfree(pdata); | ||
| 75 | err_alloc_pdata: | ||
| 76 | err_uioinfo: | ||
| 77 | return ret; | ||
| 78 | } | ||
| 79 | |||
| 80 | platform_set_drvdata(pdev, pdata); | ||
| 81 | |||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | static int uio_pdrv_remove(struct platform_device *pdev) | ||
| 86 | { | ||
| 87 | struct uio_platdata *pdata = platform_get_drvdata(pdev); | ||
| 88 | |||
| 89 | uio_unregister_device(pdata->uioinfo); | ||
| 90 | |||
| 91 | return 0; | ||
| 92 | } | ||
| 93 | |||
| 94 | static struct platform_driver uio_pdrv = { | ||
| 95 | .probe = uio_pdrv_probe, | ||
| 96 | .remove = uio_pdrv_remove, | ||
| 97 | .driver = { | ||
| 98 | .name = DRIVER_NAME, | ||
| 99 | .owner = THIS_MODULE, | ||
| 100 | }, | ||
| 101 | }; | ||
| 102 | |||
| 103 | static int __init uio_pdrv_init(void) | ||
| 104 | { | ||
| 105 | return platform_driver_register(&uio_pdrv); | ||
| 106 | } | ||
| 107 | |||
| 108 | static void __exit uio_pdrv_exit(void) | ||
| 109 | { | ||
| 110 | platform_driver_unregister(&uio_pdrv); | ||
| 111 | } | ||
| 112 | module_init(uio_pdrv_init); | ||
| 113 | module_exit(uio_pdrv_exit); | ||
| 114 | |||
| 115 | MODULE_AUTHOR("Uwe Kleine-Koenig"); | ||
| 116 | MODULE_DESCRIPTION("Userspace I/O platform driver"); | ||
| 117 | MODULE_LICENSE("GPL"); | ||
| 118 | MODULE_ALIAS("platform:" DRIVER_NAME); | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 54a350ccd033..20290c5b1562 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
| @@ -1729,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev) | |||
| 1729 | { | 1729 | { |
| 1730 | struct device *cldev; | 1730 | struct device *cldev; |
| 1731 | 1731 | ||
| 1732 | cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt, | 1732 | cldev = device_create_drvdata(usb_classdev_class, &dev->dev, |
| 1733 | "usbdev%d.%d", dev->bus->busnum, | 1733 | dev->dev.devt, NULL, "usbdev%d.%d", |
| 1734 | dev->devnum); | 1734 | dev->bus->busnum, dev->devnum); |
| 1735 | if (IS_ERR(cldev)) | 1735 | if (IS_ERR(cldev)) |
| 1736 | return PTR_ERR(cldev); | 1736 | return PTR_ERR(cldev); |
| 1737 | dev->usb_classdev = cldev; | 1737 | dev->usb_classdev = cldev; |
| @@ -1792,6 +1792,11 @@ int __init usb_devio_init(void) | |||
| 1792 | usb_classdev_class = NULL; | 1792 | usb_classdev_class = NULL; |
| 1793 | goto out; | 1793 | goto out; |
| 1794 | } | 1794 | } |
| 1795 | /* devices of this class shadow the major:minor of their parent | ||
| 1796 | * device, so clear ->dev_kobj to prevent adding duplicate entries | ||
| 1797 | * to /sys/dev | ||
| 1798 | */ | ||
| 1799 | usb_classdev_class->dev_kobj = NULL; | ||
| 1795 | 1800 | ||
| 1796 | usb_register_notify(&usbdev_nb); | 1801 | usb_register_notify(&usbdev_nb); |
| 1797 | #endif | 1802 | #endif |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 913fb8667899..6b1b229e38cd 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
| @@ -196,8 +196,9 @@ int usb_register_dev(struct usb_interface *intf, | |||
| 196 | ++temp; | 196 | ++temp; |
| 197 | else | 197 | else |
| 198 | temp = name; | 198 | temp = name; |
| 199 | intf->usb_dev = device_create(usb_class->class, &intf->dev, | 199 | intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev, |
| 200 | MKDEV(USB_MAJOR, minor), "%s", temp); | 200 | MKDEV(USB_MAJOR, minor), NULL, |
| 201 | "%s", temp); | ||
| 201 | if (IS_ERR(intf->usb_dev)) { | 202 | if (IS_ERR(intf->usb_dev)) { |
| 202 | down_write(&minor_rwsem); | 203 | down_write(&minor_rwsem); |
| 203 | usb_minors[intf->minor] = NULL; | 204 | usb_minors[intf->minor] = NULL; |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 9caaec3ae9a3..49cd9e145a9b 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
| @@ -1360,8 +1360,8 @@ printer_bind(struct usb_gadget *gadget) | |||
| 1360 | 1360 | ||
| 1361 | 1361 | ||
| 1362 | /* Setup the sysfs files for the printer gadget. */ | 1362 | /* Setup the sysfs files for the printer gadget. */ |
| 1363 | dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno, | 1363 | dev->pdev = device_create_drvdata(usb_gadget_class, NULL, |
| 1364 | "g_printer"); | 1364 | g_printer_devno, NULL, "g_printer"); |
| 1365 | if (IS_ERR(dev->pdev)) { | 1365 | if (IS_ERR(dev->pdev)) { |
| 1366 | ERROR(dev, "Failed to create device: g_printer\n"); | 1366 | ERROR(dev, "Failed to create device: g_printer\n"); |
| 1367 | goto fail; | 1367 | goto fail; |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index 293a46247c3b..6566fc0a3228 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
| @@ -1162,8 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus) | |||
| 1162 | if (minor >= MON_BIN_MAX_MINOR) | 1162 | if (minor >= MON_BIN_MAX_MINOR) |
| 1163 | return 0; | 1163 | return 0; |
| 1164 | 1164 | ||
| 1165 | dev = device_create(mon_bin_class, ubus? ubus->controller: NULL, | 1165 | dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL, |
| 1166 | MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor); | 1166 | MKDEV(MAJOR(mon_bin_dev0), minor), NULL, |
| 1167 | "usbmon%d", minor); | ||
| 1167 | if (IS_ERR(dev)) | 1168 | if (IS_ERR(dev)) |
| 1168 | return 0; | 1169 | return 0; |
| 1169 | 1170 | ||
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 24ee96c4e9e9..07b6addbb3c1 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
| @@ -1872,7 +1872,7 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i | |||
| 1872 | struct fb_info *info = pci_get_drvdata(pdev); | 1872 | struct fb_info *info = pci_get_drvdata(pdev); |
| 1873 | struct aty128fb_par *par = info->par; | 1873 | struct aty128fb_par *par = info->par; |
| 1874 | struct fb_var_screeninfo var; | 1874 | struct fb_var_screeninfo var; |
| 1875 | char video_card[DEVICE_NAME_SIZE]; | 1875 | char video_card[50]; |
| 1876 | u8 chip_rev; | 1876 | u8 chip_rev; |
| 1877 | u32 dac; | 1877 | u32 dac; |
| 1878 | 1878 | ||
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index c347e38cd0b0..ccbfffd12805 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h | |||
| @@ -289,7 +289,7 @@ struct radeonfb_info { | |||
| 289 | struct radeon_regs state; | 289 | struct radeon_regs state; |
| 290 | struct radeon_regs init_state; | 290 | struct radeon_regs init_state; |
| 291 | 291 | ||
| 292 | char name[DEVICE_NAME_SIZE]; | 292 | char name[50]; |
| 293 | 293 | ||
| 294 | unsigned long mmio_base_phys; | 294 | unsigned long mmio_base_phys; |
| 295 | unsigned long fb_base_phys; | 295 | unsigned long fb_base_phys; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 97aff8db10bf..4be3b46c069b 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
| @@ -3586,7 +3586,8 @@ static int __init fb_console_init(void) | |||
| 3586 | 3586 | ||
| 3587 | acquire_console_sem(); | 3587 | acquire_console_sem(); |
| 3588 | fb_register_client(&fbcon_event_notifier); | 3588 | fb_register_client(&fbcon_event_notifier); |
| 3589 | fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), "fbcon"); | 3589 | fbcon_device = device_create_drvdata(fb_class, NULL, MKDEV(0, 0), |
| 3590 | NULL, "fbcon"); | ||
| 3590 | 3591 | ||
| 3591 | if (IS_ERR(fbcon_device)) { | 3592 | if (IS_ERR(fbcon_device)) { |
| 3592 | printk(KERN_WARNING "Unable to create device " | 3593 | printk(KERN_WARNING "Unable to create device " |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 33ebdb198daf..1cd5071e5362 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
| @@ -1439,8 +1439,9 @@ register_framebuffer(struct fb_info *fb_info) | |||
| 1439 | break; | 1439 | break; |
| 1440 | fb_info->node = i; | 1440 | fb_info->node = i; |
| 1441 | 1441 | ||
| 1442 | fb_info->dev = device_create(fb_class, fb_info->device, | 1442 | fb_info->dev = device_create_drvdata(fb_class, fb_info->device, |
| 1443 | MKDEV(FB_MAJOR, i), "fb%d", i); | 1443 | MKDEV(FB_MAJOR, i), NULL, |
| 1444 | "fb%d", i); | ||
| 1444 | if (IS_ERR(fb_info->dev)) { | 1445 | if (IS_ERR(fb_info->dev)) { |
| 1445 | /* Not fatal */ | 1446 | /* Not fatal */ |
| 1446 | printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev)); | 1447 | printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev)); |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 591bc29b55f5..d4427cb86979 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -610,6 +610,7 @@ static ssize_t show_target_kb(struct sys_device *dev, char *buf) | |||
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | static ssize_t store_target_kb(struct sys_device *dev, | 612 | static ssize_t store_target_kb(struct sys_device *dev, |
| 613 | struct sysdev_attribute *attr, | ||
| 613 | const char *buf, | 614 | const char *buf, |
| 614 | size_t count) | 615 | size_t count) |
| 615 | { | 616 | { |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index e3eb3556622b..40c36f7352a6 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
| @@ -362,8 +362,9 @@ static int init_coda_psdev(void) | |||
| 362 | goto out_chrdev; | 362 | goto out_chrdev; |
| 363 | } | 363 | } |
| 364 | for (i = 0; i < MAX_CODADEVS; i++) | 364 | for (i = 0; i < MAX_CODADEVS; i++) |
| 365 | device_create(coda_psdev_class, NULL, | 365 | device_create_drvdata(coda_psdev_class, NULL, |
| 366 | MKDEV(CODA_PSDEV_MAJOR,i), "cfs%d", i); | 366 | MKDEV(CODA_PSDEV_MAJOR, i), |
| 367 | NULL, "cfs%d", i); | ||
| 367 | coda_sysctl_init(); | 368 | coda_sysctl_init(); |
| 368 | goto out; | 369 | goto out; |
| 369 | 370 | ||
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index e9602d85c11d..08e28c9bb416 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
| @@ -309,6 +309,31 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
| 309 | } | 309 | } |
| 310 | EXPORT_SYMBOL_GPL(debugfs_create_symlink); | 310 | EXPORT_SYMBOL_GPL(debugfs_create_symlink); |
| 311 | 311 | ||
| 312 | static void __debugfs_remove(struct dentry *dentry, struct dentry *parent) | ||
| 313 | { | ||
| 314 | int ret = 0; | ||
| 315 | |||
| 316 | if (debugfs_positive(dentry)) { | ||
| 317 | if (dentry->d_inode) { | ||
| 318 | dget(dentry); | ||
| 319 | switch (dentry->d_inode->i_mode & S_IFMT) { | ||
| 320 | case S_IFDIR: | ||
| 321 | ret = simple_rmdir(parent->d_inode, dentry); | ||
| 322 | break; | ||
| 323 | case S_IFLNK: | ||
| 324 | kfree(dentry->d_inode->i_private); | ||
| 325 | /* fall through */ | ||
| 326 | default: | ||
| 327 | simple_unlink(parent->d_inode, dentry); | ||
| 328 | break; | ||
| 329 | } | ||
| 330 | if (!ret) | ||
| 331 | d_delete(dentry); | ||
| 332 | dput(dentry); | ||
| 333 | } | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 312 | /** | 337 | /** |
| 313 | * debugfs_remove - removes a file or directory from the debugfs filesystem | 338 | * debugfs_remove - removes a file or directory from the debugfs filesystem |
| 314 | * @dentry: a pointer to a the dentry of the file or directory to be | 339 | * @dentry: a pointer to a the dentry of the file or directory to be |
| @@ -325,7 +350,6 @@ EXPORT_SYMBOL_GPL(debugfs_create_symlink); | |||
| 325 | void debugfs_remove(struct dentry *dentry) | 350 | void debugfs_remove(struct dentry *dentry) |
| 326 | { | 351 | { |
| 327 | struct dentry *parent; | 352 | struct dentry *parent; |
| 328 | int ret = 0; | ||
| 329 | 353 | ||
| 330 | if (!dentry) | 354 | if (!dentry) |
| 331 | return; | 355 | return; |
| @@ -335,29 +359,83 @@ void debugfs_remove(struct dentry *dentry) | |||
| 335 | return; | 359 | return; |
| 336 | 360 | ||
| 337 | mutex_lock(&parent->d_inode->i_mutex); | 361 | mutex_lock(&parent->d_inode->i_mutex); |
| 338 | if (debugfs_positive(dentry)) { | 362 | __debugfs_remove(dentry, parent); |
| 339 | if (dentry->d_inode) { | 363 | mutex_unlock(&parent->d_inode->i_mutex); |
| 340 | dget(dentry); | 364 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
| 341 | switch (dentry->d_inode->i_mode & S_IFMT) { | 365 | } |
| 342 | case S_IFDIR: | 366 | EXPORT_SYMBOL_GPL(debugfs_remove); |
| 343 | ret = simple_rmdir(parent->d_inode, dentry); | 367 | |
| 344 | break; | 368 | /** |
| 345 | case S_IFLNK: | 369 | * debugfs_remove_recursive - recursively removes a directory |
| 346 | kfree(dentry->d_inode->i_private); | 370 | * @dentry: a pointer to a the dentry of the directory to be removed. |
| 347 | /* fall through */ | 371 | * |
| 348 | default: | 372 | * This function recursively removes a directory tree in debugfs that |
| 349 | simple_unlink(parent->d_inode, dentry); | 373 | * was previously created with a call to another debugfs function |
| 374 | * (like debugfs_create_file() or variants thereof.) | ||
| 375 | * | ||
| 376 | * This function is required to be called in order for the file to be | ||
| 377 | * removed, no automatic cleanup of files will happen when a module is | ||
| 378 | * removed, you are responsible here. | ||
| 379 | */ | ||
| 380 | void debugfs_remove_recursive(struct dentry *dentry) | ||
| 381 | { | ||
| 382 | struct dentry *child; | ||
| 383 | struct dentry *parent; | ||
| 384 | |||
| 385 | if (!dentry) | ||
| 386 | return; | ||
| 387 | |||
| 388 | parent = dentry->d_parent; | ||
| 389 | if (!parent || !parent->d_inode) | ||
| 390 | return; | ||
| 391 | |||
| 392 | parent = dentry; | ||
| 393 | mutex_lock(&parent->d_inode->i_mutex); | ||
| 394 | |||
| 395 | while (1) { | ||
| 396 | /* | ||
| 397 | * When all dentries under "parent" has been removed, | ||
| 398 | * walk up the tree until we reach our starting point. | ||
| 399 | */ | ||
| 400 | if (list_empty(&parent->d_subdirs)) { | ||
| 401 | mutex_unlock(&parent->d_inode->i_mutex); | ||
| 402 | if (parent == dentry) | ||
| 350 | break; | 403 | break; |
| 351 | } | 404 | parent = parent->d_parent; |
| 352 | if (!ret) | 405 | mutex_lock(&parent->d_inode->i_mutex); |
| 353 | d_delete(dentry); | 406 | } |
| 354 | dput(dentry); | 407 | child = list_entry(parent->d_subdirs.next, struct dentry, |
| 408 | d_u.d_child); | ||
| 409 | |||
| 410 | /* | ||
| 411 | * If "child" isn't empty, walk down the tree and | ||
| 412 | * remove all its descendants first. | ||
| 413 | */ | ||
| 414 | if (!list_empty(&child->d_subdirs)) { | ||
| 415 | mutex_unlock(&parent->d_inode->i_mutex); | ||
| 416 | parent = child; | ||
| 417 | mutex_lock(&parent->d_inode->i_mutex); | ||
| 418 | continue; | ||
| 355 | } | 419 | } |
| 420 | __debugfs_remove(child, parent); | ||
| 421 | if (parent->d_subdirs.next == &child->d_u.d_child) { | ||
| 422 | /* | ||
| 423 | * Avoid infinite loop if we fail to remove | ||
| 424 | * one dentry. | ||
| 425 | */ | ||
| 426 | mutex_unlock(&parent->d_inode->i_mutex); | ||
| 427 | break; | ||
| 428 | } | ||
| 429 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | ||
| 356 | } | 430 | } |
| 431 | |||
| 432 | parent = dentry->d_parent; | ||
| 433 | mutex_lock(&parent->d_inode->i_mutex); | ||
| 434 | __debugfs_remove(dentry, parent); | ||
| 357 | mutex_unlock(&parent->d_inode->i_mutex); | 435 | mutex_unlock(&parent->d_inode->i_mutex); |
| 358 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 436 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
| 359 | } | 437 | } |
| 360 | EXPORT_SYMBOL_GPL(debugfs_remove); | 438 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); |
| 361 | 439 | ||
| 362 | /** | 440 | /** |
| 363 | * debugfs_rename - rename a file/directory in the debugfs filesystem | 441 | * debugfs_rename - rename a file/directory in the debugfs filesystem |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 6149e4b58c88..efef715135d3 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
| @@ -401,7 +401,7 @@ void register_disk(struct gendisk *disk) | |||
| 401 | disk->dev.parent = disk->driverfs_dev; | 401 | disk->dev.parent = disk->driverfs_dev; |
| 402 | disk->dev.devt = MKDEV(disk->major, disk->first_minor); | 402 | disk->dev.devt = MKDEV(disk->major, disk->first_minor); |
| 403 | 403 | ||
| 404 | strlcpy(disk->dev.bus_id, disk->disk_name, KOBJ_NAME_LEN); | 404 | strlcpy(disk->dev.bus_id, disk->disk_name, BUS_ID_SIZE); |
| 405 | /* ewww... some of these buggers have / in the name... */ | 405 | /* ewww... some of these buggers have / in the name... */ |
| 406 | s = strchr(disk->dev.bus_id, '/'); | 406 | s = strchr(disk->dev.bus_id, '/'); |
| 407 | if (s) | 407 | if (s) |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 8c0e4b92574f..c1a7efb310bf 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
| @@ -398,7 +398,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | |||
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | /** | 400 | /** |
| 401 | * sysfs_add_one - add sysfs_dirent to parent | 401 | * __sysfs_add_one - add sysfs_dirent to parent without warning |
| 402 | * @acxt: addrm context to use | 402 | * @acxt: addrm context to use |
| 403 | * @sd: sysfs_dirent to be added | 403 | * @sd: sysfs_dirent to be added |
| 404 | * | 404 | * |
| @@ -417,7 +417,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | |||
| 417 | * 0 on success, -EEXIST if entry with the given name already | 417 | * 0 on success, -EEXIST if entry with the given name already |
| 418 | * exists. | 418 | * exists. |
| 419 | */ | 419 | */ |
| 420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | 420 | int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
| 421 | { | 421 | { |
| 422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) | 422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) |
| 423 | return -EEXIST; | 423 | return -EEXIST; |
| @@ -435,6 +435,39 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | /** | 437 | /** |
| 438 | * sysfs_add_one - add sysfs_dirent to parent | ||
| 439 | * @acxt: addrm context to use | ||
| 440 | * @sd: sysfs_dirent to be added | ||
| 441 | * | ||
| 442 | * Get @acxt->parent_sd and set sd->s_parent to it and increment | ||
| 443 | * nlink of parent inode if @sd is a directory and link into the | ||
| 444 | * children list of the parent. | ||
| 445 | * | ||
| 446 | * This function should be called between calls to | ||
| 447 | * sysfs_addrm_start() and sysfs_addrm_finish() and should be | ||
| 448 | * passed the same @acxt as passed to sysfs_addrm_start(). | ||
| 449 | * | ||
| 450 | * LOCKING: | ||
| 451 | * Determined by sysfs_addrm_start(). | ||
| 452 | * | ||
| 453 | * RETURNS: | ||
| 454 | * 0 on success, -EEXIST if entry with the given name already | ||
| 455 | * exists. | ||
| 456 | */ | ||
| 457 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | ||
| 458 | { | ||
| 459 | int ret; | ||
| 460 | |||
| 461 | ret = __sysfs_add_one(acxt, sd); | ||
| 462 | if (ret == -EEXIST) { | ||
| 463 | printk(KERN_WARNING "sysfs: duplicate filename '%s' " | ||
| 464 | "can not be created\n", sd->s_name); | ||
| 465 | WARN_ON(1); | ||
| 466 | } | ||
| 467 | return ret; | ||
| 468 | } | ||
| 469 | |||
| 470 | /** | ||
| 438 | * sysfs_remove_one - remove sysfs_dirent from parent | 471 | * sysfs_remove_one - remove sysfs_dirent from parent |
| 439 | * @acxt: addrm context to use | 472 | * @acxt: addrm context to use |
| 440 | * @sd: sysfs_dirent to be removed | 473 | * @sd: sysfs_dirent to be removed |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index e7735f643cd1..3f07893ff896 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/kobject.h> | 14 | #include <linux/kobject.h> |
| 15 | #include <linux/kallsyms.h> | 15 | #include <linux/kallsyms.h> |
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | #include <linux/fsnotify.h> | ||
| 17 | #include <linux/namei.h> | 18 | #include <linux/namei.h> |
| 18 | #include <linux/poll.h> | 19 | #include <linux/poll.h> |
| 19 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| @@ -585,9 +586,11 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) | |||
| 585 | 586 | ||
| 586 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); | 587 | newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); |
| 587 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 588 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
| 588 | rc = notify_change(victim, &newattrs); | 589 | newattrs.ia_ctime = current_fs_time(inode->i_sb); |
| 590 | rc = sysfs_setattr(victim, &newattrs); | ||
| 589 | 591 | ||
| 590 | if (rc == 0) { | 592 | if (rc == 0) { |
| 593 | fsnotify_change(victim, newattrs.ia_valid); | ||
| 591 | mutex_lock(&sysfs_mutex); | 594 | mutex_lock(&sysfs_mutex); |
| 592 | victim_sd->s_mode = newattrs.ia_mode; | 595 | victim_sd->s_mode = newattrs.ia_mode; |
| 593 | mutex_unlock(&sysfs_mutex); | 596 | mutex_unlock(&sysfs_mutex); |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index 817f5966edca..a3ba217fbe74 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
| @@ -19,13 +19,8 @@ | |||
| 19 | 19 | ||
| 20 | #include "sysfs.h" | 20 | #include "sysfs.h" |
| 21 | 21 | ||
| 22 | /** | 22 | static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, |
| 23 | * sysfs_create_link - create symlink between two objects. | 23 | const char *name, int warn) |
| 24 | * @kobj: object whose directory we're creating the link in. | ||
| 25 | * @target: object we're pointing to. | ||
| 26 | * @name: name of the symlink. | ||
| 27 | */ | ||
| 28 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) | ||
| 29 | { | 24 | { |
| 30 | struct sysfs_dirent *parent_sd = NULL; | 25 | struct sysfs_dirent *parent_sd = NULL; |
| 31 | struct sysfs_dirent *target_sd = NULL; | 26 | struct sysfs_dirent *target_sd = NULL; |
| @@ -65,7 +60,10 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
| 65 | target_sd = NULL; /* reference is now owned by the symlink */ | 60 | target_sd = NULL; /* reference is now owned by the symlink */ |
| 66 | 61 | ||
| 67 | sysfs_addrm_start(&acxt, parent_sd); | 62 | sysfs_addrm_start(&acxt, parent_sd); |
| 68 | error = sysfs_add_one(&acxt, sd); | 63 | if (warn) |
| 64 | error = sysfs_add_one(&acxt, sd); | ||
| 65 | else | ||
| 66 | error = __sysfs_add_one(&acxt, sd); | ||
| 69 | sysfs_addrm_finish(&acxt); | 67 | sysfs_addrm_finish(&acxt); |
| 70 | 68 | ||
| 71 | if (error) | 69 | if (error) |
| @@ -80,6 +78,33 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char | |||
| 80 | } | 78 | } |
| 81 | 79 | ||
| 82 | /** | 80 | /** |
| 81 | * sysfs_create_link - create symlink between two objects. | ||
| 82 | * @kobj: object whose directory we're creating the link in. | ||
| 83 | * @target: object we're pointing to. | ||
| 84 | * @name: name of the symlink. | ||
| 85 | */ | ||
| 86 | int sysfs_create_link(struct kobject *kobj, struct kobject *target, | ||
| 87 | const char *name) | ||
| 88 | { | ||
| 89 | return sysfs_do_create_link(kobj, target, name, 1); | ||
| 90 | } | ||
| 91 | |||
| 92 | /** | ||
| 93 | * sysfs_create_link_nowarn - create symlink between two objects. | ||
| 94 | * @kobj: object whose directory we're creating the link in. | ||
| 95 | * @target: object we're pointing to. | ||
| 96 | * @name: name of the symlink. | ||
| 97 | * | ||
| 98 | * This function does the same as sysf_create_link(), but it | ||
| 99 | * doesn't warn if the link already exists. | ||
| 100 | */ | ||
| 101 | int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, | ||
| 102 | const char *name) | ||
| 103 | { | ||
| 104 | return sysfs_do_create_link(kobj, target, name, 0); | ||
| 105 | } | ||
| 106 | |||
| 107 | /** | ||
| 83 | * sysfs_remove_link - remove symlink in object's directory. | 108 | * sysfs_remove_link - remove symlink in object's directory. |
| 84 | * @kobj: object we're acting for. | 109 | * @kobj: object we're acting for. |
| 85 | * @name: name of the symlink to remove. | 110 | * @name: name of the symlink to remove. |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index ce4e15f8aaeb..a5db496f71c7 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
| @@ -107,6 +107,7 @@ struct sysfs_dirent *sysfs_get_active_two(struct sysfs_dirent *sd); | |||
| 107 | void sysfs_put_active_two(struct sysfs_dirent *sd); | 107 | void sysfs_put_active_two(struct sysfs_dirent *sd); |
| 108 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | 108 | void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, |
| 109 | struct sysfs_dirent *parent_sd); | 109 | struct sysfs_dirent *parent_sd); |
| 110 | int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | ||
| 110 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | 111 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); |
| 111 | void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); | 112 | void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); |
| 112 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); | 113 | void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt); |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index 32755cdf68db..e1a6c046cea3 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
| @@ -44,6 +44,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
| 44 | const char *dest); | 44 | const char *dest); |
| 45 | 45 | ||
| 46 | void debugfs_remove(struct dentry *dentry); | 46 | void debugfs_remove(struct dentry *dentry); |
| 47 | void debugfs_remove_recursive(struct dentry *dentry); | ||
| 47 | 48 | ||
| 48 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | 49 | struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
| 49 | struct dentry *new_dir, const char *new_name); | 50 | struct dentry *new_dir, const char *new_name); |
| @@ -101,6 +102,9 @@ static inline struct dentry *debugfs_create_symlink(const char *name, | |||
| 101 | static inline void debugfs_remove(struct dentry *dentry) | 102 | static inline void debugfs_remove(struct dentry *dentry) |
| 102 | { } | 103 | { } |
| 103 | 104 | ||
| 105 | static inline void debugfs_remove_recursive(struct dentry *dentry) | ||
| 106 | { } | ||
| 107 | |||
| 104 | static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | 108 | static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, |
| 105 | struct dentry *new_dir, char *new_name) | 109 | struct dentry *new_dir, char *new_name) |
| 106 | { | 110 | { |
diff --git a/include/linux/device.h b/include/linux/device.h index f71a78d123ae..d24a47f80f9c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
| 17 | #include <linux/klist.h> | 17 | #include <linux/klist.h> |
| 18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
| 19 | #include <linux/lockdep.h> | ||
| 19 | #include <linux/compiler.h> | 20 | #include <linux/compiler.h> |
| 20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| @@ -24,17 +25,13 @@ | |||
| 24 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
| 25 | #include <asm/device.h> | 26 | #include <asm/device.h> |
| 26 | 27 | ||
| 27 | #define DEVICE_NAME_SIZE 50 | 28 | #define BUS_ID_SIZE 20 |
| 28 | /* DEVICE_NAME_HALF is really less than half to accommodate slop */ | ||
| 29 | #define DEVICE_NAME_HALF __stringify(20) | ||
| 30 | #define DEVICE_ID_SIZE 32 | ||
| 31 | #define BUS_ID_SIZE KOBJ_NAME_LEN | ||
| 32 | |||
| 33 | 29 | ||
| 34 | struct device; | 30 | struct device; |
| 35 | struct device_driver; | 31 | struct device_driver; |
| 36 | struct driver_private; | 32 | struct driver_private; |
| 37 | struct class; | 33 | struct class; |
| 34 | struct class_private; | ||
| 38 | struct bus_type; | 35 | struct bus_type; |
| 39 | struct bus_type_private; | 36 | struct bus_type_private; |
| 40 | 37 | ||
| @@ -186,13 +183,9 @@ struct class { | |||
| 186 | const char *name; | 183 | const char *name; |
| 187 | struct module *owner; | 184 | struct module *owner; |
| 188 | 185 | ||
| 189 | struct kset subsys; | ||
| 190 | struct list_head devices; | ||
| 191 | struct list_head interfaces; | ||
| 192 | struct kset class_dirs; | ||
| 193 | struct semaphore sem; /* locks children, devices, interfaces */ | ||
| 194 | struct class_attribute *class_attrs; | 186 | struct class_attribute *class_attrs; |
| 195 | struct device_attribute *dev_attrs; | 187 | struct device_attribute *dev_attrs; |
| 188 | struct kobject *dev_kobj; | ||
| 196 | 189 | ||
| 197 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 190 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
| 198 | 191 | ||
| @@ -203,13 +196,28 @@ struct class { | |||
| 203 | int (*resume)(struct device *dev); | 196 | int (*resume)(struct device *dev); |
| 204 | 197 | ||
| 205 | struct pm_ops *pm; | 198 | struct pm_ops *pm; |
| 199 | struct class_private *p; | ||
| 206 | }; | 200 | }; |
| 207 | 201 | ||
| 208 | extern int __must_check class_register(struct class *class); | 202 | extern struct kobject *sysfs_dev_block_kobj; |
| 203 | extern struct kobject *sysfs_dev_char_kobj; | ||
| 204 | extern int __must_check __class_register(struct class *class, | ||
| 205 | struct lock_class_key *key); | ||
| 209 | extern void class_unregister(struct class *class); | 206 | extern void class_unregister(struct class *class); |
| 210 | extern int class_for_each_device(struct class *class, void *data, | 207 | |
| 208 | /* This is a #define to keep the compiler from merging different | ||
| 209 | * instances of the __key variable */ | ||
| 210 | #define class_register(class) \ | ||
| 211 | ({ \ | ||
| 212 | static struct lock_class_key __key; \ | ||
| 213 | __class_register(class, &__key); \ | ||
| 214 | }) | ||
| 215 | |||
| 216 | extern int class_for_each_device(struct class *class, struct device *start, | ||
| 217 | void *data, | ||
| 211 | int (*fn)(struct device *dev, void *data)); | 218 | int (*fn)(struct device *dev, void *data)); |
| 212 | extern struct device *class_find_device(struct class *class, void *data, | 219 | extern struct device *class_find_device(struct class *class, |
| 220 | struct device *start, void *data, | ||
| 213 | int (*match)(struct device *, void *)); | 221 | int (*match)(struct device *, void *)); |
| 214 | 222 | ||
| 215 | struct class_attribute { | 223 | struct class_attribute { |
| @@ -237,9 +245,19 @@ struct class_interface { | |||
| 237 | extern int __must_check class_interface_register(struct class_interface *); | 245 | extern int __must_check class_interface_register(struct class_interface *); |
| 238 | extern void class_interface_unregister(struct class_interface *); | 246 | extern void class_interface_unregister(struct class_interface *); |
| 239 | 247 | ||
| 240 | extern struct class *class_create(struct module *owner, const char *name); | 248 | extern struct class * __must_check __class_create(struct module *owner, |
| 249 | const char *name, | ||
| 250 | struct lock_class_key *key); | ||
| 241 | extern void class_destroy(struct class *cls); | 251 | extern void class_destroy(struct class *cls); |
| 242 | 252 | ||
| 253 | /* This is a #define to keep the compiler from merging different | ||
| 254 | * instances of the __key variable */ | ||
| 255 | #define class_create(owner, name) \ | ||
| 256 | ({ \ | ||
| 257 | static struct lock_class_key __key; \ | ||
| 258 | __class_create(owner, name, &__key); \ | ||
| 259 | }) | ||
| 260 | |||
| 243 | /* | 261 | /* |
| 244 | * The type of device, "struct device" is embedded in. A class | 262 | * The type of device, "struct device" is embedded in. A class |
| 245 | * or bus can contain devices of different types | 263 | * or bus can contain devices of different types |
| @@ -468,14 +486,10 @@ extern struct device *device_create_vargs(struct class *cls, | |||
| 468 | const char *fmt, | 486 | const char *fmt, |
| 469 | va_list vargs); | 487 | va_list vargs); |
| 470 | extern struct device *device_create(struct class *cls, struct device *parent, | 488 | extern struct device *device_create(struct class *cls, struct device *parent, |
| 471 | dev_t devt, const char *fmt, ...) | 489 | dev_t devt, void *drvdata, |
| 472 | __attribute__((format(printf, 4, 5))); | 490 | const char *fmt, ...) |
| 473 | extern struct device *device_create_drvdata(struct class *cls, | ||
| 474 | struct device *parent, | ||
| 475 | dev_t devt, | ||
| 476 | void *drvdata, | ||
| 477 | const char *fmt, ...) | ||
| 478 | __attribute__((format(printf, 5, 6))); | 491 | __attribute__((format(printf, 5, 6))); |
| 492 | #define device_create_drvdata device_create | ||
| 479 | extern void device_destroy(struct class *cls, dev_t devt); | 493 | extern void device_destroy(struct class *cls, dev_t devt); |
| 480 | 494 | ||
| 481 | /* | 495 | /* |
diff --git a/include/linux/eisa.h b/include/linux/eisa.h index fe806b6f030d..e61c0be2a459 100644 --- a/include/linux/eisa.h +++ b/include/linux/eisa.h | |||
| @@ -40,7 +40,7 @@ struct eisa_device { | |||
| 40 | u64 dma_mask; | 40 | u64 dma_mask; |
| 41 | struct device dev; /* generic device */ | 41 | struct device dev; /* generic device */ |
| 42 | #ifdef CONFIG_EISA_NAMES | 42 | #ifdef CONFIG_EISA_NAMES |
| 43 | char pretty_name[DEVICE_NAME_SIZE]; | 43 | char pretty_name[50]; |
| 44 | #endif | 44 | #endif |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 39e709f88aa0..60f0d418ae32 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
| 27 | #include <asm/atomic.h> | 27 | #include <asm/atomic.h> |
| 28 | 28 | ||
| 29 | #define KOBJ_NAME_LEN 20 | ||
| 30 | #define UEVENT_HELPER_PATH_LEN 256 | 29 | #define UEVENT_HELPER_PATH_LEN 256 |
| 31 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ | 30 | #define UEVENT_NUM_ENVP 32 /* number of env pointers */ |
| 32 | #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ | 31 | #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ |
| @@ -59,12 +58,12 @@ enum kobject_action { | |||
| 59 | 58 | ||
| 60 | struct kobject { | 59 | struct kobject { |
| 61 | const char *name; | 60 | const char *name; |
| 62 | struct kref kref; | ||
| 63 | struct list_head entry; | 61 | struct list_head entry; |
| 64 | struct kobject *parent; | 62 | struct kobject *parent; |
| 65 | struct kset *kset; | 63 | struct kset *kset; |
| 66 | struct kobj_type *ktype; | 64 | struct kobj_type *ktype; |
| 67 | struct sysfs_dirent *sd; | 65 | struct sysfs_dirent *sd; |
| 66 | struct kref kref; | ||
| 68 | unsigned int state_initialized:1; | 67 | unsigned int state_initialized:1; |
| 69 | unsigned int state_in_sysfs:1; | 68 | unsigned int state_in_sysfs:1; |
| 70 | unsigned int state_add_uevent_sent:1; | 69 | unsigned int state_add_uevent_sent:1; |
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index a9fae032ba81..9c1d95491f8b 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
| @@ -189,7 +189,7 @@ typedef union { | |||
| 189 | */ | 189 | */ |
| 190 | 190 | ||
| 191 | struct map_info { | 191 | struct map_info { |
| 192 | char *name; | 192 | const char *name; |
| 193 | unsigned long size; | 193 | unsigned long size; |
| 194 | resource_size_t phys; | 194 | resource_size_t phys; |
| 195 | #define NO_XIP (-1UL) | 195 | #define NO_XIP (-1UL) |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 245f9098e171..8b5d49133ec6 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -121,7 +121,7 @@ struct mtd_info { | |||
| 121 | u_int32_t oobavail; // Available OOB bytes per block | 121 | u_int32_t oobavail; // Available OOB bytes per block |
| 122 | 122 | ||
| 123 | // Kernel-only stuff starts here. | 123 | // Kernel-only stuff starts here. |
| 124 | char *name; | 124 | const char *name; |
| 125 | int index; | 125 | int index; |
| 126 | 126 | ||
| 127 | /* ecc layout structure pointer - read only ! */ | 127 | /* ecc layout structure pointer - read only ! */ |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 387e428f1cdf..b9a76c972084 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -733,7 +733,7 @@ struct spi_board_info { | |||
| 733 | * controller_data goes to spi_device.controller_data, | 733 | * controller_data goes to spi_device.controller_data, |
| 734 | * irq is copied too | 734 | * irq is copied too |
| 735 | */ | 735 | */ |
| 736 | char modalias[KOBJ_NAME_LEN]; | 736 | char modalias[32]; |
| 737 | const void *platform_data; | 737 | const void *platform_data; |
| 738 | void *controller_data; | 738 | void *controller_data; |
| 739 | int irq; | 739 | int irq; |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index f2767bc6b735..f395bb3fa2f2 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *); | |||
| 99 | 99 | ||
| 100 | struct sysdev_attribute { | 100 | struct sysdev_attribute { |
| 101 | struct attribute attr; | 101 | struct attribute attr; |
| 102 | ssize_t (*show)(struct sys_device *, char *); | 102 | ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); |
| 103 | ssize_t (*store)(struct sys_device *, const char *, size_t); | 103 | ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, |
| 104 | const char *, size_t); | ||
| 104 | }; | 105 | }; |
| 105 | 106 | ||
| 106 | 107 | ||
| @@ -118,4 +119,38 @@ struct sysdev_attribute { | |||
| 118 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
| 119 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
| 120 | 121 | ||
| 122 | struct sysdev_ext_attribute { | ||
| 123 | struct sysdev_attribute attr; | ||
| 124 | void *var; | ||
| 125 | }; | ||
| 126 | |||
| 127 | /* | ||
| 128 | * Support for simple variable sysdev attributes. | ||
| 129 | * The pointer to the variable is stored in a sysdev_ext_attribute | ||
| 130 | */ | ||
| 131 | |||
| 132 | /* Add more types as needed */ | ||
| 133 | |||
| 134 | extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, | ||
| 135 | char *); | ||
| 136 | extern ssize_t sysdev_store_ulong(struct sys_device *, | ||
| 137 | struct sysdev_attribute *, const char *, size_t); | ||
| 138 | extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, | ||
| 139 | char *); | ||
| 140 | extern ssize_t sysdev_store_int(struct sys_device *, | ||
| 141 | struct sysdev_attribute *, const char *, size_t); | ||
| 142 | |||
| 143 | #define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
| 144 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ | ||
| 145 | &(_var) } | ||
| 146 | #define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
| 147 | struct sysdev_ext_attribute attr_##_name = \ | ||
| 148 | _SYSDEV_ULONG_ATTR(_name, _mode, _var); | ||
| 149 | #define _SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
| 150 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ | ||
| 151 | &(_var) } | ||
| 152 | #define SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
| 153 | struct sysdev_ext_attribute attr_##_name = \ | ||
| 154 | _SYSDEV_INT_ATTR(_name, _mode, _var); | ||
| 155 | |||
| 121 | #endif /* _SYSDEV_H_ */ | 156 | #endif /* _SYSDEV_H_ */ |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 7858eac40aa7..37fa24152bd8 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -101,6 +101,9 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | |||
| 101 | 101 | ||
| 102 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 102 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
| 103 | const char *name); | 103 | const char *name); |
| 104 | int __must_check sysfs_create_link_nowarn(struct kobject *kobj, | ||
| 105 | struct kobject *target, | ||
| 106 | const char *name); | ||
| 104 | void sysfs_remove_link(struct kobject *kobj, const char *name); | 107 | void sysfs_remove_link(struct kobject *kobj, const char *name); |
| 105 | 108 | ||
| 106 | int __must_check sysfs_create_group(struct kobject *kobj, | 109 | int __must_check sysfs_create_group(struct kobject *kobj, |
| @@ -180,6 +183,13 @@ static inline int sysfs_create_link(struct kobject *kobj, | |||
| 180 | return 0; | 183 | return 0; |
| 181 | } | 184 | } |
| 182 | 185 | ||
| 186 | static inline int sysfs_create_link_nowarn(struct kobject *kobj, | ||
| 187 | struct kobject *target, | ||
| 188 | const char *name) | ||
| 189 | { | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 183 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) | 193 | static inline void sysfs_remove_link(struct kobject *kobj, const char *name) |
| 184 | { | 194 | { |
| 185 | } | 195 | } |
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 973386d439da..cdf338d94b7f 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
| @@ -36,7 +36,7 @@ struct uio_mem { | |||
| 36 | struct uio_map *map; | 36 | struct uio_map *map; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | #define MAX_UIO_MAPS 5 | 39 | #define MAX_UIO_MAPS 5 |
| 40 | 40 | ||
| 41 | struct uio_device; | 41 | struct uio_device; |
| 42 | 42 | ||
| @@ -53,6 +53,7 @@ struct uio_device; | |||
| 53 | * @mmap: mmap operation for this uio device | 53 | * @mmap: mmap operation for this uio device |
| 54 | * @open: open operation for this uio device | 54 | * @open: open operation for this uio device |
| 55 | * @release: release operation for this uio device | 55 | * @release: release operation for this uio device |
| 56 | * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX | ||
| 56 | */ | 57 | */ |
| 57 | struct uio_info { | 58 | struct uio_info { |
| 58 | struct uio_device *uio_dev; | 59 | struct uio_device *uio_dev; |
| @@ -66,6 +67,7 @@ struct uio_info { | |||
| 66 | int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); | 67 | int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); |
| 67 | int (*open)(struct uio_info *info, struct inode *inode); | 68 | int (*open)(struct uio_info *info, struct inode *inode); |
| 68 | int (*release)(struct uio_info *info, struct inode *inode); | 69 | int (*release)(struct uio_info *info, struct inode *inode); |
| 70 | int (*irqcontrol)(struct uio_info *info, s32 irq_on); | ||
| 69 | }; | 71 | }; |
| 70 | 72 | ||
| 71 | extern int __must_check | 73 | extern int __must_check |
| @@ -80,11 +82,11 @@ static inline int __must_check | |||
| 80 | extern void uio_unregister_device(struct uio_info *info); | 82 | extern void uio_unregister_device(struct uio_info *info); |
| 81 | extern void uio_event_notify(struct uio_info *info); | 83 | extern void uio_event_notify(struct uio_info *info); |
| 82 | 84 | ||
| 83 | /* defines for uio_device->irq */ | 85 | /* defines for uio_info->irq */ |
| 84 | #define UIO_IRQ_CUSTOM -1 | 86 | #define UIO_IRQ_CUSTOM -1 |
| 85 | #define UIO_IRQ_NONE -2 | 87 | #define UIO_IRQ_NONE -2 |
| 86 | 88 | ||
| 87 | /* defines for uio_device->memtype */ | 89 | /* defines for uio_mem->memtype */ |
| 88 | #define UIO_MEM_NONE 0 | 90 | #define UIO_MEM_NONE 0 |
| 89 | #define UIO_MEM_PHYS 1 | 91 | #define UIO_MEM_PHYS 1 |
| 90 | #define UIO_MEM_LOGICAL 2 | 92 | #define UIO_MEM_LOGICAL 2 |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 1834fdfe82a7..a594bac4a77d 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
| @@ -623,7 +623,7 @@ struct Scsi_Host { | |||
| 623 | /* | 623 | /* |
| 624 | * Optional work queue to be utilized by the transport | 624 | * Optional work queue to be utilized by the transport |
| 625 | */ | 625 | */ |
| 626 | char work_q_name[KOBJ_NAME_LEN]; | 626 | char work_q_name[20]; |
| 627 | struct workqueue_struct *work_q; | 627 | struct workqueue_struct *work_q; |
| 628 | 628 | ||
| 629 | /* | 629 | /* |
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 06f72bab9df0..878373c32ef7 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
| @@ -489,9 +489,9 @@ struct fc_host_attrs { | |||
| 489 | u16 npiv_vports_inuse; | 489 | u16 npiv_vports_inuse; |
| 490 | 490 | ||
| 491 | /* work queues for rport state manipulation */ | 491 | /* work queues for rport state manipulation */ |
| 492 | char work_q_name[KOBJ_NAME_LEN]; | 492 | char work_q_name[20]; |
| 493 | struct workqueue_struct *work_q; | 493 | struct workqueue_struct *work_q; |
| 494 | char devloss_work_q_name[KOBJ_NAME_LEN]; | 494 | char devloss_work_q_name[20]; |
| 495 | struct workqueue_struct *devloss_work_q; | 495 | struct workqueue_struct *devloss_work_q; |
| 496 | }; | 496 | }; |
| 497 | 497 | ||
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index f5444e033cc9..8b6c91df4c7a 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
| @@ -198,7 +198,7 @@ struct iscsi_cls_host { | |||
| 198 | atomic_t nr_scans; | 198 | atomic_t nr_scans; |
| 199 | struct mutex mutex; | 199 | struct mutex mutex; |
| 200 | struct workqueue_struct *scan_workq; | 200 | struct workqueue_struct *scan_workq; |
| 201 | char scan_workq_name[KOBJ_NAME_LEN]; | 201 | char scan_workq_name[20]; |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
| 204 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, | 204 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, |
diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c index 092e4c620af9..a56f629b057a 100644 --- a/kernel/rtmutex-tester.c +++ b/kernel/rtmutex-tester.c | |||
| @@ -297,8 +297,8 @@ static int test_func(void *data) | |||
| 297 | * | 297 | * |
| 298 | * opcode:data | 298 | * opcode:data |
| 299 | */ | 299 | */ |
| 300 | static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | 300 | static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribute *attr, |
| 301 | size_t count) | 301 | const char *buf, size_t count) |
| 302 | { | 302 | { |
| 303 | struct sched_param schedpar; | 303 | struct sched_param schedpar; |
| 304 | struct test_thread_data *td; | 304 | struct test_thread_data *td; |
| @@ -360,7 +360,8 @@ static ssize_t sysfs_test_command(struct sys_device *dev, const char *buf, | |||
| 360 | * @dev: thread to query | 360 | * @dev: thread to query |
| 361 | * @buf: char buffer to be filled with thread status info | 361 | * @buf: char buffer to be filled with thread status info |
| 362 | */ | 362 | */ |
| 363 | static ssize_t sysfs_test_status(struct sys_device *dev, char *buf) | 363 | static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute *attr, |
| 364 | char *buf) | ||
| 364 | { | 365 | { |
| 365 | struct test_thread_data *td; | 366 | struct test_thread_data *td; |
| 366 | struct task_struct *tsk; | 367 | struct task_struct *tsk; |
diff --git a/kernel/sched.c b/kernel/sched.c index 99e6d850ecab..b1104ea5d255 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -7737,11 +7737,13 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt) | |||
| 7737 | } | 7737 | } |
| 7738 | 7738 | ||
| 7739 | #ifdef CONFIG_SCHED_MC | 7739 | #ifdef CONFIG_SCHED_MC |
| 7740 | static ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page) | 7740 | static ssize_t sched_mc_power_savings_show(struct sys_device *dev, |
| 7741 | struct sysdev_attribute *attr, char *page) | ||
| 7741 | { | 7742 | { |
| 7742 | return sprintf(page, "%u\n", sched_mc_power_savings); | 7743 | return sprintf(page, "%u\n", sched_mc_power_savings); |
| 7743 | } | 7744 | } |
| 7744 | static ssize_t sched_mc_power_savings_store(struct sys_device *dev, | 7745 | static ssize_t sched_mc_power_savings_store(struct sys_device *dev, |
| 7746 | struct sysdev_attribute *attr, | ||
| 7745 | const char *buf, size_t count) | 7747 | const char *buf, size_t count) |
| 7746 | { | 7748 | { |
| 7747 | return sched_power_savings_store(buf, count, 0); | 7749 | return sched_power_savings_store(buf, count, 0); |
| @@ -7751,11 +7753,13 @@ static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show, | |||
| 7751 | #endif | 7753 | #endif |
| 7752 | 7754 | ||
| 7753 | #ifdef CONFIG_SCHED_SMT | 7755 | #ifdef CONFIG_SCHED_SMT |
| 7754 | static ssize_t sched_smt_power_savings_show(struct sys_device *dev, char *page) | 7756 | static ssize_t sched_smt_power_savings_show(struct sys_device *dev, |
| 7757 | struct sysdev_attribute *attr, char *page) | ||
| 7755 | { | 7758 | { |
| 7756 | return sprintf(page, "%u\n", sched_smt_power_savings); | 7759 | return sprintf(page, "%u\n", sched_smt_power_savings); |
| 7757 | } | 7760 | } |
| 7758 | static ssize_t sched_smt_power_savings_store(struct sys_device *dev, | 7761 | static ssize_t sched_smt_power_savings_store(struct sys_device *dev, |
| 7762 | struct sysdev_attribute *attr, | ||
| 7759 | const char *buf, size_t count) | 7763 | const char *buf, size_t count) |
| 7760 | { | 7764 | { |
| 7761 | return sched_power_savings_store(buf, count, 1); | 7765 | return sched_power_savings_store(buf, count, 1); |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index dadde5361f32..b1c2da81b050 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -376,7 +376,8 @@ void clocksource_unregister(struct clocksource *cs) | |||
| 376 | * Provides sysfs interface for listing current clocksource. | 376 | * Provides sysfs interface for listing current clocksource. |
| 377 | */ | 377 | */ |
| 378 | static ssize_t | 378 | static ssize_t |
| 379 | sysfs_show_current_clocksources(struct sys_device *dev, char *buf) | 379 | sysfs_show_current_clocksources(struct sys_device *dev, |
| 380 | struct sysdev_attribute *attr, char *buf) | ||
| 380 | { | 381 | { |
| 381 | ssize_t count = 0; | 382 | ssize_t count = 0; |
| 382 | 383 | ||
| @@ -397,6 +398,7 @@ sysfs_show_current_clocksources(struct sys_device *dev, char *buf) | |||
| 397 | * clocksource selction. | 398 | * clocksource selction. |
| 398 | */ | 399 | */ |
| 399 | static ssize_t sysfs_override_clocksource(struct sys_device *dev, | 400 | static ssize_t sysfs_override_clocksource(struct sys_device *dev, |
| 401 | struct sysdev_attribute *attr, | ||
| 400 | const char *buf, size_t count) | 402 | const char *buf, size_t count) |
| 401 | { | 403 | { |
| 402 | struct clocksource *ovr = NULL; | 404 | struct clocksource *ovr = NULL; |
| @@ -449,7 +451,9 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, | |||
| 449 | * Provides sysfs interface for listing registered clocksources | 451 | * Provides sysfs interface for listing registered clocksources |
| 450 | */ | 452 | */ |
| 451 | static ssize_t | 453 | static ssize_t |
| 452 | sysfs_show_available_clocksources(struct sys_device *dev, char *buf) | 454 | sysfs_show_available_clocksources(struct sys_device *dev, |
| 455 | struct sysdev_attribute *attr, | ||
| 456 | char *buf) | ||
| 453 | { | 457 | { |
| 454 | struct clocksource *src; | 458 | struct clocksource *src; |
| 455 | ssize_t count = 0; | 459 | ssize_t count = 0; |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index df27132a56f4..ba106db5a65b 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -74,6 +74,9 @@ config DEBUG_FS | |||
| 74 | debugging files into. Enable this option to be able to read and | 74 | debugging files into. Enable this option to be able to read and |
| 75 | write to these files. | 75 | write to these files. |
| 76 | 76 | ||
| 77 | For detailed documentation on the debugfs API, see | ||
| 78 | Documentation/DocBook/filesystems. | ||
| 79 | |||
| 77 | If unsure, say N. | 80 | If unsure, say N. |
| 78 | 81 | ||
| 79 | config HEADERS_CHECK | 82 | config HEADERS_CHECK |
diff --git a/lib/kobject.c b/lib/kobject.c index dcade0543bd2..744401571ed7 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -216,13 +216,19 @@ static int kobject_add_internal(struct kobject *kobj) | |||
| 216 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, | 216 | static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, |
| 217 | va_list vargs) | 217 | va_list vargs) |
| 218 | { | 218 | { |
| 219 | /* Free the old name, if necessary. */ | 219 | const char *old_name = kobj->name; |
| 220 | kfree(kobj->name); | 220 | char *s; |
| 221 | 221 | ||
| 222 | kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); | 222 | kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); |
| 223 | if (!kobj->name) | 223 | if (!kobj->name) |
| 224 | return -ENOMEM; | 224 | return -ENOMEM; |
| 225 | 225 | ||
| 226 | /* ewww... some of these buggers have '/' in the name ... */ | ||
| 227 | s = strchr(kobj->name, '/'); | ||
| 228 | if (s) | ||
| 229 | s[0] = '!'; | ||
| 230 | |||
| 231 | kfree(old_name); | ||
| 226 | return 0; | 232 | return 0; |
| 227 | } | 233 | } |
| 228 | 234 | ||
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 2fa545a63160..9f8d599459d1 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
| @@ -245,7 +245,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
| 245 | if (retval) | 245 | if (retval) |
| 246 | goto exit; | 246 | goto exit; |
| 247 | 247 | ||
| 248 | call_usermodehelper(argv[0], argv, env->envp, UMH_WAIT_EXEC); | 248 | retval = call_usermodehelper(argv[0], argv, |
| 249 | env->envp, UMH_WAIT_EXEC); | ||
| 249 | } | 250 | } |
| 250 | 251 | ||
| 251 | exit: | 252 | exit: |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 844ca5f1b2d4..c85bf8f678dc 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
| @@ -398,10 +398,6 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
| 398 | if (device_create_file(dev, bt_attrs[i]) < 0) | 398 | if (device_create_file(dev, bt_attrs[i]) < 0) |
| 399 | BT_ERR("Failed to create device attribute"); | 399 | BT_ERR("Failed to create device attribute"); |
| 400 | 400 | ||
| 401 | if (sysfs_create_link(&bt_class->subsys.kobj, | ||
| 402 | &dev->kobj, kobject_name(&dev->kobj)) < 0) | ||
| 403 | BT_ERR("Failed to create class symlink"); | ||
| 404 | |||
| 405 | return 0; | 401 | return 0; |
| 406 | } | 402 | } |
| 407 | 403 | ||
| @@ -409,9 +405,6 @@ void hci_unregister_sysfs(struct hci_dev *hdev) | |||
| 409 | { | 405 | { |
| 410 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); | 406 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); |
| 411 | 407 | ||
| 412 | sysfs_remove_link(&bt_class->subsys.kobj, | ||
| 413 | kobject_name(&hdev->dev.kobj)); | ||
| 414 | |||
| 415 | device_del(&hdev->dev); | 408 | device_del(&hdev->dev); |
| 416 | } | 409 | } |
| 417 | 410 | ||
diff --git a/samples/firmware_class/firmware_sample_firmware_class.c b/samples/firmware_class/firmware_sample_firmware_class.c index 9392116e47b0..e6cf7a43a297 100644 --- a/samples/firmware_class/firmware_sample_firmware_class.c +++ b/samples/firmware_class/firmware_sample_firmware_class.c | |||
| @@ -124,7 +124,7 @@ static int fw_setup_class_device(struct class_device *class_dev, | |||
| 124 | class_dev->class_id[BUS_ID_SIZE-1] = '\0'; | 124 | class_dev->class_id[BUS_ID_SIZE-1] = '\0'; |
| 125 | class_dev->dev = device; | 125 | class_dev->dev = device; |
| 126 | 126 | ||
| 127 | class_dev->class = &firmware_class, | 127 | class_dev->class = &firmware_class; |
| 128 | class_set_devdata(class_dev, fw_priv); | 128 | class_set_devdata(class_dev, fw_priv); |
| 129 | retval = class_device_register(class_dev); | 129 | retval = class_device_register(class_dev); |
| 130 | if (retval) { | 130 | if (retval) { |
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index b0a1b4fe6584..7395c0bbae18 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c | |||
| @@ -211,7 +211,7 @@ static struct foo_obj *create_foo_obj(const char *name) | |||
| 211 | */ | 211 | */ |
| 212 | retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name); | 212 | retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name); |
| 213 | if (retval) { | 213 | if (retval) { |
| 214 | kfree(foo); | 214 | kobject_put(&foo->kobj); |
| 215 | return NULL; | 215 | return NULL; |
| 216 | } | 216 | } |
| 217 | 217 | ||
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 37d5c363fbcd..1fcaf3284a6a 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -340,11 +340,18 @@ static int do_acpi_entry(const char *filename, | |||
| 340 | } | 340 | } |
| 341 | 341 | ||
| 342 | /* looks like: "pnp:dD" */ | 342 | /* looks like: "pnp:dD" */ |
| 343 | static int do_pnp_entry(const char *filename, | 343 | static void do_pnp_device_entry(void *symval, unsigned long size, |
| 344 | struct pnp_device_id *id, char *alias) | 344 | struct module *mod) |
| 345 | { | 345 | { |
| 346 | sprintf(alias, "pnp:d%s*", id->id); | 346 | const unsigned long id_size = sizeof(struct pnp_device_id); |
| 347 | return 1; | 347 | const struct pnp_device_id *id = symval; |
| 348 | |||
| 349 | device_id_check(mod->name, "pnp", size, id_size, symval); | ||
| 350 | |||
| 351 | buf_printf(&mod->dev_table_buf, | ||
| 352 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id->id); | ||
| 353 | buf_printf(&mod->dev_table_buf, | ||
| 354 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id->id); | ||
| 348 | } | 355 | } |
| 349 | 356 | ||
| 350 | /* looks like: "pnp:dD" for every device of the card */ | 357 | /* looks like: "pnp:dD" for every device of the card */ |
| @@ -388,9 +395,12 @@ static void do_pnp_card_entries(void *symval, unsigned long size, | |||
| 388 | } | 395 | } |
| 389 | 396 | ||
| 390 | /* add an individual alias for every device entry */ | 397 | /* add an individual alias for every device entry */ |
| 391 | if (!dup) | 398 | if (!dup) { |
| 392 | buf_printf(&mod->dev_table_buf, | 399 | buf_printf(&mod->dev_table_buf, |
| 393 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); | 400 | "MODULE_ALIAS(\"pnp:d%s*\");\n", id); |
| 401 | buf_printf(&mod->dev_table_buf, | ||
| 402 | "MODULE_ALIAS(\"acpi*:%s:*\");\n", id); | ||
| 403 | } | ||
| 394 | } | 404 | } |
| 395 | } | 405 | } |
| 396 | } | 406 | } |
| @@ -701,9 +711,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 701 | sizeof(struct acpi_device_id), "acpi", | 711 | sizeof(struct acpi_device_id), "acpi", |
| 702 | do_acpi_entry, mod); | 712 | do_acpi_entry, mod); |
| 703 | else if (sym_is(symname, "__mod_pnp_device_table")) | 713 | else if (sym_is(symname, "__mod_pnp_device_table")) |
| 704 | do_table(symval, sym->st_size, | 714 | do_pnp_device_entry(symval, sym->st_size, mod); |
| 705 | sizeof(struct pnp_device_id), "pnp", | ||
| 706 | do_pnp_entry, mod); | ||
| 707 | else if (sym_is(symname, "__mod_pnp_card_device_table")) | 715 | else if (sym_is(symname, "__mod_pnp_card_device_table")) |
| 708 | do_pnp_card_entries(symval, sym->st_size, mod); | 716 | do_pnp_card_entries(symval, sym->st_size, mod); |
| 709 | else if (sym_is(symname, "__mod_pcmcia_device_table")) | 717 | else if (sym_is(symname, "__mod_pcmcia_device_table")) |
diff --git a/sound/core/init.c b/sound/core/init.c index 5c254d498ae0..df46bbc25dc2 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
| @@ -548,8 +548,9 @@ int snd_card_register(struct snd_card *card) | |||
| 548 | snd_assert(card != NULL, return -EINVAL); | 548 | snd_assert(card != NULL, return -EINVAL); |
| 549 | #ifndef CONFIG_SYSFS_DEPRECATED | 549 | #ifndef CONFIG_SYSFS_DEPRECATED |
| 550 | if (!card->card_dev) { | 550 | if (!card->card_dev) { |
| 551 | card->card_dev = device_create(sound_class, card->dev, 0, | 551 | card->card_dev = device_create_drvdata(sound_class, card->dev, |
| 552 | "card%i", card->number); | 552 | MKDEV(0, 0), NULL, |
| 553 | "card%i", card->number); | ||
| 553 | if (IS_ERR(card->card_dev)) | 554 | if (IS_ERR(card->card_dev)) |
| 554 | card->card_dev = NULL; | 555 | card->card_dev = NULL; |
| 555 | } | 556 | } |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index a9c23b2502ad..7d89c081a086 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
| @@ -560,17 +560,19 @@ static int __init oss_init(void) | |||
| 560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); | 560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); |
| 561 | 561 | ||
| 562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { | 562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { |
| 563 | device_create(sound_class, NULL, | 563 | device_create_drvdata(sound_class, NULL, |
| 564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), |
| 565 | "%s", dev_list[i].name); | 565 | NULL, "%s", dev_list[i].name); |
| 566 | 566 | ||
| 567 | if (!dev_list[i].num) | 567 | if (!dev_list[i].num) |
| 568 | continue; | 568 | continue; |
| 569 | 569 | ||
| 570 | for (j = 1; j < *dev_list[i].num; j++) | 570 | for (j = 1; j < *dev_list[i].num; j++) |
| 571 | device_create(sound_class, NULL, | 571 | device_create_drvdata(sound_class, NULL, |
| 572 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), | 572 | MKDEV(SOUND_MAJOR, |
| 573 | "%s%d", dev_list[i].name, j); | 573 | dev_list[i].minor + (j*0x10)), |
| 574 | NULL, | ||
| 575 | "%s%d", dev_list[i].name, j); | ||
| 574 | } | 576 | } |
| 575 | 577 | ||
| 576 | if (sound_nblocks >= 1024) | 578 | if (sound_nblocks >= 1024) |
diff --git a/sound/sound_core.c b/sound/sound_core.c index dcfc1d5ce631..1b04259a4328 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
| @@ -171,8 +171,9 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati | |||
| 171 | else | 171 | else |
| 172 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); | 172 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); |
| 173 | 173 | ||
| 174 | device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor), | 174 | device_create_drvdata(sound_class, dev, |
| 175 | s->name+6); | 175 | MKDEV(SOUND_MAJOR, s->unit_minor), |
| 176 | NULL, s->name+6); | ||
| 176 | return r; | 177 | return r; |
| 177 | 178 | ||
| 178 | fail: | 179 | fail: |
