diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 16:40:20 -0400 |
commit | dc690d8ef842b464f1c429a376ca16cb8dbee6ae (patch) | |
tree | 77955849af5a15755f5e55e24ae4b9c520583a72 /drivers | |
parent | 57399ec9077a4b962b81037aaa279fab52f5e989 (diff) | |
parent | 91a6902958f052358899f58683d44e36228d85c2 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (61 commits)
sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes
sysfs: make directory dentries and inodes reclaimable
sysfs: implement sysfs_get_dentry()
sysfs: move sysfs_drop_dentry() to dir.c and make it static
sysfs: restructure add/remove paths and fix inode update
sysfs: use sysfs_mutex to protect the sysfs_dirent tree
sysfs: consolidate sysfs spinlocks
sysfs: make kobj point to sysfs_dirent instead of dentry
sysfs: implement sysfs_find_dirent() and sysfs_get_dirent()
sysfs: implement SYSFS_FLAG_REMOVED flag
sysfs: rename sysfs_dirent->s_type to s_flags and make room for flags
sysfs: make sysfs_drop_dentry() access inodes using ilookup()
sysfs: Fix oops in sysfs_drop_dentry on x86_64
sysfs: use singly-linked list for sysfs_dirent tree
sysfs: slim down sysfs_dirent->s_active
sysfs: move s_active functions to fs/sysfs/dir.c
sysfs: fix root sysfs_dirent -> root dentry association
sysfs: use iget_locked() instead of new_inode()
sysfs: reorganize sysfs_new_indoe() and sysfs_create()
sysfs: fix parent refcounting during rename and move
...
Diffstat (limited to 'drivers')
60 files changed, 665 insertions, 389 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 1ec0654665cf..7370d7cf5988 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #include "base.h" | 23 | #include "base.h" |
23 | 24 | ||
diff --git a/drivers/base/base.h b/drivers/base/base.h index 5512d84452f2..47eb02d9f1af 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -44,6 +44,6 @@ struct class_device_attribute *to_class_dev_attr(struct attribute *_attr) | |||
44 | 44 | ||
45 | extern char *make_class_name(const char *name, struct kobject *kobj); | 45 | extern char *make_class_name(const char *name, struct kobject *kobj); |
46 | 46 | ||
47 | extern void devres_release_all(struct device *dev); | 47 | extern int devres_release_all(struct device *dev); |
48 | 48 | ||
49 | extern struct kset devices_subsys; | 49 | extern struct kset devices_subsys; |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index dca734819e50..61c67526a656 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -138,12 +138,24 @@ void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) | |||
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | static struct kobj_type ktype_bus = { | 141 | static struct kobj_type bus_ktype = { |
142 | .sysfs_ops = &bus_sysfs_ops, | 142 | .sysfs_ops = &bus_sysfs_ops, |
143 | }; | ||
144 | |||
145 | static int bus_uevent_filter(struct kset *kset, struct kobject *kobj) | ||
146 | { | ||
147 | struct kobj_type *ktype = get_ktype(kobj); | ||
143 | 148 | ||
149 | if (ktype == &bus_ktype) | ||
150 | return 1; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static struct kset_uevent_ops bus_uevent_ops = { | ||
155 | .filter = bus_uevent_filter, | ||
144 | }; | 156 | }; |
145 | 157 | ||
146 | static decl_subsys(bus, &ktype_bus, NULL); | 158 | static decl_subsys(bus, &bus_ktype, &bus_uevent_ops); |
147 | 159 | ||
148 | 160 | ||
149 | #ifdef CONFIG_HOTPLUG | 161 | #ifdef CONFIG_HOTPLUG |
@@ -562,7 +574,6 @@ static int add_probe_files(struct bus_type *bus) | |||
562 | 574 | ||
563 | bus->drivers_probe_attr.attr.name = "drivers_probe"; | 575 | bus->drivers_probe_attr.attr.name = "drivers_probe"; |
564 | bus->drivers_probe_attr.attr.mode = S_IWUSR; | 576 | bus->drivers_probe_attr.attr.mode = S_IWUSR; |
565 | bus->drivers_probe_attr.attr.owner = bus->owner; | ||
566 | bus->drivers_probe_attr.store = store_drivers_probe; | 577 | bus->drivers_probe_attr.store = store_drivers_probe; |
567 | retval = bus_create_file(bus, &bus->drivers_probe_attr); | 578 | retval = bus_create_file(bus, &bus->drivers_probe_attr); |
568 | if (retval) | 579 | if (retval) |
@@ -570,7 +581,6 @@ static int add_probe_files(struct bus_type *bus) | |||
570 | 581 | ||
571 | bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; | 582 | bus->drivers_autoprobe_attr.attr.name = "drivers_autoprobe"; |
572 | bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; | 583 | bus->drivers_autoprobe_attr.attr.mode = S_IWUSR | S_IRUGO; |
573 | bus->drivers_autoprobe_attr.attr.owner = bus->owner; | ||
574 | bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; | 584 | bus->drivers_autoprobe_attr.show = show_drivers_autoprobe; |
575 | bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; | 585 | bus->drivers_autoprobe_attr.store = store_drivers_autoprobe; |
576 | retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); | 586 | retval = bus_create_file(bus, &bus->drivers_autoprobe_attr); |
@@ -610,7 +620,8 @@ int bus_add_driver(struct device_driver *drv) | |||
610 | if (error) | 620 | if (error) |
611 | goto out_put_bus; | 621 | goto out_put_bus; |
612 | drv->kobj.kset = &bus->drivers; | 622 | drv->kobj.kset = &bus->drivers; |
613 | if ((error = kobject_register(&drv->kobj))) | 623 | error = kobject_register(&drv->kobj); |
624 | if (error) | ||
614 | goto out_put_bus; | 625 | goto out_put_bus; |
615 | 626 | ||
616 | if (drv->bus->drivers_autoprobe) { | 627 | if (drv->bus->drivers_autoprobe) { |
@@ -760,7 +771,8 @@ static int bus_add_attrs(struct bus_type * bus) | |||
760 | 771 | ||
761 | if (bus->bus_attrs) { | 772 | if (bus->bus_attrs) { |
762 | for (i = 0; attr_name(bus->bus_attrs[i]); i++) { | 773 | for (i = 0; attr_name(bus->bus_attrs[i]); i++) { |
763 | if ((error = bus_create_file(bus,&bus->bus_attrs[i]))) | 774 | error = bus_create_file(bus,&bus->bus_attrs[i]); |
775 | if (error) | ||
764 | goto Err; | 776 | goto Err; |
765 | } | 777 | } |
766 | } | 778 | } |
diff --git a/drivers/base/class.c b/drivers/base/class.c index 8c506dbe3913..4d2222618b78 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -312,9 +312,6 @@ static void class_dev_release(struct kobject * kobj) | |||
312 | 312 | ||
313 | pr_debug("device class '%s': release.\n", cd->class_id); | 313 | pr_debug("device class '%s': release.\n", cd->class_id); |
314 | 314 | ||
315 | kfree(cd->devt_attr); | ||
316 | cd->devt_attr = NULL; | ||
317 | |||
318 | if (cd->release) | 315 | if (cd->release) |
319 | cd->release(cd); | 316 | cd->release(cd); |
320 | else if (cls->release) | 317 | else if (cls->release) |
@@ -547,6 +544,9 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf) | |||
547 | return print_dev_t(buf, class_dev->devt); | 544 | return print_dev_t(buf, class_dev->devt); |
548 | } | 545 | } |
549 | 546 | ||
547 | static struct class_device_attribute class_devt_attr = | ||
548 | __ATTR(dev, S_IRUGO, show_dev, NULL); | ||
549 | |||
550 | static ssize_t store_uevent(struct class_device *class_dev, | 550 | static ssize_t store_uevent(struct class_device *class_dev, |
551 | const char *buf, size_t count) | 551 | const char *buf, size_t count) |
552 | { | 552 | { |
@@ -554,6 +554,9 @@ static ssize_t store_uevent(struct class_device *class_dev, | |||
554 | return count; | 554 | return count; |
555 | } | 555 | } |
556 | 556 | ||
557 | static struct class_device_attribute class_uevent_attr = | ||
558 | __ATTR(uevent, S_IWUSR, NULL, store_uevent); | ||
559 | |||
557 | void class_device_initialize(struct class_device *class_dev) | 560 | void class_device_initialize(struct class_device *class_dev) |
558 | { | 561 | { |
559 | kobj_set_kset_s(class_dev, class_obj_subsys); | 562 | kobj_set_kset_s(class_dev, class_obj_subsys); |
@@ -603,32 +606,15 @@ int class_device_add(struct class_device *class_dev) | |||
603 | &parent_class->subsys.kobj, "subsystem"); | 606 | &parent_class->subsys.kobj, "subsystem"); |
604 | if (error) | 607 | if (error) |
605 | goto out3; | 608 | goto out3; |
606 | class_dev->uevent_attr.attr.name = "uevent"; | 609 | |
607 | class_dev->uevent_attr.attr.mode = S_IWUSR; | 610 | error = class_device_create_file(class_dev, &class_uevent_attr); |
608 | class_dev->uevent_attr.attr.owner = parent_class->owner; | ||
609 | class_dev->uevent_attr.store = store_uevent; | ||
610 | error = class_device_create_file(class_dev, &class_dev->uevent_attr); | ||
611 | if (error) | 611 | if (error) |
612 | goto out3; | 612 | goto out3; |
613 | 613 | ||
614 | if (MAJOR(class_dev->devt)) { | 614 | if (MAJOR(class_dev->devt)) { |
615 | struct class_device_attribute *attr; | 615 | error = class_device_create_file(class_dev, &class_devt_attr); |
616 | attr = kzalloc(sizeof(*attr), GFP_KERNEL); | 616 | if (error) |
617 | if (!attr) { | ||
618 | error = -ENOMEM; | ||
619 | goto out4; | ||
620 | } | ||
621 | attr->attr.name = "dev"; | ||
622 | attr->attr.mode = S_IRUGO; | ||
623 | attr->attr.owner = parent_class->owner; | ||
624 | attr->show = show_dev; | ||
625 | error = class_device_create_file(class_dev, attr); | ||
626 | if (error) { | ||
627 | kfree(attr); | ||
628 | goto out4; | 617 | goto out4; |
629 | } | ||
630 | |||
631 | class_dev->devt_attr = attr; | ||
632 | } | 618 | } |
633 | 619 | ||
634 | error = class_device_add_attrs(class_dev); | 620 | error = class_device_add_attrs(class_dev); |
@@ -671,10 +657,10 @@ int class_device_add(struct class_device *class_dev) | |||
671 | out6: | 657 | out6: |
672 | class_device_remove_attrs(class_dev); | 658 | class_device_remove_attrs(class_dev); |
673 | out5: | 659 | out5: |
674 | if (class_dev->devt_attr) | 660 | if (MAJOR(class_dev->devt)) |
675 | class_device_remove_file(class_dev, class_dev->devt_attr); | 661 | class_device_remove_file(class_dev, &class_devt_attr); |
676 | out4: | 662 | out4: |
677 | class_device_remove_file(class_dev, &class_dev->uevent_attr); | 663 | class_device_remove_file(class_dev, &class_uevent_attr); |
678 | out3: | 664 | out3: |
679 | kobject_del(&class_dev->kobj); | 665 | kobject_del(&class_dev->kobj); |
680 | out2: | 666 | out2: |
@@ -774,9 +760,9 @@ void class_device_del(struct class_device *class_dev) | |||
774 | sysfs_remove_link(&class_dev->kobj, "device"); | 760 | sysfs_remove_link(&class_dev->kobj, "device"); |
775 | } | 761 | } |
776 | sysfs_remove_link(&class_dev->kobj, "subsystem"); | 762 | sysfs_remove_link(&class_dev->kobj, "subsystem"); |
777 | class_device_remove_file(class_dev, &class_dev->uevent_attr); | 763 | class_device_remove_file(class_dev, &class_uevent_attr); |
778 | if (class_dev->devt_attr) | 764 | if (MAJOR(class_dev->devt)) |
779 | class_device_remove_file(class_dev, class_dev->devt_attr); | 765 | class_device_remove_file(class_dev, &class_devt_attr); |
780 | class_device_remove_attrs(class_dev); | 766 | class_device_remove_attrs(class_dev); |
781 | class_device_remove_groups(class_dev); | 767 | class_device_remove_groups(class_dev); |
782 | 768 | ||
diff --git a/drivers/base/core.c b/drivers/base/core.c index dd40d78a023d..0455aa78fa13 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -310,6 +310,9 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, | |||
310 | return count; | 310 | return count; |
311 | } | 311 | } |
312 | 312 | ||
313 | static struct device_attribute uevent_attr = | ||
314 | __ATTR(uevent, S_IRUGO | S_IWUSR, show_uevent, store_uevent); | ||
315 | |||
313 | static int device_add_attributes(struct device *dev, | 316 | static int device_add_attributes(struct device *dev, |
314 | struct device_attribute *attrs) | 317 | struct device_attribute *attrs) |
315 | { | 318 | { |
@@ -423,6 +426,9 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr, | |||
423 | return print_dev_t(buf, dev->devt); | 426 | return print_dev_t(buf, dev->devt); |
424 | } | 427 | } |
425 | 428 | ||
429 | static struct device_attribute devt_attr = | ||
430 | __ATTR(dev, S_IRUGO, show_dev, NULL); | ||
431 | |||
426 | /* | 432 | /* |
427 | * devices_subsys - structure to be registered with kobject core. | 433 | * devices_subsys - structure to be registered with kobject core. |
428 | */ | 434 | */ |
@@ -681,35 +687,14 @@ int device_add(struct device *dev) | |||
681 | blocking_notifier_call_chain(&dev->bus->bus_notifier, | 687 | blocking_notifier_call_chain(&dev->bus->bus_notifier, |
682 | BUS_NOTIFY_ADD_DEVICE, dev); | 688 | BUS_NOTIFY_ADD_DEVICE, dev); |
683 | 689 | ||
684 | dev->uevent_attr.attr.name = "uevent"; | 690 | error = device_create_file(dev, &uevent_attr); |
685 | dev->uevent_attr.attr.mode = S_IRUGO | S_IWUSR; | ||
686 | if (dev->driver) | ||
687 | dev->uevent_attr.attr.owner = dev->driver->owner; | ||
688 | dev->uevent_attr.store = store_uevent; | ||
689 | dev->uevent_attr.show = show_uevent; | ||
690 | error = device_create_file(dev, &dev->uevent_attr); | ||
691 | if (error) | 691 | if (error) |
692 | goto attrError; | 692 | goto attrError; |
693 | 693 | ||
694 | if (MAJOR(dev->devt)) { | 694 | if (MAJOR(dev->devt)) { |
695 | struct device_attribute *attr; | 695 | error = device_create_file(dev, &devt_attr); |
696 | attr = kzalloc(sizeof(*attr), GFP_KERNEL); | 696 | if (error) |
697 | if (!attr) { | ||
698 | error = -ENOMEM; | ||
699 | goto ueventattrError; | ||
700 | } | ||
701 | attr->attr.name = "dev"; | ||
702 | attr->attr.mode = S_IRUGO; | ||
703 | if (dev->driver) | ||
704 | attr->attr.owner = dev->driver->owner; | ||
705 | attr->show = show_dev; | ||
706 | error = device_create_file(dev, attr); | ||
707 | if (error) { | ||
708 | kfree(attr); | ||
709 | goto ueventattrError; | 697 | goto ueventattrError; |
710 | } | ||
711 | |||
712 | dev->devt_attr = attr; | ||
713 | } | 698 | } |
714 | 699 | ||
715 | if (dev->class) { | 700 | if (dev->class) { |
@@ -733,11 +718,14 @@ int device_add(struct device *dev) | |||
733 | } | 718 | } |
734 | } | 719 | } |
735 | 720 | ||
736 | if ((error = device_add_attrs(dev))) | 721 | error = device_add_attrs(dev); |
722 | if (error) | ||
737 | goto AttrsError; | 723 | goto AttrsError; |
738 | if ((error = device_pm_add(dev))) | 724 | error = device_pm_add(dev); |
725 | if (error) | ||
739 | goto PMError; | 726 | goto PMError; |
740 | if ((error = bus_add_device(dev))) | 727 | error = bus_add_device(dev); |
728 | if (error) | ||
741 | goto BusError; | 729 | goto BusError; |
742 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 730 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
743 | bus_attach_device(dev); | 731 | bus_attach_device(dev); |
@@ -767,10 +755,8 @@ int device_add(struct device *dev) | |||
767 | BUS_NOTIFY_DEL_DEVICE, dev); | 755 | BUS_NOTIFY_DEL_DEVICE, dev); |
768 | device_remove_attrs(dev); | 756 | device_remove_attrs(dev); |
769 | AttrsError: | 757 | AttrsError: |
770 | if (dev->devt_attr) { | 758 | if (MAJOR(dev->devt)) |
771 | device_remove_file(dev, dev->devt_attr); | 759 | device_remove_file(dev, &devt_attr); |
772 | kfree(dev->devt_attr); | ||
773 | } | ||
774 | 760 | ||
775 | if (dev->class) { | 761 | if (dev->class) { |
776 | sysfs_remove_link(&dev->kobj, "subsystem"); | 762 | sysfs_remove_link(&dev->kobj, "subsystem"); |
@@ -792,7 +778,7 @@ int device_add(struct device *dev) | |||
792 | } | 778 | } |
793 | } | 779 | } |
794 | ueventattrError: | 780 | ueventattrError: |
795 | device_remove_file(dev, &dev->uevent_attr); | 781 | device_remove_file(dev, &uevent_attr); |
796 | attrError: | 782 | attrError: |
797 | kobject_uevent(&dev->kobj, KOBJ_REMOVE); | 783 | kobject_uevent(&dev->kobj, KOBJ_REMOVE); |
798 | kobject_del(&dev->kobj); | 784 | kobject_del(&dev->kobj); |
@@ -869,10 +855,8 @@ void device_del(struct device * dev) | |||
869 | 855 | ||
870 | if (parent) | 856 | if (parent) |
871 | klist_del(&dev->knode_parent); | 857 | klist_del(&dev->knode_parent); |
872 | if (dev->devt_attr) { | 858 | if (MAJOR(dev->devt)) |
873 | device_remove_file(dev, dev->devt_attr); | 859 | device_remove_file(dev, &devt_attr); |
874 | kfree(dev->devt_attr); | ||
875 | } | ||
876 | if (dev->class) { | 860 | if (dev->class) { |
877 | sysfs_remove_link(&dev->kobj, "subsystem"); | 861 | sysfs_remove_link(&dev->kobj, "subsystem"); |
878 | /* If this is not a "fake" compatible device, remove the | 862 | /* If this is not a "fake" compatible device, remove the |
@@ -926,7 +910,7 @@ void device_del(struct device * dev) | |||
926 | up(&dev->class->sem); | 910 | up(&dev->class->sem); |
927 | } | 911 | } |
928 | } | 912 | } |
929 | device_remove_file(dev, &dev->uevent_attr); | 913 | device_remove_file(dev, &uevent_attr); |
930 | device_remove_attrs(dev); | 914 | device_remove_attrs(dev); |
931 | bus_remove_device(dev); | 915 | bus_remove_device(dev); |
932 | 916 | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index b0088b0efecd..7ac474db88c5 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -281,24 +281,16 @@ int driver_attach(struct device_driver * drv) | |||
281 | return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach); | 281 | return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach); |
282 | } | 282 | } |
283 | 283 | ||
284 | /** | 284 | /* |
285 | * device_release_driver - manually detach device from driver. | ||
286 | * @dev: device. | ||
287 | * | ||
288 | * Manually detach device from driver. | ||
289 | * | ||
290 | * __device_release_driver() must be called with @dev->sem held. | 285 | * __device_release_driver() must be called with @dev->sem held. |
291 | * When called for a USB interface, @dev->parent->sem must be held | 286 | * When called for a USB interface, @dev->parent->sem must be held as well. |
292 | * as well. | ||
293 | */ | 287 | */ |
294 | |||
295 | static void __device_release_driver(struct device * dev) | 288 | static void __device_release_driver(struct device * dev) |
296 | { | 289 | { |
297 | struct device_driver * drv; | 290 | struct device_driver * drv; |
298 | 291 | ||
299 | drv = dev->driver; | 292 | drv = get_driver(dev->driver); |
300 | if (drv) { | 293 | if (drv) { |
301 | get_driver(drv); | ||
302 | driver_sysfs_remove(dev); | 294 | driver_sysfs_remove(dev); |
303 | sysfs_remove_link(&dev->kobj, "driver"); | 295 | sysfs_remove_link(&dev->kobj, "driver"); |
304 | klist_remove(&dev->knode_driver); | 296 | klist_remove(&dev->knode_driver); |
@@ -318,6 +310,13 @@ static void __device_release_driver(struct device * dev) | |||
318 | } | 310 | } |
319 | } | 311 | } |
320 | 312 | ||
313 | /** | ||
314 | * device_release_driver - manually detach device from driver. | ||
315 | * @dev: device. | ||
316 | * | ||
317 | * Manually detach device from driver. | ||
318 | * When called for a USB interface, @dev->parent->sem must be held. | ||
319 | */ | ||
321 | void device_release_driver(struct device * dev) | 320 | void device_release_driver(struct device * dev) |
322 | { | 321 | { |
323 | /* | 322 | /* |
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index e1c0730a3b99..e8beb8e5b626 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | 12 | ||
13 | #include "base.h" | ||
14 | |||
13 | struct devres_node { | 15 | struct devres_node { |
14 | struct list_head entry; | 16 | struct list_head entry; |
15 | dr_release_t release; | 17 | dr_release_t release; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 89a5f4a54913..53f0ee6f3016 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -175,7 +175,7 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
175 | static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); | 175 | static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); |
176 | 176 | ||
177 | static ssize_t | 177 | static ssize_t |
178 | firmware_data_read(struct kobject *kobj, | 178 | firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
179 | char *buffer, loff_t offset, size_t count) | 179 | char *buffer, loff_t offset, size_t count) |
180 | { | 180 | { |
181 | struct device *dev = to_dev(kobj); | 181 | struct device *dev = to_dev(kobj); |
@@ -240,7 +240,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) | |||
240 | * the driver as a firmware image. | 240 | * the driver as a firmware image. |
241 | **/ | 241 | **/ |
242 | static ssize_t | 242 | static ssize_t |
243 | firmware_data_write(struct kobject *kobj, | 243 | firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
244 | char *buffer, loff_t offset, size_t count) | 244 | char *buffer, loff_t offset, size_t count) |
245 | { | 245 | { |
246 | struct device *dev = to_dev(kobj); | 246 | struct device *dev = to_dev(kobj); |
@@ -271,7 +271,7 @@ out: | |||
271 | } | 271 | } |
272 | 272 | ||
273 | static struct bin_attribute firmware_attr_data_tmpl = { | 273 | static struct bin_attribute firmware_attr_data_tmpl = { |
274 | .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, | 274 | .attr = {.name = "data", .mode = 0644}, |
275 | .size = 0, | 275 | .size = 0, |
276 | .read = firmware_data_read, | 276 | .read = firmware_data_read, |
277 | .write = firmware_data_write, | 277 | .write = firmware_data_write, |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 05dc8764e765..eb9f38d0aa58 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -20,64 +20,44 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/mutex.h> | ||
24 | |||
23 | #include "power.h" | 25 | #include "power.h" |
24 | 26 | ||
25 | LIST_HEAD(dpm_active); | 27 | LIST_HEAD(dpm_active); |
26 | LIST_HEAD(dpm_off); | 28 | LIST_HEAD(dpm_off); |
27 | LIST_HEAD(dpm_off_irq); | 29 | LIST_HEAD(dpm_off_irq); |
28 | 30 | ||
29 | DECLARE_MUTEX(dpm_sem); | 31 | DEFINE_MUTEX(dpm_mtx); |
30 | DECLARE_MUTEX(dpm_list_sem); | 32 | DEFINE_MUTEX(dpm_list_mtx); |
31 | 33 | ||
32 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | 34 | int (*platform_enable_wakeup)(struct device *dev, int is_on); |
33 | 35 | ||
34 | 36 | int device_pm_add(struct device *dev) | |
35 | /** | ||
36 | * device_pm_set_parent - Specify power dependency. | ||
37 | * @dev: Device who needs power. | ||
38 | * @parent: Device that supplies power. | ||
39 | * | ||
40 | * This function is used to manually describe a power-dependency | ||
41 | * relationship. It may be used to specify a transversal relationship | ||
42 | * (where the power supplier is not the physical (or electrical) | ||
43 | * ancestor of a specific device. | ||
44 | * The effect of this is that the supplier will not be powered down | ||
45 | * before the power dependent. | ||
46 | */ | ||
47 | |||
48 | void device_pm_set_parent(struct device * dev, struct device * parent) | ||
49 | { | ||
50 | put_device(dev->power.pm_parent); | ||
51 | dev->power.pm_parent = get_device(parent); | ||
52 | } | ||
53 | EXPORT_SYMBOL_GPL(device_pm_set_parent); | ||
54 | |||
55 | int device_pm_add(struct device * dev) | ||
56 | { | 37 | { |
57 | int error; | 38 | int error; |
58 | 39 | ||
59 | pr_debug("PM: Adding info for %s:%s\n", | 40 | pr_debug("PM: Adding info for %s:%s\n", |
60 | dev->bus ? dev->bus->name : "No Bus", | 41 | dev->bus ? dev->bus->name : "No Bus", |
61 | kobject_name(&dev->kobj)); | 42 | kobject_name(&dev->kobj)); |
62 | down(&dpm_list_sem); | 43 | mutex_lock(&dpm_list_mtx); |
63 | list_add_tail(&dev->power.entry, &dpm_active); | 44 | list_add_tail(&dev->power.entry, &dpm_active); |
64 | device_pm_set_parent(dev, dev->parent); | 45 | error = dpm_sysfs_add(dev); |
65 | if ((error = dpm_sysfs_add(dev))) | 46 | if (error) |
66 | list_del(&dev->power.entry); | 47 | list_del(&dev->power.entry); |
67 | up(&dpm_list_sem); | 48 | mutex_unlock(&dpm_list_mtx); |
68 | return error; | 49 | return error; |
69 | } | 50 | } |
70 | 51 | ||
71 | void device_pm_remove(struct device * dev) | 52 | void device_pm_remove(struct device *dev) |
72 | { | 53 | { |
73 | pr_debug("PM: Removing info for %s:%s\n", | 54 | pr_debug("PM: Removing info for %s:%s\n", |
74 | dev->bus ? dev->bus->name : "No Bus", | 55 | dev->bus ? dev->bus->name : "No Bus", |
75 | kobject_name(&dev->kobj)); | 56 | kobject_name(&dev->kobj)); |
76 | down(&dpm_list_sem); | 57 | mutex_lock(&dpm_list_mtx); |
77 | dpm_sysfs_remove(dev); | 58 | dpm_sysfs_remove(dev); |
78 | put_device(dev->power.pm_parent); | ||
79 | list_del_init(&dev->power.entry); | 59 | list_del_init(&dev->power.entry); |
80 | up(&dpm_list_sem); | 60 | mutex_unlock(&dpm_list_mtx); |
81 | } | 61 | } |
82 | 62 | ||
83 | 63 | ||
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index fb3d35a9e101..2760f25b3ac5 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -14,12 +14,12 @@ extern void device_shutdown(void); | |||
14 | /* | 14 | /* |
15 | * Used to synchronize global power management operations. | 15 | * Used to synchronize global power management operations. |
16 | */ | 16 | */ |
17 | extern struct semaphore dpm_sem; | 17 | extern struct mutex dpm_mtx; |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * Used to serialize changes to the dpm_* lists. | 20 | * Used to serialize changes to the dpm_* lists. |
21 | */ | 21 | */ |
22 | extern struct semaphore dpm_list_sem; | 22 | extern struct mutex dpm_list_mtx; |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * The PM lists. | 25 | * The PM lists. |
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index a2c64188d713..00fd84ae6e66 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c | |||
@@ -29,14 +29,6 @@ int resume_device(struct device * dev) | |||
29 | 29 | ||
30 | down(&dev->sem); | 30 | down(&dev->sem); |
31 | 31 | ||
32 | if (dev->power.pm_parent | ||
33 | && dev->power.pm_parent->power.power_state.event) { | ||
34 | dev_err(dev, "PM: resume from %d, parent %s still %d\n", | ||
35 | dev->power.power_state.event, | ||
36 | dev->power.pm_parent->bus_id, | ||
37 | dev->power.pm_parent->power.power_state.event); | ||
38 | } | ||
39 | |||
40 | if (dev->bus && dev->bus->resume) { | 32 | if (dev->bus && dev->bus->resume) { |
41 | dev_dbg(dev,"resuming\n"); | 33 | dev_dbg(dev,"resuming\n"); |
42 | error = dev->bus->resume(dev); | 34 | error = dev->bus->resume(dev); |
@@ -80,7 +72,7 @@ static int resume_device_early(struct device * dev) | |||
80 | */ | 72 | */ |
81 | void dpm_resume(void) | 73 | void dpm_resume(void) |
82 | { | 74 | { |
83 | down(&dpm_list_sem); | 75 | mutex_lock(&dpm_list_mtx); |
84 | while(!list_empty(&dpm_off)) { | 76 | while(!list_empty(&dpm_off)) { |
85 | struct list_head * entry = dpm_off.next; | 77 | struct list_head * entry = dpm_off.next; |
86 | struct device * dev = to_device(entry); | 78 | struct device * dev = to_device(entry); |
@@ -88,13 +80,12 @@ void dpm_resume(void) | |||
88 | get_device(dev); | 80 | get_device(dev); |
89 | list_move_tail(entry, &dpm_active); | 81 | list_move_tail(entry, &dpm_active); |
90 | 82 | ||
91 | up(&dpm_list_sem); | 83 | mutex_unlock(&dpm_list_mtx); |
92 | if (!dev->power.prev_state.event) | 84 | resume_device(dev); |
93 | resume_device(dev); | 85 | mutex_lock(&dpm_list_mtx); |
94 | down(&dpm_list_sem); | ||
95 | put_device(dev); | 86 | put_device(dev); |
96 | } | 87 | } |
97 | up(&dpm_list_sem); | 88 | mutex_unlock(&dpm_list_mtx); |
98 | } | 89 | } |
99 | 90 | ||
100 | 91 | ||
@@ -108,9 +99,9 @@ void dpm_resume(void) | |||
108 | void device_resume(void) | 99 | void device_resume(void) |
109 | { | 100 | { |
110 | might_sleep(); | 101 | might_sleep(); |
111 | down(&dpm_sem); | 102 | mutex_lock(&dpm_mtx); |
112 | dpm_resume(); | 103 | dpm_resume(); |
113 | up(&dpm_sem); | 104 | mutex_unlock(&dpm_mtx); |
114 | } | 105 | } |
115 | 106 | ||
116 | EXPORT_SYMBOL_GPL(device_resume); | 107 | EXPORT_SYMBOL_GPL(device_resume); |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 96370ec1d673..df6174d85866 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -32,9 +32,9 @@ static void runtime_resume(struct device * dev) | |||
32 | 32 | ||
33 | void dpm_runtime_resume(struct device * dev) | 33 | void dpm_runtime_resume(struct device * dev) |
34 | { | 34 | { |
35 | down(&dpm_sem); | 35 | mutex_lock(&dpm_mtx); |
36 | runtime_resume(dev); | 36 | runtime_resume(dev); |
37 | up(&dpm_sem); | 37 | mutex_unlock(&dpm_mtx); |
38 | } | 38 | } |
39 | EXPORT_SYMBOL(dpm_runtime_resume); | 39 | EXPORT_SYMBOL(dpm_runtime_resume); |
40 | 40 | ||
@@ -49,7 +49,7 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state) | |||
49 | { | 49 | { |
50 | int error = 0; | 50 | int error = 0; |
51 | 51 | ||
52 | down(&dpm_sem); | 52 | mutex_lock(&dpm_mtx); |
53 | if (dev->power.power_state.event == state.event) | 53 | if (dev->power.power_state.event == state.event) |
54 | goto Done; | 54 | goto Done; |
55 | 55 | ||
@@ -59,7 +59,7 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state) | |||
59 | if (!(error = suspend_device(dev, state))) | 59 | if (!(error = suspend_device(dev, state))) |
60 | dev->power.power_state = state; | 60 | dev->power.power_state = state; |
61 | Done: | 61 | Done: |
62 | up(&dpm_sem); | 62 | mutex_unlock(&dpm_mtx); |
63 | return error; | 63 | return error; |
64 | } | 64 | } |
65 | EXPORT_SYMBOL(dpm_runtime_suspend); | 65 | EXPORT_SYMBOL(dpm_runtime_suspend); |
@@ -78,8 +78,8 @@ EXPORT_SYMBOL(dpm_runtime_suspend); | |||
78 | */ | 78 | */ |
79 | void dpm_set_power_state(struct device * dev, pm_message_t state) | 79 | void dpm_set_power_state(struct device * dev, pm_message_t state) |
80 | { | 80 | { |
81 | down(&dpm_sem); | 81 | mutex_lock(&dpm_mtx); |
82 | dev->power.power_state = state; | 82 | dev->power.power_state = state; |
83 | up(&dpm_sem); | 83 | mutex_unlock(&dpm_mtx); |
84 | } | 84 | } |
85 | #endif /* 0 */ | 85 | #endif /* 0 */ |
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 42d2b86ba765..26df9b231737 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c | |||
@@ -40,6 +40,14 @@ static inline char *suspend_verb(u32 event) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | static void | ||
44 | suspend_device_dbg(struct device *dev, pm_message_t state, char *info) | ||
45 | { | ||
46 | dev_dbg(dev, "%s%s%s\n", info, suspend_verb(state.event), | ||
47 | ((state.event == PM_EVENT_SUSPEND) && device_may_wakeup(dev)) ? | ||
48 | ", may wakeup" : ""); | ||
49 | } | ||
50 | |||
43 | /** | 51 | /** |
44 | * suspend_device - Save state of one device. | 52 | * suspend_device - Save state of one device. |
45 | * @dev: Device. | 53 | * @dev: Device. |
@@ -55,49 +63,21 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
55 | dev_dbg(dev, "PM: suspend %d-->%d\n", | 63 | dev_dbg(dev, "PM: suspend %d-->%d\n", |
56 | dev->power.power_state.event, state.event); | 64 | dev->power.power_state.event, state.event); |
57 | } | 65 | } |
58 | if (dev->power.pm_parent | ||
59 | && dev->power.pm_parent->power.power_state.event) { | ||
60 | dev_err(dev, | ||
61 | "PM: suspend %d->%d, parent %s already %d\n", | ||
62 | dev->power.power_state.event, state.event, | ||
63 | dev->power.pm_parent->bus_id, | ||
64 | dev->power.pm_parent->power.power_state.event); | ||
65 | } | ||
66 | |||
67 | dev->power.prev_state = dev->power.power_state; | ||
68 | 66 | ||
69 | if (dev->class && dev->class->suspend && !dev->power.power_state.event) { | 67 | if (dev->class && dev->class->suspend) { |
70 | dev_dbg(dev, "class %s%s\n", | 68 | suspend_device_dbg(dev, state, "class "); |
71 | suspend_verb(state.event), | ||
72 | ((state.event == PM_EVENT_SUSPEND) | ||
73 | && device_may_wakeup(dev)) | ||
74 | ? ", may wakeup" | ||
75 | : "" | ||
76 | ); | ||
77 | error = dev->class->suspend(dev, state); | 69 | error = dev->class->suspend(dev, state); |
78 | suspend_report_result(dev->class->suspend, error); | 70 | suspend_report_result(dev->class->suspend, error); |
79 | } | 71 | } |
80 | 72 | ||
81 | if (!error && dev->type && dev->type->suspend && !dev->power.power_state.event) { | 73 | if (!error && dev->type && dev->type->suspend) { |
82 | dev_dbg(dev, "%s%s\n", | 74 | suspend_device_dbg(dev, state, "type "); |
83 | suspend_verb(state.event), | ||
84 | ((state.event == PM_EVENT_SUSPEND) | ||
85 | && device_may_wakeup(dev)) | ||
86 | ? ", may wakeup" | ||
87 | : "" | ||
88 | ); | ||
89 | error = dev->type->suspend(dev, state); | 75 | error = dev->type->suspend(dev, state); |
90 | suspend_report_result(dev->type->suspend, error); | 76 | suspend_report_result(dev->type->suspend, error); |
91 | } | 77 | } |
92 | 78 | ||
93 | if (!error && dev->bus && dev->bus->suspend && !dev->power.power_state.event) { | 79 | if (!error && dev->bus && dev->bus->suspend) { |
94 | dev_dbg(dev, "%s%s\n", | 80 | suspend_device_dbg(dev, state, ""); |
95 | suspend_verb(state.event), | ||
96 | ((state.event == PM_EVENT_SUSPEND) | ||
97 | && device_may_wakeup(dev)) | ||
98 | ? ", may wakeup" | ||
99 | : "" | ||
100 | ); | ||
101 | error = dev->bus->suspend(dev, state); | 81 | error = dev->bus->suspend(dev, state); |
102 | suspend_report_result(dev->bus->suspend, error); | 82 | suspend_report_result(dev->bus->suspend, error); |
103 | } | 83 | } |
@@ -108,21 +88,15 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
108 | 88 | ||
109 | /* | 89 | /* |
110 | * This is called with interrupts off, only a single CPU | 90 | * This is called with interrupts off, only a single CPU |
111 | * running. We can't do down() on a semaphore (and we don't | 91 | * running. We can't acquire a mutex or semaphore (and we don't |
112 | * need the protection) | 92 | * need the protection) |
113 | */ | 93 | */ |
114 | static int suspend_device_late(struct device *dev, pm_message_t state) | 94 | static int suspend_device_late(struct device *dev, pm_message_t state) |
115 | { | 95 | { |
116 | int error = 0; | 96 | int error = 0; |
117 | 97 | ||
118 | if (dev->bus && dev->bus->suspend_late && !dev->power.power_state.event) { | 98 | if (dev->bus && dev->bus->suspend_late) { |
119 | dev_dbg(dev, "LATE %s%s\n", | 99 | suspend_device_dbg(dev, state, "LATE "); |
120 | suspend_verb(state.event), | ||
121 | ((state.event == PM_EVENT_SUSPEND) | ||
122 | && device_may_wakeup(dev)) | ||
123 | ? ", may wakeup" | ||
124 | : "" | ||
125 | ); | ||
126 | error = dev->bus->suspend_late(dev, state); | 100 | error = dev->bus->suspend_late(dev, state); |
127 | suspend_report_result(dev->bus->suspend_late, error); | 101 | suspend_report_result(dev->bus->suspend_late, error); |
128 | } | 102 | } |
@@ -153,18 +127,18 @@ int device_suspend(pm_message_t state) | |||
153 | int error = 0; | 127 | int error = 0; |
154 | 128 | ||
155 | might_sleep(); | 129 | might_sleep(); |
156 | down(&dpm_sem); | 130 | mutex_lock(&dpm_mtx); |
157 | down(&dpm_list_sem); | 131 | mutex_lock(&dpm_list_mtx); |
158 | while (!list_empty(&dpm_active) && error == 0) { | 132 | while (!list_empty(&dpm_active) && error == 0) { |
159 | struct list_head * entry = dpm_active.prev; | 133 | struct list_head * entry = dpm_active.prev; |
160 | struct device * dev = to_device(entry); | 134 | struct device * dev = to_device(entry); |
161 | 135 | ||
162 | get_device(dev); | 136 | get_device(dev); |
163 | up(&dpm_list_sem); | 137 | mutex_unlock(&dpm_list_mtx); |
164 | 138 | ||
165 | error = suspend_device(dev, state); | 139 | error = suspend_device(dev, state); |
166 | 140 | ||
167 | down(&dpm_list_sem); | 141 | mutex_lock(&dpm_list_mtx); |
168 | 142 | ||
169 | /* Check if the device got removed */ | 143 | /* Check if the device got removed */ |
170 | if (!list_empty(&dev->power.entry)) { | 144 | if (!list_empty(&dev->power.entry)) { |
@@ -179,11 +153,11 @@ int device_suspend(pm_message_t state) | |||
179 | error == -EAGAIN ? " (please convert to suspend_late)" : ""); | 153 | error == -EAGAIN ? " (please convert to suspend_late)" : ""); |
180 | put_device(dev); | 154 | put_device(dev); |
181 | } | 155 | } |
182 | up(&dpm_list_sem); | 156 | mutex_unlock(&dpm_list_mtx); |
183 | if (error) | 157 | if (error) |
184 | dpm_resume(); | 158 | dpm_resume(); |
185 | 159 | ||
186 | up(&dpm_sem); | 160 | mutex_unlock(&dpm_mtx); |
187 | return error; | 161 | return error; |
188 | } | 162 | } |
189 | 163 | ||
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 29f1291966c1..18febe26caa1 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/pm.h> | 22 | #include <linux/pm.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <asm/semaphore.h> | 24 | #include <linux/mutex.h> |
25 | 25 | ||
26 | #include "base.h" | 26 | #include "base.h" |
27 | 27 | ||
@@ -155,7 +155,7 @@ EXPORT_SYMBOL_GPL(sysdev_class_unregister); | |||
155 | 155 | ||
156 | 156 | ||
157 | static LIST_HEAD(sysdev_drivers); | 157 | static LIST_HEAD(sysdev_drivers); |
158 | static DECLARE_MUTEX(sysdev_drivers_lock); | 158 | static DEFINE_MUTEX(sysdev_drivers_lock); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * sysdev_driver_register - Register auxillary driver | 161 | * sysdev_driver_register - Register auxillary driver |
@@ -172,7 +172,7 @@ static DECLARE_MUTEX(sysdev_drivers_lock); | |||
172 | int sysdev_driver_register(struct sysdev_class * cls, | 172 | int sysdev_driver_register(struct sysdev_class * cls, |
173 | struct sysdev_driver * drv) | 173 | struct sysdev_driver * drv) |
174 | { | 174 | { |
175 | down(&sysdev_drivers_lock); | 175 | mutex_lock(&sysdev_drivers_lock); |
176 | if (cls && kset_get(&cls->kset)) { | 176 | if (cls && kset_get(&cls->kset)) { |
177 | list_add_tail(&drv->entry, &cls->drivers); | 177 | list_add_tail(&drv->entry, &cls->drivers); |
178 | 178 | ||
@@ -184,7 +184,7 @@ int sysdev_driver_register(struct sysdev_class * cls, | |||
184 | } | 184 | } |
185 | } else | 185 | } else |
186 | list_add_tail(&drv->entry, &sysdev_drivers); | 186 | list_add_tail(&drv->entry, &sysdev_drivers); |
187 | up(&sysdev_drivers_lock); | 187 | mutex_unlock(&sysdev_drivers_lock); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
@@ -197,7 +197,7 @@ int sysdev_driver_register(struct sysdev_class * cls, | |||
197 | void sysdev_driver_unregister(struct sysdev_class * cls, | 197 | void sysdev_driver_unregister(struct sysdev_class * cls, |
198 | struct sysdev_driver * drv) | 198 | struct sysdev_driver * drv) |
199 | { | 199 | { |
200 | down(&sysdev_drivers_lock); | 200 | mutex_lock(&sysdev_drivers_lock); |
201 | list_del_init(&drv->entry); | 201 | list_del_init(&drv->entry); |
202 | if (cls) { | 202 | if (cls) { |
203 | if (drv->remove) { | 203 | if (drv->remove) { |
@@ -207,7 +207,7 @@ void sysdev_driver_unregister(struct sysdev_class * cls, | |||
207 | } | 207 | } |
208 | kset_put(&cls->kset); | 208 | kset_put(&cls->kset); |
209 | } | 209 | } |
210 | up(&sysdev_drivers_lock); | 210 | mutex_unlock(&sysdev_drivers_lock); |
211 | } | 211 | } |
212 | 212 | ||
213 | EXPORT_SYMBOL_GPL(sysdev_driver_register); | 213 | EXPORT_SYMBOL_GPL(sysdev_driver_register); |
@@ -246,7 +246,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
246 | if (!error) { | 246 | if (!error) { |
247 | struct sysdev_driver * drv; | 247 | struct sysdev_driver * drv; |
248 | 248 | ||
249 | down(&sysdev_drivers_lock); | 249 | mutex_lock(&sysdev_drivers_lock); |
250 | /* Generic notification is implicit, because it's that | 250 | /* Generic notification is implicit, because it's that |
251 | * code that should have called us. | 251 | * code that should have called us. |
252 | */ | 252 | */ |
@@ -262,7 +262,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
262 | if (drv->add) | 262 | if (drv->add) |
263 | drv->add(sysdev); | 263 | drv->add(sysdev); |
264 | } | 264 | } |
265 | up(&sysdev_drivers_lock); | 265 | mutex_unlock(&sysdev_drivers_lock); |
266 | } | 266 | } |
267 | return error; | 267 | return error; |
268 | } | 268 | } |
@@ -271,7 +271,7 @@ void sysdev_unregister(struct sys_device * sysdev) | |||
271 | { | 271 | { |
272 | struct sysdev_driver * drv; | 272 | struct sysdev_driver * drv; |
273 | 273 | ||
274 | down(&sysdev_drivers_lock); | 274 | mutex_lock(&sysdev_drivers_lock); |
275 | list_for_each_entry(drv, &sysdev_drivers, entry) { | 275 | list_for_each_entry(drv, &sysdev_drivers, entry) { |
276 | if (drv->remove) | 276 | if (drv->remove) |
277 | drv->remove(sysdev); | 277 | drv->remove(sysdev); |
@@ -281,7 +281,7 @@ void sysdev_unregister(struct sys_device * sysdev) | |||
281 | if (drv->remove) | 281 | if (drv->remove) |
282 | drv->remove(sysdev); | 282 | drv->remove(sysdev); |
283 | } | 283 | } |
284 | up(&sysdev_drivers_lock); | 284 | mutex_unlock(&sysdev_drivers_lock); |
285 | 285 | ||
286 | kobject_unregister(&sysdev->kobj); | 286 | kobject_unregister(&sysdev->kobj); |
287 | } | 287 | } |
@@ -308,7 +308,7 @@ void sysdev_shutdown(void) | |||
308 | 308 | ||
309 | pr_debug("Shutting Down System Devices\n"); | 309 | pr_debug("Shutting Down System Devices\n"); |
310 | 310 | ||
311 | down(&sysdev_drivers_lock); | 311 | mutex_lock(&sysdev_drivers_lock); |
312 | list_for_each_entry_reverse(cls, &system_subsys.list, | 312 | list_for_each_entry_reverse(cls, &system_subsys.list, |
313 | kset.kobj.entry) { | 313 | kset.kobj.entry) { |
314 | struct sys_device * sysdev; | 314 | struct sys_device * sysdev; |
@@ -337,7 +337,7 @@ void sysdev_shutdown(void) | |||
337 | cls->shutdown(sysdev); | 337 | cls->shutdown(sysdev); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | up(&sysdev_drivers_lock); | 340 | mutex_unlock(&sysdev_drivers_lock); |
341 | } | 341 | } |
342 | 342 | ||
343 | static void __sysdev_resume(struct sys_device *dev) | 343 | static void __sysdev_resume(struct sys_device *dev) |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index f1b9dd7d47d6..ce64e86d6ffb 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -146,8 +146,7 @@ static void pkt_kobj_release(struct kobject *kobj) | |||
146 | **********************************************************/ | 146 | **********************************************************/ |
147 | 147 | ||
148 | #define DEF_ATTR(_obj,_name,_mode) \ | 148 | #define DEF_ATTR(_obj,_name,_mode) \ |
149 | static struct attribute _obj = { \ | 149 | static struct attribute _obj = { .name = _name, .mode = _mode } |
150 | .name = _name, .owner = THIS_MODULE, .mode = _mode } | ||
151 | 150 | ||
152 | /********************************************************** | 151 | /********************************************************** |
153 | /sys/class/pktcdvd/pktcdvd[0-7]/ | 152 | /sys/class/pktcdvd/pktcdvd[0-7]/ |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 8e222f2b80cc..b5df7e61aeb2 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -2171,52 +2171,42 @@ static int create_files(struct bmc_device *bmc) | |||
2171 | int err; | 2171 | int err; |
2172 | 2172 | ||
2173 | bmc->device_id_attr.attr.name = "device_id"; | 2173 | bmc->device_id_attr.attr.name = "device_id"; |
2174 | bmc->device_id_attr.attr.owner = THIS_MODULE; | ||
2175 | bmc->device_id_attr.attr.mode = S_IRUGO; | 2174 | bmc->device_id_attr.attr.mode = S_IRUGO; |
2176 | bmc->device_id_attr.show = device_id_show; | 2175 | bmc->device_id_attr.show = device_id_show; |
2177 | 2176 | ||
2178 | bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; | 2177 | bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs"; |
2179 | bmc->provides_dev_sdrs_attr.attr.owner = THIS_MODULE; | ||
2180 | bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; | 2178 | bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO; |
2181 | bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; | 2179 | bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show; |
2182 | 2180 | ||
2183 | bmc->revision_attr.attr.name = "revision"; | 2181 | bmc->revision_attr.attr.name = "revision"; |
2184 | bmc->revision_attr.attr.owner = THIS_MODULE; | ||
2185 | bmc->revision_attr.attr.mode = S_IRUGO; | 2182 | bmc->revision_attr.attr.mode = S_IRUGO; |
2186 | bmc->revision_attr.show = revision_show; | 2183 | bmc->revision_attr.show = revision_show; |
2187 | 2184 | ||
2188 | bmc->firmware_rev_attr.attr.name = "firmware_revision"; | 2185 | bmc->firmware_rev_attr.attr.name = "firmware_revision"; |
2189 | bmc->firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2190 | bmc->firmware_rev_attr.attr.mode = S_IRUGO; | 2186 | bmc->firmware_rev_attr.attr.mode = S_IRUGO; |
2191 | bmc->firmware_rev_attr.show = firmware_rev_show; | 2187 | bmc->firmware_rev_attr.show = firmware_rev_show; |
2192 | 2188 | ||
2193 | bmc->version_attr.attr.name = "ipmi_version"; | 2189 | bmc->version_attr.attr.name = "ipmi_version"; |
2194 | bmc->version_attr.attr.owner = THIS_MODULE; | ||
2195 | bmc->version_attr.attr.mode = S_IRUGO; | 2190 | bmc->version_attr.attr.mode = S_IRUGO; |
2196 | bmc->version_attr.show = ipmi_version_show; | 2191 | bmc->version_attr.show = ipmi_version_show; |
2197 | 2192 | ||
2198 | bmc->add_dev_support_attr.attr.name = "additional_device_support"; | 2193 | bmc->add_dev_support_attr.attr.name = "additional_device_support"; |
2199 | bmc->add_dev_support_attr.attr.owner = THIS_MODULE; | ||
2200 | bmc->add_dev_support_attr.attr.mode = S_IRUGO; | 2194 | bmc->add_dev_support_attr.attr.mode = S_IRUGO; |
2201 | bmc->add_dev_support_attr.show = add_dev_support_show; | 2195 | bmc->add_dev_support_attr.show = add_dev_support_show; |
2202 | 2196 | ||
2203 | bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; | 2197 | bmc->manufacturer_id_attr.attr.name = "manufacturer_id"; |
2204 | bmc->manufacturer_id_attr.attr.owner = THIS_MODULE; | ||
2205 | bmc->manufacturer_id_attr.attr.mode = S_IRUGO; | 2198 | bmc->manufacturer_id_attr.attr.mode = S_IRUGO; |
2206 | bmc->manufacturer_id_attr.show = manufacturer_id_show; | 2199 | bmc->manufacturer_id_attr.show = manufacturer_id_show; |
2207 | 2200 | ||
2208 | bmc->product_id_attr.attr.name = "product_id"; | 2201 | bmc->product_id_attr.attr.name = "product_id"; |
2209 | bmc->product_id_attr.attr.owner = THIS_MODULE; | ||
2210 | bmc->product_id_attr.attr.mode = S_IRUGO; | 2202 | bmc->product_id_attr.attr.mode = S_IRUGO; |
2211 | bmc->product_id_attr.show = product_id_show; | 2203 | bmc->product_id_attr.show = product_id_show; |
2212 | 2204 | ||
2213 | bmc->guid_attr.attr.name = "guid"; | 2205 | bmc->guid_attr.attr.name = "guid"; |
2214 | bmc->guid_attr.attr.owner = THIS_MODULE; | ||
2215 | bmc->guid_attr.attr.mode = S_IRUGO; | 2206 | bmc->guid_attr.attr.mode = S_IRUGO; |
2216 | bmc->guid_attr.show = guid_show; | 2207 | bmc->guid_attr.show = guid_show; |
2217 | 2208 | ||
2218 | bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; | 2209 | bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; |
2219 | bmc->aux_firmware_rev_attr.attr.owner = THIS_MODULE; | ||
2220 | bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; | 2210 | bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO; |
2221 | bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; | 2211 | bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show; |
2222 | 2212 | ||
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index d2f0cbd8b8f3..917b9bab9ccb 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -25,8 +25,7 @@ static spinlock_t cpufreq_stats_lock; | |||
25 | 25 | ||
26 | #define CPUFREQ_STATDEVICE_ATTR(_name,_mode,_show) \ | 26 | #define CPUFREQ_STATDEVICE_ATTR(_name,_mode,_show) \ |
27 | static struct freq_attr _attr_##_name = {\ | 27 | static struct freq_attr _attr_##_name = {\ |
28 | .attr = {.name = __stringify(_name), .owner = THIS_MODULE, \ | 28 | .attr = {.name = __stringify(_name), .mode = _mode, }, \ |
29 | .mode = _mode, }, \ | ||
30 | .show = _show,\ | 29 | .show = _show,\ |
31 | }; | 30 | }; |
32 | 31 | ||
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 860345c7799a..a648970338b0 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c | |||
@@ -120,7 +120,7 @@ store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) | |||
120 | 120 | ||
121 | static struct freq_attr freq_attr_scaling_setspeed = | 121 | static struct freq_attr freq_attr_scaling_setspeed = |
122 | { | 122 | { |
123 | .attr = { .name = "scaling_setspeed", .mode = 0644, .owner = THIS_MODULE }, | 123 | .attr = { .name = "scaling_setspeed", .mode = 0644 }, |
124 | .show = show_speed, | 124 | .show = show_speed, |
125 | .store = store_speed, | 125 | .store = store_speed, |
126 | }; | 126 | }; |
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index e7490925fdcf..5409f3afb3f8 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -199,7 +199,6 @@ static ssize_t show_available_freqs (struct cpufreq_policy *policy, char *buf) | |||
199 | struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { | 199 | struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { |
200 | .attr = { .name = "scaling_available_frequencies", | 200 | .attr = { .name = "scaling_available_frequencies", |
201 | .mode = 0444, | 201 | .mode = 0444, |
202 | .owner=THIS_MODULE | ||
203 | }, | 202 | }, |
204 | .show = show_available_freqs, | 203 | .show = show_available_freqs, |
205 | }; | 204 | }; |
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 88f462122a30..05f02a326f1c 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig | |||
@@ -84,4 +84,13 @@ config DCDBAS | |||
84 | Say Y or M here to enable the driver for use by Dell systems | 84 | Say Y or M here to enable the driver for use by Dell systems |
85 | management software such as Dell OpenManage. | 85 | management software such as Dell OpenManage. |
86 | 86 | ||
87 | config DMIID | ||
88 | bool "Export DMI identification via sysfs to userspace" | ||
89 | depends on DMI | ||
90 | default y | ||
91 | help | ||
92 | Say Y here if you want to query SMBIOS/DMI system identification | ||
93 | information from userspace through /sys/class/dmi/id/ or if you want | ||
94 | DMI-based module auto-loading. | ||
95 | |||
87 | endmenu | 96 | endmenu |
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 98e395f4bb29..8d4ebc805a50 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile | |||
@@ -7,3 +7,4 @@ obj-$(CONFIG_EFI_VARS) += efivars.o | |||
7 | obj-$(CONFIG_EFI_PCDP) += pcdp.o | 7 | obj-$(CONFIG_EFI_PCDP) += pcdp.o |
8 | obj-$(CONFIG_DELL_RBU) += dell_rbu.o | 8 | obj-$(CONFIG_DELL_RBU) += dell_rbu.o |
9 | obj-$(CONFIG_DCDBAS) += dcdbas.o | 9 | obj-$(CONFIG_DCDBAS) += dcdbas.o |
10 | obj-$(CONFIG_DMIID) += dmi-id.o | ||
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 1865b56fb141..18cdcb3ae1ca 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c | |||
@@ -149,8 +149,9 @@ static ssize_t smi_data_buf_size_store(struct device *dev, | |||
149 | return count; | 149 | return count; |
150 | } | 150 | } |
151 | 151 | ||
152 | static ssize_t smi_data_read(struct kobject *kobj, char *buf, loff_t pos, | 152 | static ssize_t smi_data_read(struct kobject *kobj, |
153 | size_t count) | 153 | struct bin_attribute *bin_attr, |
154 | char *buf, loff_t pos, size_t count) | ||
154 | { | 155 | { |
155 | size_t max_read; | 156 | size_t max_read; |
156 | ssize_t ret; | 157 | ssize_t ret; |
@@ -170,8 +171,9 @@ out: | |||
170 | return ret; | 171 | return ret; |
171 | } | 172 | } |
172 | 173 | ||
173 | static ssize_t smi_data_write(struct kobject *kobj, char *buf, loff_t pos, | 174 | static ssize_t smi_data_write(struct kobject *kobj, |
174 | size_t count) | 175 | struct bin_attribute *bin_attr, |
176 | char *buf, loff_t pos, size_t count) | ||
175 | { | 177 | { |
176 | ssize_t ret; | 178 | ssize_t ret; |
177 | 179 | ||
diff --git a/drivers/firmware/dcdbas.h b/drivers/firmware/dcdbas.h index 58a85182b3e8..dcdba0f1b32c 100644 --- a/drivers/firmware/dcdbas.h +++ b/drivers/firmware/dcdbas.h | |||
@@ -67,8 +67,7 @@ | |||
67 | #define DCDBAS_BIN_ATTR_RW(_name) \ | 67 | #define DCDBAS_BIN_ATTR_RW(_name) \ |
68 | struct bin_attribute bin_attr_##_name = { \ | 68 | struct bin_attribute bin_attr_##_name = { \ |
69 | .attr = { .name = __stringify(_name), \ | 69 | .attr = { .name = __stringify(_name), \ |
70 | .mode = 0600, \ | 70 | .mode = 0600 }, \ |
71 | .owner = THIS_MODULE }, \ | ||
72 | .read = _name##_read, \ | 71 | .read = _name##_read, \ |
73 | .write = _name##_write, \ | 72 | .write = _name##_write, \ |
74 | } | 73 | } |
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index fc702e40bd43..477a3d0e3caf 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -543,8 +543,9 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) | |||
543 | return ret_count; | 543 | return ret_count; |
544 | } | 544 | } |
545 | 545 | ||
546 | static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, | 546 | static ssize_t read_rbu_data(struct kobject *kobj, |
547 | loff_t pos, size_t count) | 547 | struct bin_attribute *bin_attr, |
548 | char *buffer, loff_t pos, size_t count) | ||
548 | { | 549 | { |
549 | ssize_t ret_count = 0; | 550 | ssize_t ret_count = 0; |
550 | 551 | ||
@@ -591,8 +592,9 @@ static void callbackfn_rbu(const struct firmware *fw, void *context) | |||
591 | spin_unlock(&rbu_data.lock); | 592 | spin_unlock(&rbu_data.lock); |
592 | } | 593 | } |
593 | 594 | ||
594 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | 595 | static ssize_t read_rbu_image_type(struct kobject *kobj, |
595 | loff_t pos, size_t count) | 596 | struct bin_attribute *bin_attr, |
597 | char *buffer, loff_t pos, size_t count) | ||
596 | { | 598 | { |
597 | int size = 0; | 599 | int size = 0; |
598 | if (!pos) | 600 | if (!pos) |
@@ -600,8 +602,9 @@ static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, | |||
600 | return size; | 602 | return size; |
601 | } | 603 | } |
602 | 604 | ||
603 | static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | 605 | static ssize_t write_rbu_image_type(struct kobject *kobj, |
604 | loff_t pos, size_t count) | 606 | struct bin_attribute *bin_attr, |
607 | char *buffer, loff_t pos, size_t count) | ||
605 | { | 608 | { |
606 | int rc = count; | 609 | int rc = count; |
607 | int req_firm_rc = 0; | 610 | int req_firm_rc = 0; |
@@ -660,8 +663,9 @@ static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, | |||
660 | return rc; | 663 | return rc; |
661 | } | 664 | } |
662 | 665 | ||
663 | static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, | 666 | static ssize_t read_rbu_packet_size(struct kobject *kobj, |
664 | loff_t pos, size_t count) | 667 | struct bin_attribute *bin_attr, |
668 | char *buffer, loff_t pos, size_t count) | ||
665 | { | 669 | { |
666 | int size = 0; | 670 | int size = 0; |
667 | if (!pos) { | 671 | if (!pos) { |
@@ -672,8 +676,9 @@ static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer, | |||
672 | return size; | 676 | return size; |
673 | } | 677 | } |
674 | 678 | ||
675 | static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, | 679 | static ssize_t write_rbu_packet_size(struct kobject *kobj, |
676 | loff_t pos, size_t count) | 680 | struct bin_attribute *bin_attr, |
681 | char *buffer, loff_t pos, size_t count) | ||
677 | { | 682 | { |
678 | unsigned long temp; | 683 | unsigned long temp; |
679 | spin_lock(&rbu_data.lock); | 684 | spin_lock(&rbu_data.lock); |
@@ -687,18 +692,18 @@ static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer, | |||
687 | } | 692 | } |
688 | 693 | ||
689 | static struct bin_attribute rbu_data_attr = { | 694 | static struct bin_attribute rbu_data_attr = { |
690 | .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444}, | 695 | .attr = {.name = "data", .mode = 0444}, |
691 | .read = read_rbu_data, | 696 | .read = read_rbu_data, |
692 | }; | 697 | }; |
693 | 698 | ||
694 | static struct bin_attribute rbu_image_type_attr = { | 699 | static struct bin_attribute rbu_image_type_attr = { |
695 | .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644}, | 700 | .attr = {.name = "image_type", .mode = 0644}, |
696 | .read = read_rbu_image_type, | 701 | .read = read_rbu_image_type, |
697 | .write = write_rbu_image_type, | 702 | .write = write_rbu_image_type, |
698 | }; | 703 | }; |
699 | 704 | ||
700 | static struct bin_attribute rbu_packet_size_attr = { | 705 | static struct bin_attribute rbu_packet_size_attr = { |
701 | .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644}, | 706 | .attr = {.name = "packet_size", .mode = 0644}, |
702 | .read = read_rbu_packet_size, | 707 | .read = read_rbu_packet_size, |
703 | .write = write_rbu_packet_size, | 708 | .write = write_rbu_packet_size, |
704 | }; | 709 | }; |
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c new file mode 100644 index 000000000000..59c3b5aa89f4 --- /dev/null +++ b/drivers/firmware/dmi-id.c | |||
@@ -0,0 +1,222 @@ | |||
1 | /* | ||
2 | * Export SMBIOS/DMI info via sysfs to userspace | ||
3 | * | ||
4 | * Copyright 2007, Lennart Poettering | ||
5 | * | ||
6 | * Licensed under GPLv2 | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/dmi.h> | ||
13 | #include <linux/device.h> | ||
14 | #include <linux/autoconf.h> | ||
15 | |||
16 | #define DEFINE_DMI_ATTR(_name, _mode, _show) \ | ||
17 | static struct device_attribute sys_dmi_##_name##_attr = \ | ||
18 | __ATTR(_name, _mode, _show, NULL); | ||
19 | |||
20 | #define DEFINE_DMI_ATTR_WITH_SHOW(_name, _mode, _field) \ | ||
21 | static ssize_t sys_dmi_##_name##_show(struct device *dev, \ | ||
22 | struct device_attribute *attr, \ | ||
23 | char *page) \ | ||
24 | { \ | ||
25 | ssize_t len; \ | ||
26 | len = scnprintf(page, PAGE_SIZE, "%s\n", dmi_get_system_info(_field)); \ | ||
27 | page[len-1] = '\n'; \ | ||
28 | return len; \ | ||
29 | } \ | ||
30 | DEFINE_DMI_ATTR(_name, _mode, sys_dmi_##_name##_show); | ||
31 | |||
32 | DEFINE_DMI_ATTR_WITH_SHOW(bios_vendor, 0444, DMI_BIOS_VENDOR); | ||
33 | DEFINE_DMI_ATTR_WITH_SHOW(bios_version, 0444, DMI_BIOS_VERSION); | ||
34 | DEFINE_DMI_ATTR_WITH_SHOW(bios_date, 0444, DMI_BIOS_DATE); | ||
35 | DEFINE_DMI_ATTR_WITH_SHOW(sys_vendor, 0444, DMI_SYS_VENDOR); | ||
36 | DEFINE_DMI_ATTR_WITH_SHOW(product_name, 0444, DMI_PRODUCT_NAME); | ||
37 | DEFINE_DMI_ATTR_WITH_SHOW(product_version, 0444, DMI_PRODUCT_VERSION); | ||
38 | DEFINE_DMI_ATTR_WITH_SHOW(product_serial, 0400, DMI_PRODUCT_SERIAL); | ||
39 | DEFINE_DMI_ATTR_WITH_SHOW(product_uuid, 0400, DMI_PRODUCT_UUID); | ||
40 | DEFINE_DMI_ATTR_WITH_SHOW(board_vendor, 0444, DMI_BOARD_VENDOR); | ||
41 | DEFINE_DMI_ATTR_WITH_SHOW(board_name, 0444, DMI_BOARD_NAME); | ||
42 | DEFINE_DMI_ATTR_WITH_SHOW(board_version, 0444, DMI_BOARD_VERSION); | ||
43 | DEFINE_DMI_ATTR_WITH_SHOW(board_serial, 0400, DMI_BOARD_SERIAL); | ||
44 | DEFINE_DMI_ATTR_WITH_SHOW(board_asset_tag, 0444, DMI_BOARD_ASSET_TAG); | ||
45 | DEFINE_DMI_ATTR_WITH_SHOW(chassis_vendor, 0444, DMI_CHASSIS_VENDOR); | ||
46 | DEFINE_DMI_ATTR_WITH_SHOW(chassis_type, 0444, DMI_CHASSIS_TYPE); | ||
47 | DEFINE_DMI_ATTR_WITH_SHOW(chassis_version, 0444, DMI_CHASSIS_VERSION); | ||
48 | DEFINE_DMI_ATTR_WITH_SHOW(chassis_serial, 0400, DMI_CHASSIS_SERIAL); | ||
49 | DEFINE_DMI_ATTR_WITH_SHOW(chassis_asset_tag, 0444, DMI_CHASSIS_ASSET_TAG); | ||
50 | |||
51 | static void ascii_filter(char *d, const char *s) | ||
52 | { | ||
53 | /* Filter out characters we don't want to see in the modalias string */ | ||
54 | for (; *s; s++) | ||
55 | if (*s > ' ' && *s < 127 && *s != ':') | ||
56 | *(d++) = *s; | ||
57 | |||
58 | *d = 0; | ||
59 | } | ||
60 | |||
61 | static ssize_t get_modalias(char *buffer, size_t buffer_size) | ||
62 | { | ||
63 | static const struct mafield { | ||
64 | const char *prefix; | ||
65 | int field; | ||
66 | } fields[] = { | ||
67 | { "bvn", DMI_BIOS_VENDOR }, | ||
68 | { "bvr", DMI_BIOS_VERSION }, | ||
69 | { "bd", DMI_BIOS_DATE }, | ||
70 | { "svn", DMI_SYS_VENDOR }, | ||
71 | { "pn", DMI_PRODUCT_NAME }, | ||
72 | { "pvr", DMI_PRODUCT_VERSION }, | ||
73 | { "rvn", DMI_BOARD_VENDOR }, | ||
74 | { "rn", DMI_BOARD_NAME }, | ||
75 | { "rvr", DMI_BOARD_VERSION }, | ||
76 | { "cvn", DMI_CHASSIS_VENDOR }, | ||
77 | { "ct", DMI_CHASSIS_TYPE }, | ||
78 | { "cvr", DMI_CHASSIS_VERSION }, | ||
79 | { NULL, DMI_NONE } | ||
80 | }; | ||
81 | |||
82 | ssize_t l, left; | ||
83 | char *p; | ||
84 | const struct mafield *f; | ||
85 | |||
86 | strcpy(buffer, "dmi"); | ||
87 | p = buffer + 3; left = buffer_size - 4; | ||
88 | |||
89 | for (f = fields; f->prefix && left > 0; f++) { | ||
90 | const char *c; | ||
91 | char *t; | ||
92 | |||
93 | c = dmi_get_system_info(f->field); | ||
94 | if (!c) | ||
95 | continue; | ||
96 | |||
97 | t = kmalloc(strlen(c) + 1, GFP_KERNEL); | ||
98 | if (!t) | ||
99 | break; | ||
100 | ascii_filter(t, c); | ||
101 | l = scnprintf(p, left, ":%s%s", f->prefix, t); | ||
102 | kfree(t); | ||
103 | |||
104 | p += l; | ||
105 | left -= l; | ||
106 | } | ||
107 | |||
108 | p[0] = ':'; | ||
109 | p[1] = 0; | ||
110 | |||
111 | return p - buffer + 1; | ||
112 | } | ||
113 | |||
114 | static ssize_t sys_dmi_modalias_show(struct device *dev, | ||
115 | struct device_attribute *attr, char *page) | ||
116 | { | ||
117 | ssize_t r; | ||
118 | r = get_modalias(page, PAGE_SIZE-1); | ||
119 | page[r] = '\n'; | ||
120 | page[r+1] = 0; | ||
121 | return r+1; | ||
122 | } | ||
123 | |||
124 | DEFINE_DMI_ATTR(modalias, 0444, sys_dmi_modalias_show); | ||
125 | |||
126 | static struct attribute *sys_dmi_attributes[DMI_STRING_MAX+2]; | ||
127 | |||
128 | static struct attribute_group sys_dmi_attribute_group = { | ||
129 | .attrs = sys_dmi_attributes, | ||
130 | }; | ||
131 | |||
132 | static struct attribute_group* sys_dmi_attribute_groups[] = { | ||
133 | &sys_dmi_attribute_group, | ||
134 | NULL | ||
135 | }; | ||
136 | |||
137 | static int dmi_dev_uevent(struct device *dev, char **envp, | ||
138 | int num_envp, char *buffer, int buffer_size) | ||
139 | { | ||
140 | strcpy(buffer, "MODALIAS="); | ||
141 | get_modalias(buffer+9, buffer_size-9); | ||
142 | envp[0] = buffer; | ||
143 | envp[1] = NULL; | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | static struct class dmi_class = { | ||
149 | .name = "dmi", | ||
150 | .dev_release = (void(*)(struct device *)) kfree, | ||
151 | .dev_uevent = dmi_dev_uevent, | ||
152 | }; | ||
153 | |||
154 | static struct device *dmi_dev; | ||
155 | |||
156 | /* Initialization */ | ||
157 | |||
158 | #define ADD_DMI_ATTR(_name, _field) \ | ||
159 | if (dmi_get_system_info(_field)) \ | ||
160 | sys_dmi_attributes[i++] = & sys_dmi_##_name##_attr.attr; | ||
161 | |||
162 | extern int dmi_available; | ||
163 | |||
164 | static int __init dmi_id_init(void) | ||
165 | { | ||
166 | int ret, i; | ||
167 | |||
168 | if (!dmi_available) | ||
169 | return -ENODEV; | ||
170 | |||
171 | /* Not necessarily all DMI fields are available on all | ||
172 | * systems, hence let's built an attribute table of just | ||
173 | * what's available */ | ||
174 | i = 0; | ||
175 | ADD_DMI_ATTR(bios_vendor, DMI_BIOS_VENDOR); | ||
176 | ADD_DMI_ATTR(bios_version, DMI_BIOS_VERSION); | ||
177 | ADD_DMI_ATTR(bios_date, DMI_BIOS_DATE); | ||
178 | ADD_DMI_ATTR(sys_vendor, DMI_SYS_VENDOR); | ||
179 | ADD_DMI_ATTR(product_name, DMI_PRODUCT_NAME); | ||
180 | ADD_DMI_ATTR(product_version, DMI_PRODUCT_VERSION); | ||
181 | ADD_DMI_ATTR(product_serial, DMI_PRODUCT_SERIAL); | ||
182 | ADD_DMI_ATTR(product_uuid, DMI_PRODUCT_UUID); | ||
183 | ADD_DMI_ATTR(board_vendor, DMI_BOARD_VENDOR); | ||
184 | ADD_DMI_ATTR(board_name, DMI_BOARD_NAME); | ||
185 | ADD_DMI_ATTR(board_version, DMI_BOARD_VERSION); | ||
186 | ADD_DMI_ATTR(board_serial, DMI_BOARD_SERIAL); | ||
187 | ADD_DMI_ATTR(board_asset_tag, DMI_BOARD_ASSET_TAG); | ||
188 | ADD_DMI_ATTR(chassis_vendor, DMI_CHASSIS_VENDOR); | ||
189 | ADD_DMI_ATTR(chassis_type, DMI_CHASSIS_TYPE); | ||
190 | ADD_DMI_ATTR(chassis_version, DMI_CHASSIS_VERSION); | ||
191 | ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL); | ||
192 | ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG); | ||
193 | sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr; | ||
194 | |||
195 | ret = class_register(&dmi_class); | ||
196 | if (ret) | ||
197 | return ret; | ||
198 | |||
199 | dmi_dev = kzalloc(sizeof(*dmi_dev), GFP_KERNEL); | ||
200 | if (!dmi_dev) { | ||
201 | ret = -ENOMEM; | ||
202 | goto fail_class_unregister; | ||
203 | } | ||
204 | |||
205 | dmi_dev->class = &dmi_class; | ||
206 | strcpy(dmi_dev->bus_id, "id"); | ||
207 | dmi_dev->groups = sys_dmi_attribute_groups; | ||
208 | |||
209 | ret = device_register(dmi_dev); | ||
210 | if (ret) | ||
211 | goto fail_class_unregister; | ||
212 | |||
213 | return 0; | ||
214 | |||
215 | fail_class_unregister: | ||
216 | |||
217 | class_unregister(&dmi_class); | ||
218 | |||
219 | return ret; | ||
220 | } | ||
221 | |||
222 | arch_initcall(dmi_id_init); | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 37deee6c0c1c..f7318b3b51f2 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -84,6 +84,7 @@ static int __init dmi_checksum(u8 *buf) | |||
84 | 84 | ||
85 | static char *dmi_ident[DMI_STRING_MAX]; | 85 | static char *dmi_ident[DMI_STRING_MAX]; |
86 | static LIST_HEAD(dmi_devices); | 86 | static LIST_HEAD(dmi_devices); |
87 | int dmi_available; | ||
87 | 88 | ||
88 | /* | 89 | /* |
89 | * Save a DMI string | 90 | * Save a DMI string |
@@ -102,6 +103,51 @@ static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) | |||
102 | dmi_ident[slot] = p; | 103 | dmi_ident[slot] = p; |
103 | } | 104 | } |
104 | 105 | ||
106 | static void __init dmi_save_uuid(struct dmi_header *dm, int slot, int index) | ||
107 | { | ||
108 | u8 *d = (u8*) dm + index; | ||
109 | char *s; | ||
110 | int is_ff = 1, is_00 = 1, i; | ||
111 | |||
112 | if (dmi_ident[slot]) | ||
113 | return; | ||
114 | |||
115 | for (i = 0; i < 16 && (is_ff || is_00); i++) { | ||
116 | if(d[i] != 0x00) is_ff = 0; | ||
117 | if(d[i] != 0xFF) is_00 = 0; | ||
118 | } | ||
119 | |||
120 | if (is_ff || is_00) | ||
121 | return; | ||
122 | |||
123 | s = dmi_alloc(16*2+4+1); | ||
124 | if (!s) | ||
125 | return; | ||
126 | |||
127 | sprintf(s, | ||
128 | "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", | ||
129 | d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], | ||
130 | d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]); | ||
131 | |||
132 | dmi_ident[slot] = s; | ||
133 | } | ||
134 | |||
135 | static void __init dmi_save_type(struct dmi_header *dm, int slot, int index) | ||
136 | { | ||
137 | u8 *d = (u8*) dm + index; | ||
138 | char *s; | ||
139 | |||
140 | if (dmi_ident[slot]) | ||
141 | return; | ||
142 | |||
143 | s = dmi_alloc(4); | ||
144 | if (!s) | ||
145 | return; | ||
146 | |||
147 | sprintf(s, "%u", *d & 0x7F); | ||
148 | dmi_ident[slot] = s; | ||
149 | } | ||
150 | |||
105 | static void __init dmi_save_devices(struct dmi_header *dm) | 151 | static void __init dmi_save_devices(struct dmi_header *dm) |
106 | { | 152 | { |
107 | int i, count = (dm->length - sizeof(struct dmi_header)) / 2; | 153 | int i, count = (dm->length - sizeof(struct dmi_header)) / 2; |
@@ -192,11 +238,21 @@ static void __init dmi_decode(struct dmi_header *dm) | |||
192 | dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); | 238 | dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); |
193 | dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); | 239 | dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); |
194 | dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); | 240 | dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); |
241 | dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8); | ||
195 | break; | 242 | break; |
196 | case 2: /* Base Board Information */ | 243 | case 2: /* Base Board Information */ |
197 | dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); | 244 | dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); |
198 | dmi_save_ident(dm, DMI_BOARD_NAME, 5); | 245 | dmi_save_ident(dm, DMI_BOARD_NAME, 5); |
199 | dmi_save_ident(dm, DMI_BOARD_VERSION, 6); | 246 | dmi_save_ident(dm, DMI_BOARD_VERSION, 6); |
247 | dmi_save_ident(dm, DMI_BOARD_SERIAL, 7); | ||
248 | dmi_save_ident(dm, DMI_BOARD_ASSET_TAG, 8); | ||
249 | break; | ||
250 | case 3: /* Chassis Information */ | ||
251 | dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4); | ||
252 | dmi_save_type(dm, DMI_CHASSIS_TYPE, 5); | ||
253 | dmi_save_ident(dm, DMI_CHASSIS_VERSION, 6); | ||
254 | dmi_save_ident(dm, DMI_CHASSIS_SERIAL, 7); | ||
255 | dmi_save_ident(dm, DMI_CHASSIS_ASSET_TAG, 8); | ||
200 | break; | 256 | break; |
201 | case 10: /* Onboard Devices Information */ | 257 | case 10: /* Onboard Devices Information */ |
202 | dmi_save_devices(dm); | 258 | dmi_save_devices(dm); |
@@ -243,18 +299,20 @@ void __init dmi_scan_machine(void) | |||
243 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) | 299 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) |
244 | goto out; | 300 | goto out; |
245 | 301 | ||
246 | /* This is called as a core_initcall() because it isn't | 302 | /* This is called as a core_initcall() because it isn't |
247 | * needed during early boot. This also means we can | 303 | * needed during early boot. This also means we can |
248 | * iounmap the space when we're done with it. | 304 | * iounmap the space when we're done with it. |
249 | */ | 305 | */ |
250 | p = dmi_ioremap(efi.smbios, 32); | 306 | p = dmi_ioremap(efi.smbios, 32); |
251 | if (p == NULL) | 307 | if (p == NULL) |
252 | goto out; | 308 | goto out; |
253 | 309 | ||
254 | rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ | 310 | rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ |
255 | dmi_iounmap(p, 32); | 311 | dmi_iounmap(p, 32); |
256 | if (!rc) | 312 | if (!rc) { |
313 | dmi_available = 1; | ||
257 | return; | 314 | return; |
315 | } | ||
258 | } | 316 | } |
259 | else { | 317 | else { |
260 | /* | 318 | /* |
@@ -268,8 +326,10 @@ void __init dmi_scan_machine(void) | |||
268 | 326 | ||
269 | for (q = p; q < p + 0x10000; q += 16) { | 327 | for (q = p; q < p + 0x10000; q += 16) { |
270 | rc = dmi_present(q); | 328 | rc = dmi_present(q); |
271 | if (!rc) | 329 | if (!rc) { |
330 | dmi_available = 1; | ||
272 | return; | 331 | return; |
332 | } | ||
273 | } | 333 | } |
274 | } | 334 | } |
275 | out: printk(KERN_INFO "DMI not present or invalid.\n"); | 335 | out: printk(KERN_INFO "DMI not present or invalid.\n"); |
@@ -404,3 +464,4 @@ int dmi_get_year(int field) | |||
404 | 464 | ||
405 | return year; | 465 | return year; |
406 | } | 466 | } |
467 | |||
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index d8806e4f1829..15232271d848 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c | |||
@@ -74,7 +74,7 @@ static struct edd_device *edd_devices[EDD_MBR_SIG_MAX]; | |||
74 | 74 | ||
75 | #define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \ | 75 | #define EDD_DEVICE_ATTR(_name,_mode,_show,_test) \ |
76 | struct edd_attribute edd_attr_##_name = { \ | 76 | struct edd_attribute edd_attr_##_name = { \ |
77 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ | 77 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
78 | .show = _show, \ | 78 | .show = _show, \ |
79 | .test = _test, \ | 79 | .test = _test, \ |
80 | }; | 80 | }; |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 1324984a4c35..bfd2d67df689 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -131,21 +131,21 @@ struct efivar_attribute { | |||
131 | 131 | ||
132 | #define EFI_ATTR(_name, _mode, _show, _store) \ | 132 | #define EFI_ATTR(_name, _mode, _show, _store) \ |
133 | struct subsys_attribute efi_attr_##_name = { \ | 133 | struct subsys_attribute efi_attr_##_name = { \ |
134 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ | 134 | .attr = {.name = __stringify(_name), .mode = _mode}, \ |
135 | .show = _show, \ | 135 | .show = _show, \ |
136 | .store = _store, \ | 136 | .store = _store, \ |
137 | }; | 137 | }; |
138 | 138 | ||
139 | #define EFIVAR_ATTR(_name, _mode, _show, _store) \ | 139 | #define EFIVAR_ATTR(_name, _mode, _show, _store) \ |
140 | struct efivar_attribute efivar_attr_##_name = { \ | 140 | struct efivar_attribute efivar_attr_##_name = { \ |
141 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ | 141 | .attr = {.name = __stringify(_name), .mode = _mode}, \ |
142 | .show = _show, \ | 142 | .show = _show, \ |
143 | .store = _store, \ | 143 | .store = _store, \ |
144 | }; | 144 | }; |
145 | 145 | ||
146 | #define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \ | 146 | #define VAR_SUBSYS_ATTR(_name, _mode, _show, _store) \ |
147 | struct subsys_attribute var_subsys_attr_##_name = { \ | 147 | struct subsys_attribute var_subsys_attr_##_name = { \ |
148 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ | 148 | .attr = {.name = __stringify(_name), .mode = _mode}, \ |
149 | .show = _show, \ | 149 | .show = _show, \ |
150 | .store = _store, \ | 150 | .store = _store, \ |
151 | }; | 151 | }; |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 48f857ae8748..d3da1fb05b9b 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -112,7 +112,8 @@ exit: | |||
112 | mutex_unlock(&data->update_lock); | 112 | mutex_unlock(&data->update_lock); |
113 | } | 113 | } |
114 | 114 | ||
115 | static ssize_t eeprom_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 115 | static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
116 | char *buf, loff_t off, size_t count) | ||
116 | { | 117 | { |
117 | struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); | 118 | struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); |
118 | struct eeprom_data *data = i2c_get_clientdata(client); | 119 | struct eeprom_data *data = i2c_get_clientdata(client); |
@@ -145,7 +146,6 @@ static struct bin_attribute eeprom_attr = { | |||
145 | .attr = { | 146 | .attr = { |
146 | .name = "eeprom", | 147 | .name = "eeprom", |
147 | .mode = S_IRUGO, | 148 | .mode = S_IRUGO, |
148 | .owner = THIS_MODULE, | ||
149 | }, | 149 | }, |
150 | .size = EEPROM_SIZE, | 150 | .size = EEPROM_SIZE, |
151 | .read = eeprom_read, | 151 | .read = eeprom_read, |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index e9e9e5171b53..64692f666372 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -126,8 +126,9 @@ exit_up: | |||
126 | mutex_unlock(&data->update_lock); | 126 | mutex_unlock(&data->update_lock); |
127 | } | 127 | } |
128 | 128 | ||
129 | static ssize_t max6875_read(struct kobject *kobj, char *buf, loff_t off, | 129 | static ssize_t max6875_read(struct kobject *kobj, |
130 | size_t count) | 130 | struct bin_attribute *bin_attr, |
131 | char *buf, loff_t off, size_t count) | ||
131 | { | 132 | { |
132 | struct i2c_client *client = kobj_to_i2c_client(kobj); | 133 | struct i2c_client *client = kobj_to_i2c_client(kobj); |
133 | struct max6875_data *data = i2c_get_clientdata(client); | 134 | struct max6875_data *data = i2c_get_clientdata(client); |
@@ -153,7 +154,6 @@ static struct bin_attribute user_eeprom_attr = { | |||
153 | .attr = { | 154 | .attr = { |
154 | .name = "eeprom", | 155 | .name = "eeprom", |
155 | .mode = S_IRUGO, | 156 | .mode = S_IRUGO, |
156 | .owner = THIS_MODULE, | ||
157 | }, | 157 | }, |
158 | .size = USER_EEPROM_SIZE, | 158 | .size = USER_EEPROM_SIZE, |
159 | .read = max6875_read, | 159 | .read = max6875_read, |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 08c299ebf4a8..bf9b99292048 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -479,7 +479,6 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *, | |||
479 | 479 | ||
480 | element->attr.attr.name = element->name; | 480 | element->attr.attr.name = element->name; |
481 | element->attr.attr.mode = S_IRUGO; | 481 | element->attr.attr.mode = S_IRUGO; |
482 | element->attr.attr.owner = THIS_MODULE; | ||
483 | element->attr.show = show; | 482 | element->attr.show = show; |
484 | element->index = i; | 483 | element->index = i; |
485 | 484 | ||
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 27a68835b5ba..1317bdd8cc7c 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -119,7 +119,6 @@ static struct psmouse_attribute psmouse_attr_##_name = { \ | |||
119 | .attr = { \ | 119 | .attr = { \ |
120 | .name = __stringify(_name), \ | 120 | .name = __stringify(_name), \ |
121 | .mode = _mode, \ | 121 | .mode = _mode, \ |
122 | .owner = THIS_MODULE, \ | ||
123 | }, \ | 122 | }, \ |
124 | .show = psmouse_attr_show_helper, \ | 123 | .show = psmouse_attr_show_helper, \ |
125 | .store = psmouse_attr_set_helper, \ | 124 | .store = psmouse_attr_set_helper, \ |
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index 11ced17f438a..4fcb245ba184 100644 --- a/drivers/macintosh/windfarm_core.c +++ b/drivers/macintosh/windfarm_core.c | |||
@@ -212,7 +212,6 @@ int wf_register_control(struct wf_control *new_ct) | |||
212 | list_add(&new_ct->link, &wf_controls); | 212 | list_add(&new_ct->link, &wf_controls); |
213 | 213 | ||
214 | new_ct->attr.attr.name = new_ct->name; | 214 | new_ct->attr.attr.name = new_ct->name; |
215 | new_ct->attr.attr.owner = THIS_MODULE; | ||
216 | new_ct->attr.attr.mode = 0644; | 215 | new_ct->attr.attr.mode = 0644; |
217 | new_ct->attr.show = wf_show_control; | 216 | new_ct->attr.show = wf_show_control; |
218 | new_ct->attr.store = wf_store_control; | 217 | new_ct->attr.store = wf_store_control; |
@@ -325,7 +324,6 @@ int wf_register_sensor(struct wf_sensor *new_sr) | |||
325 | list_add(&new_sr->link, &wf_sensors); | 324 | list_add(&new_sr->link, &wf_sensors); |
326 | 325 | ||
327 | new_sr->attr.attr.name = new_sr->name; | 326 | new_sr->attr.attr.name = new_sr->name; |
328 | new_sr->attr.attr.owner = THIS_MODULE; | ||
329 | new_sr->attr.attr.mode = 0444; | 327 | new_sr->attr.attr.mode = 0444; |
330 | new_sr->attr.show = wf_show_sensor; | 328 | new_sr->attr.show = wf_show_sensor; |
331 | new_sr->attr.store = NULL; | 329 | new_sr->attr.store = NULL; |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 4f9060a2a2f2..7798f590e5aa 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -737,8 +737,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | |||
737 | struct device_attribute dev_attr_##_name = { \ | 737 | struct device_attribute dev_attr_##_name = { \ |
738 | .attr = { \ | 738 | .attr = { \ |
739 | .name = __stringify(_name), \ | 739 | .name = __stringify(_name), \ |
740 | .mode = 0, \ | 740 | .mode = 0 }, \ |
741 | .owner = THIS_MODULE }, \ | ||
742 | .show = NULL, \ | 741 | .show = NULL, \ |
743 | .store = NULL, \ | 742 | .store = NULL, \ |
744 | } | 743 | } |
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c index 41e901f53e7c..932a415197b3 100644 --- a/drivers/misc/msi-laptop.c +++ b/drivers/misc/msi-laptop.c | |||
@@ -23,6 +23,8 @@ | |||
23 | * msi-laptop.c - MSI S270 laptop support. This laptop is sold under | 23 | * msi-laptop.c - MSI S270 laptop support. This laptop is sold under |
24 | * various brands, including "Cytron/TCM/Medion/Tchibo MD96100". | 24 | * various brands, including "Cytron/TCM/Medion/Tchibo MD96100". |
25 | * | 25 | * |
26 | * Driver also supports S271, S420 models. | ||
27 | * | ||
26 | * This driver exports a few files in /sys/devices/platform/msi-laptop-pf/: | 28 | * This driver exports a few files in /sys/devices/platform/msi-laptop-pf/: |
27 | * | 29 | * |
28 | * lcd_level - Screen brightness: contains a single integer in the | 30 | * lcd_level - Screen brightness: contains a single integer in the |
@@ -281,25 +283,56 @@ static struct platform_device *msipf_device; | |||
281 | 283 | ||
282 | /* Initialization */ | 284 | /* Initialization */ |
283 | 285 | ||
286 | static int dmi_check_cb(struct dmi_system_id *id) | ||
287 | { | ||
288 | printk("msi-laptop: Identified laptop model '%s'.\n", id->ident); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
284 | static struct dmi_system_id __initdata msi_dmi_table[] = { | 292 | static struct dmi_system_id __initdata msi_dmi_table[] = { |
285 | { | 293 | { |
286 | .ident = "MSI S270", | 294 | .ident = "MSI S270", |
287 | .matches = { | 295 | .matches = { |
288 | DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), | 296 | DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), |
289 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), | 297 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), |
290 | } | 298 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), |
299 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") | ||
300 | }, | ||
301 | .callback = dmi_check_cb | ||
302 | }, | ||
303 | { | ||
304 | .ident = "MSI S271", | ||
305 | .matches = { | ||
306 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | ||
307 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1058"), | ||
308 | DMI_MATCH(DMI_PRODUCT_VERSION, "0581"), | ||
309 | DMI_MATCH(DMI_BOARD_NAME, "MS-1058") | ||
310 | }, | ||
311 | .callback = dmi_check_cb | ||
312 | }, | ||
313 | { | ||
314 | .ident = "MSI S420", | ||
315 | .matches = { | ||
316 | DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"), | ||
317 | DMI_MATCH(DMI_PRODUCT_NAME, "MS-1412"), | ||
318 | DMI_MATCH(DMI_BOARD_VENDOR, "MSI"), | ||
319 | DMI_MATCH(DMI_BOARD_NAME, "MS-1412") | ||
320 | }, | ||
321 | .callback = dmi_check_cb | ||
291 | }, | 322 | }, |
292 | { | 323 | { |
293 | .ident = "Medion MD96100", | 324 | .ident = "Medion MD96100", |
294 | .matches = { | 325 | .matches = { |
295 | DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), | 326 | DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), |
296 | DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), | 327 | DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), |
297 | } | 328 | DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), |
329 | DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT'L CO.,LTD") | ||
330 | }, | ||
331 | .callback = dmi_check_cb | ||
298 | }, | 332 | }, |
299 | { } | 333 | { } |
300 | }; | 334 | }; |
301 | 335 | ||
302 | |||
303 | static int __init msi_init(void) | 336 | static int __init msi_init(void) |
304 | { | 337 | { |
305 | int ret; | 338 | int ret; |
@@ -394,3 +427,8 @@ MODULE_AUTHOR("Lennart Poettering"); | |||
394 | MODULE_DESCRIPTION("MSI Laptop Support"); | 427 | MODULE_DESCRIPTION("MSI Laptop Support"); |
395 | MODULE_VERSION(MSI_DRIVER_VERSION); | 428 | MODULE_VERSION(MSI_DRIVER_VERSION); |
396 | MODULE_LICENSE("GPL"); | 429 | MODULE_LICENSE("GPL"); |
430 | |||
431 | MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | ||
432 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); | ||
433 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | ||
434 | MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | ||
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 6ec3d500f334..d96eb7229548 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1337,7 +1337,7 @@ const char * buf, size_t count) | |||
1337 | 1337 | ||
1338 | #define ATTR(_name, _mode) \ | 1338 | #define ATTR(_name, _mode) \ |
1339 | struct attribute veth_##_name##_attr = { \ | 1339 | struct attribute veth_##_name##_attr = { \ |
1340 | .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE \ | 1340 | .name = __stringify(_name), .mode = _mode, \ |
1341 | }; | 1341 | }; |
1342 | 1342 | ||
1343 | static ATTR(active, 0644); | 1343 | static ATTR(active, 0644); |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 924ef0609460..fc4bde259dc7 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -121,14 +121,14 @@ struct pdcspath_entry pdcspath_entry_##_name = { \ | |||
121 | 121 | ||
122 | #define PDCS_ATTR(_name, _mode, _show, _store) \ | 122 | #define PDCS_ATTR(_name, _mode, _show, _store) \ |
123 | struct subsys_attribute pdcs_attr_##_name = { \ | 123 | struct subsys_attribute pdcs_attr_##_name = { \ |
124 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ | 124 | .attr = {.name = __stringify(_name), .mode = _mode}, \ |
125 | .show = _show, \ | 125 | .show = _show, \ |
126 | .store = _store, \ | 126 | .store = _store, \ |
127 | }; | 127 | }; |
128 | 128 | ||
129 | #define PATHS_ATTR(_name, _mode, _show, _store) \ | 129 | #define PATHS_ATTR(_name, _mode, _show, _store) \ |
130 | struct pdcspath_attribute paths_attr_##_name = { \ | 130 | struct pdcspath_attribute paths_attr_##_name = { \ |
131 | .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \ | 131 | .attr = {.name = __stringify(_name), .mode = _mode}, \ |
132 | .show = _show, \ | 132 | .show = _show, \ |
133 | .store = _store, \ | 133 | .store = _store, \ |
134 | }; | 134 | }; |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index e7322c25d377..70db38c0ced9 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -106,7 +106,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status); | |||
106 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context); | 106 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context); |
107 | static int ibm_get_table_from_acpi(char **bufp); | 107 | static int ibm_get_table_from_acpi(char **bufp); |
108 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 108 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
109 | char *buffer, loff_t pos, size_t size); | 109 | struct bin_attribute *bin_attr, |
110 | char *buffer, loff_t pos, size_t size); | ||
110 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | 111 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, |
111 | u32 lvl, void *context, void **rv); | 112 | u32 lvl, void *context, void **rv); |
112 | static int __init ibm_acpiphp_init(void); | 113 | static int __init ibm_acpiphp_init(void); |
@@ -117,7 +118,6 @@ static struct notification ibm_note; | |||
117 | static struct bin_attribute ibm_apci_table_attr = { | 118 | static struct bin_attribute ibm_apci_table_attr = { |
118 | .attr = { | 119 | .attr = { |
119 | .name = "apci_table", | 120 | .name = "apci_table", |
120 | .owner = THIS_MODULE, | ||
121 | .mode = S_IRUGO, | 121 | .mode = S_IRUGO, |
122 | }, | 122 | }, |
123 | .read = ibm_read_apci_table, | 123 | .read = ibm_read_apci_table, |
@@ -358,7 +358,8 @@ read_table_done: | |||
358 | * our solution is to only allow reading the table in all at once | 358 | * our solution is to only allow reading the table in all at once |
359 | **/ | 359 | **/ |
360 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 360 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
361 | char *buffer, loff_t pos, size_t size) | 361 | struct bin_attribute *bin_attr, |
362 | char *buffer, loff_t pos, size_t size) | ||
362 | { | 363 | { |
363 | int bytes_read = -EINVAL; | 364 | int bytes_read = -EINVAL; |
364 | char *table = NULL; | 365 | char *table = NULL; |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 284e83a527f9..6543cbe83be5 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -213,7 +213,8 @@ struct device_attribute pci_dev_attrs[] = { | |||
213 | }; | 213 | }; |
214 | 214 | ||
215 | static ssize_t | 215 | static ssize_t |
216 | pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 216 | pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
217 | char *buf, loff_t off, size_t count) | ||
217 | { | 218 | { |
218 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 219 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
219 | unsigned int size = 64; | 220 | unsigned int size = 64; |
@@ -285,7 +286,8 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
285 | } | 286 | } |
286 | 287 | ||
287 | static ssize_t | 288 | static ssize_t |
288 | pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 289 | pci_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
290 | char *buf, loff_t off, size_t count) | ||
289 | { | 291 | { |
290 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); | 292 | struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); |
291 | unsigned int size = count; | 293 | unsigned int size = count; |
@@ -352,7 +354,8 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
352 | * callback routine (pci_legacy_read). | 354 | * callback routine (pci_legacy_read). |
353 | */ | 355 | */ |
354 | ssize_t | 356 | ssize_t |
355 | pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | 357 | pci_read_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, |
358 | char *buf, loff_t off, size_t count) | ||
356 | { | 359 | { |
357 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 360 | struct pci_bus *bus = to_pci_bus(container_of(kobj, |
358 | struct class_device, | 361 | struct class_device, |
@@ -376,7 +379,8 @@ pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
376 | * callback routine (pci_legacy_write). | 379 | * callback routine (pci_legacy_write). |
377 | */ | 380 | */ |
378 | ssize_t | 381 | ssize_t |
379 | pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off, size_t count) | 382 | pci_write_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, |
383 | char *buf, loff_t off, size_t count) | ||
380 | { | 384 | { |
381 | struct pci_bus *bus = to_pci_bus(container_of(kobj, | 385 | struct pci_bus *bus = to_pci_bus(container_of(kobj, |
382 | struct class_device, | 386 | struct class_device, |
@@ -499,7 +503,6 @@ static int pci_create_resource_files(struct pci_dev *pdev) | |||
499 | sprintf(res_attr_name, "resource%d", i); | 503 | sprintf(res_attr_name, "resource%d", i); |
500 | res_attr->attr.name = res_attr_name; | 504 | res_attr->attr.name = res_attr_name; |
501 | res_attr->attr.mode = S_IRUSR | S_IWUSR; | 505 | res_attr->attr.mode = S_IRUSR | S_IWUSR; |
502 | res_attr->attr.owner = THIS_MODULE; | ||
503 | res_attr->size = pci_resource_len(pdev, i); | 506 | res_attr->size = pci_resource_len(pdev, i); |
504 | res_attr->mmap = pci_mmap_resource; | 507 | res_attr->mmap = pci_mmap_resource; |
505 | res_attr->private = &pdev->resource[i]; | 508 | res_attr->private = &pdev->resource[i]; |
@@ -529,7 +532,8 @@ static inline void pci_remove_resource_files(struct pci_dev *dev) { return; } | |||
529 | * writing anything except 0 enables it | 532 | * writing anything except 0 enables it |
530 | */ | 533 | */ |
531 | static ssize_t | 534 | static ssize_t |
532 | pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | 535 | pci_write_rom(struct kobject *kobj, struct bin_attribute *bin_attr, |
536 | char *buf, loff_t off, size_t count) | ||
533 | { | 537 | { |
534 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 538 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
535 | 539 | ||
@@ -552,7 +556,8 @@ pci_write_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
552 | * device corresponding to @kobj. | 556 | * device corresponding to @kobj. |
553 | */ | 557 | */ |
554 | static ssize_t | 558 | static ssize_t |
555 | pci_read_rom(struct kobject *kobj, char *buf, loff_t off, size_t count) | 559 | pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr, |
560 | char *buf, loff_t off, size_t count) | ||
556 | { | 561 | { |
557 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); | 562 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); |
558 | void __iomem *rom; | 563 | void __iomem *rom; |
@@ -582,7 +587,6 @@ static struct bin_attribute pci_config_attr = { | |||
582 | .attr = { | 587 | .attr = { |
583 | .name = "config", | 588 | .name = "config", |
584 | .mode = S_IRUGO | S_IWUSR, | 589 | .mode = S_IRUGO | S_IWUSR, |
585 | .owner = THIS_MODULE, | ||
586 | }, | 590 | }, |
587 | .size = 256, | 591 | .size = 256, |
588 | .read = pci_read_config, | 592 | .read = pci_read_config, |
@@ -593,7 +597,6 @@ static struct bin_attribute pcie_config_attr = { | |||
593 | .attr = { | 597 | .attr = { |
594 | .name = "config", | 598 | .name = "config", |
595 | .mode = S_IRUGO | S_IWUSR, | 599 | .mode = S_IRUGO | S_IWUSR, |
596 | .owner = THIS_MODULE, | ||
597 | }, | 600 | }, |
598 | .size = 4096, | 601 | .size = 4096, |
599 | .read = pci_read_config, | 602 | .read = pci_read_config, |
@@ -628,7 +631,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
628 | rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | 631 | rom_attr->size = pci_resource_len(pdev, PCI_ROM_RESOURCE); |
629 | rom_attr->attr.name = "rom"; | 632 | rom_attr->attr.name = "rom"; |
630 | rom_attr->attr.mode = S_IRUSR; | 633 | rom_attr->attr.mode = S_IRUSR; |
631 | rom_attr->attr.owner = THIS_MODULE; | ||
632 | rom_attr->read = pci_read_rom; | 634 | rom_attr->read = pci_read_rom; |
633 | rom_attr->write = pci_write_rom; | 635 | rom_attr->write = pci_write_rom; |
634 | retval = sysfs_create_bin_file(&pdev->dev.kobj, rom_attr); | 636 | retval = sysfs_create_bin_file(&pdev->dev.kobj, rom_attr); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e48fcf089621..08783bd381f5 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -39,7 +39,6 @@ static void pci_create_legacy_files(struct pci_bus *b) | |||
39 | b->legacy_io->attr.name = "legacy_io"; | 39 | b->legacy_io->attr.name = "legacy_io"; |
40 | b->legacy_io->size = 0xffff; | 40 | b->legacy_io->size = 0xffff; |
41 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; | 41 | b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; |
42 | b->legacy_io->attr.owner = THIS_MODULE; | ||
43 | b->legacy_io->read = pci_read_legacy_io; | 42 | b->legacy_io->read = pci_read_legacy_io; |
44 | b->legacy_io->write = pci_write_legacy_io; | 43 | b->legacy_io->write = pci_write_legacy_io; |
45 | class_device_create_bin_file(&b->class_dev, b->legacy_io); | 44 | class_device_create_bin_file(&b->class_dev, b->legacy_io); |
@@ -49,7 +48,6 @@ static void pci_create_legacy_files(struct pci_bus *b) | |||
49 | b->legacy_mem->attr.name = "legacy_mem"; | 48 | b->legacy_mem->attr.name = "legacy_mem"; |
50 | b->legacy_mem->size = 1024*1024; | 49 | b->legacy_mem->size = 1024*1024; |
51 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; | 50 | b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; |
52 | b->legacy_mem->attr.owner = THIS_MODULE; | ||
53 | b->legacy_mem->mmap = pci_mmap_legacy_mem; | 51 | b->legacy_mem->mmap = pci_mmap_legacy_mem; |
54 | class_device_create_bin_file(&b->class_dev, b->legacy_mem); | 52 | class_device_create_bin_file(&b->class_dev, b->legacy_mem); |
55 | } | 53 | } |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index a2bb46526b56..b4409002b7f8 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -283,7 +283,9 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off | |||
283 | return (ret); | 283 | return (ret); |
284 | } | 284 | } |
285 | 285 | ||
286 | static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) | 286 | static ssize_t pccard_show_cis(struct kobject *kobj, |
287 | struct bin_attribute *bin_attr, | ||
288 | char *buf, loff_t off, size_t count) | ||
287 | { | 289 | { |
288 | unsigned int size = 0x200; | 290 | unsigned int size = 0x200; |
289 | 291 | ||
@@ -311,7 +313,9 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size | |||
311 | return (count); | 313 | return (count); |
312 | } | 314 | } |
313 | 315 | ||
314 | static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) | 316 | static ssize_t pccard_store_cis(struct kobject *kobj, |
317 | struct bin_attribute *bin_attr, | ||
318 | char *buf, loff_t off, size_t count) | ||
315 | { | 319 | { |
316 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); | 320 | struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); |
317 | cisdump_t *cis; | 321 | cisdump_t *cis; |
@@ -366,7 +370,7 @@ static struct device_attribute *pccard_socket_attributes[] = { | |||
366 | }; | 370 | }; |
367 | 371 | ||
368 | static struct bin_attribute pccard_cis_attr = { | 372 | static struct bin_attribute pccard_cis_attr = { |
369 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE}, | 373 | .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, |
370 | .size = 0x200, | 374 | .size = 0x200, |
371 | .read = pccard_show_cis, | 375 | .read = pccard_show_cis, |
372 | .write = pccard_store_cis, | 376 | .write = pccard_store_cis, |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index eed91434417d..659e31164cf0 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -67,7 +67,8 @@ struct device_attribute rio_dev_attrs[] = { | |||
67 | }; | 67 | }; |
68 | 68 | ||
69 | static ssize_t | 69 | static ssize_t |
70 | rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 70 | rio_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
71 | char *buf, loff_t off, size_t count) | ||
71 | { | 72 | { |
72 | struct rio_dev *dev = | 73 | struct rio_dev *dev = |
73 | to_rio_dev(container_of(kobj, struct device, kobj)); | 74 | to_rio_dev(container_of(kobj, struct device, kobj)); |
@@ -137,7 +138,8 @@ rio_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
137 | } | 138 | } |
138 | 139 | ||
139 | static ssize_t | 140 | static ssize_t |
140 | rio_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) | 141 | rio_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
142 | char *buf, loff_t off, size_t count) | ||
141 | { | 143 | { |
142 | struct rio_dev *dev = | 144 | struct rio_dev *dev = |
143 | to_rio_dev(container_of(kobj, struct device, kobj)); | 145 | to_rio_dev(container_of(kobj, struct device, kobj)); |
@@ -197,7 +199,6 @@ static struct bin_attribute rio_config_attr = { | |||
197 | .attr = { | 199 | .attr = { |
198 | .name = "config", | 200 | .name = "config", |
199 | .mode = S_IRUGO | S_IWUSR, | 201 | .mode = S_IRUGO | S_IWUSR, |
200 | .owner = THIS_MODULE, | ||
201 | }, | 202 | }, |
202 | .size = 0x200000, | 203 | .size = 0x200000, |
203 | .read = rio_read_config, | 204 | .read = rio_read_config, |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index afa64c7fa2e2..f98a83a11aae 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -258,8 +258,9 @@ static const struct rtc_class_ops ds1553_rtc_ops = { | |||
258 | .ioctl = ds1553_rtc_ioctl, | 258 | .ioctl = ds1553_rtc_ioctl, |
259 | }; | 259 | }; |
260 | 260 | ||
261 | static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, | 261 | static ssize_t ds1553_nvram_read(struct kobject *kobj, |
262 | loff_t pos, size_t size) | 262 | struct bin_attribute *bin_attr, |
263 | char *buf, loff_t pos, size_t size) | ||
263 | { | 264 | { |
264 | struct platform_device *pdev = | 265 | struct platform_device *pdev = |
265 | to_platform_device(container_of(kobj, struct device, kobj)); | 266 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -272,8 +273,9 @@ static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, | |||
272 | return count; | 273 | return count; |
273 | } | 274 | } |
274 | 275 | ||
275 | static ssize_t ds1553_nvram_write(struct kobject *kobj, char *buf, | 276 | static ssize_t ds1553_nvram_write(struct kobject *kobj, |
276 | loff_t pos, size_t size) | 277 | struct bin_attribute *bin_attr, |
278 | char *buf, loff_t pos, size_t size) | ||
277 | { | 279 | { |
278 | struct platform_device *pdev = | 280 | struct platform_device *pdev = |
279 | to_platform_device(container_of(kobj, struct device, kobj)); | 281 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -290,7 +292,6 @@ static struct bin_attribute ds1553_nvram_attr = { | |||
290 | .attr = { | 292 | .attr = { |
291 | .name = "nvram", | 293 | .name = "nvram", |
292 | .mode = S_IRUGO | S_IWUGO, | 294 | .mode = S_IRUGO | S_IWUGO, |
293 | .owner = THIS_MODULE, | ||
294 | }, | 295 | }, |
295 | .size = RTC_OFFSET, | 296 | .size = RTC_OFFSET, |
296 | .read = ds1553_nvram_read, | 297 | .read = ds1553_nvram_read, |
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index d68288b389dc..d1778ae8bca5 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c | |||
@@ -127,8 +127,9 @@ static const struct rtc_class_ops ds1742_rtc_ops = { | |||
127 | .set_time = ds1742_rtc_set_time, | 127 | .set_time = ds1742_rtc_set_time, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, | 130 | static ssize_t ds1742_nvram_read(struct kobject *kobj, |
131 | loff_t pos, size_t size) | 131 | struct bin_attribute *bin_attr, |
132 | char *buf, loff_t pos, size_t size) | ||
132 | { | 133 | { |
133 | struct platform_device *pdev = | 134 | struct platform_device *pdev = |
134 | to_platform_device(container_of(kobj, struct device, kobj)); | 135 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -141,8 +142,9 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, | |||
141 | return count; | 142 | return count; |
142 | } | 143 | } |
143 | 144 | ||
144 | static ssize_t ds1742_nvram_write(struct kobject *kobj, char *buf, | 145 | static ssize_t ds1742_nvram_write(struct kobject *kobj, |
145 | loff_t pos, size_t size) | 146 | struct bin_attribute *bin_attr, |
147 | char *buf, loff_t pos, size_t size) | ||
146 | { | 148 | { |
147 | struct platform_device *pdev = | 149 | struct platform_device *pdev = |
148 | to_platform_device(container_of(kobj, struct device, kobj)); | 150 | to_platform_device(container_of(kobj, struct device, kobj)); |
@@ -159,7 +161,6 @@ static struct bin_attribute ds1742_nvram_attr = { | |||
159 | .attr = { | 161 | .attr = { |
160 | .name = "nvram", | 162 | .name = "nvram", |
161 | .mode = S_IRUGO | S_IWUGO, | 163 | .mode = S_IRUGO | S_IWUGO, |
162 | .owner = THIS_MODULE, | ||
163 | }, | 164 | }, |
164 | .read = ds1742_nvram_read, | 165 | .read = ds1742_nvram_read, |
165 | .write = ds1742_nvram_write, | 166 | .write = ds1742_nvram_write, |
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index ac289e6eadfe..b57d93d986c0 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
@@ -141,8 +141,9 @@ static int s390_vary_chpid(struct chp_id chpid, int on) | |||
141 | /* | 141 | /* |
142 | * Channel measurement related functions | 142 | * Channel measurement related functions |
143 | */ | 143 | */ |
144 | static ssize_t chp_measurement_chars_read(struct kobject *kobj, char *buf, | 144 | static ssize_t chp_measurement_chars_read(struct kobject *kobj, |
145 | loff_t off, size_t count) | 145 | struct bin_attribute *bin_attr, |
146 | char *buf, loff_t off, size_t count) | ||
146 | { | 147 | { |
147 | struct channel_path *chp; | 148 | struct channel_path *chp; |
148 | unsigned int size; | 149 | unsigned int size; |
@@ -165,7 +166,6 @@ static struct bin_attribute chp_measurement_chars_attr = { | |||
165 | .attr = { | 166 | .attr = { |
166 | .name = "measurement_chars", | 167 | .name = "measurement_chars", |
167 | .mode = S_IRUSR, | 168 | .mode = S_IRUSR, |
168 | .owner = THIS_MODULE, | ||
169 | }, | 169 | }, |
170 | .size = sizeof(struct cmg_chars), | 170 | .size = sizeof(struct cmg_chars), |
171 | .read = chp_measurement_chars_read, | 171 | .read = chp_measurement_chars_read, |
@@ -193,8 +193,9 @@ static void chp_measurement_copy_block(struct cmg_entry *buf, | |||
193 | } while (reference_buf.values[0] != buf->values[0]); | 193 | } while (reference_buf.values[0] != buf->values[0]); |
194 | } | 194 | } |
195 | 195 | ||
196 | static ssize_t chp_measurement_read(struct kobject *kobj, char *buf, | 196 | static ssize_t chp_measurement_read(struct kobject *kobj, |
197 | loff_t off, size_t count) | 197 | struct bin_attribute *bin_attr, |
198 | char *buf, loff_t off, size_t count) | ||
198 | { | 199 | { |
199 | struct channel_path *chp; | 200 | struct channel_path *chp; |
200 | struct channel_subsystem *css; | 201 | struct channel_subsystem *css; |
@@ -217,7 +218,6 @@ static struct bin_attribute chp_measurement_attr = { | |||
217 | .attr = { | 218 | .attr = { |
218 | .name = "measurement", | 219 | .name = "measurement", |
219 | .mode = S_IRUSR, | 220 | .mode = S_IRUSR, |
220 | .owner = THIS_MODULE, | ||
221 | }, | 221 | }, |
222 | .size = sizeof(struct cmg_entry), | 222 | .size = sizeof(struct cmg_entry), |
223 | .read = chp_measurement_read, | 223 | .read = chp_measurement_read, |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 65ffc21afc37..bb0287ad1aac 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -991,7 +991,7 @@ static struct attribute_group qeth_osn_device_attr_group = { | |||
991 | 991 | ||
992 | #define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \ | 992 | #define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \ |
993 | struct device_attribute dev_attr_##_id = { \ | 993 | struct device_attribute dev_attr_##_id = { \ |
994 | .attr = {.name=__stringify(_name), .mode=_mode, .owner=THIS_MODULE },\ | 994 | .attr = {.name=__stringify(_name), .mode=_mode, },\ |
995 | .show = _show, \ | 995 | .show = _show, \ |
996 | .store = _store, \ | 996 | .store = _store, \ |
997 | }; | 997 | }; |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index 03bfed61bffc..06c0dce3b839 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -59,8 +59,9 @@ | |||
59 | struct class_device_attribute *arcmsr_host_attrs[]; | 59 | struct class_device_attribute *arcmsr_host_attrs[]; |
60 | 60 | ||
61 | static ssize_t | 61 | static ssize_t |
62 | arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, | 62 | arcmsr_sysfs_iop_message_read(struct kobject *kobj, |
63 | size_t count) | 63 | struct bin_attribute *bin_attr, |
64 | char *buf, loff_t off, size_t count) | ||
64 | { | 65 | { |
65 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 66 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
66 | struct Scsi_Host *host = class_to_shost(cdev); | 67 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -105,8 +106,9 @@ arcmsr_sysfs_iop_message_read(struct kobject *kobj, char *buf, loff_t off, | |||
105 | } | 106 | } |
106 | 107 | ||
107 | static ssize_t | 108 | static ssize_t |
108 | arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, | 109 | arcmsr_sysfs_iop_message_write(struct kobject *kobj, |
109 | size_t count) | 110 | struct bin_attribute *bin_attr, |
111 | char *buf, loff_t off, size_t count) | ||
110 | { | 112 | { |
111 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 113 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
112 | struct Scsi_Host *host = class_to_shost(cdev); | 114 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -152,8 +154,9 @@ arcmsr_sysfs_iop_message_write(struct kobject *kobj, char *buf, loff_t off, | |||
152 | } | 154 | } |
153 | 155 | ||
154 | static ssize_t | 156 | static ssize_t |
155 | arcmsr_sysfs_iop_message_clear(struct kobject *kobj, char *buf, loff_t off, | 157 | arcmsr_sysfs_iop_message_clear(struct kobject *kobj, |
156 | size_t count) | 158 | struct bin_attribute *bin_attr, |
159 | char *buf, loff_t off, size_t count) | ||
157 | { | 160 | { |
158 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 161 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
159 | struct Scsi_Host *host = class_to_shost(cdev); | 162 | struct Scsi_Host *host = class_to_shost(cdev); |
@@ -188,7 +191,6 @@ static struct bin_attribute arcmsr_sysfs_message_read_attr = { | |||
188 | .attr = { | 191 | .attr = { |
189 | .name = "mu_read", | 192 | .name = "mu_read", |
190 | .mode = S_IRUSR , | 193 | .mode = S_IRUSR , |
191 | .owner = THIS_MODULE, | ||
192 | }, | 194 | }, |
193 | .size = 1032, | 195 | .size = 1032, |
194 | .read = arcmsr_sysfs_iop_message_read, | 196 | .read = arcmsr_sysfs_iop_message_read, |
@@ -198,7 +200,6 @@ static struct bin_attribute arcmsr_sysfs_message_write_attr = { | |||
198 | .attr = { | 200 | .attr = { |
199 | .name = "mu_write", | 201 | .name = "mu_write", |
200 | .mode = S_IWUSR, | 202 | .mode = S_IWUSR, |
201 | .owner = THIS_MODULE, | ||
202 | }, | 203 | }, |
203 | .size = 1032, | 204 | .size = 1032, |
204 | .write = arcmsr_sysfs_iop_message_write, | 205 | .write = arcmsr_sysfs_iop_message_write, |
@@ -208,7 +209,6 @@ static struct bin_attribute arcmsr_sysfs_message_clear_attr = { | |||
208 | .attr = { | 209 | .attr = { |
209 | .name = "mu_clear", | 210 | .name = "mu_clear", |
210 | .mode = S_IWUSR, | 211 | .mode = S_IWUSR, |
211 | .owner = THIS_MODULE, | ||
212 | }, | 212 | }, |
213 | .size = 1, | 213 | .size = 1, |
214 | .write = arcmsr_sysfs_iop_message_clear, | 214 | .write = arcmsr_sysfs_iop_message_clear, |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index fa6ff295e568..4a3083ea59d5 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2465,6 +2465,7 @@ restart: | |||
2465 | /** | 2465 | /** |
2466 | * ipr_read_trace - Dump the adapter trace | 2466 | * ipr_read_trace - Dump the adapter trace |
2467 | * @kobj: kobject struct | 2467 | * @kobj: kobject struct |
2468 | * @bin_attr: bin_attribute struct | ||
2468 | * @buf: buffer | 2469 | * @buf: buffer |
2469 | * @off: offset | 2470 | * @off: offset |
2470 | * @count: buffer size | 2471 | * @count: buffer size |
@@ -2472,8 +2473,9 @@ restart: | |||
2472 | * Return value: | 2473 | * Return value: |
2473 | * number of bytes printed to buffer | 2474 | * number of bytes printed to buffer |
2474 | **/ | 2475 | **/ |
2475 | static ssize_t ipr_read_trace(struct kobject *kobj, char *buf, | 2476 | static ssize_t ipr_read_trace(struct kobject *kobj, |
2476 | loff_t off, size_t count) | 2477 | struct bin_attribute *bin_attr, |
2478 | char *buf, loff_t off, size_t count) | ||
2477 | { | 2479 | { |
2478 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 2480 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
2479 | struct Scsi_Host *shost = class_to_shost(cdev); | 2481 | struct Scsi_Host *shost = class_to_shost(cdev); |
@@ -3166,6 +3168,7 @@ static struct class_device_attribute *ipr_ioa_attrs[] = { | |||
3166 | /** | 3168 | /** |
3167 | * ipr_read_dump - Dump the adapter | 3169 | * ipr_read_dump - Dump the adapter |
3168 | * @kobj: kobject struct | 3170 | * @kobj: kobject struct |
3171 | * @bin_attr: bin_attribute struct | ||
3169 | * @buf: buffer | 3172 | * @buf: buffer |
3170 | * @off: offset | 3173 | * @off: offset |
3171 | * @count: buffer size | 3174 | * @count: buffer size |
@@ -3173,8 +3176,9 @@ static struct class_device_attribute *ipr_ioa_attrs[] = { | |||
3173 | * Return value: | 3176 | * Return value: |
3174 | * number of bytes printed to buffer | 3177 | * number of bytes printed to buffer |
3175 | **/ | 3178 | **/ |
3176 | static ssize_t ipr_read_dump(struct kobject *kobj, char *buf, | 3179 | static ssize_t ipr_read_dump(struct kobject *kobj, |
3177 | loff_t off, size_t count) | 3180 | struct bin_attribute *bin_attr, |
3181 | char *buf, loff_t off, size_t count) | ||
3178 | { | 3182 | { |
3179 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3183 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
3180 | struct Scsi_Host *shost = class_to_shost(cdev); | 3184 | struct Scsi_Host *shost = class_to_shost(cdev); |
@@ -3327,6 +3331,7 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) | |||
3327 | /** | 3331 | /** |
3328 | * ipr_write_dump - Setup dump state of adapter | 3332 | * ipr_write_dump - Setup dump state of adapter |
3329 | * @kobj: kobject struct | 3333 | * @kobj: kobject struct |
3334 | * @bin_attr: bin_attribute struct | ||
3330 | * @buf: buffer | 3335 | * @buf: buffer |
3331 | * @off: offset | 3336 | * @off: offset |
3332 | * @count: buffer size | 3337 | * @count: buffer size |
@@ -3334,8 +3339,9 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) | |||
3334 | * Return value: | 3339 | * Return value: |
3335 | * number of bytes printed to buffer | 3340 | * number of bytes printed to buffer |
3336 | **/ | 3341 | **/ |
3337 | static ssize_t ipr_write_dump(struct kobject *kobj, char *buf, | 3342 | static ssize_t ipr_write_dump(struct kobject *kobj, |
3338 | loff_t off, size_t count) | 3343 | struct bin_attribute *bin_attr, |
3344 | char *buf, loff_t off, size_t count) | ||
3339 | { | 3345 | { |
3340 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3346 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); |
3341 | struct Scsi_Host *shost = class_to_shost(cdev); | 3347 | struct Scsi_Host *shost = class_to_shost(cdev); |
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index e34442e405e8..23e90c5f8f35 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -38,8 +38,10 @@ static int sas_disable_routing(struct domain_device *dev, u8 *sas_addr); | |||
38 | 38 | ||
39 | #if 0 | 39 | #if 0 |
40 | /* FIXME: smp needs to migrate into the sas class */ | 40 | /* FIXME: smp needs to migrate into the sas class */ |
41 | static ssize_t smp_portal_read(struct kobject *, char *, loff_t, size_t); | 41 | static ssize_t smp_portal_read(struct kobject *, struct bin_attribute *, |
42 | static ssize_t smp_portal_write(struct kobject *, char *, loff_t, size_t); | 42 | char *, loff_t, size_t); |
43 | static ssize_t smp_portal_write(struct kobject *, struct bin_attribute *, | ||
44 | char *, loff_t, size_t); | ||
43 | #endif | 45 | #endif |
44 | 46 | ||
45 | /* ---------- SMP task management ---------- */ | 47 | /* ---------- SMP task management ---------- */ |
@@ -1368,7 +1370,6 @@ static void sas_ex_smp_hook(struct domain_device *dev) | |||
1368 | memset(bin_attr, 0, sizeof(*bin_attr)); | 1370 | memset(bin_attr, 0, sizeof(*bin_attr)); |
1369 | 1371 | ||
1370 | bin_attr->attr.name = SMP_BIN_ATTR_NAME; | 1372 | bin_attr->attr.name = SMP_BIN_ATTR_NAME; |
1371 | bin_attr->attr.owner = THIS_MODULE; | ||
1372 | bin_attr->attr.mode = 0600; | 1373 | bin_attr->attr.mode = 0600; |
1373 | 1374 | ||
1374 | bin_attr->size = 0; | 1375 | bin_attr->size = 0; |
@@ -1846,8 +1847,9 @@ out: | |||
1846 | #if 0 | 1847 | #if 0 |
1847 | /* ---------- SMP portal ---------- */ | 1848 | /* ---------- SMP portal ---------- */ |
1848 | 1849 | ||
1849 | static ssize_t smp_portal_write(struct kobject *kobj, char *buf, loff_t offs, | 1850 | static ssize_t smp_portal_write(struct kobject *kobj, |
1850 | size_t size) | 1851 | struct bin_attribute *bin_attr, |
1852 | char *buf, loff_t offs, size_t size) | ||
1851 | { | 1853 | { |
1852 | struct domain_device *dev = to_dom_device(kobj); | 1854 | struct domain_device *dev = to_dom_device(kobj); |
1853 | struct expander_device *ex = &dev->ex_dev; | 1855 | struct expander_device *ex = &dev->ex_dev; |
@@ -1873,8 +1875,9 @@ static ssize_t smp_portal_write(struct kobject *kobj, char *buf, loff_t offs, | |||
1873 | return size; | 1875 | return size; |
1874 | } | 1876 | } |
1875 | 1877 | ||
1876 | static ssize_t smp_portal_read(struct kobject *kobj, char *buf, loff_t offs, | 1878 | static ssize_t smp_portal_read(struct kobject *kobj, |
1877 | size_t size) | 1879 | struct bin_attribute *bin_attr, |
1880 | char *buf, loff_t offs, size_t size) | ||
1878 | { | 1881 | { |
1879 | struct domain_device *dev = to_dom_device(kobj); | 1882 | struct domain_device *dev = to_dom_device(kobj); |
1880 | struct expander_device *ex = &dev->ex_dev; | 1883 | struct expander_device *ex = &dev->ex_dev; |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 95fe77e816f8..5dfda9778c80 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1133,7 +1133,8 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
1133 | }; | 1133 | }; |
1134 | 1134 | ||
1135 | static ssize_t | 1135 | static ssize_t |
1136 | sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1136 | sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1137 | char *buf, loff_t off, size_t count) | ||
1137 | { | 1138 | { |
1138 | size_t buf_off; | 1139 | size_t buf_off; |
1139 | struct Scsi_Host *host = class_to_shost(container_of(kobj, | 1140 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
@@ -1165,7 +1166,8 @@ sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1165 | } | 1166 | } |
1166 | 1167 | ||
1167 | static ssize_t | 1168 | static ssize_t |
1168 | sysfs_ctlreg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1169 | sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
1170 | char *buf, loff_t off, size_t count) | ||
1169 | { | 1171 | { |
1170 | size_t buf_off; | 1172 | size_t buf_off; |
1171 | uint32_t * tmp_ptr; | 1173 | uint32_t * tmp_ptr; |
@@ -1200,7 +1202,6 @@ static struct bin_attribute sysfs_ctlreg_attr = { | |||
1200 | .attr = { | 1202 | .attr = { |
1201 | .name = "ctlreg", | 1203 | .name = "ctlreg", |
1202 | .mode = S_IRUSR | S_IWUSR, | 1204 | .mode = S_IRUSR | S_IWUSR, |
1203 | .owner = THIS_MODULE, | ||
1204 | }, | 1205 | }, |
1205 | .size = 256, | 1206 | .size = 256, |
1206 | .read = sysfs_ctlreg_read, | 1207 | .read = sysfs_ctlreg_read, |
@@ -1222,7 +1223,8 @@ sysfs_mbox_idle (struct lpfc_hba * phba) | |||
1222 | } | 1223 | } |
1223 | 1224 | ||
1224 | static ssize_t | 1225 | static ssize_t |
1225 | sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1226 | sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1227 | char *buf, loff_t off, size_t count) | ||
1226 | { | 1228 | { |
1227 | struct Scsi_Host * host = | 1229 | struct Scsi_Host * host = |
1228 | class_to_shost(container_of(kobj, struct class_device, kobj)); | 1230 | class_to_shost(container_of(kobj, struct class_device, kobj)); |
@@ -1274,7 +1276,8 @@ sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
1274 | } | 1276 | } |
1275 | 1277 | ||
1276 | static ssize_t | 1278 | static ssize_t |
1277 | sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 1279 | sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
1280 | char *buf, loff_t off, size_t count) | ||
1278 | { | 1281 | { |
1279 | struct Scsi_Host *host = | 1282 | struct Scsi_Host *host = |
1280 | class_to_shost(container_of(kobj, struct class_device, | 1283 | class_to_shost(container_of(kobj, struct class_device, |
@@ -1422,7 +1425,6 @@ static struct bin_attribute sysfs_mbox_attr = { | |||
1422 | .attr = { | 1425 | .attr = { |
1423 | .name = "mbox", | 1426 | .name = "mbox", |
1424 | .mode = S_IRUSR | S_IWUSR, | 1427 | .mode = S_IRUSR | S_IWUSR, |
1425 | .owner = THIS_MODULE, | ||
1426 | }, | 1428 | }, |
1427 | .size = MAILBOX_CMD_SIZE, | 1429 | .size = MAILBOX_CMD_SIZE, |
1428 | .read = sysfs_mbox_read, | 1430 | .read = sysfs_mbox_read, |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 8081b637d97e..942db9de785e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -11,8 +11,9 @@ | |||
11 | /* SYSFS attributes --------------------------------------------------------- */ | 11 | /* SYSFS attributes --------------------------------------------------------- */ |
12 | 12 | ||
13 | static ssize_t | 13 | static ssize_t |
14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 14 | qla2x00_sysfs_read_fw_dump(struct kobject *kobj, |
15 | size_t count) | 15 | struct bin_attribute *bin_attr, |
16 | char *buf, loff_t off, size_t count) | ||
16 | { | 17 | { |
17 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 18 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
18 | struct device, kobj))); | 19 | struct device, kobj))); |
@@ -31,8 +32,9 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off, | |||
31 | } | 32 | } |
32 | 33 | ||
33 | static ssize_t | 34 | static ssize_t |
34 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off, | 35 | qla2x00_sysfs_write_fw_dump(struct kobject *kobj, |
35 | size_t count) | 36 | struct bin_attribute *bin_attr, |
37 | char *buf, loff_t off, size_t count) | ||
36 | { | 38 | { |
37 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 39 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
38 | struct device, kobj))); | 40 | struct device, kobj))); |
@@ -73,7 +75,6 @@ static struct bin_attribute sysfs_fw_dump_attr = { | |||
73 | .attr = { | 75 | .attr = { |
74 | .name = "fw_dump", | 76 | .name = "fw_dump", |
75 | .mode = S_IRUSR | S_IWUSR, | 77 | .mode = S_IRUSR | S_IWUSR, |
76 | .owner = THIS_MODULE, | ||
77 | }, | 78 | }, |
78 | .size = 0, | 79 | .size = 0, |
79 | .read = qla2x00_sysfs_read_fw_dump, | 80 | .read = qla2x00_sysfs_read_fw_dump, |
@@ -81,8 +82,9 @@ static struct bin_attribute sysfs_fw_dump_attr = { | |||
81 | }; | 82 | }; |
82 | 83 | ||
83 | static ssize_t | 84 | static ssize_t |
84 | qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | 85 | qla2x00_sysfs_read_nvram(struct kobject *kobj, |
85 | size_t count) | 86 | struct bin_attribute *bin_attr, |
87 | char *buf, loff_t off, size_t count) | ||
86 | { | 88 | { |
87 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 89 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
88 | struct device, kobj))); | 90 | struct device, kobj))); |
@@ -101,8 +103,9 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off, | |||
101 | } | 103 | } |
102 | 104 | ||
103 | static ssize_t | 105 | static ssize_t |
104 | qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off, | 106 | qla2x00_sysfs_write_nvram(struct kobject *kobj, |
105 | size_t count) | 107 | struct bin_attribute *bin_attr, |
108 | char *buf, loff_t off, size_t count) | ||
106 | { | 109 | { |
107 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 110 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
108 | struct device, kobj))); | 111 | struct device, kobj))); |
@@ -149,7 +152,6 @@ static struct bin_attribute sysfs_nvram_attr = { | |||
149 | .attr = { | 152 | .attr = { |
150 | .name = "nvram", | 153 | .name = "nvram", |
151 | .mode = S_IRUSR | S_IWUSR, | 154 | .mode = S_IRUSR | S_IWUSR, |
152 | .owner = THIS_MODULE, | ||
153 | }, | 155 | }, |
154 | .size = 512, | 156 | .size = 512, |
155 | .read = qla2x00_sysfs_read_nvram, | 157 | .read = qla2x00_sysfs_read_nvram, |
@@ -157,8 +159,9 @@ static struct bin_attribute sysfs_nvram_attr = { | |||
157 | }; | 159 | }; |
158 | 160 | ||
159 | static ssize_t | 161 | static ssize_t |
160 | qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | 162 | qla2x00_sysfs_read_optrom(struct kobject *kobj, |
161 | size_t count) | 163 | struct bin_attribute *bin_attr, |
164 | char *buf, loff_t off, size_t count) | ||
162 | { | 165 | { |
163 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 166 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
164 | struct device, kobj))); | 167 | struct device, kobj))); |
@@ -176,8 +179,9 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, char *buf, loff_t off, | |||
176 | } | 179 | } |
177 | 180 | ||
178 | static ssize_t | 181 | static ssize_t |
179 | qla2x00_sysfs_write_optrom(struct kobject *kobj, char *buf, loff_t off, | 182 | qla2x00_sysfs_write_optrom(struct kobject *kobj, |
180 | size_t count) | 183 | struct bin_attribute *bin_attr, |
184 | char *buf, loff_t off, size_t count) | ||
181 | { | 185 | { |
182 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 186 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
183 | struct device, kobj))); | 187 | struct device, kobj))); |
@@ -198,7 +202,6 @@ static struct bin_attribute sysfs_optrom_attr = { | |||
198 | .attr = { | 202 | .attr = { |
199 | .name = "optrom", | 203 | .name = "optrom", |
200 | .mode = S_IRUSR | S_IWUSR, | 204 | .mode = S_IRUSR | S_IWUSR, |
201 | .owner = THIS_MODULE, | ||
202 | }, | 205 | }, |
203 | .size = OPTROM_SIZE_24XX, | 206 | .size = OPTROM_SIZE_24XX, |
204 | .read = qla2x00_sysfs_read_optrom, | 207 | .read = qla2x00_sysfs_read_optrom, |
@@ -206,8 +209,9 @@ static struct bin_attribute sysfs_optrom_attr = { | |||
206 | }; | 209 | }; |
207 | 210 | ||
208 | static ssize_t | 211 | static ssize_t |
209 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, char *buf, loff_t off, | 212 | qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, |
210 | size_t count) | 213 | struct bin_attribute *bin_attr, |
214 | char *buf, loff_t off, size_t count) | ||
211 | { | 215 | { |
212 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 216 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
213 | struct device, kobj))); | 217 | struct device, kobj))); |
@@ -279,15 +283,15 @@ static struct bin_attribute sysfs_optrom_ctl_attr = { | |||
279 | .attr = { | 283 | .attr = { |
280 | .name = "optrom_ctl", | 284 | .name = "optrom_ctl", |
281 | .mode = S_IWUSR, | 285 | .mode = S_IWUSR, |
282 | .owner = THIS_MODULE, | ||
283 | }, | 286 | }, |
284 | .size = 0, | 287 | .size = 0, |
285 | .write = qla2x00_sysfs_write_optrom_ctl, | 288 | .write = qla2x00_sysfs_write_optrom_ctl, |
286 | }; | 289 | }; |
287 | 290 | ||
288 | static ssize_t | 291 | static ssize_t |
289 | qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | 292 | qla2x00_sysfs_read_vpd(struct kobject *kobj, |
290 | size_t count) | 293 | struct bin_attribute *bin_attr, |
294 | char *buf, loff_t off, size_t count) | ||
291 | { | 295 | { |
292 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 296 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
293 | struct device, kobj))); | 297 | struct device, kobj))); |
@@ -305,8 +309,9 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, char *buf, loff_t off, | |||
305 | } | 309 | } |
306 | 310 | ||
307 | static ssize_t | 311 | static ssize_t |
308 | qla2x00_sysfs_write_vpd(struct kobject *kobj, char *buf, loff_t off, | 312 | qla2x00_sysfs_write_vpd(struct kobject *kobj, |
309 | size_t count) | 313 | struct bin_attribute *bin_attr, |
314 | char *buf, loff_t off, size_t count) | ||
310 | { | 315 | { |
311 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 316 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
312 | struct device, kobj))); | 317 | struct device, kobj))); |
@@ -327,7 +332,6 @@ static struct bin_attribute sysfs_vpd_attr = { | |||
327 | .attr = { | 332 | .attr = { |
328 | .name = "vpd", | 333 | .name = "vpd", |
329 | .mode = S_IRUSR | S_IWUSR, | 334 | .mode = S_IRUSR | S_IWUSR, |
330 | .owner = THIS_MODULE, | ||
331 | }, | 335 | }, |
332 | .size = 0, | 336 | .size = 0, |
333 | .read = qla2x00_sysfs_read_vpd, | 337 | .read = qla2x00_sysfs_read_vpd, |
@@ -335,8 +339,9 @@ static struct bin_attribute sysfs_vpd_attr = { | |||
335 | }; | 339 | }; |
336 | 340 | ||
337 | static ssize_t | 341 | static ssize_t |
338 | qla2x00_sysfs_read_sfp(struct kobject *kobj, char *buf, loff_t off, | 342 | qla2x00_sysfs_read_sfp(struct kobject *kobj, |
339 | size_t count) | 343 | struct bin_attribute *bin_attr, |
344 | char *buf, loff_t off, size_t count) | ||
340 | { | 345 | { |
341 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, | 346 | struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, |
342 | struct device, kobj))); | 347 | struct device, kobj))); |
@@ -375,7 +380,6 @@ static struct bin_attribute sysfs_sfp_attr = { | |||
375 | .attr = { | 380 | .attr = { |
376 | .name = "sfp", | 381 | .name = "sfp", |
377 | .mode = S_IRUSR | S_IWUSR, | 382 | .mode = S_IRUSR | S_IWUSR, |
378 | .owner = THIS_MODULE, | ||
379 | }, | 383 | }, |
380 | .size = SFP_DEV_SIZE * 2, | 384 | .size = SFP_DEV_SIZE * 2, |
381 | .read = qla2x00_sysfs_read_sfp, | 385 | .read = qla2x00_sysfs_read_sfp, |
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index 8efa07e8b8c2..e007833cca59 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
@@ -111,7 +111,8 @@ at25_ee_read( | |||
111 | } | 111 | } |
112 | 112 | ||
113 | static ssize_t | 113 | static ssize_t |
114 | at25_bin_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 114 | at25_bin_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
115 | char *buf, loff_t off, size_t count) | ||
115 | { | 116 | { |
116 | struct device *dev; | 117 | struct device *dev; |
117 | struct at25_data *at25; | 118 | struct at25_data *at25; |
@@ -236,7 +237,8 @@ at25_ee_write(struct at25_data *at25, char *buf, loff_t off, size_t count) | |||
236 | } | 237 | } |
237 | 238 | ||
238 | static ssize_t | 239 | static ssize_t |
239 | at25_bin_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 240 | at25_bin_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
241 | char *buf, loff_t off, size_t count) | ||
240 | { | 242 | { |
241 | struct device *dev; | 243 | struct device *dev; |
242 | struct at25_data *at25; | 244 | struct at25_data *at25; |
@@ -314,7 +316,6 @@ static int at25_probe(struct spi_device *spi) | |||
314 | */ | 316 | */ |
315 | at25->bin.attr.name = "eeprom"; | 317 | at25->bin.attr.name = "eeprom"; |
316 | at25->bin.attr.mode = S_IRUSR; | 318 | at25->bin.attr.mode = S_IRUSR; |
317 | at25->bin.attr.owner = THIS_MODULE; | ||
318 | at25->bin.read = at25_bin_read; | 319 | at25->bin.read = at25_bin_read; |
319 | 320 | ||
320 | at25->bin.size = at25->chip.byte_len; | 321 | at25->bin.size = at25->chip.byte_len; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 24f10a19dbdb..a9cf8b30bccc 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1109,11 +1109,6 @@ void usb_root_hub_lost_power(struct usb_device *rhdev) | |||
1109 | 1109 | ||
1110 | dev_warn(&rhdev->dev, "root hub lost power or was reset\n"); | 1110 | dev_warn(&rhdev->dev, "root hub lost power or was reset\n"); |
1111 | 1111 | ||
1112 | /* Make sure no potential wakeup events get lost, | ||
1113 | * by forcing the root hub to be resumed. | ||
1114 | */ | ||
1115 | rhdev->dev.power.prev_state.event = PM_EVENT_ON; | ||
1116 | |||
1117 | spin_lock_irqsave(&device_state_lock, flags); | 1112 | spin_lock_irqsave(&device_state_lock, flags); |
1118 | hub = hdev_to_hub(rhdev); | 1113 | hub = hdev_to_hub(rhdev); |
1119 | for (port1 = 1; port1 <= rhdev->maxchild; ++port1) { | 1114 | for (port1 = 1; port1 <= rhdev->maxchild; ++port1) { |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 2ce050193018..2349e71b0083 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -2102,7 +2102,9 @@ static ssize_t radeon_show_one_edid(char *buf, loff_t off, size_t count, const u | |||
2102 | } | 2102 | } |
2103 | 2103 | ||
2104 | 2104 | ||
2105 | static ssize_t radeon_show_edid1(struct kobject *kobj, char *buf, loff_t off, size_t count) | 2105 | static ssize_t radeon_show_edid1(struct kobject *kobj, |
2106 | struct bin_attribute *bin_attr, | ||
2107 | char *buf, loff_t off, size_t count) | ||
2106 | { | 2108 | { |
2107 | struct device *dev = container_of(kobj, struct device, kobj); | 2109 | struct device *dev = container_of(kobj, struct device, kobj); |
2108 | struct pci_dev *pdev = to_pci_dev(dev); | 2110 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -2113,7 +2115,9 @@ static ssize_t radeon_show_edid1(struct kobject *kobj, char *buf, loff_t off, si | |||
2113 | } | 2115 | } |
2114 | 2116 | ||
2115 | 2117 | ||
2116 | static ssize_t radeon_show_edid2(struct kobject *kobj, char *buf, loff_t off, size_t count) | 2118 | static ssize_t radeon_show_edid2(struct kobject *kobj, |
2119 | struct bin_attribute *bin_attr, | ||
2120 | char *buf, loff_t off, size_t count) | ||
2117 | { | 2121 | { |
2118 | struct device *dev = container_of(kobj, struct device, kobj); | 2122 | struct device *dev = container_of(kobj, struct device, kobj); |
2119 | struct pci_dev *pdev = to_pci_dev(dev); | 2123 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -2126,7 +2130,6 @@ static ssize_t radeon_show_edid2(struct kobject *kobj, char *buf, loff_t off, si | |||
2126 | static struct bin_attribute edid1_attr = { | 2130 | static struct bin_attribute edid1_attr = { |
2127 | .attr = { | 2131 | .attr = { |
2128 | .name = "edid1", | 2132 | .name = "edid1", |
2129 | .owner = THIS_MODULE, | ||
2130 | .mode = 0444, | 2133 | .mode = 0444, |
2131 | }, | 2134 | }, |
2132 | .size = EDID_LENGTH, | 2135 | .size = EDID_LENGTH, |
@@ -2136,7 +2139,6 @@ static struct bin_attribute edid1_attr = { | |||
2136 | static struct bin_attribute edid2_attr = { | 2139 | static struct bin_attribute edid2_attr = { |
2137 | .attr = { | 2140 | .attr = { |
2138 | .name = "edid2", | 2141 | .name = "edid2", |
2139 | .owner = THIS_MODULE, | ||
2140 | .mode = 0444, | 2142 | .mode = 0444, |
2141 | }, | 2143 | }, |
2142 | .size = EDID_LENGTH, | 2144 | .size = EDID_LENGTH, |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index c65e81ff3578..7e06223bca94 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -172,7 +172,7 @@ static struct class backlight_class = { | |||
172 | 172 | ||
173 | #define DECLARE_ATTR(_name,_mode,_show,_store) \ | 173 | #define DECLARE_ATTR(_name,_mode,_show,_store) \ |
174 | { \ | 174 | { \ |
175 | .attr = { .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ | 175 | .attr = { .name = __stringify(_name), .mode = _mode }, \ |
176 | .show = _show, \ | 176 | .show = _show, \ |
177 | .store = _store, \ | 177 | .store = _store, \ |
178 | } | 178 | } |
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 6ef8f0a7a137..648b53c1fdea 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -157,7 +157,7 @@ static struct class lcd_class = { | |||
157 | 157 | ||
158 | #define DECLARE_ATTR(_name,_mode,_show,_store) \ | 158 | #define DECLARE_ATTR(_name,_mode,_show,_store) \ |
159 | { \ | 159 | { \ |
160 | .attr = { .name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, \ | 160 | .attr = { .name = __stringify(_name), .mode = _mode }, \ |
161 | .show = _show, \ | 161 | .show = _show, \ |
162 | .store = _store, \ | 162 | .store = _store, \ |
163 | } | 163 | } |
diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index 8ea17a53eed8..cab56005dd49 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c | |||
@@ -91,8 +91,9 @@ static int w1_f23_refresh_block(struct w1_slave *sl, struct w1_f23_data *data, | |||
91 | } | 91 | } |
92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ | 92 | #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ |
93 | 93 | ||
94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, char *buf, loff_t off, | 94 | static ssize_t w1_f23_read_bin(struct kobject *kobj, |
95 | size_t count) | 95 | struct bin_attribute *bin_attr, |
96 | char *buf, loff_t off, size_t count) | ||
96 | { | 97 | { |
97 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 98 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
98 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC | 99 | #ifdef CONFIG_W1_SLAVE_DS2433_CRC |
@@ -199,8 +200,9 @@ static int w1_f23_write(struct w1_slave *sl, int addr, int len, const u8 *data) | |||
199 | return 0; | 200 | return 0; |
200 | } | 201 | } |
201 | 202 | ||
202 | static ssize_t w1_f23_write_bin(struct kobject *kobj, char *buf, loff_t off, | 203 | static ssize_t w1_f23_write_bin(struct kobject *kobj, |
203 | size_t count) | 204 | struct bin_attribute *bin_attr, |
205 | char *buf, loff_t off, size_t count) | ||
204 | { | 206 | { |
205 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 207 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
206 | int addr, len, idx; | 208 | int addr, len, idx; |
@@ -252,7 +254,6 @@ static struct bin_attribute w1_f23_bin_attr = { | |||
252 | .attr = { | 254 | .attr = { |
253 | .name = "eeprom", | 255 | .name = "eeprom", |
254 | .mode = S_IRUGO | S_IWUSR, | 256 | .mode = S_IRUGO | S_IWUSR, |
255 | .owner = THIS_MODULE, | ||
256 | }, | 257 | }, |
257 | .size = W1_EEPROM_SIZE, | 258 | .size = W1_EEPROM_SIZE, |
258 | .read = w1_f23_read_bin, | 259 | .read = w1_f23_read_bin, |
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 1a6937dc190b..4318935678c5 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -42,13 +42,13 @@ static u8 bad_roms[][9] = { | |||
42 | {} | 42 | {} |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); | 45 | static ssize_t w1_therm_read_bin(struct kobject *, struct bin_attribute *, |
46 | char *, loff_t, size_t); | ||
46 | 47 | ||
47 | static struct bin_attribute w1_therm_bin_attr = { | 48 | static struct bin_attribute w1_therm_bin_attr = { |
48 | .attr = { | 49 | .attr = { |
49 | .name = "w1_slave", | 50 | .name = "w1_slave", |
50 | .mode = S_IRUGO, | 51 | .mode = S_IRUGO, |
51 | .owner = THIS_MODULE, | ||
52 | }, | 52 | }, |
53 | .size = W1_SLAVE_DATA_SIZE, | 53 | .size = W1_SLAVE_DATA_SIZE, |
54 | .read = w1_therm_read_bin, | 54 | .read = w1_therm_read_bin, |
@@ -159,7 +159,9 @@ static int w1_therm_check_rom(u8 rom[9]) | |||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | 161 | ||
162 | static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, size_t count) | 162 | static ssize_t w1_therm_read_bin(struct kobject *kobj, |
163 | struct bin_attribute *bin_attr, | ||
164 | char *buf, loff_t off, size_t count) | ||
163 | { | 165 | { |
164 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 166 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
165 | struct w1_master *dev = sl->master; | 167 | struct w1_master *dev = sl->master; |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 7d6876dbcc96..f5c5b760ed7b 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -105,7 +105,9 @@ static ssize_t w1_slave_read_name(struct device *dev, struct device_attribute *a | |||
105 | return sprintf(buf, "%s\n", sl->name); | 105 | return sprintf(buf, "%s\n", sl->name); |
106 | } | 106 | } |
107 | 107 | ||
108 | static ssize_t w1_slave_read_id(struct kobject *kobj, char *buf, loff_t off, size_t count) | 108 | static ssize_t w1_slave_read_id(struct kobject *kobj, |
109 | struct bin_attribute *bin_attr, | ||
110 | char *buf, loff_t off, size_t count) | ||
109 | { | 111 | { |
110 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 112 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
111 | 113 | ||
@@ -128,7 +130,6 @@ static struct bin_attribute w1_slave_attr_bin_id = { | |||
128 | .attr = { | 130 | .attr = { |
129 | .name = "id", | 131 | .name = "id", |
130 | .mode = S_IRUGO, | 132 | .mode = S_IRUGO, |
131 | .owner = THIS_MODULE, | ||
132 | }, | 133 | }, |
133 | .size = 8, | 134 | .size = 8, |
134 | .read = w1_slave_read_id, | 135 | .read = w1_slave_read_id, |
@@ -136,7 +137,9 @@ static struct bin_attribute w1_slave_attr_bin_id = { | |||
136 | 137 | ||
137 | /* Default family */ | 138 | /* Default family */ |
138 | 139 | ||
139 | static ssize_t w1_default_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | 140 | static ssize_t w1_default_write(struct kobject *kobj, |
141 | struct bin_attribute *bin_attr, | ||
142 | char *buf, loff_t off, size_t count) | ||
140 | { | 143 | { |
141 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 144 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
142 | 145 | ||
@@ -153,7 +156,9 @@ out_up: | |||
153 | return count; | 156 | return count; |
154 | } | 157 | } |
155 | 158 | ||
156 | static ssize_t w1_default_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 159 | static ssize_t w1_default_read(struct kobject *kobj, |
160 | struct bin_attribute *bin_attr, | ||
161 | char *buf, loff_t off, size_t count) | ||
157 | { | 162 | { |
158 | struct w1_slave *sl = kobj_to_w1_slave(kobj); | 163 | struct w1_slave *sl = kobj_to_w1_slave(kobj); |
159 | 164 | ||
@@ -167,7 +172,6 @@ static struct bin_attribute w1_default_attr = { | |||
167 | .attr = { | 172 | .attr = { |
168 | .name = "rw", | 173 | .name = "rw", |
169 | .mode = S_IRUGO | S_IWUSR, | 174 | .mode = S_IRUGO | S_IWUSR, |
170 | .owner = THIS_MODULE, | ||
171 | }, | 175 | }, |
172 | .size = PAGE_SIZE, | 176 | .size = PAGE_SIZE, |
173 | .read = w1_default_read, | 177 | .read = w1_default_read, |
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index c3ba0ec334c4..9130f1c12c26 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -49,8 +49,9 @@ static ssize_t zorro_show_resource(struct device *dev, struct device_attribute * | |||
49 | 49 | ||
50 | static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); | 50 | static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); |
51 | 51 | ||
52 | static ssize_t zorro_read_config(struct kobject *kobj, char *buf, loff_t off, | 52 | static ssize_t zorro_read_config(struct kobject *kobj, |
53 | size_t count) | 53 | struct bin_attribute *bin_attr, |
54 | char *buf, loff_t off, size_t count) | ||
54 | { | 55 | { |
55 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, | 56 | struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, |
56 | kobj)); | 57 | kobj)); |
@@ -78,7 +79,6 @@ static struct bin_attribute zorro_config_attr = { | |||
78 | .attr = { | 79 | .attr = { |
79 | .name = "config", | 80 | .name = "config", |
80 | .mode = S_IRUGO | S_IWUSR, | 81 | .mode = S_IRUGO | S_IWUSR, |
81 | .owner = THIS_MODULE | ||
82 | }, | 82 | }, |
83 | .size = sizeof(struct ConfigDev), | 83 | .size = sizeof(struct ConfigDev), |
84 | .read = zorro_read_config, | 84 | .read = zorro_read_config, |