aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/system.c2
-rw-r--r--drivers/auxdisplay/cfag12864bfb.c2
-rw-r--r--drivers/base/Kconfig51
-rw-r--r--drivers/base/bus.c26
-rw-r--r--drivers/base/class.c16
-rw-r--r--drivers/base/core.c46
-rw-r--r--drivers/base/cpu.c105
-rw-r--r--drivers/base/dd.c38
-rw-r--r--drivers/base/devtmpfs.c13
-rw-r--r--drivers/base/firmware_class.c11
-rw-r--r--drivers/base/memory.c20
-rw-r--r--drivers/base/node.c81
-rw-r--r--drivers/base/platform.c76
-rw-r--r--drivers/base/power/main.c20
-rw-r--r--drivers/base/sys.c17
-rw-r--r--drivers/block/osdblk.c12
-rw-r--r--drivers/block/pktcdvd.c14
-rw-r--r--drivers/cpufreq/cpufreq.c2
-rw-r--r--drivers/cpuidle/sysfs.c8
-rw-r--r--drivers/dma/ioat/dma.c2
-rw-r--r--drivers/dma/ioat/dma.h2
-rw-r--r--drivers/edac/edac_device_sysfs.c6
-rw-r--r--drivers/edac/edac_mc_sysfs.c4
-rw-r--r--drivers/edac/edac_pci_sysfs.c4
-rw-r--r--drivers/firewire/core-device.c5
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/firmware/efivars.c2
-rw-r--r--drivers/firmware/iscsi_ibft.c2
-rw-r--r--drivers/firmware/memmap.c2
-rw-r--r--drivers/gpio/gpiolib.c8
-rw-r--r--drivers/gpu/drm/drm_sysfs.c18
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_memory.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c2
-rw-r--r--drivers/ieee1394/nodemgr.c5
-rw-r--r--drivers/infiniband/core/cm.c2
-rw-r--r--drivers/infiniband/core/sysfs.c2
-rw-r--r--drivers/infiniband/core/ucm.c13
-rw-r--r--drivers/infiniband/core/user_mad.c9
-rw-r--r--drivers/infiniband/core/uverbs_main.c9
-rw-r--r--drivers/macintosh/windfarm_core.c1
-rw-r--r--drivers/macintosh/windfarm_smu_controls.c1
-rw-r--r--drivers/md/dm-sysfs.c2
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/media/video/omap24xxcam.c2
-rw-r--r--drivers/misc/phantom.c13
-rw-r--r--drivers/mtd/ubi/build.c3
-rw-r--r--drivers/net/bonding/bond_sysfs.c5
-rw-r--r--drivers/net/ibmveth.c2
-rw-r--r--drivers/net/iseries_veth.c4
-rw-r--r--drivers/parisc/pdc_stable.c2
-rw-r--r--drivers/pci/bus.c4
-rw-r--r--drivers/pci/hotplug/fakephp.c2
-rw-r--r--drivers/pci/pci-sysfs.c5
-rw-r--r--drivers/pci/pci.c4
-rw-r--r--drivers/pci/slot.c2
-rw-r--r--drivers/pcmcia/ds.c8
-rw-r--r--drivers/platform/x86/Kconfig1
-rw-r--r--drivers/platform/x86/hp-wmi.c4
-rw-r--r--drivers/platform/x86/msi-laptop.c360
-rw-r--r--drivers/scsi/sgiwd93.c2
-rw-r--r--drivers/scsi/sni_53c710.c2
-rw-r--r--drivers/staging/asus_oled/asus_oled.c13
-rw-r--r--drivers/uio/Kconfig24
-rw-r--r--drivers/uio/Makefile2
-rw-r--r--drivers/uio/uio.c4
-rw-r--r--drivers/uio/uio_netx.c172
-rw-r--r--drivers/uio/uio_smx.c140
-rw-r--r--drivers/usb/core/driver.c4
-rw-r--r--drivers/uwb/driver.c5
-rw-r--r--drivers/uwb/umc-bus.c4
-rw-r--r--drivers/uwb/uwb-internal.h4
-rw-r--r--drivers/uwb/wlp/sysfs.c3
-rw-r--r--drivers/video/acornfb.c2
-rw-r--r--drivers/video/arcfb.c2
-rw-r--r--drivers/video/cobalt_lcdfb.c2
-rw-r--r--drivers/video/efifb.c2
-rw-r--r--drivers/video/epson1355fb.c2
-rw-r--r--drivers/video/gbefb.c2
-rw-r--r--drivers/video/hgafb.c2
-rw-r--r--drivers/video/hitfb.c2
-rw-r--r--drivers/video/omap2/dss/manager.c2
-rw-r--r--drivers/video/omap2/dss/overlay.c2
-rw-r--r--drivers/video/q40fb.c2
-rw-r--r--drivers/video/s3c2410fb.c4
-rw-r--r--drivers/video/sa1100fb.c2
-rw-r--r--drivers/video/sgivwfb.c2
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c2
-rw-r--r--drivers/video/vesafb.c2
-rw-r--r--drivers/video/vfb.c2
-rw-r--r--drivers/video/vga16fb.c2
-rw-r--r--drivers/video/w100fb.c2
-rw-r--r--drivers/w1/masters/omap_hdq.c4
-rw-r--r--drivers/xen/sys-hypervisor.c2
94 files changed, 995 insertions, 522 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index a206a12da78a..743f2445e2a1 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -101,6 +101,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
101 struct acpi_table_header *header = NULL; 101 struct acpi_table_header *header = NULL;
102 struct acpi_table_attr *attr = NULL; 102 struct acpi_table_attr *attr = NULL;
103 103
104 sysfs_attr_init(&table_attr->attr.attr);
104 if (table_header->signature[0] != '\0') 105 if (table_header->signature[0] != '\0')
105 memcpy(table_attr->name, table_header->signature, 106 memcpy(table_attr->name, table_header->signature,
106 ACPI_NAME_SIZE); 107 ACPI_NAME_SIZE);
@@ -475,6 +476,7 @@ void acpi_irq_stats_init(void)
475 goto fail; 476 goto fail;
476 strncpy(name, buffer, strlen(buffer) + 1); 477 strncpy(name, buffer, strlen(buffer) + 1);
477 478
479 sysfs_attr_init(&counter_attrs[i].attr);
478 counter_attrs[i].attr.name = name; 480 counter_attrs[i].attr.name = name;
479 counter_attrs[i].attr.mode = 0644; 481 counter_attrs[i].attr.mode = 0644;
480 counter_attrs[i].show = counter_show; 482 counter_attrs[i].show = counter_show;
diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c
index fe3a865be4e5..b0ca5a47f47d 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -81,7 +81,7 @@ static struct fb_ops cfag12864bfb_ops = {
81 .fb_mmap = cfag12864bfb_mmap, 81 .fb_mmap = cfag12864bfb_mmap,
82}; 82};
83 83
84static int __init cfag12864bfb_probe(struct platform_device *device) 84static int __devinit cfag12864bfb_probe(struct platform_device *device)
85{ 85{
86 int ret = -EINVAL; 86 int ret = -EINVAL;
87 struct fb_info *info = framebuffer_alloc(0, &device->dev); 87 struct fb_info *info = framebuffer_alloc(0, &device->dev);
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index ee377270beb9..fd52c48ee762 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -3,35 +3,50 @@ menu "Generic Driver Options"
3config UEVENT_HELPER_PATH 3config UEVENT_HELPER_PATH
4 string "path to uevent helper" 4 string "path to uevent helper"
5 depends on HOTPLUG 5 depends on HOTPLUG
6 default "/sbin/hotplug" 6 default ""
7 help 7 help
8 Path to uevent helper program forked by the kernel for 8 Path to uevent helper program forked by the kernel for
9 every uevent. 9 every uevent.
10 Before the switch to the netlink-based uevent source, this was
11 used to hook hotplug scripts into kernel device events. It
12 usually pointed to a shell script at /sbin/hotplug.
13 This should not be used today, because usual systems create
14 many events at bootup or device discovery in a very short time
15 frame. One forked process per event can create so many processes
16 that it creates a high system load, or on smaller systems
17 it is known to create out-of-memory situations during bootup.
10 18
11config DEVTMPFS 19config DEVTMPFS
12 bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)" 20 bool "Maintain a devtmpfs filesystem to mount at /dev"
13 depends on HOTPLUG && SHMEM && TMPFS 21 depends on HOTPLUG && SHMEM && TMPFS
14 help 22 help
15 This creates a tmpfs filesystem, and mounts it at bootup 23 This creates a tmpfs filesystem instance early at bootup.
16 and mounts it at /dev. The kernel driver core creates device 24 In this filesystem, the kernel driver core maintains device
17 nodes for all registered devices in that filesystem. All device 25 nodes with their default names and permissions for all
18 nodes are owned by root and have the default mode of 0600. 26 registered devices with an assigned major/minor number.
19 Userspace can add and delete the nodes as needed. This is 27 Userspace can modify the filesystem content as needed, add
20 intended to simplify bootup, and make it possible to delay 28 symlinks, and apply needed permissions.
21 the initial coldplug at bootup done by udev in userspace. 29 It provides a fully functional /dev directory, where usually
22 It should also provide a simpler way for rescue systems 30 udev runs on top, managing permissions and adding meaningful
23 to bring up a kernel with dynamic major/minor numbers. 31 symlinks.
24 Meaningful symlinks, permissions and device ownership must 32 In very limited environments, it may provide a sufficient
25 still be handled by userspace. 33 functional /dev without any further help. It also allows simple
26 If unsure, say N here. 34 rescue systems, and reliably handles dynamic major/minor numbers.
27 35
28config DEVTMPFS_MOUNT 36config DEVTMPFS_MOUNT
29 bool "Automount devtmpfs at /dev" 37 bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs"
30 depends on DEVTMPFS 38 depends on DEVTMPFS
31 help 39 help
32 This will mount devtmpfs at /dev if the kernel mounts the root 40 This will instruct the kernel to automatically mount the
33 filesystem. It will not affect initramfs based mounting. 41 devtmpfs filesystem at /dev, directly after the kernel has
34 If unsure, say N here. 42 mounted the root filesystem. The behavior can be overridden
43 with the commandline parameter: devtmpfs.mount=0|1.
44 This option does not affect initramfs based booting, here
45 the devtmpfs filesystem always needs to be mounted manually
46 after the roots is mounted.
47 With this option enabled, it allows to bring up a system in
48 rescue mode with init=/bin/sh, even when the /dev directory
49 on the rootfs is completely empty.
35 50
36config STANDALONE 51config STANDALONE
37 bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL 52 bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index c0c5a43d9fb3..71f6af5c8b0b 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -70,7 +70,7 @@ static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,
70 return ret; 70 return ret;
71} 71}
72 72
73static struct sysfs_ops driver_sysfs_ops = { 73static const struct sysfs_ops driver_sysfs_ops = {
74 .show = drv_attr_show, 74 .show = drv_attr_show,
75 .store = drv_attr_store, 75 .store = drv_attr_store,
76}; 76};
@@ -115,7 +115,7 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr,
115 return ret; 115 return ret;
116} 116}
117 117
118static struct sysfs_ops bus_sysfs_ops = { 118static const struct sysfs_ops bus_sysfs_ops = {
119 .show = bus_attr_show, 119 .show = bus_attr_show,
120 .store = bus_attr_store, 120 .store = bus_attr_store,
121}; 121};
@@ -154,7 +154,7 @@ static int bus_uevent_filter(struct kset *kset, struct kobject *kobj)
154 return 0; 154 return 0;
155} 155}
156 156
157static struct kset_uevent_ops bus_uevent_ops = { 157static const struct kset_uevent_ops bus_uevent_ops = {
158 .filter = bus_uevent_filter, 158 .filter = bus_uevent_filter,
159}; 159};
160 160
@@ -173,10 +173,10 @@ static ssize_t driver_unbind(struct device_driver *drv,
173 dev = bus_find_device_by_name(bus, NULL, buf); 173 dev = bus_find_device_by_name(bus, NULL, buf);
174 if (dev && dev->driver == drv) { 174 if (dev && dev->driver == drv) {
175 if (dev->parent) /* Needed for USB */ 175 if (dev->parent) /* Needed for USB */
176 down(&dev->parent->sem); 176 device_lock(dev->parent);
177 device_release_driver(dev); 177 device_release_driver(dev);
178 if (dev->parent) 178 if (dev->parent)
179 up(&dev->parent->sem); 179 device_unlock(dev->parent);
180 err = count; 180 err = count;
181 } 181 }
182 put_device(dev); 182 put_device(dev);
@@ -200,12 +200,12 @@ static ssize_t driver_bind(struct device_driver *drv,
200 dev = bus_find_device_by_name(bus, NULL, buf); 200 dev = bus_find_device_by_name(bus, NULL, buf);
201 if (dev && dev->driver == NULL && driver_match_device(drv, dev)) { 201 if (dev && dev->driver == NULL && driver_match_device(drv, dev)) {
202 if (dev->parent) /* Needed for USB */ 202 if (dev->parent) /* Needed for USB */
203 down(&dev->parent->sem); 203 device_lock(dev->parent);
204 down(&dev->sem); 204 device_lock(dev);
205 err = driver_probe_device(drv, dev); 205 err = driver_probe_device(drv, dev);
206 up(&dev->sem); 206 device_unlock(dev);
207 if (dev->parent) 207 if (dev->parent)
208 up(&dev->parent->sem); 208 device_unlock(dev->parent);
209 209
210 if (err > 0) { 210 if (err > 0) {
211 /* success */ 211 /* success */
@@ -744,10 +744,10 @@ static int __must_check bus_rescan_devices_helper(struct device *dev,
744 744
745 if (!dev->driver) { 745 if (!dev->driver) {
746 if (dev->parent) /* Needed for USB */ 746 if (dev->parent) /* Needed for USB */
747 down(&dev->parent->sem); 747 device_lock(dev->parent);
748 ret = device_attach(dev); 748 ret = device_attach(dev);
749 if (dev->parent) 749 if (dev->parent)
750 up(&dev->parent->sem); 750 device_unlock(dev->parent);
751 } 751 }
752 return ret < 0 ? ret : 0; 752 return ret < 0 ? ret : 0;
753} 753}
@@ -779,10 +779,10 @@ int device_reprobe(struct device *dev)
779{ 779{
780 if (dev->driver) { 780 if (dev->driver) {
781 if (dev->parent) /* Needed for USB */ 781 if (dev->parent) /* Needed for USB */
782 down(&dev->parent->sem); 782 device_lock(dev->parent);
783 device_release_driver(dev); 783 device_release_driver(dev);
784 if (dev->parent) 784 if (dev->parent)
785 up(&dev->parent->sem); 785 device_unlock(dev->parent);
786 } 786 }
787 return bus_rescan_devices_helper(dev, NULL); 787 return bus_rescan_devices_helper(dev, NULL);
788} 788}
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 6e2c3b064f53..0147f476b8a9 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -31,7 +31,7 @@ static ssize_t class_attr_show(struct kobject *kobj, struct attribute *attr,
31 ssize_t ret = -EIO; 31 ssize_t ret = -EIO;
32 32
33 if (class_attr->show) 33 if (class_attr->show)
34 ret = class_attr->show(cp->class, buf); 34 ret = class_attr->show(cp->class, class_attr, buf);
35 return ret; 35 return ret;
36} 36}
37 37
@@ -43,7 +43,7 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr,
43 ssize_t ret = -EIO; 43 ssize_t ret = -EIO;
44 44
45 if (class_attr->store) 45 if (class_attr->store)
46 ret = class_attr->store(cp->class, buf, count); 46 ret = class_attr->store(cp->class, class_attr, buf, count);
47 return ret; 47 return ret;
48} 48}
49 49
@@ -63,7 +63,7 @@ static void class_release(struct kobject *kobj)
63 kfree(cp); 63 kfree(cp);
64} 64}
65 65
66static struct sysfs_ops class_sysfs_ops = { 66static const struct sysfs_ops class_sysfs_ops = {
67 .show = class_attr_show, 67 .show = class_attr_show,
68 .store = class_attr_store, 68 .store = class_attr_store,
69}; 69};
@@ -490,6 +490,16 @@ void class_interface_unregister(struct class_interface *class_intf)
490 class_put(parent); 490 class_put(parent);
491} 491}
492 492
493ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr,
494 char *buf)
495{
496 struct class_attribute_string *cs;
497 cs = container_of(attr, struct class_attribute_string, attr);
498 return snprintf(buf, PAGE_SIZE, "%s\n", cs->str);
499}
500
501EXPORT_SYMBOL_GPL(show_class_attr_string);
502
493struct class_compat { 503struct class_compat {
494 struct kobject *kobj; 504 struct kobject *kobj;
495}; 505};
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 282025770429..ef55df34ddd0 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -100,7 +100,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
100 return ret; 100 return ret;
101} 101}
102 102
103static struct sysfs_ops dev_sysfs_ops = { 103static const struct sysfs_ops dev_sysfs_ops = {
104 .show = dev_attr_show, 104 .show = dev_attr_show,
105 .store = dev_attr_store, 105 .store = dev_attr_store,
106}; 106};
@@ -252,7 +252,7 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj,
252 return retval; 252 return retval;
253} 253}
254 254
255static struct kset_uevent_ops device_uevent_ops = { 255static const struct kset_uevent_ops device_uevent_ops = {
256 .filter = dev_uevent_filter, 256 .filter = dev_uevent_filter,
257 .name = dev_uevent_name, 257 .name = dev_uevent_name,
258 .uevent = dev_uevent, 258 .uevent = dev_uevent,
@@ -306,15 +306,10 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,
306{ 306{
307 enum kobject_action action; 307 enum kobject_action action;
308 308
309 if (kobject_action_type(buf, count, &action) == 0) { 309 if (kobject_action_type(buf, count, &action) == 0)
310 kobject_uevent(&dev->kobj, action); 310 kobject_uevent(&dev->kobj, action);
311 goto out; 311 else
312 } 312 dev_err(dev, "uevent: unknown action-string\n");
313
314 dev_err(dev, "uevent: unsupported action-string; this will "
315 "be ignored in a future kernel version\n");
316 kobject_uevent(&dev->kobj, KOBJ_ADD);
317out:
318 return count; 313 return count;
319} 314}
320 315
@@ -607,6 +602,7 @@ static struct kobject *get_device_parent(struct device *dev,
607 int retval; 602 int retval;
608 603
609 if (dev->class) { 604 if (dev->class) {
605 static DEFINE_MUTEX(gdp_mutex);
610 struct kobject *kobj = NULL; 606 struct kobject *kobj = NULL;
611 struct kobject *parent_kobj; 607 struct kobject *parent_kobj;
612 struct kobject *k; 608 struct kobject *k;
@@ -623,6 +619,8 @@ static struct kobject *get_device_parent(struct device *dev,
623 else 619 else
624 parent_kobj = &parent->kobj; 620 parent_kobj = &parent->kobj;
625 621
622 mutex_lock(&gdp_mutex);
623
626 /* find our class-directory at the parent and reference it */ 624 /* find our class-directory at the parent and reference it */
627 spin_lock(&dev->class->p->class_dirs.list_lock); 625 spin_lock(&dev->class->p->class_dirs.list_lock);
628 list_for_each_entry(k, &dev->class->p->class_dirs.list, entry) 626 list_for_each_entry(k, &dev->class->p->class_dirs.list, entry)
@@ -631,20 +629,26 @@ static struct kobject *get_device_parent(struct device *dev,
631 break; 629 break;
632 } 630 }
633 spin_unlock(&dev->class->p->class_dirs.list_lock); 631 spin_unlock(&dev->class->p->class_dirs.list_lock);
634 if (kobj) 632 if (kobj) {
633 mutex_unlock(&gdp_mutex);
635 return kobj; 634 return kobj;
635 }
636 636
637 /* or create a new class-directory at the parent device */ 637 /* or create a new class-directory at the parent device */
638 k = kobject_create(); 638 k = kobject_create();
639 if (!k) 639 if (!k) {
640 mutex_unlock(&gdp_mutex);
640 return NULL; 641 return NULL;
642 }
641 k->kset = &dev->class->p->class_dirs; 643 k->kset = &dev->class->p->class_dirs;
642 retval = kobject_add(k, parent_kobj, "%s", dev->class->name); 644 retval = kobject_add(k, parent_kobj, "%s", dev->class->name);
643 if (retval < 0) { 645 if (retval < 0) {
646 mutex_unlock(&gdp_mutex);
644 kobject_put(k); 647 kobject_put(k);
645 return NULL; 648 return NULL;
646 } 649 }
647 /* do not emit an uevent for this simple "glue" directory */ 650 /* do not emit an uevent for this simple "glue" directory */
651 mutex_unlock(&gdp_mutex);
648 return k; 652 return k;
649 } 653 }
650 654
@@ -1574,22 +1578,16 @@ int device_rename(struct device *dev, char *new_name)
1574 if (old_class_name) { 1578 if (old_class_name) {
1575 new_class_name = make_class_name(dev->class->name, &dev->kobj); 1579 new_class_name = make_class_name(dev->class->name, &dev->kobj);
1576 if (new_class_name) { 1580 if (new_class_name) {
1577 error = sysfs_create_link_nowarn(&dev->parent->kobj, 1581 error = sysfs_rename_link(&dev->parent->kobj,
1578 &dev->kobj, 1582 &dev->kobj,
1579 new_class_name); 1583 old_class_name,
1580 if (error) 1584 new_class_name);
1581 goto out;
1582 sysfs_remove_link(&dev->parent->kobj, old_class_name);
1583 } 1585 }
1584 } 1586 }
1585#else 1587#else
1586 if (dev->class) { 1588 if (dev->class) {
1587 error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, 1589 error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
1588 &dev->kobj, dev_name(dev)); 1590 &dev->kobj, old_device_name, new_name);
1589 if (error)
1590 goto out;
1591 sysfs_remove_link(&dev->class->p->class_subsys.kobj,
1592 old_device_name);
1593 } 1591 }
1594#endif 1592#endif
1595 1593
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 958bd1540c30..7036e8e96ab8 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -13,8 +13,11 @@
13 13
14#include "base.h" 14#include "base.h"
15 15
16static struct sysdev_class_attribute *cpu_sysdev_class_attrs[];
17
16struct sysdev_class cpu_sysdev_class = { 18struct sysdev_class cpu_sysdev_class = {
17 .name = "cpu", 19 .name = "cpu",
20 .attrs = cpu_sysdev_class_attrs,
18}; 21};
19EXPORT_SYMBOL(cpu_sysdev_class); 22EXPORT_SYMBOL(cpu_sysdev_class);
20 23
@@ -76,34 +79,24 @@ void unregister_cpu(struct cpu *cpu)
76} 79}
77 80
78#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 81#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
79static ssize_t cpu_probe_store(struct class *class, const char *buf, 82static ssize_t cpu_probe_store(struct sys_device *dev,
83 struct sysdev_attribute *attr,
84 const char *buf,
80 size_t count) 85 size_t count)
81{ 86{
82 return arch_cpu_probe(buf, count); 87 return arch_cpu_probe(buf, count);
83} 88}
84 89
85static ssize_t cpu_release_store(struct class *class, const char *buf, 90static ssize_t cpu_release_store(struct sys_device *dev,
91 struct sysdev_attribute *attr,
92 const char *buf,
86 size_t count) 93 size_t count)
87{ 94{
88 return arch_cpu_release(buf, count); 95 return arch_cpu_release(buf, count);
89} 96}
90 97
91static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 98static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
92static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); 99static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store);
93
94int __init cpu_probe_release_init(void)
95{
96 int rc;
97
98 rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
99 &class_attr_probe.attr);
100 if (!rc)
101 rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
102 &class_attr_release.attr);
103
104 return rc;
105}
106device_initcall(cpu_probe_release_init);
107#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ 100#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
108 101
109#else /* ... !CONFIG_HOTPLUG_CPU */ 102#else /* ... !CONFIG_HOTPLUG_CPU */
@@ -141,31 +134,39 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL);
141/* 134/*
142 * Print cpu online, possible, present, and system maps 135 * Print cpu online, possible, present, and system maps
143 */ 136 */
144static ssize_t print_cpus_map(char *buf, const struct cpumask *map) 137
138struct cpu_attr {
139 struct sysdev_class_attribute attr;
140 const struct cpumask *const * const map;
141};
142
143static ssize_t show_cpus_attr(struct sysdev_class *class,
144 struct sysdev_class_attribute *attr,
145 char *buf)
145{ 146{
146 int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); 147 struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
148 int n = cpulist_scnprintf(buf, PAGE_SIZE-2, *(ca->map));
147 149
148 buf[n++] = '\n'; 150 buf[n++] = '\n';
149 buf[n] = '\0'; 151 buf[n] = '\0';
150 return n; 152 return n;
151} 153}
152 154
153#define print_cpus_func(type) \ 155#define _CPU_ATTR(name, map) \
154static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf) \ 156 { _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map }
155{ \
156 return print_cpus_map(buf, cpu_##type##_mask); \
157} \
158static struct sysdev_class_attribute attr_##type##_map = \
159 _SYSDEV_CLASS_ATTR(type, 0444, print_cpus_##type, NULL)
160 157
161print_cpus_func(online); 158/* Keep in sync with cpu_sysdev_class_attrs */
162print_cpus_func(possible); 159static struct cpu_attr cpu_attrs[] = {
163print_cpus_func(present); 160 _CPU_ATTR(online, &cpu_online_mask),
161 _CPU_ATTR(possible, &cpu_possible_mask),
162 _CPU_ATTR(present, &cpu_present_mask),
163};
164 164
165/* 165/*
166 * Print values for NR_CPUS and offlined cpus 166 * Print values for NR_CPUS and offlined cpus
167 */ 167 */
168static ssize_t print_cpus_kernel_max(struct sysdev_class *class, char *buf) 168static ssize_t print_cpus_kernel_max(struct sysdev_class *class,
169 struct sysdev_class_attribute *attr, char *buf)
169{ 170{
170 int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); 171 int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1);
171 return n; 172 return n;
@@ -175,7 +176,8 @@ static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
175/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ 176/* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
176unsigned int total_cpus; 177unsigned int total_cpus;
177 178
178static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf) 179static ssize_t print_cpus_offline(struct sysdev_class *class,
180 struct sysdev_class_attribute *attr, char *buf)
179{ 181{
180 int n = 0, len = PAGE_SIZE-2; 182 int n = 0, len = PAGE_SIZE-2;
181 cpumask_var_t offline; 183 cpumask_var_t offline;
@@ -204,29 +206,6 @@ static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf)
204} 206}
205static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); 207static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL);
206 208
207static struct sysdev_class_attribute *cpu_state_attr[] = {
208 &attr_online_map,
209 &attr_possible_map,
210 &attr_present_map,
211 &attr_kernel_max,
212 &attr_offline,
213};
214
215static int cpu_states_init(void)
216{
217 int i;
218 int err = 0;
219
220 for (i = 0; i < ARRAY_SIZE(cpu_state_attr); i++) {
221 int ret;
222 ret = sysdev_class_create_file(&cpu_sysdev_class,
223 cpu_state_attr[i]);
224 if (!err)
225 err = ret;
226 }
227 return err;
228}
229
230/* 209/*
231 * register_cpu - Setup a sysfs device for a CPU. 210 * register_cpu - Setup a sysfs device for a CPU.
232 * @cpu - cpu->hotpluggable field set to 1 will generate a control file in 211 * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
@@ -272,9 +251,6 @@ int __init cpu_dev_init(void)
272 int err; 251 int err;
273 252
274 err = sysdev_class_register(&cpu_sysdev_class); 253 err = sysdev_class_register(&cpu_sysdev_class);
275 if (!err)
276 err = cpu_states_init();
277
278#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 254#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
279 if (!err) 255 if (!err)
280 err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); 256 err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class);
@@ -282,3 +258,16 @@ int __init cpu_dev_init(void)
282 258
283 return err; 259 return err;
284} 260}
261
262static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = {
263#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
264 &attr_probe,
265 &attr_release,
266#endif
267 &cpu_attrs[0].attr,
268 &cpu_attrs[1].attr,
269 &cpu_attrs[2].attr,
270 &attr_kernel_max,
271 &attr_offline,
272 NULL
273};
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index ee95c76bfd3d..c89291f8a16b 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -85,7 +85,7 @@ static void driver_sysfs_remove(struct device *dev)
85 * for before calling this. (It is ok to call with no other effort 85 * for before calling this. (It is ok to call with no other effort
86 * from a driver's probe() method.) 86 * from a driver's probe() method.)
87 * 87 *
88 * This function must be called with @dev->sem held. 88 * This function must be called with the device lock held.
89 */ 89 */
90int device_bind_driver(struct device *dev) 90int device_bind_driver(struct device *dev)
91{ 91{
@@ -190,8 +190,8 @@ EXPORT_SYMBOL_GPL(wait_for_device_probe);
190 * This function returns -ENODEV if the device is not registered, 190 * This function returns -ENODEV if the device is not registered,
191 * 1 if the device is bound successfully and 0 otherwise. 191 * 1 if the device is bound successfully and 0 otherwise.
192 * 192 *
193 * This function must be called with @dev->sem held. When called for a 193 * This function must be called with @dev lock held. When called for a
194 * USB interface, @dev->parent->sem must be held as well. 194 * USB interface, @dev->parent lock must be held as well.
195 */ 195 */
196int driver_probe_device(struct device_driver *drv, struct device *dev) 196int driver_probe_device(struct device_driver *drv, struct device *dev)
197{ 197{
@@ -233,13 +233,13 @@ static int __device_attach(struct device_driver *drv, void *data)
233 * 0 if no matching driver was found; 233 * 0 if no matching driver was found;
234 * -ENODEV if the device is not registered. 234 * -ENODEV if the device is not registered.
235 * 235 *
236 * When called for a USB interface, @dev->parent->sem must be held. 236 * When called for a USB interface, @dev->parent lock must be held.
237 */ 237 */
238int device_attach(struct device *dev) 238int device_attach(struct device *dev)
239{ 239{
240 int ret = 0; 240 int ret = 0;
241 241
242 down(&dev->sem); 242 device_lock(dev);
243 if (dev->driver) { 243 if (dev->driver) {
244 ret = device_bind_driver(dev); 244 ret = device_bind_driver(dev);
245 if (ret == 0) 245 if (ret == 0)
@@ -253,7 +253,7 @@ int device_attach(struct device *dev)
253 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); 253 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
254 pm_runtime_put_sync(dev); 254 pm_runtime_put_sync(dev);
255 } 255 }
256 up(&dev->sem); 256 device_unlock(dev);
257 return ret; 257 return ret;
258} 258}
259EXPORT_SYMBOL_GPL(device_attach); 259EXPORT_SYMBOL_GPL(device_attach);
@@ -276,13 +276,13 @@ static int __driver_attach(struct device *dev, void *data)
276 return 0; 276 return 0;
277 277
278 if (dev->parent) /* Needed for USB */ 278 if (dev->parent) /* Needed for USB */
279 down(&dev->parent->sem); 279 device_lock(dev->parent);
280 down(&dev->sem); 280 device_lock(dev);
281 if (!dev->driver) 281 if (!dev->driver)
282 driver_probe_device(drv, dev); 282 driver_probe_device(drv, dev);
283 up(&dev->sem); 283 device_unlock(dev);
284 if (dev->parent) 284 if (dev->parent)
285 up(&dev->parent->sem); 285 device_unlock(dev->parent);
286 286
287 return 0; 287 return 0;
288} 288}
@@ -303,8 +303,8 @@ int driver_attach(struct device_driver *drv)
303EXPORT_SYMBOL_GPL(driver_attach); 303EXPORT_SYMBOL_GPL(driver_attach);
304 304
305/* 305/*
306 * __device_release_driver() must be called with @dev->sem held. 306 * __device_release_driver() must be called with @dev lock held.
307 * When called for a USB interface, @dev->parent->sem must be held as well. 307 * When called for a USB interface, @dev->parent lock must be held as well.
308 */ 308 */
309static void __device_release_driver(struct device *dev) 309static void __device_release_driver(struct device *dev)
310{ 310{
@@ -343,7 +343,7 @@ static void __device_release_driver(struct device *dev)
343 * @dev: device. 343 * @dev: device.
344 * 344 *
345 * Manually detach device from driver. 345 * Manually detach device from driver.
346 * When called for a USB interface, @dev->parent->sem must be held. 346 * When called for a USB interface, @dev->parent lock must be held.
347 */ 347 */
348void device_release_driver(struct device *dev) 348void device_release_driver(struct device *dev)
349{ 349{
@@ -352,9 +352,9 @@ void device_release_driver(struct device *dev)
352 * within their ->remove callback for the same device, they 352 * within their ->remove callback for the same device, they
353 * will deadlock right here. 353 * will deadlock right here.
354 */ 354 */
355 down(&dev->sem); 355 device_lock(dev);
356 __device_release_driver(dev); 356 __device_release_driver(dev);
357 up(&dev->sem); 357 device_unlock(dev);
358} 358}
359EXPORT_SYMBOL_GPL(device_release_driver); 359EXPORT_SYMBOL_GPL(device_release_driver);
360 360
@@ -381,13 +381,13 @@ void driver_detach(struct device_driver *drv)
381 spin_unlock(&drv->p->klist_devices.k_lock); 381 spin_unlock(&drv->p->klist_devices.k_lock);
382 382
383 if (dev->parent) /* Needed for USB */ 383 if (dev->parent) /* Needed for USB */
384 down(&dev->parent->sem); 384 device_lock(dev->parent);
385 down(&dev->sem); 385 device_lock(dev);
386 if (dev->driver == drv) 386 if (dev->driver == drv)
387 __device_release_driver(dev); 387 __device_release_driver(dev);
388 up(&dev->sem); 388 device_unlock(dev);
389 if (dev->parent) 389 if (dev->parent)
390 up(&dev->parent->sem); 390 device_unlock(dev->parent);
391 put_device(dev); 391 put_device(dev);
392 } 392 }
393} 393}
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 42ae452b36b0..dac478c6e460 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -301,6 +301,19 @@ int devtmpfs_delete_node(struct device *dev)
301 if (dentry->d_inode) { 301 if (dentry->d_inode) {
302 err = vfs_getattr(nd.path.mnt, dentry, &stat); 302 err = vfs_getattr(nd.path.mnt, dentry, &stat);
303 if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { 303 if (!err && dev_mynode(dev, dentry->d_inode, &stat)) {
304 struct iattr newattrs;
305 /*
306 * before unlinking this node, reset permissions
307 * of possible references like hardlinks
308 */
309 newattrs.ia_uid = 0;
310 newattrs.ia_gid = 0;
311 newattrs.ia_mode = stat.mode & ~0777;
312 newattrs.ia_valid =
313 ATTR_UID|ATTR_GID|ATTR_MODE;
314 mutex_lock(&dentry->d_inode->i_mutex);
315 notify_change(dentry, &newattrs);
316 mutex_unlock(&dentry->d_inode->i_mutex);
304 err = vfs_unlink(nd.path.dentry->d_inode, 317 err = vfs_unlink(nd.path.dentry->d_inode,
305 dentry); 318 dentry);
306 if (!err || err == -ENOENT) 319 if (!err || err == -ENOENT)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index a95024166b66..d0dc26ad5387 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -19,7 +19,6 @@
19#include <linux/kthread.h> 19#include <linux/kthread.h>
20#include <linux/highmem.h> 20#include <linux/highmem.h>
21#include <linux/firmware.h> 21#include <linux/firmware.h>
22#include "base.h"
23 22
24#define to_dev(obj) container_of(obj, struct device, kobj) 23#define to_dev(obj) container_of(obj, struct device, kobj)
25 24
@@ -69,7 +68,9 @@ fw_load_abort(struct firmware_priv *fw_priv)
69} 68}
70 69
71static ssize_t 70static ssize_t
72firmware_timeout_show(struct class *class, char *buf) 71firmware_timeout_show(struct class *class,
72 struct class_attribute *attr,
73 char *buf)
73{ 74{
74 return sprintf(buf, "%d\n", loading_timeout); 75 return sprintf(buf, "%d\n", loading_timeout);
75} 76}
@@ -87,7 +88,9 @@ firmware_timeout_show(struct class *class, char *buf)
87 * Note: zero means 'wait forever'. 88 * Note: zero means 'wait forever'.
88 **/ 89 **/
89static ssize_t 90static ssize_t
90firmware_timeout_store(struct class *class, const char *buf, size_t count) 91firmware_timeout_store(struct class *class,
92 struct class_attribute *attr,
93 const char *buf, size_t count)
91{ 94{
92 loading_timeout = simple_strtol(buf, NULL, 10); 95 loading_timeout = simple_strtol(buf, NULL, 10);
93 if (loading_timeout < 0) 96 if (loading_timeout < 0)
@@ -610,7 +613,7 @@ request_firmware_work_func(void *arg)
610} 613}
611 614
612/** 615/**
613 * request_firmware_nowait: asynchronous version of request_firmware 616 * request_firmware_nowait - asynchronous version of request_firmware
614 * @module: module requesting the firmware 617 * @module: module requesting the firmware
615 * @uevent: sends uevent to copy the firmware image if this flag 618 * @uevent: sends uevent to copy the firmware image if this flag
616 * is non-zero else the firmware copy must be done manually. 619 * is non-zero else the firmware copy must be done manually.
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index bd025059711f..2f8691511190 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -44,7 +44,7 @@ static int memory_uevent(struct kset *kset, struct kobject *obj, struct kobj_uev
44 return retval; 44 return retval;
45} 45}
46 46
47static struct kset_uevent_ops memory_uevent_ops = { 47static const struct kset_uevent_ops memory_uevent_ops = {
48 .name = memory_uevent_name, 48 .name = memory_uevent_name,
49 .uevent = memory_uevent, 49 .uevent = memory_uevent,
50}; 50};
@@ -309,17 +309,18 @@ static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL);
309 * Block size attribute stuff 309 * Block size attribute stuff
310 */ 310 */
311static ssize_t 311static ssize_t
312print_block_size(struct class *class, char *buf) 312print_block_size(struct sysdev_class *class, struct sysdev_class_attribute *attr,
313 char *buf)
313{ 314{
314 return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE); 315 return sprintf(buf, "%#lx\n", (unsigned long)PAGES_PER_SECTION * PAGE_SIZE);
315} 316}
316 317
317static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); 318static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL);
318 319
319static int block_size_init(void) 320static int block_size_init(void)
320{ 321{
321 return sysfs_create_file(&memory_sysdev_class.kset.kobj, 322 return sysfs_create_file(&memory_sysdev_class.kset.kobj,
322 &class_attr_block_size_bytes.attr); 323 &attr_block_size_bytes.attr);
323} 324}
324 325
325/* 326/*
@@ -330,7 +331,8 @@ static int block_size_init(void)
330 */ 331 */
331#ifdef CONFIG_ARCH_MEMORY_PROBE 332#ifdef CONFIG_ARCH_MEMORY_PROBE
332static ssize_t 333static ssize_t
333memory_probe_store(struct class *class, const char *buf, size_t count) 334memory_probe_store(struct class *class, struct class_attribute *attr,
335 const char *buf, size_t count)
334{ 336{
335 u64 phys_addr; 337 u64 phys_addr;
336 int nid; 338 int nid;
@@ -367,7 +369,9 @@ static inline int memory_probe_init(void)
367 369
368/* Soft offline a page */ 370/* Soft offline a page */
369static ssize_t 371static ssize_t
370store_soft_offline_page(struct class *class, const char *buf, size_t count) 372store_soft_offline_page(struct class *class,
373 struct class_attribute *attr,
374 const char *buf, size_t count)
371{ 375{
372 int ret; 376 int ret;
373 u64 pfn; 377 u64 pfn;
@@ -384,7 +388,9 @@ store_soft_offline_page(struct class *class, const char *buf, size_t count)
384 388
385/* Forcibly offline a page, including killing processes. */ 389/* Forcibly offline a page, including killing processes. */
386static ssize_t 390static ssize_t
387store_hard_offline_page(struct class *class, const char *buf, size_t count) 391store_hard_offline_page(struct class *class,
392 struct class_attribute *attr,
393 const char *buf, size_t count)
388{ 394{
389 int ret; 395 int ret;
390 u64 pfn; 396 u64 pfn;
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 70122791683d..ad43185ec15a 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -16,8 +16,11 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18 18
19static struct sysdev_class_attribute *node_state_attrs[];
20
19static struct sysdev_class node_class = { 21static struct sysdev_class node_class = {
20 .name = "node", 22 .name = "node",
23 .attrs = node_state_attrs,
21}; 24};
22 25
23 26
@@ -544,76 +547,52 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
544 return n; 547 return n;
545} 548}
546 549
547static ssize_t print_nodes_possible(struct sysdev_class *class, char *buf) 550struct node_attr {
548{ 551 struct sysdev_class_attribute attr;
549 return print_nodes_state(N_POSSIBLE, buf); 552 enum node_states state;
550} 553};
551
552static ssize_t print_nodes_online(struct sysdev_class *class, char *buf)
553{
554 return print_nodes_state(N_ONLINE, buf);
555}
556
557static ssize_t print_nodes_has_normal_memory(struct sysdev_class *class,
558 char *buf)
559{
560 return print_nodes_state(N_NORMAL_MEMORY, buf);
561}
562 554
563static ssize_t print_nodes_has_cpu(struct sysdev_class *class, char *buf) 555static ssize_t show_node_state(struct sysdev_class *class,
556 struct sysdev_class_attribute *attr, char *buf)
564{ 557{
565 return print_nodes_state(N_CPU, buf); 558 struct node_attr *na = container_of(attr, struct node_attr, attr);
559 return print_nodes_state(na->state, buf);
566} 560}
567 561
568static SYSDEV_CLASS_ATTR(possible, 0444, print_nodes_possible, NULL); 562#define _NODE_ATTR(name, state) \
569static SYSDEV_CLASS_ATTR(online, 0444, print_nodes_online, NULL); 563 { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state }
570static SYSDEV_CLASS_ATTR(has_normal_memory, 0444, print_nodes_has_normal_memory,
571 NULL);
572static SYSDEV_CLASS_ATTR(has_cpu, 0444, print_nodes_has_cpu, NULL);
573 564
565static struct node_attr node_state_attr[] = {
566 _NODE_ATTR(possible, N_POSSIBLE),
567 _NODE_ATTR(online, N_ONLINE),
568 _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY),
569 _NODE_ATTR(has_cpu, N_CPU),
574#ifdef CONFIG_HIGHMEM 570#ifdef CONFIG_HIGHMEM
575static ssize_t print_nodes_has_high_memory(struct sysdev_class *class, 571 _NODE_ATTR(has_high_memory, N_HIGH_MEMORY),
576 char *buf)
577{
578 return print_nodes_state(N_HIGH_MEMORY, buf);
579}
580
581static SYSDEV_CLASS_ATTR(has_high_memory, 0444, print_nodes_has_high_memory,
582 NULL);
583#endif 572#endif
573};
584 574
585struct sysdev_class_attribute *node_state_attr[] = { 575static struct sysdev_class_attribute *node_state_attrs[] = {
586 &attr_possible, 576 &node_state_attr[0].attr,
587 &attr_online, 577 &node_state_attr[1].attr,
588 &attr_has_normal_memory, 578 &node_state_attr[2].attr,
579 &node_state_attr[3].attr,
589#ifdef CONFIG_HIGHMEM 580#ifdef CONFIG_HIGHMEM
590 &attr_has_high_memory, 581 &node_state_attr[4].attr,
591#endif 582#endif
592 &attr_has_cpu, 583 NULL
593}; 584};
594 585
595static int node_states_init(void)
596{
597 int i;
598 int err = 0;
599
600 for (i = 0; i < NR_NODE_STATES; i++) {
601 int ret;
602 ret = sysdev_class_create_file(&node_class, node_state_attr[i]);
603 if (!err)
604 err = ret;
605 }
606 return err;
607}
608
609#define NODE_CALLBACK_PRI 2 /* lower than SLAB */ 586#define NODE_CALLBACK_PRI 2 /* lower than SLAB */
610static int __init register_node_type(void) 587static int __init register_node_type(void)
611{ 588{
612 int ret; 589 int ret;
613 590
591 BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES);
592 BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES);
593
614 ret = sysdev_class_register(&node_class); 594 ret = sysdev_class_register(&node_class);
615 if (!ret) { 595 if (!ret) {
616 ret = node_states_init();
617 hotplug_memory_notifier(node_memory_callback, 596 hotplug_memory_notifier(node_memory_callback,
618 NODE_CALLBACK_PRI); 597 NODE_CALLBACK_PRI);
619 } 598 }
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 58efaf2f1259..1ba9d617d241 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -128,7 +128,7 @@ struct platform_object {
128}; 128};
129 129
130/** 130/**
131 * platform_device_put 131 * platform_device_put - destroy a platform device
132 * @pdev: platform device to free 132 * @pdev: platform device to free
133 * 133 *
134 * Free all memory associated with a platform device. This function must 134 * Free all memory associated with a platform device. This function must
@@ -152,7 +152,7 @@ static void platform_device_release(struct device *dev)
152} 152}
153 153
154/** 154/**
155 * platform_device_alloc 155 * platform_device_alloc - create a platform device
156 * @name: base name of the device we're adding 156 * @name: base name of the device we're adding
157 * @id: instance id 157 * @id: instance id
158 * 158 *
@@ -177,7 +177,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
177EXPORT_SYMBOL_GPL(platform_device_alloc); 177EXPORT_SYMBOL_GPL(platform_device_alloc);
178 178
179/** 179/**
180 * platform_device_add_resources 180 * platform_device_add_resources - add resources to a platform device
181 * @pdev: platform device allocated by platform_device_alloc to add resources to 181 * @pdev: platform device allocated by platform_device_alloc to add resources to
182 * @res: set of resources that needs to be allocated for the device 182 * @res: set of resources that needs to be allocated for the device
183 * @num: number of resources 183 * @num: number of resources
@@ -202,7 +202,7 @@ int platform_device_add_resources(struct platform_device *pdev,
202EXPORT_SYMBOL_GPL(platform_device_add_resources); 202EXPORT_SYMBOL_GPL(platform_device_add_resources);
203 203
204/** 204/**
205 * platform_device_add_data 205 * platform_device_add_data - add platform-specific data to a platform device
206 * @pdev: platform device allocated by platform_device_alloc to add resources to 206 * @pdev: platform device allocated by platform_device_alloc to add resources to
207 * @data: platform specific data for this platform device 207 * @data: platform specific data for this platform device
208 * @size: size of platform specific data 208 * @size: size of platform specific data
@@ -344,7 +344,7 @@ void platform_device_unregister(struct platform_device *pdev)
344EXPORT_SYMBOL_GPL(platform_device_unregister); 344EXPORT_SYMBOL_GPL(platform_device_unregister);
345 345
346/** 346/**
347 * platform_device_register_simple 347 * platform_device_register_simple - add a platform-level device and its resources
348 * @name: base name of the device we're adding 348 * @name: base name of the device we're adding
349 * @id: instance id 349 * @id: instance id
350 * @res: set of resources that needs to be allocated for the device 350 * @res: set of resources that needs to be allocated for the device
@@ -396,7 +396,7 @@ error:
396EXPORT_SYMBOL_GPL(platform_device_register_simple); 396EXPORT_SYMBOL_GPL(platform_device_register_simple);
397 397
398/** 398/**
399 * platform_device_register_data 399 * platform_device_register_data - add a platform-level device with platform-specific data
400 * @parent: parent device for the device we're adding 400 * @parent: parent device for the device we're adding
401 * @name: base name of the device we're adding 401 * @name: base name of the device we're adding
402 * @id: instance id 402 * @id: instance id
@@ -473,7 +473,7 @@ static void platform_drv_shutdown(struct device *_dev)
473} 473}
474 474
475/** 475/**
476 * platform_driver_register 476 * platform_driver_register - register a driver for platform-level devices
477 * @drv: platform driver structure 477 * @drv: platform driver structure
478 */ 478 */
479int platform_driver_register(struct platform_driver *drv) 479int platform_driver_register(struct platform_driver *drv)
@@ -491,7 +491,7 @@ int platform_driver_register(struct platform_driver *drv)
491EXPORT_SYMBOL_GPL(platform_driver_register); 491EXPORT_SYMBOL_GPL(platform_driver_register);
492 492
493/** 493/**
494 * platform_driver_unregister 494 * platform_driver_unregister - unregister a driver for platform-level devices
495 * @drv: platform driver structure 495 * @drv: platform driver structure
496 */ 496 */
497void platform_driver_unregister(struct platform_driver *drv) 497void platform_driver_unregister(struct platform_driver *drv)
@@ -548,6 +548,64 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
548} 548}
549EXPORT_SYMBOL_GPL(platform_driver_probe); 549EXPORT_SYMBOL_GPL(platform_driver_probe);
550 550
551/**
552 * platform_create_bundle - register driver and create corresponding device
553 * @driver: platform driver structure
554 * @probe: the driver probe routine, probably from an __init section
555 * @res: set of resources that needs to be allocated for the device
556 * @n_res: number of resources
557 * @data: platform specific data for this platform device
558 * @size: size of platform specific data
559 *
560 * Use this in legacy-style modules that probe hardware directly and
561 * register a single platform device and corresponding platform driver.
562 */
563struct platform_device * __init_or_module platform_create_bundle(
564 struct platform_driver *driver,
565 int (*probe)(struct platform_device *),
566 struct resource *res, unsigned int n_res,
567 const void *data, size_t size)
568{
569 struct platform_device *pdev;
570 int error;
571
572 pdev = platform_device_alloc(driver->driver.name, -1);
573 if (!pdev) {
574 error = -ENOMEM;
575 goto err_out;
576 }
577
578 if (res) {
579 error = platform_device_add_resources(pdev, res, n_res);
580 if (error)
581 goto err_pdev_put;
582 }
583
584 if (data) {
585 error = platform_device_add_data(pdev, data, size);
586 if (error)
587 goto err_pdev_put;
588 }
589
590 error = platform_device_add(pdev);
591 if (error)
592 goto err_pdev_put;
593
594 error = platform_driver_probe(driver, probe);
595 if (error)
596 goto err_pdev_del;
597
598 return pdev;
599
600err_pdev_del:
601 platform_device_del(pdev);
602err_pdev_put:
603 platform_device_put(pdev);
604err_out:
605 return ERR_PTR(error);
606}
607EXPORT_SYMBOL_GPL(platform_create_bundle);
608
551/* modalias support enables more hands-off userspace setup: 609/* modalias support enables more hands-off userspace setup:
552 * (a) environment variable lets new-style hotplug events work once system is 610 * (a) environment variable lets new-style hotplug events work once system is
553 * fully running: "modprobe $MODALIAS" 611 * fully running: "modprobe $MODALIAS"
@@ -578,7 +636,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
578} 636}
579 637
580static const struct platform_device_id *platform_match_id( 638static const struct platform_device_id *platform_match_id(
581 struct platform_device_id *id, 639 const struct platform_device_id *id,
582 struct platform_device *pdev) 640 struct platform_device *pdev)
583{ 641{
584 while (id->name[0]) { 642 while (id->name[0]) {
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 0e26a6f6fd48..d477f4dc5e51 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -35,8 +35,8 @@
35 * because children are guaranteed to be discovered after parents, and 35 * because children are guaranteed to be discovered after parents, and
36 * are inserted at the back of the list on discovery. 36 * are inserted at the back of the list on discovery.
37 * 37 *
38 * Since device_pm_add() may be called with a device semaphore held, 38 * Since device_pm_add() may be called with a device lock held,
39 * we must never try to acquire a device semaphore while holding 39 * we must never try to acquire a device lock while holding
40 * dpm_list_mutex. 40 * dpm_list_mutex.
41 */ 41 */
42 42
@@ -508,7 +508,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
508 TRACE_RESUME(0); 508 TRACE_RESUME(0);
509 509
510 dpm_wait(dev->parent, async); 510 dpm_wait(dev->parent, async);
511 down(&dev->sem); 511 device_lock(dev);
512 512
513 dev->power.status = DPM_RESUMING; 513 dev->power.status = DPM_RESUMING;
514 514
@@ -543,7 +543,7 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
543 } 543 }
544 } 544 }
545 End: 545 End:
546 up(&dev->sem); 546 device_unlock(dev);
547 complete_all(&dev->power.completion); 547 complete_all(&dev->power.completion);
548 548
549 TRACE_RESUME(error); 549 TRACE_RESUME(error);
@@ -629,7 +629,7 @@ static void dpm_resume(pm_message_t state)
629 */ 629 */
630static void device_complete(struct device *dev, pm_message_t state) 630static void device_complete(struct device *dev, pm_message_t state)
631{ 631{
632 down(&dev->sem); 632 device_lock(dev);
633 633
634 if (dev->class && dev->class->pm && dev->class->pm->complete) { 634 if (dev->class && dev->class->pm && dev->class->pm->complete) {
635 pm_dev_dbg(dev, state, "completing class "); 635 pm_dev_dbg(dev, state, "completing class ");
@@ -646,7 +646,7 @@ static void device_complete(struct device *dev, pm_message_t state)
646 dev->bus->pm->complete(dev); 646 dev->bus->pm->complete(dev);
647 } 647 }
648 648
649 up(&dev->sem); 649 device_unlock(dev);
650} 650}
651 651
652/** 652/**
@@ -809,7 +809,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
809 int error = 0; 809 int error = 0;
810 810
811 dpm_wait_for_children(dev, async); 811 dpm_wait_for_children(dev, async);
812 down(&dev->sem); 812 device_lock(dev);
813 813
814 if (async_error) 814 if (async_error)
815 goto End; 815 goto End;
@@ -849,7 +849,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
849 dev->power.status = DPM_OFF; 849 dev->power.status = DPM_OFF;
850 850
851 End: 851 End:
852 up(&dev->sem); 852 device_unlock(dev);
853 complete_all(&dev->power.completion); 853 complete_all(&dev->power.completion);
854 854
855 return error; 855 return error;
@@ -938,7 +938,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
938{ 938{
939 int error = 0; 939 int error = 0;
940 940
941 down(&dev->sem); 941 device_lock(dev);
942 942
943 if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) { 943 if (dev->bus && dev->bus->pm && dev->bus->pm->prepare) {
944 pm_dev_dbg(dev, state, "preparing "); 944 pm_dev_dbg(dev, state, "preparing ");
@@ -962,7 +962,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
962 suspend_report_result(dev->class->pm->prepare, error); 962 suspend_report_result(dev->class->pm->prepare, error);
963 } 963 }
964 End: 964 End:
965 up(&dev->sem); 965 device_unlock(dev);
966 966
967 return error; 967 return error;
968} 968}
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 0d903909af7e..8980feec5d14 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -54,7 +54,7 @@ sysdev_store(struct kobject *kobj, struct attribute *attr,
54 return -EIO; 54 return -EIO;
55} 55}
56 56
57static struct sysfs_ops sysfs_ops = { 57static const struct sysfs_ops sysfs_ops = {
58 .show = sysdev_show, 58 .show = sysdev_show,
59 .store = sysdev_store, 59 .store = sysdev_store,
60}; 60};
@@ -89,7 +89,7 @@ static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr,
89 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); 89 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
90 90
91 if (class_attr->show) 91 if (class_attr->show)
92 return class_attr->show(class, buffer); 92 return class_attr->show(class, class_attr, buffer);
93 return -EIO; 93 return -EIO;
94} 94}
95 95
@@ -100,11 +100,11 @@ static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr,
100 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); 100 struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr);
101 101
102 if (class_attr->store) 102 if (class_attr->store)
103 return class_attr->store(class, buffer, count); 103 return class_attr->store(class, class_attr, buffer, count);
104 return -EIO; 104 return -EIO;
105} 105}
106 106
107static struct sysfs_ops sysfs_class_ops = { 107static const struct sysfs_ops sysfs_class_ops = {
108 .show = sysdev_class_show, 108 .show = sysdev_class_show,
109 .store = sysdev_class_store, 109 .store = sysdev_class_store,
110}; 110};
@@ -145,13 +145,20 @@ int sysdev_class_register(struct sysdev_class *cls)
145 if (retval) 145 if (retval)
146 return retval; 146 return retval;
147 147
148 return kset_register(&cls->kset); 148 retval = kset_register(&cls->kset);
149 if (!retval && cls->attrs)
150 retval = sysfs_create_files(&cls->kset.kobj,
151 (const struct attribute **)cls->attrs);
152 return retval;
149} 153}
150 154
151void sysdev_class_unregister(struct sysdev_class *cls) 155void sysdev_class_unregister(struct sysdev_class *cls)
152{ 156{
153 pr_debug("Unregistering sysdev class '%s'\n", 157 pr_debug("Unregistering sysdev class '%s'\n",
154 kobject_name(&cls->kset.kobj)); 158 kobject_name(&cls->kset.kobj));
159 if (cls->attrs)
160 sysfs_remove_files(&cls->kset.kobj,
161 (const struct attribute **)cls->attrs);
155 kset_unregister(&cls->kset); 162 kset_unregister(&cls->kset);
156} 163}
157 164
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c
index a808b1530b3b..eb2091aa1c19 100644
--- a/drivers/block/osdblk.c
+++ b/drivers/block/osdblk.c
@@ -476,7 +476,9 @@ static void class_osdblk_release(struct class *cls)
476 kfree(cls); 476 kfree(cls);
477} 477}
478 478
479static ssize_t class_osdblk_list(struct class *c, char *data) 479static ssize_t class_osdblk_list(struct class *c,
480 struct class_attribute *attr,
481 char *data)
480{ 482{
481 int n = 0; 483 int n = 0;
482 struct list_head *tmp; 484 struct list_head *tmp;
@@ -500,7 +502,9 @@ static ssize_t class_osdblk_list(struct class *c, char *data)
500 return n; 502 return n;
501} 503}
502 504
503static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) 505static ssize_t class_osdblk_add(struct class *c,
506 struct class_attribute *attr,
507 const char *buf, size_t count)
504{ 508{
505 struct osdblk_device *osdev; 509 struct osdblk_device *osdev;
506 ssize_t rc; 510 ssize_t rc;
@@ -592,7 +596,9 @@ err_out_mod:
592 return rc; 596 return rc;
593} 597}
594 598
595static ssize_t class_osdblk_remove(struct class *c, const char *buf, 599static ssize_t class_osdblk_remove(struct class *c,
600 struct class_attribute *attr,
601 const char *buf,
596 size_t count) 602 size_t count)
597{ 603{
598 struct osdblk_device *osdev = NULL; 604 struct osdblk_device *osdev = NULL;
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index b72935b8f203..39c8514442eb 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -284,7 +284,7 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,
284 return len; 284 return len;
285} 285}
286 286
287static struct sysfs_ops kobj_pkt_ops = { 287static const struct sysfs_ops kobj_pkt_ops = {
288 .show = kobj_pkt_show, 288 .show = kobj_pkt_show,
289 .store = kobj_pkt_store 289 .store = kobj_pkt_store
290}; 290};
@@ -337,7 +337,9 @@ static void class_pktcdvd_release(struct class *cls)
337{ 337{
338 kfree(cls); 338 kfree(cls);
339} 339}
340static ssize_t class_pktcdvd_show_map(struct class *c, char *data) 340static ssize_t class_pktcdvd_show_map(struct class *c,
341 struct class_attribute *attr,
342 char *data)
341{ 343{
342 int n = 0; 344 int n = 0;
343 int idx; 345 int idx;
@@ -356,7 +358,9 @@ static ssize_t class_pktcdvd_show_map(struct class *c, char *data)
356 return n; 358 return n;
357} 359}
358 360
359static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, 361static ssize_t class_pktcdvd_store_add(struct class *c,
362 struct class_attribute *attr,
363 const char *buf,
360 size_t count) 364 size_t count)
361{ 365{
362 unsigned int major, minor; 366 unsigned int major, minor;
@@ -376,7 +380,9 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
376 return -EINVAL; 380 return -EINVAL;
377} 381}
378 382
379static ssize_t class_pktcdvd_store_remove(struct class *c, const char *buf, 383static ssize_t class_pktcdvd_store_remove(struct class *c,
384 struct class_attribute *attr,
385 const char *buf,
380 size_t count) 386 size_t count)
381{ 387{
382 unsigned int major, minor; 388 unsigned int major, minor;
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 67bc2ece7b4b..2d5d575e889d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -766,7 +766,7 @@ static void cpufreq_sysfs_release(struct kobject *kobj)
766 complete(&policy->kobj_unregister); 766 complete(&policy->kobj_unregister);
767} 767}
768 768
769static struct sysfs_ops sysfs_ops = { 769static const struct sysfs_ops sysfs_ops = {
770 .show = show, 770 .show = show,
771 .store = store, 771 .store = store,
772}; 772};
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 97b003839fb6..8719b36e1a4d 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -22,6 +22,7 @@ static int __init cpuidle_sysfs_setup(char *unused)
22__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); 22__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
23 23
24static ssize_t show_available_governors(struct sysdev_class *class, 24static ssize_t show_available_governors(struct sysdev_class *class,
25 struct sysdev_class_attribute *attr,
25 char *buf) 26 char *buf)
26{ 27{
27 ssize_t i = 0; 28 ssize_t i = 0;
@@ -41,6 +42,7 @@ out:
41} 42}
42 43
43static ssize_t show_current_driver(struct sysdev_class *class, 44static ssize_t show_current_driver(struct sysdev_class *class,
45 struct sysdev_class_attribute *attr,
44 char *buf) 46 char *buf)
45{ 47{
46 ssize_t ret; 48 ssize_t ret;
@@ -56,6 +58,7 @@ static ssize_t show_current_driver(struct sysdev_class *class,
56} 58}
57 59
58static ssize_t show_current_governor(struct sysdev_class *class, 60static ssize_t show_current_governor(struct sysdev_class *class,
61 struct sysdev_class_attribute *attr,
59 char *buf) 62 char *buf)
60{ 63{
61 ssize_t ret; 64 ssize_t ret;
@@ -71,6 +74,7 @@ static ssize_t show_current_governor(struct sysdev_class *class,
71} 74}
72 75
73static ssize_t store_current_governor(struct sysdev_class *class, 76static ssize_t store_current_governor(struct sysdev_class *class,
77 struct sysdev_class_attribute *attr,
74 const char *buf, size_t count) 78 const char *buf, size_t count)
75{ 79{
76 char gov_name[CPUIDLE_NAME_LEN]; 80 char gov_name[CPUIDLE_NAME_LEN];
@@ -191,7 +195,7 @@ static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,
191 return ret; 195 return ret;
192} 196}
193 197
194static struct sysfs_ops cpuidle_sysfs_ops = { 198static const struct sysfs_ops cpuidle_sysfs_ops = {
195 .show = cpuidle_show, 199 .show = cpuidle_show,
196 .store = cpuidle_store, 200 .store = cpuidle_store,
197}; 201};
@@ -277,7 +281,7 @@ static ssize_t cpuidle_state_show(struct kobject * kobj,
277 return ret; 281 return ret;
278} 282}
279 283
280static struct sysfs_ops cpuidle_state_sysfs_ops = { 284static const struct sysfs_ops cpuidle_state_sysfs_ops = {
281 .show = cpuidle_state_show, 285 .show = cpuidle_state_show,
282}; 286};
283 287
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index af14c9a5b8d4..0099340b9616 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -1138,7 +1138,7 @@ ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
1138 return entry->show(&chan->common, page); 1138 return entry->show(&chan->common, page);
1139} 1139}
1140 1140
1141struct sysfs_ops ioat_sysfs_ops = { 1141const struct sysfs_ops ioat_sysfs_ops = {
1142 .show = ioat_attr_show, 1142 .show = ioat_attr_show,
1143}; 1143};
1144 1144
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 4f747a254074..86b97ac8774e 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -346,7 +346,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
346 unsigned long *phys_complete); 346 unsigned long *phys_complete);
347void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); 347void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type);
348void ioat_kobject_del(struct ioatdma_device *device); 348void ioat_kobject_del(struct ioatdma_device *device);
349extern struct sysfs_ops ioat_sysfs_ops; 349extern const struct sysfs_ops ioat_sysfs_ops;
350extern struct ioat_sysfs_entry ioat_version_attr; 350extern struct ioat_sysfs_entry ioat_version_attr;
351extern struct ioat_sysfs_entry ioat_cap_attr; 351extern struct ioat_sysfs_entry ioat_cap_attr;
352#endif /* IOATDMA_H */ 352#endif /* IOATDMA_H */
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 53764577035f..5fdedbc0f545 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -137,7 +137,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
137} 137}
138 138
139/* edac_dev file operations for an 'ctl_info' */ 139/* edac_dev file operations for an 'ctl_info' */
140static struct sysfs_ops device_ctl_info_ops = { 140static const struct sysfs_ops device_ctl_info_ops = {
141 .show = edac_dev_ctl_info_show, 141 .show = edac_dev_ctl_info_show,
142 .store = edac_dev_ctl_info_store 142 .store = edac_dev_ctl_info_store
143}; 143};
@@ -373,7 +373,7 @@ static ssize_t edac_dev_instance_store(struct kobject *kobj,
373} 373}
374 374
375/* edac_dev file operations for an 'instance' */ 375/* edac_dev file operations for an 'instance' */
376static struct sysfs_ops device_instance_ops = { 376static const struct sysfs_ops device_instance_ops = {
377 .show = edac_dev_instance_show, 377 .show = edac_dev_instance_show,
378 .store = edac_dev_instance_store 378 .store = edac_dev_instance_store
379}; 379};
@@ -476,7 +476,7 @@ static ssize_t edac_dev_block_store(struct kobject *kobj,
476} 476}
477 477
478/* edac_dev file operations for a 'block' */ 478/* edac_dev file operations for a 'block' */
479static struct sysfs_ops device_block_ops = { 479static const struct sysfs_ops device_block_ops = {
480 .show = edac_dev_block_show, 480 .show = edac_dev_block_show,
481 .store = edac_dev_block_store 481 .store = edac_dev_block_store
482}; 482};
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index e1d4ce083481..88840e9fa3e0 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -245,7 +245,7 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr,
245 return -EIO; 245 return -EIO;
246} 246}
247 247
248static struct sysfs_ops csrowfs_ops = { 248static const struct sysfs_ops csrowfs_ops = {
249 .show = csrowdev_show, 249 .show = csrowdev_show,
250 .store = csrowdev_store 250 .store = csrowdev_store
251}; 251};
@@ -575,7 +575,7 @@ static ssize_t mcidev_store(struct kobject *kobj, struct attribute *attr,
575} 575}
576 576
577/* Intermediate show/store table */ 577/* Intermediate show/store table */
578static struct sysfs_ops mci_ops = { 578static const struct sysfs_ops mci_ops = {
579 .show = mcidev_show, 579 .show = mcidev_show,
580 .store = mcidev_store 580 .store = mcidev_store
581}; 581};
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index fb60a877d768..bef94e3d9944 100644
--- a/drivers/edac/edac_pci_sysfs.c
+++ b/drivers/edac/edac_pci_sysfs.c
@@ -121,7 +121,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj,
121} 121}
122 122
123/* fs_ops table */ 123/* fs_ops table */
124static struct sysfs_ops pci_instance_ops = { 124static const struct sysfs_ops pci_instance_ops = {
125 .show = edac_pci_instance_show, 125 .show = edac_pci_instance_show,
126 .store = edac_pci_instance_store 126 .store = edac_pci_instance_store
127}; 127};
@@ -261,7 +261,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,
261 return -EIO; 261 return -EIO;
262} 262}
263 263
264static struct sysfs_ops edac_pci_sysfs_ops = { 264static const struct sysfs_ops edac_pci_sysfs_ops = {
265 .show = edac_pci_dev_show, 265 .show = edac_pci_dev_show,
266 .store = edac_pci_dev_store 266 .store = edac_pci_dev_store
267}; 267};
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 014cabd3afda..5db0518c66da 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -33,7 +33,6 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/rwsem.h> 35#include <linux/rwsem.h>
36#include <linux/semaphore.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/string.h> 37#include <linux/string.h>
39#include <linux/workqueue.h> 38#include <linux/workqueue.h>
@@ -828,9 +827,9 @@ static int update_unit(struct device *dev, void *data)
828 struct fw_driver *driver = (struct fw_driver *)dev->driver; 827 struct fw_driver *driver = (struct fw_driver *)dev->driver;
829 828
830 if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) { 829 if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) {
831 down(&dev->sem); 830 device_lock(dev);
832 driver->update(unit); 831 driver->update(unit);
833 up(&dev->sem); 832 device_unlock(dev);
834 } 833 }
835 834
836 return 0; 835 return 0;
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 9e4f59dc7f1e..110e24e50883 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
122 return ret; 122 return ret;
123} 123}
124 124
125static struct sysfs_ops edd_attr_ops = { 125static const struct sysfs_ops edd_attr_ops = {
126 .show = edd_attr_show, 126 .show = edd_attr_show,
127}; 127};
128 128
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index f4f709d1370b..082f06ecd327 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -362,7 +362,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,
362 return ret; 362 return ret;
363} 363}
364 364
365static struct sysfs_ops efivar_attr_ops = { 365static const struct sysfs_ops efivar_attr_ops = {
366 .show = efivar_attr_show, 366 .show = efivar_attr_show,
367 .store = efivar_attr_store, 367 .store = efivar_attr_store,
368}; 368};
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index a3600e3ed0fa..ed2801c378de 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -519,7 +519,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,
519 return ret; 519 return ret;
520} 520}
521 521
522static struct sysfs_ops ibft_attr_ops = { 522static const struct sysfs_ops ibft_attr_ops = {
523 .show = ibft_show_attribute, 523 .show = ibft_show_attribute,
524}; 524};
525 525
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 20f645743ead..d59f7cad2269 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -74,7 +74,7 @@ static struct attribute *def_attrs[] = {
74 NULL 74 NULL
75}; 75};
76 76
77static struct sysfs_ops memmap_attr_ops = { 77static const struct sysfs_ops memmap_attr_ops = {
78 .show = memmap_attr_show, 78 .show = memmap_attr_show,
79}; 79};
80 80
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 9006fdb26fea..6d1b86661e63 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -623,7 +623,9 @@ static const struct attribute_group gpiochip_attr_group = {
623 * /sys/class/gpio/unexport ... write-only 623 * /sys/class/gpio/unexport ... write-only
624 * integer N ... number of GPIO to unexport 624 * integer N ... number of GPIO to unexport
625 */ 625 */
626static ssize_t export_store(struct class *class, const char *buf, size_t len) 626static ssize_t export_store(struct class *class,
627 struct class_attribute *attr,
628 const char *buf, size_t len)
627{ 629{
628 long gpio; 630 long gpio;
629 int status; 631 int status;
@@ -653,7 +655,9 @@ done:
653 return status ? : len; 655 return status ? : len;
654} 656}
655 657
656static ssize_t unexport_store(struct class *class, const char *buf, size_t len) 658static ssize_t unexport_store(struct class *class,
659 struct class_attribute *attr,
660 const char *buf, size_t len)
657{ 661{
658 long gpio; 662 long gpio;
659 int status; 663 int status;
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 7e42b7e9d43a..014ce24761b9 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -70,19 +70,17 @@ static int drm_class_resume(struct device *dev)
70 return 0; 70 return 0;
71} 71}
72 72
73/* Display the version of drm_core. This doesn't work right in current design */
74static ssize_t version_show(struct class *dev, char *buf)
75{
76 return sprintf(buf, "%s %d.%d.%d %s\n", CORE_NAME, CORE_MAJOR,
77 CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
78}
79
80static char *drm_devnode(struct device *dev, mode_t *mode) 73static char *drm_devnode(struct device *dev, mode_t *mode)
81{ 74{
82 return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); 75 return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev));
83} 76}
84 77
85static CLASS_ATTR(version, S_IRUGO, version_show, NULL); 78static CLASS_ATTR_STRING(version, S_IRUGO,
79 CORE_NAME " "
80 __stringify(CORE_MAJOR) "."
81 __stringify(CORE_MINOR) "."
82 __stringify(CORE_PATCHLEVEL) " "
83 CORE_DATE);
86 84
87/** 85/**
88 * drm_sysfs_create - create a struct drm_sysfs_class structure 86 * drm_sysfs_create - create a struct drm_sysfs_class structure
@@ -109,7 +107,7 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
109 class->suspend = drm_class_suspend; 107 class->suspend = drm_class_suspend;
110 class->resume = drm_class_resume; 108 class->resume = drm_class_resume;
111 109
112 err = class_create_file(class, &class_attr_version); 110 err = class_create_file(class, &class_attr_version.attr);
113 if (err) 111 if (err)
114 goto err_out_class; 112 goto err_out_class;
115 113
@@ -132,7 +130,7 @@ void drm_sysfs_destroy(void)
132{ 130{
133 if ((drm_class == NULL) || (IS_ERR(drm_class))) 131 if ((drm_class == NULL) || (IS_ERR(drm_class)))
134 return; 132 return;
135 class_remove_file(drm_class, &class_attr_version); 133 class_remove_file(drm_class, &class_attr_version.attr);
136 class_destroy(drm_class); 134 class_destroy(drm_class);
137} 135}
138 136
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index c7320ce4567d..89c38c49066f 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -128,7 +128,7 @@ static struct attribute *ttm_bo_global_attrs[] = {
128 NULL 128 NULL
129}; 129};
130 130
131static struct sysfs_ops ttm_bo_global_ops = { 131static const struct sysfs_ops ttm_bo_global_ops = {
132 .show = &ttm_bo_global_show 132 .show = &ttm_bo_global_show
133}; 133};
134 134
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index f5245c02b8fd..eb143e04d402 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -152,7 +152,7 @@ static struct attribute *ttm_mem_zone_attrs[] = {
152 NULL 152 NULL
153}; 153};
154 154
155static struct sysfs_ops ttm_mem_zone_ops = { 155static const struct sysfs_ops ttm_mem_zone_ops = {
156 .show = &ttm_mem_zone_show, 156 .show = &ttm_mem_zone_show,
157 .store = &ttm_mem_zone_store 157 .store = &ttm_mem_zone_store
158}; 158};
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 913abd7c172f..c7c237537f81 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -850,7 +850,7 @@ static const struct i2c_algorithm omap_i2c_algo = {
850 .functionality = omap_i2c_func, 850 .functionality = omap_i2c_func,
851}; 851};
852 852
853static int __init 853static int __devinit
854omap_i2c_probe(struct platform_device *pdev) 854omap_i2c_probe(struct platform_device *pdev)
855{ 855{
856 struct omap_i2c_dev *dev; 856 struct omap_i2c_dev *dev;
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 5122b5a8aa2d..18350213479e 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -19,7 +19,6 @@
19#include <linux/moduleparam.h> 19#include <linux/moduleparam.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/freezer.h> 21#include <linux/freezer.h>
22#include <linux/semaphore.h>
23#include <asm/atomic.h> 22#include <asm/atomic.h>
24 23
25#include "csr.h" 24#include "csr.h"
@@ -1397,9 +1396,9 @@ static int update_pdrv(struct device *dev, void *data)
1397 pdrv = container_of(drv, struct hpsb_protocol_driver, 1396 pdrv = container_of(drv, struct hpsb_protocol_driver,
1398 driver); 1397 driver);
1399 if (pdrv->update) { 1398 if (pdrv->update) {
1400 down(&ud->device.sem); 1399 device_lock(&ud->device);
1401 error = pdrv->update(ud); 1400 error = pdrv->update(ud);
1402 up(&ud->device.sem); 1401 device_unlock(&ud->device);
1403 } 1402 }
1404 if (error) 1403 if (error)
1405 device_release_driver(&ud->device); 1404 device_release_driver(&ud->device);
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 5130fc55b8e2..764787ebe8d8 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3597,7 +3597,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
3597 atomic_long_read(&group->counter[cm_attr->index])); 3597 atomic_long_read(&group->counter[cm_attr->index]));
3598} 3598}
3599 3599
3600static struct sysfs_ops cm_counter_ops = { 3600static const struct sysfs_ops cm_counter_ops = {
3601 .show = cm_show_counter 3601 .show = cm_show_counter
3602}; 3602};
3603 3603
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 158a214da2f7..1558bb7fc74d 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -79,7 +79,7 @@ static ssize_t port_attr_show(struct kobject *kobj,
79 return port_attr->show(p, port_attr, buf); 79 return port_attr->show(p, port_attr, buf);
80} 80}
81 81
82static struct sysfs_ops port_sysfs_ops = { 82static const struct sysfs_ops port_sysfs_ops = {
83 .show = port_attr_show 83 .show = port_attr_show
84}; 84};
85 85
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 1b09b735c5a8..017d6e24448f 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1336,11 +1336,8 @@ static void ib_ucm_remove_one(struct ib_device *device)
1336 device_unregister(&ucm_dev->dev); 1336 device_unregister(&ucm_dev->dev);
1337} 1337}
1338 1338
1339static ssize_t show_abi_version(struct class *class, char *buf) 1339static CLASS_ATTR_STRING(abi_version, S_IRUGO,
1340{ 1340 __stringify(IB_USER_CM_ABI_VERSION));
1341 return sprintf(buf, "%d\n", IB_USER_CM_ABI_VERSION);
1342}
1343static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
1344 1341
1345static int __init ib_ucm_init(void) 1342static int __init ib_ucm_init(void)
1346{ 1343{
@@ -1353,7 +1350,7 @@ static int __init ib_ucm_init(void)
1353 goto error1; 1350 goto error1;
1354 } 1351 }
1355 1352
1356 ret = class_create_file(&cm_class, &class_attr_abi_version); 1353 ret = class_create_file(&cm_class, &class_attr_abi_version.attr);
1357 if (ret) { 1354 if (ret) {
1358 printk(KERN_ERR "ucm: couldn't create abi_version attribute\n"); 1355 printk(KERN_ERR "ucm: couldn't create abi_version attribute\n");
1359 goto error2; 1356 goto error2;
@@ -1367,7 +1364,7 @@ static int __init ib_ucm_init(void)
1367 return 0; 1364 return 0;
1368 1365
1369error3: 1366error3:
1370 class_remove_file(&cm_class, &class_attr_abi_version); 1367 class_remove_file(&cm_class, &class_attr_abi_version.attr);
1371error2: 1368error2:
1372 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); 1369 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
1373error1: 1370error1:
@@ -1377,7 +1374,7 @@ error1:
1377static void __exit ib_ucm_cleanup(void) 1374static void __exit ib_ucm_cleanup(void)
1378{ 1375{
1379 ib_unregister_client(&ucm_client); 1376 ib_unregister_client(&ucm_client);
1380 class_remove_file(&cm_class, &class_attr_abi_version); 1377 class_remove_file(&cm_class, &class_attr_abi_version.attr);
1381 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); 1378 unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
1382 if (overflow_maj) 1379 if (overflow_maj)
1383 unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES); 1380 unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES);
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 02d360cfc2f7..04b585e86cb2 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -965,11 +965,8 @@ static ssize_t show_port(struct device *dev, struct device_attribute *attr,
965} 965}
966static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); 966static DEVICE_ATTR(port, S_IRUGO, show_port, NULL);
967 967
968static ssize_t show_abi_version(struct class *class, char *buf) 968static CLASS_ATTR_STRING(abi_version, S_IRUGO,
969{ 969 __stringify(IB_USER_MAD_ABI_VERSION));
970 return sprintf(buf, "%d\n", IB_USER_MAD_ABI_VERSION);
971}
972static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
973 970
974static dev_t overflow_maj; 971static dev_t overflow_maj;
975static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS); 972static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
@@ -1194,7 +1191,7 @@ static int __init ib_umad_init(void)
1194 goto out_chrdev; 1191 goto out_chrdev;
1195 } 1192 }
1196 1193
1197 ret = class_create_file(umad_class, &class_attr_abi_version); 1194 ret = class_create_file(umad_class, &class_attr_abi_version.attr);
1198 if (ret) { 1195 if (ret) {
1199 printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n"); 1196 printk(KERN_ERR "user_mad: couldn't create abi_version attribute\n");
1200 goto out_class; 1197 goto out_class;
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 4fa2e6516441..d805cf365c8d 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -691,11 +691,8 @@ static ssize_t show_dev_abi_version(struct device *device,
691} 691}
692static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); 692static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL);
693 693
694static ssize_t show_abi_version(struct class *class, char *buf) 694static CLASS_ATTR_STRING(abi_version, S_IRUGO,
695{ 695 __stringify(IB_USER_VERBS_ABI_VERSION));
696 return sprintf(buf, "%d\n", IB_USER_VERBS_ABI_VERSION);
697}
698static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
699 696
700static dev_t overflow_maj; 697static dev_t overflow_maj;
701static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES); 698static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES);
@@ -841,7 +838,7 @@ static int __init ib_uverbs_init(void)
841 goto out_chrdev; 838 goto out_chrdev;
842 } 839 }
843 840
844 ret = class_create_file(uverbs_class, &class_attr_abi_version); 841 ret = class_create_file(uverbs_class, &class_attr_abi_version.attr);
845 if (ret) { 842 if (ret) {
846 printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n"); 843 printk(KERN_ERR "user_verbs: couldn't create abi_version attribute\n");
847 goto out_class; 844 goto out_class;
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 437f55c5d18d..419795f4a2aa 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -321,6 +321,7 @@ int wf_register_sensor(struct wf_sensor *new_sr)
321 kref_init(&new_sr->ref); 321 kref_init(&new_sr->ref);
322 list_add(&new_sr->link, &wf_sensors); 322 list_add(&new_sr->link, &wf_sensors);
323 323
324 sysfs_attr_init(&new_sr->attr.attr);
324 new_sr->attr.attr.name = new_sr->name; 325 new_sr->attr.attr.name = new_sr->name;
325 new_sr->attr.attr.mode = 0444; 326 new_sr->attr.attr.mode = 0444;
326 new_sr->attr.show = wf_show_sensor; 327 new_sr->attr.show = wf_show_sensor;
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 6c68b9e5f5c4..43137b421f92 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -173,6 +173,7 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
173 173
174 fct->fan_type = pwm_fan; 174 fct->fan_type = pwm_fan;
175 fct->ctrl.type = pwm_fan ? WF_CONTROL_PWM_FAN : WF_CONTROL_RPM_FAN; 175 fct->ctrl.type = pwm_fan ? WF_CONTROL_PWM_FAN : WF_CONTROL_RPM_FAN;
176 sysfs_attr_init(&fct->ctrl.attr.attr);
176 177
177 /* We use the name & location here the same way we do for SMU sensors, 178 /* We use the name & location here the same way we do for SMU sensors,
178 * see the comment in windfarm_smu_sensors.c. The locations are a bit 179 * see the comment in windfarm_smu_sensors.c. The locations are a bit
diff --git a/drivers/md/dm-sysfs.c b/drivers/md/dm-sysfs.c
index f91b40942e07..84d2b91e4efb 100644
--- a/drivers/md/dm-sysfs.c
+++ b/drivers/md/dm-sysfs.c
@@ -75,7 +75,7 @@ static struct attribute *dm_attrs[] = {
75 NULL, 75 NULL,
76}; 76};
77 77
78static struct sysfs_ops dm_sysfs_ops = { 78static const struct sysfs_ops dm_sysfs_ops = {
79 .show = dm_attr_show, 79 .show = dm_attr_show,
80}; 80};
81 81
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a20a71e5efd3..fdc1890b6ac5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2642,7 +2642,7 @@ static void rdev_free(struct kobject *ko)
2642 mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj); 2642 mdk_rdev_t *rdev = container_of(ko, mdk_rdev_t, kobj);
2643 kfree(rdev); 2643 kfree(rdev);
2644} 2644}
2645static struct sysfs_ops rdev_sysfs_ops = { 2645static const struct sysfs_ops rdev_sysfs_ops = {
2646 .show = rdev_attr_show, 2646 .show = rdev_attr_show,
2647 .store = rdev_attr_store, 2647 .store = rdev_attr_store,
2648}; 2648};
@@ -4059,7 +4059,7 @@ static void md_free(struct kobject *ko)
4059 kfree(mddev); 4059 kfree(mddev);
4060} 4060}
4061 4061
4062static struct sysfs_ops md_sysfs_ops = { 4062static const struct sysfs_ops md_sysfs_ops = {
4063 .show = md_attr_show, 4063 .show = md_attr_show,
4064 .store = md_attr_store, 4064 .store = md_attr_store,
4065}; 4065};
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index 7400eacb4d64..142c327afb32 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1735,7 +1735,7 @@ static struct v4l2_int_device omap24xxcam = {
1735 * 1735 *
1736 */ 1736 */
1737 1737
1738static int __init omap24xxcam_probe(struct platform_device *pdev) 1738static int __devinit omap24xxcam_probe(struct platform_device *pdev)
1739{ 1739{
1740 struct omap24xxcam_device *cam; 1740 struct omap24xxcam_device *cam;
1741 struct resource *mem; 1741 struct resource *mem;
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 04c27266f567..779aa8ebe4cf 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -497,12 +497,7 @@ static struct pci_driver phantom_pci_driver = {
497 .resume = phantom_resume 497 .resume = phantom_resume
498}; 498};
499 499
500static ssize_t phantom_show_version(struct class *cls, char *buf) 500static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);
501{
502 return sprintf(buf, PHANTOM_VERSION "\n");
503}
504
505static CLASS_ATTR(version, 0444, phantom_show_version, NULL);
506 501
507static int __init phantom_init(void) 502static int __init phantom_init(void)
508{ 503{
@@ -515,7 +510,7 @@ static int __init phantom_init(void)
515 printk(KERN_ERR "phantom: can't register phantom class\n"); 510 printk(KERN_ERR "phantom: can't register phantom class\n");
516 goto err; 511 goto err;
517 } 512 }
518 retval = class_create_file(phantom_class, &class_attr_version); 513 retval = class_create_file(phantom_class, &class_attr_version.attr);
519 if (retval) { 514 if (retval) {
520 printk(KERN_ERR "phantom: can't create sysfs version file\n"); 515 printk(KERN_ERR "phantom: can't create sysfs version file\n");
521 goto err_class; 516 goto err_class;
@@ -541,7 +536,7 @@ static int __init phantom_init(void)
541err_unchr: 536err_unchr:
542 unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); 537 unregister_chrdev_region(dev, PHANTOM_MAX_MINORS);
543err_attr: 538err_attr:
544 class_remove_file(phantom_class, &class_attr_version); 539 class_remove_file(phantom_class, &class_attr_version.attr);
545err_class: 540err_class:
546 class_destroy(phantom_class); 541 class_destroy(phantom_class);
547err: 542err:
@@ -554,7 +549,7 @@ static void __exit phantom_exit(void)
554 549
555 unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS); 550 unregister_chrdev_region(MKDEV(phantom_major, 0), PHANTOM_MAX_MINORS);
556 551
557 class_remove_file(phantom_class, &class_attr_version); 552 class_remove_file(phantom_class, &class_attr_version.attr);
558 class_destroy(phantom_class); 553 class_destroy(phantom_class);
559 554
560 pr_debug("phantom: module successfully removed\n"); 555 pr_debug("phantom: module successfully removed\n");
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index bc45ef9af17d..fad40aa6f099 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -89,7 +89,8 @@ DEFINE_MUTEX(ubi_devices_mutex);
89static DEFINE_SPINLOCK(ubi_devices_lock); 89static DEFINE_SPINLOCK(ubi_devices_lock);
90 90
91/* "Show" method for files in '/<sysfs>/class/ubi/' */ 91/* "Show" method for files in '/<sysfs>/class/ubi/' */
92static ssize_t ubi_version_show(struct class *class, char *buf) 92static ssize_t ubi_version_show(struct class *class, struct class_attribute *attr,
93 char *buf)
93{ 94{
94 return sprintf(buf, "%d\n", UBI_VERSION); 95 return sprintf(buf, "%d\n", UBI_VERSION);
95} 96}
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5acd557cea9b..b8bec086daa1 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -51,7 +51,9 @@
51 * "show" function for the bond_masters attribute. 51 * "show" function for the bond_masters attribute.
52 * The class parameter is ignored. 52 * The class parameter is ignored.
53 */ 53 */
54static ssize_t bonding_show_bonds(struct class *cls, char *buf) 54static ssize_t bonding_show_bonds(struct class *cls,
55 struct class_attribute *attr,
56 char *buf)
55{ 57{
56 struct net *net = current->nsproxy->net_ns; 58 struct net *net = current->nsproxy->net_ns;
57 struct bond_net *bn = net_generic(net, bond_net_id); 59 struct bond_net *bn = net_generic(net, bond_net_id);
@@ -98,6 +100,7 @@ static struct net_device *bond_get_by_name(struct net *net, const char *ifname)
98 */ 100 */
99 101
100static ssize_t bonding_store_bonds(struct class *cls, 102static ssize_t bonding_store_bonds(struct class *cls,
103 struct class_attribute *attr,
101 const char *buffer, size_t count) 104 const char *buffer, size_t count)
102{ 105{
103 struct net *net = current->nsproxy->net_ns; 106 struct net *net = current->nsproxy->net_ns;
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index f2b937966950..0bc777bac9b4 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1577,7 +1577,7 @@ static struct attribute * veth_pool_attrs[] = {
1577 NULL, 1577 NULL,
1578}; 1578};
1579 1579
1580static struct sysfs_ops veth_pool_ops = { 1580static const struct sysfs_ops veth_pool_ops = {
1581 .show = veth_pool_show, 1581 .show = veth_pool_show,
1582 .store = veth_pool_store, 1582 .store = veth_pool_store,
1583}; 1583};
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index 966de5d69521..e6e972d9b7ca 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -384,7 +384,7 @@ static struct attribute *veth_cnx_default_attrs[] = {
384 NULL 384 NULL
385}; 385};
386 386
387static struct sysfs_ops veth_cnx_sysfs_ops = { 387static const struct sysfs_ops veth_cnx_sysfs_ops = {
388 .show = veth_cnx_attribute_show 388 .show = veth_cnx_attribute_show
389}; 389};
390 390
@@ -441,7 +441,7 @@ static struct attribute *veth_port_default_attrs[] = {
441 NULL 441 NULL
442}; 442};
443 443
444static struct sysfs_ops veth_port_sysfs_ops = { 444static const struct sysfs_ops veth_port_sysfs_ops = {
445 .show = veth_port_attribute_show 445 .show = veth_port_attribute_show
446}; 446};
447 447
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 0bc5d474b168..1062b8ffe244 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -481,7 +481,7 @@ pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,
481 return ret; 481 return ret;
482} 482}
483 483
484static struct sysfs_ops pdcspath_attr_ops = { 484static const struct sysfs_ops pdcspath_attr_ops = {
485 .show = pdcspath_attr_show, 485 .show = pdcspath_attr_show,
486 .store = pdcspath_attr_store, 486 .store = pdcspath_attr_store,
487}; 487};
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 712250f5874a..26301cb25e7f 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -288,9 +288,9 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
288 next = dev->bus_list.next; 288 next = dev->bus_list.next;
289 289
290 /* Run device routines with the device locked */ 290 /* Run device routines with the device locked */
291 down(&dev->dev.sem); 291 device_lock(&dev->dev);
292 retval = cb(dev, userdata); 292 retval = cb(dev, userdata);
293 up(&dev->dev.sem); 293 device_unlock(&dev->dev);
294 if (retval) 294 if (retval)
295 break; 295 break;
296 } 296 }
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 6151389fd903..0a894efd4b9b 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -73,7 +73,7 @@ static void legacy_release(struct kobject *kobj)
73} 73}
74 74
75static struct kobj_type legacy_ktype = { 75static struct kobj_type legacy_ktype = {
76 .sysfs_ops = &(struct sysfs_ops){ 76 .sysfs_ops = &(const struct sysfs_ops){
77 .store = legacy_store, .show = legacy_show 77 .store = legacy_store, .show = legacy_show
78 }, 78 },
79 .release = &legacy_release, 79 .release = &legacy_release,
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 807224ec8351..de296452c957 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -642,6 +642,7 @@ void pci_create_legacy_files(struct pci_bus *b)
642 if (!b->legacy_io) 642 if (!b->legacy_io)
643 goto kzalloc_err; 643 goto kzalloc_err;
644 644
645 sysfs_bin_attr_init(b->legacy_io);
645 b->legacy_io->attr.name = "legacy_io"; 646 b->legacy_io->attr.name = "legacy_io";
646 b->legacy_io->size = 0xffff; 647 b->legacy_io->size = 0xffff;
647 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR; 648 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
@@ -654,6 +655,7 @@ void pci_create_legacy_files(struct pci_bus *b)
654 goto legacy_io_err; 655 goto legacy_io_err;
655 656
656 /* Allocated above after the legacy_io struct */ 657 /* Allocated above after the legacy_io struct */
658 sysfs_bin_attr_init(b->legacy_mem);
657 b->legacy_mem = b->legacy_io + 1; 659 b->legacy_mem = b->legacy_io + 1;
658 b->legacy_mem->attr.name = "legacy_mem"; 660 b->legacy_mem->attr.name = "legacy_mem";
659 b->legacy_mem->size = 1024*1024; 661 b->legacy_mem->size = 1024*1024;
@@ -800,6 +802,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
800 if (res_attr) { 802 if (res_attr) {
801 char *res_attr_name = (char *)(res_attr + 1); 803 char *res_attr_name = (char *)(res_attr + 1);
802 804
805 sysfs_bin_attr_init(res_attr);
803 if (write_combine) { 806 if (write_combine) {
804 pdev->res_attr_wc[num] = res_attr; 807 pdev->res_attr_wc[num] = res_attr;
805 sprintf(res_attr_name, "resource%d_wc", num); 808 sprintf(res_attr_name, "resource%d_wc", num);
@@ -972,6 +975,7 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev)
972 if (!attr) 975 if (!attr)
973 return -ENOMEM; 976 return -ENOMEM;
974 977
978 sysfs_bin_attr_init(attr);
975 attr->size = dev->vpd->len; 979 attr->size = dev->vpd->len;
976 attr->attr.name = "vpd"; 980 attr->attr.name = "vpd";
977 attr->attr.mode = S_IRUSR | S_IWUSR; 981 attr->attr.mode = S_IRUSR | S_IWUSR;
@@ -1038,6 +1042,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
1038 retval = -ENOMEM; 1042 retval = -ENOMEM;
1039 goto err_resource_files; 1043 goto err_resource_files;
1040 } 1044 }
1045 sysfs_bin_attr_init(attr);
1041 attr->size = rom_size; 1046 attr->size = rom_size;
1042 attr->attr.name = "rom"; 1047 attr->attr.name = "rom";
1043 attr->attr.mode = S_IRUSR; 1048 attr->attr.mode = S_IRUSR;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 77b493b3d97b..897fa5ccdb78 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2486,7 +2486,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe)
2486 if (!probe) { 2486 if (!probe) {
2487 pci_block_user_cfg_access(dev); 2487 pci_block_user_cfg_access(dev);
2488 /* block PM suspend, driver probe, etc. */ 2488 /* block PM suspend, driver probe, etc. */
2489 down(&dev->dev.sem); 2489 device_lock(&dev->dev);
2490 } 2490 }
2491 2491
2492 rc = pci_dev_specific_reset(dev, probe); 2492 rc = pci_dev_specific_reset(dev, probe);
@@ -2508,7 +2508,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe)
2508 rc = pci_parent_bus_reset(dev, probe); 2508 rc = pci_parent_bus_reset(dev, probe);
2509done: 2509done:
2510 if (!probe) { 2510 if (!probe) {
2511 up(&dev->dev.sem); 2511 device_unlock(&dev->dev);
2512 pci_unblock_user_cfg_access(dev); 2512 pci_unblock_user_cfg_access(dev);
2513 } 2513 }
2514 2514
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index 49c9e6c9779a..f75a44d37fbe 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -29,7 +29,7 @@ static ssize_t pci_slot_attr_store(struct kobject *kobj,
29 return attribute->store ? attribute->store(slot, buf, len) : -EIO; 29 return attribute->store ? attribute->store(slot, buf, len) : -EIO;
30} 30}
31 31
32static struct sysfs_ops pci_slot_sysfs_ops = { 32static const struct sysfs_ops pci_slot_sysfs_ops = {
33 .show = pci_slot_attr_show, 33 .show = pci_slot_attr_show,
34 .store = pci_slot_attr_store, 34 .store = pci_slot_attr_store,
35}; 35};
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 0f98be4450b7..ad93ebd7b2a2 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -971,9 +971,9 @@ static int runtime_suspend(struct device *dev)
971{ 971{
972 int rc; 972 int rc;
973 973
974 down(&dev->sem); 974 device_lock(dev);
975 rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); 975 rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND);
976 up(&dev->sem); 976 device_unlock(dev);
977 return rc; 977 return rc;
978} 978}
979 979
@@ -981,9 +981,9 @@ static int runtime_resume(struct device *dev)
981{ 981{
982 int rc; 982 int rc;
983 983
984 down(&dev->sem); 984 device_lock(dev);
985 rc = pcmcia_dev_resume(dev); 985 rc = pcmcia_dev_resume(dev);
986 up(&dev->sem); 986 device_unlock(dev);
987 return rc; 987 return rc;
988} 988}
989 989
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index cd2ee6fce1b4..e631dbeafd79 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -150,6 +150,7 @@ config MSI_LAPTOP
150 tristate "MSI Laptop Extras" 150 tristate "MSI Laptop Extras"
151 depends on ACPI 151 depends on ACPI
152 depends on BACKLIGHT_CLASS_DEVICE 152 depends on BACKLIGHT_CLASS_DEVICE
153 depends on RFKILL
153 ---help--- 154 ---help---
154 This is a driver for laptops built by MSI (MICRO-STAR 155 This is a driver for laptops built by MSI (MICRO-STAR
155 INTERNATIONAL): 156 INTERNATIONAL):
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 3aa57da8b43b..7ccf33c08967 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -57,7 +57,7 @@ enum hp_wmi_radio {
57 HPWMI_WWAN = 2, 57 HPWMI_WWAN = 2,
58}; 58};
59 59
60static int __init hp_wmi_bios_setup(struct platform_device *device); 60static int __devinit hp_wmi_bios_setup(struct platform_device *device);
61static int __exit hp_wmi_bios_remove(struct platform_device *device); 61static int __exit hp_wmi_bios_remove(struct platform_device *device);
62static int hp_wmi_resume_handler(struct device *device); 62static int hp_wmi_resume_handler(struct device *device);
63 63
@@ -447,7 +447,7 @@ static void cleanup_sysfs(struct platform_device *device)
447 device_remove_file(&device->dev, &dev_attr_tablet); 447 device_remove_file(&device->dev, &dev_attr_tablet);
448} 448}
449 449
450static int __init hp_wmi_bios_setup(struct platform_device *device) 450static int __devinit hp_wmi_bios_setup(struct platform_device *device)
451{ 451{
452 int err; 452 int err;
453 int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0); 453 int wireless = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 0, 0);
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
index 759763d18e4c..c2b05da4289a 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -58,6 +58,7 @@
58#include <linux/dmi.h> 58#include <linux/dmi.h>
59#include <linux/backlight.h> 59#include <linux/backlight.h>
60#include <linux/platform_device.h> 60#include <linux/platform_device.h>
61#include <linux/rfkill.h>
61 62
62#define MSI_DRIVER_VERSION "0.5" 63#define MSI_DRIVER_VERSION "0.5"
63 64
@@ -66,6 +67,20 @@
66#define MSI_EC_COMMAND_WIRELESS 0x10 67#define MSI_EC_COMMAND_WIRELESS 0x10
67#define MSI_EC_COMMAND_LCD_LEVEL 0x11 68#define MSI_EC_COMMAND_LCD_LEVEL 0x11
68 69
70#define MSI_STANDARD_EC_COMMAND_ADDRESS 0x2e
71#define MSI_STANDARD_EC_BLUETOOTH_MASK (1 << 0)
72#define MSI_STANDARD_EC_WEBCAM_MASK (1 << 1)
73#define MSI_STANDARD_EC_WLAN_MASK (1 << 3)
74#define MSI_STANDARD_EC_3G_MASK (1 << 4)
75
76/* For set SCM load flag to disable BIOS fn key */
77#define MSI_STANDARD_EC_SCM_LOAD_ADDRESS 0x2d
78#define MSI_STANDARD_EC_SCM_LOAD_MASK (1 << 0)
79
80static int msi_laptop_resume(struct platform_device *device);
81
82#define MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS 0x2f
83
69static int force; 84static int force;
70module_param(force, bool, 0); 85module_param(force, bool, 0);
71MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); 86MODULE_PARM_DESC(force, "Force driver load, ignore DMI data");
@@ -74,6 +89,23 @@ static int auto_brightness;
74module_param(auto_brightness, int, 0); 89module_param(auto_brightness, int, 0);
75MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); 90MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)");
76 91
92static bool old_ec_model;
93static int wlan_s, bluetooth_s, threeg_s;
94static int threeg_exists;
95
96/* Some MSI 3G netbook only have one fn key to control Wlan/Bluetooth/3G,
97 * those netbook will load the SCM (windows app) to disable the original
98 * Wlan/Bluetooth control by BIOS when user press fn key, then control
99 * Wlan/Bluetooth/3G by SCM (software control by OS). Without SCM, user
100 * cann't on/off 3G module on those 3G netbook.
101 * On Linux, msi-laptop driver will do the same thing to disable the
102 * original BIOS control, then might need use HAL or other userland
103 * application to do the software control that simulate with SCM.
104 * e.g. MSI N034 netbook
105 */
106static bool load_scm_model;
107static struct rfkill *rfk_wlan, *rfk_bluetooth, *rfk_threeg;
108
77/* Hardware access */ 109/* Hardware access */
78 110
79static int set_lcd_level(int level) 111static int set_lcd_level(int level)
@@ -130,6 +162,35 @@ static int set_auto_brightness(int enable)
130 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1); 162 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1);
131} 163}
132 164
165static ssize_t set_device_state(const char *buf, size_t count, u8 mask)
166{
167 int status;
168 u8 wdata = 0, rdata;
169 int result;
170
171 if (sscanf(buf, "%i", &status) != 1 || (status < 0 || status > 1))
172 return -EINVAL;
173
174 /* read current device state */
175 result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
176 if (result < 0)
177 return -EINVAL;
178
179 if (!!(rdata & mask) != status) {
180 /* reverse device bit */
181 if (rdata & mask)
182 wdata = rdata & ~mask;
183 else
184 wdata = rdata | mask;
185
186 result = ec_write(MSI_STANDARD_EC_COMMAND_ADDRESS, wdata);
187 if (result < 0)
188 return -EINVAL;
189 }
190
191 return count;
192}
193
133static int get_wireless_state(int *wlan, int *bluetooth) 194static int get_wireless_state(int *wlan, int *bluetooth)
134{ 195{
135 u8 wdata = 0, rdata; 196 u8 wdata = 0, rdata;
@@ -148,6 +209,38 @@ static int get_wireless_state(int *wlan, int *bluetooth)
148 return 0; 209 return 0;
149} 210}
150 211
212static int get_wireless_state_ec_standard(void)
213{
214 u8 rdata;
215 int result;
216
217 result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);
218 if (result < 0)
219 return -1;
220
221 wlan_s = !!(rdata & MSI_STANDARD_EC_WLAN_MASK);
222
223 bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK);
224
225 threeg_s = !!(rdata & MSI_STANDARD_EC_3G_MASK);
226
227 return 0;
228}
229
230static int get_threeg_exists(void)
231{
232 u8 rdata;
233 int result;
234
235 result = ec_read(MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS, &rdata);
236 if (result < 0)
237 return -1;
238
239 threeg_exists = !!(rdata & MSI_STANDARD_EC_3G_MASK);
240
241 return 0;
242}
243
151/* Backlight device stuff */ 244/* Backlight device stuff */
152 245
153static int bl_get_brightness(struct backlight_device *b) 246static int bl_get_brightness(struct backlight_device *b)
@@ -176,26 +269,71 @@ static ssize_t show_wlan(struct device *dev,
176 269
177 int ret, enabled; 270 int ret, enabled;
178 271
179 ret = get_wireless_state(&enabled, NULL); 272 if (old_ec_model) {
273 ret = get_wireless_state(&enabled, NULL);
274 } else {
275 ret = get_wireless_state_ec_standard();
276 enabled = wlan_s;
277 }
180 if (ret < 0) 278 if (ret < 0)
181 return ret; 279 return ret;
182 280
183 return sprintf(buf, "%i\n", enabled); 281 return sprintf(buf, "%i\n", enabled);
184} 282}
185 283
284static ssize_t store_wlan(struct device *dev,
285 struct device_attribute *attr, const char *buf, size_t count)
286{
287 return set_device_state(buf, count, MSI_STANDARD_EC_WLAN_MASK);
288}
289
186static ssize_t show_bluetooth(struct device *dev, 290static ssize_t show_bluetooth(struct device *dev,
187 struct device_attribute *attr, char *buf) 291 struct device_attribute *attr, char *buf)
188{ 292{
189 293
190 int ret, enabled; 294 int ret, enabled;
191 295
192 ret = get_wireless_state(NULL, &enabled); 296 if (old_ec_model) {
297 ret = get_wireless_state(NULL, &enabled);
298 } else {
299 ret = get_wireless_state_ec_standard();
300 enabled = bluetooth_s;
301 }
193 if (ret < 0) 302 if (ret < 0)
194 return ret; 303 return ret;
195 304
196 return sprintf(buf, "%i\n", enabled); 305 return sprintf(buf, "%i\n", enabled);
197} 306}
198 307
308static ssize_t store_bluetooth(struct device *dev,
309 struct device_attribute *attr, const char *buf, size_t count)
310{
311 return set_device_state(buf, count, MSI_STANDARD_EC_BLUETOOTH_MASK);
312}
313
314static ssize_t show_threeg(struct device *dev,
315 struct device_attribute *attr, char *buf)
316{
317
318 int ret;
319
320 /* old msi ec not support 3G */
321 if (old_ec_model)
322 return -1;
323
324 ret = get_wireless_state_ec_standard();
325 if (ret < 0)
326 return ret;
327
328 return sprintf(buf, "%i\n", threeg_s);
329}
330
331static ssize_t store_threeg(struct device *dev,
332 struct device_attribute *attr, const char *buf, size_t count)
333{
334 return set_device_state(buf, count, MSI_STANDARD_EC_3G_MASK);
335}
336
199static ssize_t show_lcd_level(struct device *dev, 337static ssize_t show_lcd_level(struct device *dev,
200 struct device_attribute *attr, char *buf) 338 struct device_attribute *attr, char *buf)
201{ 339{
@@ -258,6 +396,7 @@ static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
258static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); 396static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness);
259static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); 397static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL);
260static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); 398static DEVICE_ATTR(wlan, 0444, show_wlan, NULL);
399static DEVICE_ATTR(threeg, 0444, show_threeg, NULL);
261 400
262static struct attribute *msipf_attributes[] = { 401static struct attribute *msipf_attributes[] = {
263 &dev_attr_lcd_level.attr, 402 &dev_attr_lcd_level.attr,
@@ -275,7 +414,8 @@ static struct platform_driver msipf_driver = {
275 .driver = { 414 .driver = {
276 .name = "msi-laptop-pf", 415 .name = "msi-laptop-pf",
277 .owner = THIS_MODULE, 416 .owner = THIS_MODULE,
278 } 417 },
418 .resume = msi_laptop_resume,
279}; 419};
280 420
281static struct platform_device *msipf_device; 421static struct platform_device *msipf_device;
@@ -332,6 +472,192 @@ static struct dmi_system_id __initdata msi_dmi_table[] = {
332 { } 472 { }
333}; 473};
334 474
475static struct dmi_system_id __initdata msi_load_scm_models_dmi_table[] = {
476 {
477 .ident = "MSI N034",
478 .matches = {
479 DMI_MATCH(DMI_SYS_VENDOR,
480 "MICRO-STAR INTERNATIONAL CO., LTD"),
481 DMI_MATCH(DMI_PRODUCT_NAME, "MS-N034"),
482 DMI_MATCH(DMI_CHASSIS_VENDOR,
483 "MICRO-STAR INTERNATIONAL CO., LTD")
484 },
485 .callback = dmi_check_cb
486 },
487 { }
488};
489
490static int rfkill_bluetooth_set(void *data, bool blocked)
491{
492 /* Do something with blocked...*/
493 /*
494 * blocked == false is on
495 * blocked == true is off
496 */
497 if (blocked)
498 set_device_state("0", 0, MSI_STANDARD_EC_BLUETOOTH_MASK);
499 else
500 set_device_state("1", 0, MSI_STANDARD_EC_BLUETOOTH_MASK);
501
502 return 0;
503}
504
505static int rfkill_wlan_set(void *data, bool blocked)
506{
507 if (blocked)
508 set_device_state("0", 0, MSI_STANDARD_EC_WLAN_MASK);
509 else
510 set_device_state("1", 0, MSI_STANDARD_EC_WLAN_MASK);
511
512 return 0;
513}
514
515static int rfkill_threeg_set(void *data, bool blocked)
516{
517 if (blocked)
518 set_device_state("0", 0, MSI_STANDARD_EC_3G_MASK);
519 else
520 set_device_state("1", 0, MSI_STANDARD_EC_3G_MASK);
521
522 return 0;
523}
524
525static struct rfkill_ops rfkill_bluetooth_ops = {
526 .set_block = rfkill_bluetooth_set
527};
528
529static struct rfkill_ops rfkill_wlan_ops = {
530 .set_block = rfkill_wlan_set
531};
532
533static struct rfkill_ops rfkill_threeg_ops = {
534 .set_block = rfkill_threeg_set
535};
536
537static void rfkill_cleanup(void)
538{
539 if (rfk_bluetooth) {
540 rfkill_unregister(rfk_bluetooth);
541 rfkill_destroy(rfk_bluetooth);
542 }
543
544 if (rfk_threeg) {
545 rfkill_unregister(rfk_threeg);
546 rfkill_destroy(rfk_threeg);
547 }
548
549 if (rfk_wlan) {
550 rfkill_unregister(rfk_wlan);
551 rfkill_destroy(rfk_wlan);
552 }
553}
554
555static int rfkill_init(struct platform_device *sdev)
556{
557 /* add rfkill */
558 int retval;
559
560 rfk_bluetooth = rfkill_alloc("msi-bluetooth", &sdev->dev,
561 RFKILL_TYPE_BLUETOOTH,
562 &rfkill_bluetooth_ops, NULL);
563 if (!rfk_bluetooth) {
564 retval = -ENOMEM;
565 goto err_bluetooth;
566 }
567 retval = rfkill_register(rfk_bluetooth);
568 if (retval)
569 goto err_bluetooth;
570
571 rfk_wlan = rfkill_alloc("msi-wlan", &sdev->dev, RFKILL_TYPE_WLAN,
572 &rfkill_wlan_ops, NULL);
573 if (!rfk_wlan) {
574 retval = -ENOMEM;
575 goto err_wlan;
576 }
577 retval = rfkill_register(rfk_wlan);
578 if (retval)
579 goto err_wlan;
580
581 if (threeg_exists) {
582 rfk_threeg = rfkill_alloc("msi-threeg", &sdev->dev,
583 RFKILL_TYPE_WWAN, &rfkill_threeg_ops, NULL);
584 if (!rfk_threeg) {
585 retval = -ENOMEM;
586 goto err_threeg;
587 }
588 retval = rfkill_register(rfk_threeg);
589 if (retval)
590 goto err_threeg;
591 }
592
593 return 0;
594
595err_threeg:
596 rfkill_destroy(rfk_threeg);
597 if (rfk_wlan)
598 rfkill_unregister(rfk_wlan);
599err_wlan:
600 rfkill_destroy(rfk_wlan);
601 if (rfk_bluetooth)
602 rfkill_unregister(rfk_bluetooth);
603err_bluetooth:
604 rfkill_destroy(rfk_bluetooth);
605
606 return retval;
607}
608
609static int msi_laptop_resume(struct platform_device *device)
610{
611 u8 data;
612 int result;
613
614 if (!load_scm_model)
615 return 0;
616
617 /* set load SCM to disable hardware control by fn key */
618 result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
619 if (result < 0)
620 return result;
621
622 result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
623 data | MSI_STANDARD_EC_SCM_LOAD_MASK);
624 if (result < 0)
625 return result;
626
627 return 0;
628}
629
630static int load_scm_model_init(struct platform_device *sdev)
631{
632 u8 data;
633 int result;
634
635 /* allow userland write sysfs file */
636 dev_attr_bluetooth.store = store_bluetooth;
637 dev_attr_wlan.store = store_wlan;
638 dev_attr_threeg.store = store_threeg;
639 dev_attr_bluetooth.attr.mode |= S_IWUSR;
640 dev_attr_wlan.attr.mode |= S_IWUSR;
641 dev_attr_threeg.attr.mode |= S_IWUSR;
642
643 /* disable hardware control by fn key */
644 result = ec_read(MSI_STANDARD_EC_SCM_LOAD_ADDRESS, &data);
645 if (result < 0)
646 return result;
647
648 result = ec_write(MSI_STANDARD_EC_SCM_LOAD_ADDRESS,
649 data | MSI_STANDARD_EC_SCM_LOAD_MASK);
650 if (result < 0)
651 return result;
652
653 /* initial rfkill */
654 result = rfkill_init(sdev);
655 if (result < 0)
656 return result;
657
658 return 0;
659}
660
335static int __init msi_init(void) 661static int __init msi_init(void)
336{ 662{
337 int ret; 663 int ret;
@@ -339,8 +665,14 @@ static int __init msi_init(void)
339 if (acpi_disabled) 665 if (acpi_disabled)
340 return -ENODEV; 666 return -ENODEV;
341 667
342 if (!force && !dmi_check_system(msi_dmi_table)) 668 if (force || dmi_check_system(msi_dmi_table))
343 return -ENODEV; 669 old_ec_model = 1;
670
671 if (!old_ec_model)
672 get_threeg_exists();
673
674 if (!old_ec_model && dmi_check_system(msi_load_scm_models_dmi_table))
675 load_scm_model = 1;
344 676
345 if (auto_brightness < 0 || auto_brightness > 2) 677 if (auto_brightness < 0 || auto_brightness > 2)
346 return -EINVAL; 678 return -EINVAL;
@@ -374,10 +706,23 @@ static int __init msi_init(void)
374 if (ret) 706 if (ret)
375 goto fail_platform_device1; 707 goto fail_platform_device1;
376 708
709 if (load_scm_model && (load_scm_model_init(msipf_device) < 0)) {
710 ret = -EINVAL;
711 goto fail_platform_device1;
712 }
713
377 ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group); 714 ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group);
378 if (ret) 715 if (ret)
379 goto fail_platform_device2; 716 goto fail_platform_device2;
380 717
718 if (!old_ec_model) {
719 if (threeg_exists)
720 ret = device_create_file(&msipf_device->dev,
721 &dev_attr_threeg);
722 if (ret)
723 goto fail_platform_device2;
724 }
725
381 /* Disable automatic brightness control by default because 726 /* Disable automatic brightness control by default because
382 * this module was probably loaded to do brightness control in 727 * this module was probably loaded to do brightness control in
383 * software. */ 728 * software. */
@@ -412,10 +757,14 @@ static void __exit msi_cleanup(void)
412{ 757{
413 758
414 sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); 759 sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group);
760 if (!old_ec_model && threeg_exists)
761 device_remove_file(&msipf_device->dev, &dev_attr_threeg);
415 platform_device_unregister(msipf_device); 762 platform_device_unregister(msipf_device);
416 platform_driver_unregister(&msipf_driver); 763 platform_driver_unregister(&msipf_driver);
417 backlight_device_unregister(msibl_device); 764 backlight_device_unregister(msibl_device);
418 765
766 rfkill_cleanup();
767
419 /* Enable automatic brightness control again */ 768 /* Enable automatic brightness control again */
420 if (auto_brightness != 2) 769 if (auto_brightness != 2)
421 set_auto_brightness(1); 770 set_auto_brightness(1);
@@ -435,3 +784,4 @@ MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARIN
435MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); 784MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*");
436MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 785MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
437MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); 786MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
787MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*");
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index 0807b260268b..fef0e3c75b16 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = {
226 .use_clustering = DISABLE_CLUSTERING, 226 .use_clustering = DISABLE_CLUSTERING,
227}; 227};
228 228
229static int __init sgiwd93_probe(struct platform_device *pdev) 229static int __devinit sgiwd93_probe(struct platform_device *pdev)
230{ 230{
231 struct sgiwd93_platform_data *pd = pdev->dev.platform_data; 231 struct sgiwd93_platform_data *pd = pdev->dev.platform_data;
232 unsigned char *wdregs = pd->wdregs; 232 unsigned char *wdregs = pd->wdregs;
diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
index 37b3359e863e..56cf0bb4ed1f 100644
--- a/drivers/scsi/sni_53c710.c
+++ b/drivers/scsi/sni_53c710.c
@@ -64,7 +64,7 @@ static struct scsi_host_template snirm710_template = {
64 .module = THIS_MODULE, 64 .module = THIS_MODULE,
65}; 65};
66 66
67static int __init snirm710_probe(struct platform_device *dev) 67static int __devinit snirm710_probe(struct platform_device *dev)
68{ 68{
69 unsigned long base; 69 unsigned long base;
70 struct NCR_700_Host_Parameters *hostdata; 70 struct NCR_700_Host_Parameters *hostdata;
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index cadb6f7321ad..7ebecc92c61b 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -770,13 +770,8 @@ static struct usb_driver oled_driver = {
770 .id_table = id_table, 770 .id_table = id_table,
771}; 771};
772 772
773static ssize_t version_show(struct class *dev, char *buf) 773static CLASS_ATTR_STRING(version, S_IRUGO,
774{ 774 ASUS_OLED_UNDERSCORE_NAME " " ASUS_OLED_VERSION);
775 return sprintf(buf, ASUS_OLED_UNDERSCORE_NAME " %s\n",
776 ASUS_OLED_VERSION);
777}
778
779static CLASS_ATTR(version, S_IRUGO, version_show, NULL);
780 775
781static int __init asus_oled_init(void) 776static int __init asus_oled_init(void)
782{ 777{
@@ -788,7 +783,7 @@ static int __init asus_oled_init(void)
788 return PTR_ERR(oled_class); 783 return PTR_ERR(oled_class);
789 } 784 }
790 785
791 retval = class_create_file(oled_class, &class_attr_version); 786 retval = class_create_file(oled_class, &class_attr_version.attr);
792 if (retval) { 787 if (retval) {
793 err("Error creating class version file"); 788 err("Error creating class version file");
794 goto error; 789 goto error;
@@ -810,7 +805,7 @@ error:
810 805
811static void __exit asus_oled_exit(void) 806static void __exit asus_oled_exit(void)
812{ 807{
813 class_remove_file(oled_class, &class_attr_version); 808 class_remove_file(oled_class, &class_attr_version.attr);
814 class_destroy(oled_class); 809 class_destroy(oled_class);
815 810
816 usb_deregister(&oled_driver); 811 usb_deregister(&oled_driver);
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 8aa1955f35ed..1da73ecd9799 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -44,17 +44,6 @@ config UIO_PDRV_GENIRQ
44 44
45 If you don't know what to do here, say N. 45 If you don't know what to do here, say N.
46 46
47config UIO_SMX
48 tristate "SMX cryptengine UIO interface"
49 help
50 Userspace IO interface to the Cryptography engine found on the
51 Nias Digital SMX boards. These will be available from Q4 2008
52 from http://www.niasdigital.com. The userspace part of this
53 driver will be released under the GPL at the same time as the
54 hardware and will be able to be downloaded from the same site.
55
56 If you compile this as a module, it will be called uio_smx.
57
58config UIO_AEC 47config UIO_AEC
59 tristate "AEC video timestamp device" 48 tristate "AEC video timestamp device"
60 depends on PCI 49 depends on PCI
@@ -74,6 +63,7 @@ config UIO_AEC
74 63
75config UIO_SERCOS3 64config UIO_SERCOS3
76 tristate "Automata Sercos III PCI card driver" 65 tristate "Automata Sercos III PCI card driver"
66 depends on PCI
77 help 67 help
78 Userspace I/O interface for the Sercos III PCI card from 68 Userspace I/O interface for the Sercos III PCI card from
79 Automata GmbH. The userspace part of this driver will be 69 Automata GmbH. The userspace part of this driver will be
@@ -87,11 +77,21 @@ config UIO_SERCOS3
87config UIO_PCI_GENERIC 77config UIO_PCI_GENERIC
88 tristate "Generic driver for PCI 2.3 and PCI Express cards" 78 tristate "Generic driver for PCI 2.3 and PCI Express cards"
89 depends on PCI 79 depends on PCI
90 default n
91 help 80 help
92 Generic driver that you can bind, dynamically, to any 81 Generic driver that you can bind, dynamically, to any
93 PCI 2.3 compliant and PCI Express card. It is useful, 82 PCI 2.3 compliant and PCI Express card. It is useful,
94 primarily, for virtualization scenarios. 83 primarily, for virtualization scenarios.
95 If you compile this as a module, it will be called uio_pci_generic. 84 If you compile this as a module, it will be called uio_pci_generic.
96 85
86config UIO_NETX
87 tristate "Hilscher NetX Card driver"
88 depends on PCI
89 help
90 Driver for Hilscher NetX based fieldbus cards (cifX, comX).
91 This driver requires a userspace component that comes with the card
92 or is available from Hilscher (http://www.hilscher.com).
93
94 To compile this driver as a module, choose M here; the module
95 will be called uio_netx.
96
97endif 97endif
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index 73b2e7516729..18fd818c5b97 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -2,7 +2,7 @@ obj-$(CONFIG_UIO) += uio.o
2obj-$(CONFIG_UIO_CIF) += uio_cif.o 2obj-$(CONFIG_UIO_CIF) += uio_cif.o
3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o
4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o 4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
5obj-$(CONFIG_UIO_SMX) += uio_smx.o
6obj-$(CONFIG_UIO_AEC) += uio_aec.o 5obj-$(CONFIG_UIO_AEC) += uio_aec.o
7obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o 6obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o
8obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o 7obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o
8obj-$(CONFIG_UIO_NETX) += uio_netx.o
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index e941367dd28f..4de382acd8f2 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -129,7 +129,7 @@ static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
129 return entry->show(mem, buf); 129 return entry->show(mem, buf);
130} 130}
131 131
132static struct sysfs_ops map_sysfs_ops = { 132static const struct sysfs_ops map_sysfs_ops = {
133 .show = map_type_show, 133 .show = map_type_show,
134}; 134};
135 135
@@ -217,7 +217,7 @@ static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,
217 return entry->show(port, buf); 217 return entry->show(port, buf);
218} 218}
219 219
220static struct sysfs_ops portio_sysfs_ops = { 220static const struct sysfs_ops portio_sysfs_ops = {
221 .show = portio_type_show, 221 .show = portio_type_show,
222}; 222};
223 223
diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c
new file mode 100644
index 000000000000..afbf0bd55cc9
--- /dev/null
+++ b/drivers/uio/uio_netx.c
@@ -0,0 +1,172 @@
1/*
2 * UIO driver for Hilscher NetX based fieldbus cards (cifX, comX).
3 * See http://www.hilscher.com for details.
4 *
5 * (C) 2007 Hans J. Koch <hjk@linutronix.de>
6 * (C) 2008 Manuel Traut <manut@linutronix.de>
7 *
8 * Licensed under GPL version 2 only.
9 *
10 */
11
12#include <linux/device.h>
13#include <linux/io.h>
14#include <linux/module.h>
15#include <linux/pci.h>
16#include <linux/uio_driver.h>
17
18#define PCI_VENDOR_ID_HILSCHER 0x15CF
19#define PCI_DEVICE_ID_HILSCHER_NETX 0x0000
20#define PCI_SUBDEVICE_ID_NXSB_PCA 0x3235
21#define PCI_SUBDEVICE_ID_NXPCA 0x3335
22
23#define DPM_HOST_INT_EN0 0xfff0
24#define DPM_HOST_INT_STAT0 0xffe0
25
26#define DPM_HOST_INT_MASK 0xe600ffff
27#define DPM_HOST_INT_GLOBAL_EN 0x80000000
28
29static irqreturn_t netx_handler(int irq, struct uio_info *dev_info)
30{
31 void __iomem *int_enable_reg = dev_info->mem[0].internal_addr
32 + DPM_HOST_INT_EN0;
33 void __iomem *int_status_reg = dev_info->mem[0].internal_addr
34 + DPM_HOST_INT_STAT0;
35
36 /* Is one of our interrupts enabled and active ? */
37 if (!(ioread32(int_enable_reg) & ioread32(int_status_reg)
38 & DPM_HOST_INT_MASK))
39 return IRQ_NONE;
40
41 /* Disable interrupt */
42 iowrite32(ioread32(int_enable_reg) & ~DPM_HOST_INT_GLOBAL_EN,
43 int_enable_reg);
44 return IRQ_HANDLED;
45}
46
47static int __devinit netx_pci_probe(struct pci_dev *dev,
48 const struct pci_device_id *id)
49{
50 struct uio_info *info;
51 int bar;
52
53 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
54 if (!info)
55 return -ENOMEM;
56
57 if (pci_enable_device(dev))
58 goto out_free;
59
60 if (pci_request_regions(dev, "netx"))
61 goto out_disable;
62
63 switch (id->device) {
64 case PCI_DEVICE_ID_HILSCHER_NETX:
65 bar = 0;
66 info->name = "netx";
67 break;
68 default:
69 bar = 2;
70 info->name = "netx_plx";
71 }
72
73 /* BAR0 or 2 points to the card's dual port memory */
74 info->mem[0].addr = pci_resource_start(dev, bar);
75 if (!info->mem[0].addr)
76 goto out_release;
77 info->mem[0].internal_addr = ioremap(pci_resource_start(dev, bar),
78 pci_resource_len(dev, bar));
79
80 if (!info->mem[0].internal_addr)
81 goto out_release;
82
83 info->mem[0].size = pci_resource_len(dev, bar);
84 info->mem[0].memtype = UIO_MEM_PHYS;
85 info->irq = dev->irq;
86 info->irq_flags = IRQF_SHARED;
87 info->handler = netx_handler;
88 info->version = "0.0.1";
89
90 /* Make sure all interrupts are disabled */
91 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0);
92
93 if (uio_register_device(&dev->dev, info))
94 goto out_unmap;
95
96 pci_set_drvdata(dev, info);
97 dev_info(&dev->dev, "Found %s card, registered UIO device.\n",
98 info->name);
99
100 return 0;
101
102out_unmap:
103 iounmap(info->mem[0].internal_addr);
104out_release:
105 pci_release_regions(dev);
106out_disable:
107 pci_disable_device(dev);
108out_free:
109 kfree(info);
110 return -ENODEV;
111}
112
113static void netx_pci_remove(struct pci_dev *dev)
114{
115 struct uio_info *info = pci_get_drvdata(dev);
116
117 /* Disable all interrupts */
118 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0);
119 uio_unregister_device(info);
120 pci_release_regions(dev);
121 pci_disable_device(dev);
122 pci_set_drvdata(dev, NULL);
123 iounmap(info->mem[0].internal_addr);
124
125 kfree(info);
126}
127
128static struct pci_device_id netx_pci_ids[] = {
129 {
130 .vendor = PCI_VENDOR_ID_HILSCHER,
131 .device = PCI_DEVICE_ID_HILSCHER_NETX,
132 .subvendor = 0,
133 .subdevice = 0,
134 },
135 {
136 .vendor = PCI_VENDOR_ID_PLX,
137 .device = PCI_DEVICE_ID_PLX_9030,
138 .subvendor = PCI_VENDOR_ID_PLX,
139 .subdevice = PCI_SUBDEVICE_ID_NXSB_PCA,
140 },
141 {
142 .vendor = PCI_VENDOR_ID_PLX,
143 .device = PCI_DEVICE_ID_PLX_9030,
144 .subvendor = PCI_VENDOR_ID_PLX,
145 .subdevice = PCI_SUBDEVICE_ID_NXPCA,
146 },
147 { 0, }
148};
149
150static struct pci_driver netx_pci_driver = {
151 .name = "netx",
152 .id_table = netx_pci_ids,
153 .probe = netx_pci_probe,
154 .remove = netx_pci_remove,
155};
156
157static int __init netx_init_module(void)
158{
159 return pci_register_driver(&netx_pci_driver);
160}
161
162static void __exit netx_exit_module(void)
163{
164 pci_unregister_driver(&netx_pci_driver);
165}
166
167module_init(netx_init_module);
168module_exit(netx_exit_module);
169
170MODULE_DEVICE_TABLE(pci, netx_pci_ids);
171MODULE_LICENSE("GPL v2");
172MODULE_AUTHOR("Hans J. Koch, Manuel Traut");
diff --git a/drivers/uio/uio_smx.c b/drivers/uio/uio_smx.c
deleted file mode 100644
index 44054a650a8a..000000000000
--- a/drivers/uio/uio_smx.c
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * UIO SMX Cryptengine driver.
3 *
4 * (C) 2008 Nias Digital P/L <bn@niasdigital.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/device.h>
13#include <linux/module.h>
14#include <linux/platform_device.h>
15#include <linux/uio_driver.h>
16#include <linux/io.h>
17
18#define DRV_NAME "smx-ce"
19#define DRV_VERSION "0.03"
20
21#define SMX_CSR 0x00000000
22#define SMX_EnD 0x00000001
23#define SMX_RUN 0x00000002
24#define SMX_DRDY 0x00000004
25#define SMX_ERR 0x00000008
26
27static irqreturn_t smx_handler(int irq, struct uio_info *dev_info)
28{
29 void __iomem *csr = dev_info->mem[0].internal_addr + SMX_CSR;
30
31 u32 status = ioread32(csr);
32
33 if (!(status & SMX_DRDY))
34 return IRQ_NONE;
35
36 /* Disable interrupt */
37 iowrite32(status & ~SMX_DRDY, csr);
38 return IRQ_HANDLED;
39}
40
41static int __devinit smx_ce_probe(struct platform_device *dev)
42{
43
44 int ret = -ENODEV;
45 struct uio_info *info;
46 struct resource *regs;
47
48 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
49 if (!info)
50 return -ENOMEM;
51
52 regs = platform_get_resource(dev, IORESOURCE_MEM, 0);
53 if (!regs) {
54 dev_err(&dev->dev, "No memory resource specified\n");
55 goto out_free;
56 }
57
58 info->mem[0].addr = regs->start;
59 if (!info->mem[0].addr) {
60 dev_err(&dev->dev, "Invalid memory resource\n");
61 goto out_free;
62 }
63
64 info->mem[0].size = regs->end - regs->start + 1;
65 info->mem[0].internal_addr = ioremap(regs->start, info->mem[0].size);
66
67 if (!info->mem[0].internal_addr) {
68 dev_err(&dev->dev, "Can't remap memory address range\n");
69 goto out_free;
70 }
71
72 info->mem[0].memtype = UIO_MEM_PHYS;
73
74 info->name = "smx-ce";
75 info->version = "0.03";
76
77 info->irq = platform_get_irq(dev, 0);
78 if (info->irq < 0) {
79 ret = info->irq;
80 dev_err(&dev->dev, "No (or invalid) IRQ resource specified\n");
81 goto out_unmap;
82 }
83
84 info->irq_flags = IRQF_SHARED;
85 info->handler = smx_handler;
86
87 platform_set_drvdata(dev, info);
88
89 ret = uio_register_device(&dev->dev, info);
90
91 if (ret)
92 goto out_unmap;
93
94 return 0;
95
96out_unmap:
97 iounmap(info->mem[0].internal_addr);
98out_free:
99 kfree(info);
100
101 return ret;
102}
103
104static int __devexit smx_ce_remove(struct platform_device *dev)
105{
106 struct uio_info *info = platform_get_drvdata(dev);
107
108 uio_unregister_device(info);
109 platform_set_drvdata(dev, NULL);
110 iounmap(info->mem[0].internal_addr);
111
112 kfree(info);
113
114 return 0;
115}
116
117static struct platform_driver smx_ce_driver = {
118 .probe = smx_ce_probe,
119 .remove = __devexit_p(smx_ce_remove),
120 .driver = {
121 .name = DRV_NAME,
122 .owner = THIS_MODULE,
123 },
124};
125
126static int __init smx_ce_init_module(void)
127{
128 return platform_driver_register(&smx_ce_driver);
129}
130module_init(smx_ce_init_module);
131
132static void __exit smx_ce_exit_module(void)
133{
134 platform_driver_unregister(&smx_ce_driver);
135}
136module_exit(smx_ce_exit_module);
137
138MODULE_LICENSE("GPL v2");
139MODULE_VERSION(DRV_VERSION);
140MODULE_AUTHOR("Ben Nizette <bn@niasdigital.com>");
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index a7037bf81688..f3c233806fa3 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -489,10 +489,10 @@ void usb_driver_release_interface(struct usb_driver *driver,
489 if (device_is_registered(dev)) { 489 if (device_is_registered(dev)) {
490 device_release_driver(dev); 490 device_release_driver(dev);
491 } else { 491 } else {
492 down(&dev->sem); 492 device_lock(dev);
493 usb_unbind_interface(dev); 493 usb_unbind_interface(dev);
494 dev->driver = NULL; 494 dev->driver = NULL;
495 up(&dev->sem); 495 device_unlock(dev);
496 } 496 }
497} 497}
498EXPORT_SYMBOL_GPL(usb_driver_release_interface); 498EXPORT_SYMBOL_GPL(usb_driver_release_interface);
diff --git a/drivers/uwb/driver.c b/drivers/uwb/driver.c
index da77e41de990..08bd6dbfd4a6 100644
--- a/drivers/uwb/driver.c
+++ b/drivers/uwb/driver.c
@@ -74,13 +74,16 @@
74unsigned long beacon_timeout_ms = 500; 74unsigned long beacon_timeout_ms = 500;
75 75
76static 76static
77ssize_t beacon_timeout_ms_show(struct class *class, char *buf) 77ssize_t beacon_timeout_ms_show(struct class *class,
78 struct class_attribute *attr,
79 char *buf)
78{ 80{
79 return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms); 81 return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms);
80} 82}
81 83
82static 84static
83ssize_t beacon_timeout_ms_store(struct class *class, 85ssize_t beacon_timeout_ms_store(struct class *class,
86 struct class_attribute *attr,
84 const char *buf, size_t size) 87 const char *buf, size_t size)
85{ 88{
86 unsigned long bt; 89 unsigned long bt;
diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c
index cdd6c8efc9f8..5fad4e791b3e 100644
--- a/drivers/uwb/umc-bus.c
+++ b/drivers/uwb/umc-bus.c
@@ -62,12 +62,12 @@ int umc_controller_reset(struct umc_dev *umc)
62 struct device *parent = umc->dev.parent; 62 struct device *parent = umc->dev.parent;
63 int ret = 0; 63 int ret = 0;
64 64
65 if(down_trylock(&parent->sem)) 65 if (device_trylock(parent))
66 return -EAGAIN; 66 return -EAGAIN;
67 ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); 67 ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper);
68 if (ret >= 0) 68 if (ret >= 0)
69 ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper); 69 ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper);
70 up(&parent->sem); 70 device_unlock(parent);
71 71
72 return ret; 72 return ret;
73} 73}
diff --git a/drivers/uwb/uwb-internal.h b/drivers/uwb/uwb-internal.h
index d5bcfc1c227a..157485c862c0 100644
--- a/drivers/uwb/uwb-internal.h
+++ b/drivers/uwb/uwb-internal.h
@@ -366,12 +366,12 @@ struct dentry *uwb_dbg_create_pal_dir(struct uwb_pal *pal);
366 366
367static inline void uwb_dev_lock(struct uwb_dev *uwb_dev) 367static inline void uwb_dev_lock(struct uwb_dev *uwb_dev)
368{ 368{
369 down(&uwb_dev->dev.sem); 369 device_lock(&uwb_dev->dev);
370} 370}
371 371
372static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev) 372static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev)
373{ 373{
374 up(&uwb_dev->dev.sem); 374 device_unlock(&uwb_dev->dev);
375} 375}
376 376
377#endif /* #ifndef __UWB_INTERNAL_H__ */ 377#endif /* #ifndef __UWB_INTERNAL_H__ */
diff --git a/drivers/uwb/wlp/sysfs.c b/drivers/uwb/wlp/sysfs.c
index 0370399ff4bb..6627c94cc854 100644
--- a/drivers/uwb/wlp/sysfs.c
+++ b/drivers/uwb/wlp/sysfs.c
@@ -615,8 +615,7 @@ ssize_t wlp_wss_attr_store(struct kobject *kobj, struct attribute *attr,
615 return ret; 615 return ret;
616} 616}
617 617
618static 618static const struct sysfs_ops wss_sysfs_ops = {
619struct sysfs_ops wss_sysfs_ops = {
620 .show = wlp_wss_attr_show, 619 .show = wlp_wss_attr_show,
621 .store = wlp_wss_attr_store, 620 .store = wlp_wss_attr_store,
622}; 621};
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index 0bcc59eb37fa..43d7d5067361 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -1221,7 +1221,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
1221 printk("acornfb: freed %dK memory\n", mb_freed); 1221 printk("acornfb: freed %dK memory\n", mb_freed);
1222} 1222}
1223 1223
1224static int __init acornfb_probe(struct platform_device *dev) 1224static int __devinit acornfb_probe(struct platform_device *dev)
1225{ 1225{
1226 unsigned long size; 1226 unsigned long size;
1227 u_int h_sync, v_sync; 1227 u_int h_sync, v_sync;
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index c3431691c9f2..01554d696528 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -504,7 +504,7 @@ static struct fb_ops arcfb_ops = {
504 .fb_ioctl = arcfb_ioctl, 504 .fb_ioctl = arcfb_ioctl,
505}; 505};
506 506
507static int __init arcfb_probe(struct platform_device *dev) 507static int __devinit arcfb_probe(struct platform_device *dev)
508{ 508{
509 struct fb_info *info; 509 struct fb_info *info;
510 int retval = -ENOMEM; 510 int retval = -ENOMEM;
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c
index 108b89e09a80..5eb61b5adfe8 100644
--- a/drivers/video/cobalt_lcdfb.c
+++ b/drivers/video/cobalt_lcdfb.c
@@ -287,7 +287,7 @@ static struct fb_ops cobalt_lcd_fbops = {
287 .fb_cursor = cobalt_lcdfb_cursor, 287 .fb_cursor = cobalt_lcdfb_cursor,
288}; 288};
289 289
290static int __init cobalt_lcdfb_probe(struct platform_device *dev) 290static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
291{ 291{
292 struct fb_info *info; 292 struct fb_info *info;
293 struct resource *res; 293 struct resource *res;
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index d25df51bb0d2..581d2dbf675a 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -210,7 +210,7 @@ static int __init efifb_setup(char *options)
210 return 0; 210 return 0;
211} 211}
212 212
213static int __init efifb_probe(struct platform_device *dev) 213static int __devinit efifb_probe(struct platform_device *dev)
214{ 214{
215 struct fb_info *info; 215 struct fb_info *info;
216 int err; 216 int err;
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c
index 2735b79e52a1..6d755bb3a2bc 100644
--- a/drivers/video/epson1355fb.c
+++ b/drivers/video/epson1355fb.c
@@ -602,7 +602,7 @@ static int epson1355fb_remove(struct platform_device *dev)
602 return 0; 602 return 0;
603} 603}
604 604
605int __init epson1355fb_probe(struct platform_device *dev) 605int __devinit epson1355fb_probe(struct platform_device *dev)
606{ 606{
607 struct epson1355_par *default_par; 607 struct epson1355_par *default_par;
608 struct fb_info *info; 608 struct fb_info *info;
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 695fa013fe7e..5643a35c1746 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -1128,7 +1128,7 @@ static int __init gbefb_setup(char *options)
1128 return 0; 1128 return 0;
1129} 1129}
1130 1130
1131static int __init gbefb_probe(struct platform_device *p_dev) 1131static int __devinit gbefb_probe(struct platform_device *p_dev)
1132{ 1132{
1133 int i, ret = 0; 1133 int i, ret = 0;
1134 struct fb_info *info; 1134 struct fb_info *info;
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index 0129c044f6d6..db9b785b56eb 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -551,7 +551,7 @@ static struct fb_ops hgafb_ops = {
551 * Initialization 551 * Initialization
552 */ 552 */
553 553
554static int __init hgafb_probe(struct platform_device *pdev) 554static int __devinit hgafb_probe(struct platform_device *pdev)
555{ 555{
556 struct fb_info *info; 556 struct fb_info *info;
557 557
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c
index 73c83a8de2d3..bf78779199c6 100644
--- a/drivers/video/hitfb.c
+++ b/drivers/video/hitfb.c
@@ -325,7 +325,7 @@ static struct fb_ops hitfb_ops = {
325 .fb_imageblit = cfb_imageblit, 325 .fb_imageblit = cfb_imageblit,
326}; 326};
327 327
328static int __init hitfb_probe(struct platform_device *dev) 328static int __devinit hitfb_probe(struct platform_device *dev)
329{ 329{
330 unsigned short lcdclor, ldr3, ldvndr; 330 unsigned short lcdclor, ldr3, ldvndr;
331 struct fb_info *info; 331 struct fb_info *info;
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index 913142d4cab1..9acef00c47ea 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -341,7 +341,7 @@ static ssize_t manager_attr_store(struct kobject *kobj, struct attribute *attr,
341 return manager_attr->store(manager, buf, size); 341 return manager_attr->store(manager, buf, size);
342} 342}
343 343
344static struct sysfs_ops manager_sysfs_ops = { 344static const struct sysfs_ops manager_sysfs_ops = {
345 .show = manager_attr_show, 345 .show = manager_attr_show,
346 .store = manager_attr_store, 346 .store = manager_attr_store,
347}; 347};
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 0c5bea263ac6..aed3f3194347 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -320,7 +320,7 @@ static ssize_t overlay_attr_store(struct kobject *kobj, struct attribute *attr,
320 return overlay_attr->store(overlay, buf, size); 320 return overlay_attr->store(overlay, buf, size);
321} 321}
322 322
323static struct sysfs_ops overlay_sysfs_ops = { 323static const struct sysfs_ops overlay_sysfs_ops = {
324 .show = overlay_attr_show, 324 .show = overlay_attr_show,
325 .store = overlay_attr_store, 325 .store = overlay_attr_store,
326}; 326};
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c
index 4beac1df617b..de40a626dc76 100644
--- a/drivers/video/q40fb.c
+++ b/drivers/video/q40fb.c
@@ -85,7 +85,7 @@ static struct fb_ops q40fb_ops = {
85 .fb_imageblit = cfb_imageblit, 85 .fb_imageblit = cfb_imageblit,
86}; 86};
87 87
88static int __init q40fb_probe(struct platform_device *dev) 88static int __devinit q40fb_probe(struct platform_device *dev)
89{ 89{
90 struct fb_info *info; 90 struct fb_info *info;
91 91
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index aac661225c78..2b094dec4a56 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1004,12 +1004,12 @@ dealloc_fb:
1004 return ret; 1004 return ret;
1005} 1005}
1006 1006
1007static int __init s3c2410fb_probe(struct platform_device *pdev) 1007static int __devinit s3c2410fb_probe(struct platform_device *pdev)
1008{ 1008{
1009 return s3c24xxfb_probe(pdev, DRV_S3C2410); 1009 return s3c24xxfb_probe(pdev, DRV_S3C2410);
1010} 1010}
1011 1011
1012static int __init s3c2412fb_probe(struct platform_device *pdev) 1012static int __devinit s3c2412fb_probe(struct platform_device *pdev)
1013{ 1013{
1014 return s3c24xxfb_probe(pdev, DRV_S3C2412); 1014 return s3c24xxfb_probe(pdev, DRV_S3C2412);
1015} 1015}
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index cdaa873a6054..e8b76d65a070 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1435,7 +1435,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
1435 return fbi; 1435 return fbi;
1436} 1436}
1437 1437
1438static int __init sa1100fb_probe(struct platform_device *pdev) 1438static int __devinit sa1100fb_probe(struct platform_device *pdev)
1439{ 1439{
1440 struct sa1100fb_info *fbi; 1440 struct sa1100fb_info *fbi;
1441 int ret, irq; 1441 int ret, irq;
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
index f86012239bff..7a3a5e28eca1 100644
--- a/drivers/video/sgivwfb.c
+++ b/drivers/video/sgivwfb.c
@@ -745,7 +745,7 @@ int __init sgivwfb_setup(char *options)
745/* 745/*
746 * Initialisation 746 * Initialisation
747 */ 747 */
748static int __init sgivwfb_probe(struct platform_device *dev) 748static int __devinit sgivwfb_probe(struct platform_device *dev)
749{ 749{
750 struct sgivw_par *par; 750 struct sgivw_par *par;
751 struct fb_info *info; 751 struct fb_info *info;
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 8d7653e56df5..bbd1dbf4026a 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -943,7 +943,7 @@ static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {
943 943
944static int sh_mobile_lcdc_remove(struct platform_device *pdev); 944static int sh_mobile_lcdc_remove(struct platform_device *pdev);
945 945
946static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) 946static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
947{ 947{
948 struct fb_info *info; 948 struct fb_info *info;
949 struct sh_mobile_lcdc_priv *priv; 949 struct sh_mobile_lcdc_priv *priv;
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index bd37ee1f6a25..ef4128c8e57a 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -226,7 +226,7 @@ static int __init vesafb_setup(char *options)
226 return 0; 226 return 0;
227} 227}
228 228
229static int __init vesafb_probe(struct platform_device *dev) 229static int __devinit vesafb_probe(struct platform_device *dev)
230{ 230{
231 struct fb_info *info; 231 struct fb_info *info;
232 int i, err; 232 int i, err;
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index 050d432c7d95..b8ab995fbda7 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -479,7 +479,7 @@ static int __init vfb_setup(char *options)
479 * Initialisation 479 * Initialisation
480 */ 480 */
481 481
482static int __init vfb_probe(struct platform_device *dev) 482static int __devinit vfb_probe(struct platform_device *dev)
483{ 483{
484 struct fb_info *info; 484 struct fb_info *info;
485 int retval = -ENOMEM; 485 int retval = -ENOMEM;
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 5b2938903ac2..76d8dae5b1bb 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -1293,7 +1293,7 @@ static int vga16fb_setup(char *options)
1293} 1293}
1294#endif 1294#endif
1295 1295
1296static int __init vga16fb_probe(struct platform_device *dev) 1296static int __devinit vga16fb_probe(struct platform_device *dev)
1297{ 1297{
1298 struct fb_info *info; 1298 struct fb_info *info;
1299 struct vga16fb_par *par; 1299 struct vga16fb_par *par;
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 2376f688ec8b..5d223959778a 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -628,7 +628,7 @@ static int w100fb_resume(struct platform_device *dev)
628#endif 628#endif
629 629
630 630
631int __init w100fb_probe(struct platform_device *pdev) 631int __devinit w100fb_probe(struct platform_device *pdev)
632{ 632{
633 int err = -EIO; 633 int err = -EIO;
634 struct w100fb_mach_info *inf; 634 struct w100fb_mach_info *inf;
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 0d92969404c3..22977d30f89e 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -72,7 +72,7 @@ struct hdq_data {
72 int init_trans; 72 int init_trans;
73}; 73};
74 74
75static int __init omap_hdq_probe(struct platform_device *pdev); 75static int __devinit omap_hdq_probe(struct platform_device *pdev);
76static int omap_hdq_remove(struct platform_device *pdev); 76static int omap_hdq_remove(struct platform_device *pdev);
77 77
78static struct platform_driver omap_hdq_driver = { 78static struct platform_driver omap_hdq_driver = {
@@ -558,7 +558,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)
558 return; 558 return;
559} 559}
560 560
561static int __init omap_hdq_probe(struct platform_device *pdev) 561static int __devinit omap_hdq_probe(struct platform_device *pdev)
562{ 562{
563 struct hdq_data *hdq_data; 563 struct hdq_data *hdq_data;
564 struct resource *res; 564 struct resource *res;
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index ae5cb05a1a1c..bb71ab2336c8 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -426,7 +426,7 @@ static ssize_t hyp_sysfs_store(struct kobject *kobj,
426 return 0; 426 return 0;
427} 427}
428 428
429static struct sysfs_ops hyp_sysfs_ops = { 429static const struct sysfs_ops hyp_sysfs_ops = {
430 .show = hyp_sysfs_show, 430 .show = hyp_sysfs_show,
431 .store = hyp_sysfs_store, 431 .store = hyp_sysfs_store,
432}; 432};