diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-03-10 02:41:57 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-10 02:41:57 -0500 |
commit | d28c145debb1bd53cde63ac8bccc192e3e00067e (patch) | |
tree | 87fb1d66cab7689aa662ebd0337b39ff1bf6f433 /drivers | |
parent | 2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02 (diff) | |
parent | ec0ffe2ee0e0fb9da4409d86bfd72636450f32df (diff) |
Merge branch 'sh/driver-core' into sh/clkfwk
Diffstat (limited to 'drivers')
175 files changed, 2449 insertions, 804 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 | ||
84 | static int __init cfag12864bfb_probe(struct platform_device *device) | 84 | static 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" | |||
3 | config UEVENT_HELPER_PATH | 3 | config 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 | ||
11 | config DEVTMPFS | 19 | config 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 | ||
28 | config DEVTMPFS_MOUNT | 36 | config 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 | ||
36 | config STANDALONE | 51 | config 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 | ||
73 | static struct sysfs_ops driver_sysfs_ops = { | 73 | static 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 | ||
118 | static struct sysfs_ops bus_sysfs_ops = { | 118 | static 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 | ||
157 | static struct kset_uevent_ops bus_uevent_ops = { | 157 | static 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 | ||
66 | static struct sysfs_ops class_sysfs_ops = { | 66 | static 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 | ||
493 | ssize_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 | |||
501 | EXPORT_SYMBOL_GPL(show_class_attr_string); | ||
502 | |||
493 | struct class_compat { | 503 | struct 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 | ||
103 | static struct sysfs_ops dev_sysfs_ops = { | 103 | static 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 | ||
255 | static struct kset_uevent_ops device_uevent_ops = { | 255 | static 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); | ||
317 | out: | ||
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 | ||
16 | static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; | ||
17 | |||
16 | struct sysdev_class cpu_sysdev_class = { | 18 | struct sysdev_class cpu_sysdev_class = { |
17 | .name = "cpu", | 19 | .name = "cpu", |
20 | .attrs = cpu_sysdev_class_attrs, | ||
18 | }; | 21 | }; |
19 | EXPORT_SYMBOL(cpu_sysdev_class); | 22 | EXPORT_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 |
79 | static ssize_t cpu_probe_store(struct class *class, const char *buf, | 82 | static 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 | ||
85 | static ssize_t cpu_release_store(struct class *class, const char *buf, | 90 | static 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 | ||
91 | static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | 98 | static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); |
92 | static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); | 99 | static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store); |
93 | |||
94 | int __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 | } | ||
106 | device_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 | */ |
144 | static ssize_t print_cpus_map(char *buf, const struct cpumask *map) | 137 | |
138 | struct cpu_attr { | ||
139 | struct sysdev_class_attribute attr; | ||
140 | const struct cpumask *const * const map; | ||
141 | }; | ||
142 | |||
143 | static 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) \ |
154 | static 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 | } \ | ||
158 | static struct sysdev_class_attribute attr_##type##_map = \ | ||
159 | _SYSDEV_CLASS_ATTR(type, 0444, print_cpus_##type, NULL) | ||
160 | 157 | ||
161 | print_cpus_func(online); | 158 | /* Keep in sync with cpu_sysdev_class_attrs */ |
162 | print_cpus_func(possible); | 159 | static struct cpu_attr cpu_attrs[] = { |
163 | print_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 | */ |
168 | static ssize_t print_cpus_kernel_max(struct sysdev_class *class, char *buf) | 168 | static 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 */ |
176 | unsigned int total_cpus; | 177 | unsigned int total_cpus; |
177 | 178 | ||
178 | static ssize_t print_cpus_offline(struct sysdev_class *class, char *buf) | 179 | static 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 | } |
205 | static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); | 207 | static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); |
206 | 208 | ||
207 | static 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 | |||
215 | static 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 | |||
262 | static 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 | */ |
90 | int device_bind_driver(struct device *dev) | 90 | int 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 | */ |
196 | int driver_probe_device(struct device_driver *drv, struct device *dev) | 196 | int 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 | */ |
238 | int device_attach(struct device *dev) | 238 | int 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 | } |
259 | EXPORT_SYMBOL_GPL(device_attach); | 259 | EXPORT_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) | |||
303 | EXPORT_SYMBOL_GPL(driver_attach); | 303 | EXPORT_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 | */ |
309 | static void __device_release_driver(struct device *dev) | 309 | static 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 | */ |
348 | void device_release_driver(struct device *dev) | 348 | void 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 | } |
359 | EXPORT_SYMBOL_GPL(device_release_driver); | 359 | EXPORT_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 | ||
71 | static ssize_t | 70 | static ssize_t |
72 | firmware_timeout_show(struct class *class, char *buf) | 71 | firmware_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 | **/ |
89 | static ssize_t | 90 | static ssize_t |
90 | firmware_timeout_store(struct class *class, const char *buf, size_t count) | 91 | firmware_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 | ||
47 | static struct kset_uevent_ops memory_uevent_ops = { | 47 | static 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 | */ |
311 | static ssize_t | 311 | static ssize_t |
312 | print_block_size(struct class *class, char *buf) | 312 | print_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 | ||
317 | static CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); | 318 | static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); |
318 | 319 | ||
319 | static int block_size_init(void) | 320 | static 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 |
332 | static ssize_t | 333 | static ssize_t |
333 | memory_probe_store(struct class *class, const char *buf, size_t count) | 334 | memory_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 */ |
369 | static ssize_t | 371 | static ssize_t |
370 | store_soft_offline_page(struct class *class, const char *buf, size_t count) | 372 | store_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. */ |
386 | static ssize_t | 390 | static ssize_t |
387 | store_hard_offline_page(struct class *class, const char *buf, size_t count) | 391 | store_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 | ||
19 | static struct sysdev_class_attribute *node_state_attrs[]; | ||
20 | |||
19 | static struct sysdev_class node_class = { | 21 | static 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 | ||
547 | static ssize_t print_nodes_possible(struct sysdev_class *class, char *buf) | 550 | struct 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 | |||
552 | static ssize_t print_nodes_online(struct sysdev_class *class, char *buf) | ||
553 | { | ||
554 | return print_nodes_state(N_ONLINE, buf); | ||
555 | } | ||
556 | |||
557 | static 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 | ||
563 | static ssize_t print_nodes_has_cpu(struct sysdev_class *class, char *buf) | 555 | static 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 | ||
568 | static SYSDEV_CLASS_ATTR(possible, 0444, print_nodes_possible, NULL); | 562 | #define _NODE_ATTR(name, state) \ |
569 | static SYSDEV_CLASS_ATTR(online, 0444, print_nodes_online, NULL); | 563 | { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } |
570 | static SYSDEV_CLASS_ATTR(has_normal_memory, 0444, print_nodes_has_normal_memory, | ||
571 | NULL); | ||
572 | static SYSDEV_CLASS_ATTR(has_cpu, 0444, print_nodes_has_cpu, NULL); | ||
573 | 564 | ||
565 | static 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 |
575 | static 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 | |||
581 | static SYSDEV_CLASS_ATTR(has_high_memory, 0444, print_nodes_has_high_memory, | ||
582 | NULL); | ||
583 | #endif | 572 | #endif |
573 | }; | ||
584 | 574 | ||
585 | struct sysdev_class_attribute *node_state_attr[] = { | 575 | static 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 | ||
595 | static 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 */ |
610 | static int __init register_node_type(void) | 587 | static 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..d2d4926c5c4c 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) | |||
177 | EXPORT_SYMBOL_GPL(platform_device_alloc); | 177 | EXPORT_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, | |||
202 | EXPORT_SYMBOL_GPL(platform_device_add_resources); | 202 | EXPORT_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) | |||
344 | EXPORT_SYMBOL_GPL(platform_device_unregister); | 344 | EXPORT_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: | |||
396 | EXPORT_SYMBOL_GPL(platform_device_register_simple); | 396 | EXPORT_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 | */ |
479 | int platform_driver_register(struct platform_driver *drv) | 479 | int platform_driver_register(struct platform_driver *drv) |
@@ -491,7 +491,7 @@ int platform_driver_register(struct platform_driver *drv) | |||
491 | EXPORT_SYMBOL_GPL(platform_driver_register); | 491 | EXPORT_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 | */ |
497 | void platform_driver_unregister(struct platform_driver *drv) | 497 | void platform_driver_unregister(struct platform_driver *drv) |
@@ -548,6 +548,64 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, | |||
548 | } | 548 | } |
549 | EXPORT_SYMBOL_GPL(platform_driver_probe); | 549 | EXPORT_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 | */ | ||
563 | struct 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 | |||
600 | err_pdev_del: | ||
601 | platform_device_del(pdev); | ||
602 | err_pdev_put: | ||
603 | platform_device_put(pdev); | ||
604 | err_out: | ||
605 | return ERR_PTR(error); | ||
606 | } | ||
607 | EXPORT_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 | ||
580 | static const struct platform_device_id *platform_match_id( | 638 | static 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]) { |
@@ -1181,6 +1239,25 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1181 | } | 1239 | } |
1182 | 1240 | ||
1183 | if (match) { | 1241 | if (match) { |
1242 | /* | ||
1243 | * Set up a sensible init_name to enable | ||
1244 | * dev_name() and others to be used before the | ||
1245 | * rest of the driver core is initialized. | ||
1246 | */ | ||
1247 | if (!match->dev.init_name) { | ||
1248 | char buf[32]; | ||
1249 | |||
1250 | if (match->id != -1) | ||
1251 | snprintf(buf, sizeof(buf), "%s.%d", | ||
1252 | match->name, match->id); | ||
1253 | else | ||
1254 | snprintf(buf, sizeof(buf), "%s", | ||
1255 | match->name); | ||
1256 | |||
1257 | match->dev.init_name = kstrdup(buf, GFP_KERNEL); | ||
1258 | if (!match->dev.init_name) | ||
1259 | return -ENOMEM; | ||
1260 | } | ||
1184 | if (epdrv->pdrv->probe(match)) | 1261 | if (epdrv->pdrv->probe(match)) |
1185 | pr_warning("%s: unable to probe %s early.\n", | 1262 | pr_warning("%s: unable to probe %s early.\n", |
1186 | class_str, match->name); | 1263 | class_str, match->name); |
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 | */ |
630 | static void device_complete(struct device *dev, pm_message_t state) | 630 | static 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 | ||
57 | static struct sysfs_ops sysfs_ops = { | 57 | static 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 | ||
107 | static struct sysfs_ops sysfs_class_ops = { | 107 | static 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 | ||
151 | void sysdev_class_unregister(struct sysdev_class *cls) | 155 | void 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 | ||
479 | static ssize_t class_osdblk_list(struct class *c, char *data) | 479 | static 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 | ||
503 | static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) | 505 | static 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 | ||
595 | static ssize_t class_osdblk_remove(struct class *c, const char *buf, | 599 | static 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 | ||
287 | static struct sysfs_ops kobj_pkt_ops = { | 287 | static 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 | } |
340 | static ssize_t class_pktcdvd_show_map(struct class *c, char *data) | 340 | static 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 | ||
359 | static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf, | 361 | static 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 | ||
379 | static ssize_t class_pktcdvd_store_remove(struct class *c, const char *buf, | 383 | static 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/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index 21681a81cc35..37b0542a4eeb 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c | |||
@@ -139,6 +139,8 @@ struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num) | |||
139 | * | 139 | * |
140 | * This function allocates a new struct iucv_tty_buffer element and, optionally, | 140 | * This function allocates a new struct iucv_tty_buffer element and, optionally, |
141 | * allocates an internal data buffer with the specified size @size. | 141 | * allocates an internal data buffer with the specified size @size. |
142 | * The internal data buffer is always allocated with GFP_DMA which is | ||
143 | * required for receiving and sending data with IUCV. | ||
142 | * Note: The total message size arises from the internal buffer size and the | 144 | * Note: The total message size arises from the internal buffer size and the |
143 | * members of the iucv_tty_msg structure. | 145 | * members of the iucv_tty_msg structure. |
144 | * The function returns NULL if memory allocation has failed. | 146 | * The function returns NULL if memory allocation has failed. |
@@ -154,7 +156,7 @@ static struct iucv_tty_buffer *alloc_tty_buffer(size_t size, gfp_t flags) | |||
154 | 156 | ||
155 | if (size > 0) { | 157 | if (size > 0) { |
156 | bufp->msg.length = MSG_SIZE(size); | 158 | bufp->msg.length = MSG_SIZE(size); |
157 | bufp->mbuf = kmalloc(bufp->msg.length, flags); | 159 | bufp->mbuf = kmalloc(bufp->msg.length, flags | GFP_DMA); |
158 | if (!bufp->mbuf) { | 160 | if (!bufp->mbuf) { |
159 | mempool_free(bufp, hvc_iucv_mempool); | 161 | mempool_free(bufp, hvc_iucv_mempool); |
160 | return NULL; | 162 | return NULL; |
@@ -237,7 +239,7 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv, | |||
237 | if (!rb->mbuf) { /* message not yet received ... */ | 239 | if (!rb->mbuf) { /* message not yet received ... */ |
238 | /* allocate mem to store msg data; if no memory is available | 240 | /* allocate mem to store msg data; if no memory is available |
239 | * then leave the buffer on the list and re-try later */ | 241 | * then leave the buffer on the list and re-try later */ |
240 | rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC); | 242 | rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC | GFP_DMA); |
241 | if (!rb->mbuf) | 243 | if (!rb->mbuf) |
242 | return -ENOMEM; | 244 | return -ENOMEM; |
243 | 245 | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 578595c4425d..a1d381171388 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -149,13 +149,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
149 | 149 | ||
150 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | 150 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) |
151 | { | 151 | { |
152 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
153 | int ret; | 152 | int ret; |
154 | 153 | ||
155 | /* enable clock */ | 154 | /* enable clock */ |
156 | ret = clk_enable(p->clk); | 155 | ret = clk_enable(p->clk); |
157 | if (ret) { | 156 | if (ret) { |
158 | pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk); | 157 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
159 | return ret; | 158 | return ret; |
160 | } | 159 | } |
161 | 160 | ||
@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, | |||
278 | delay = 1; | 277 | delay = 1; |
279 | 278 | ||
280 | if (!delay) | 279 | if (!delay) |
281 | pr_warning("sh_cmt: too long delay\n"); | 280 | dev_warn(&p->pdev->dev, "too long delay\n"); |
282 | 281 | ||
283 | } while (delay); | 282 | } while (delay); |
284 | } | 283 | } |
@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | |||
288 | unsigned long flags; | 287 | unsigned long flags; |
289 | 288 | ||
290 | if (delta > p->max_match_value) | 289 | if (delta > p->max_match_value) |
291 | pr_warning("sh_cmt: delta out of range\n"); | 290 | dev_warn(&p->pdev->dev, "delta out of range\n"); |
292 | 291 | ||
293 | spin_lock_irqsave(&p->lock, flags); | 292 | spin_lock_irqsave(&p->lock, flags); |
294 | p->next_match_value = delta; | 293 | p->next_match_value = delta; |
@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | |||
450 | cs->resume = sh_cmt_clocksource_resume; | 449 | cs->resume = sh_cmt_clocksource_resume; |
451 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); | 450 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); |
452 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 451 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
453 | pr_info("sh_cmt: %s used as clock source\n", cs->name); | 452 | dev_info(&p->pdev->dev, "used as clock source\n"); |
454 | clocksource_register(cs); | 453 | clocksource_register(cs); |
455 | return 0; | 454 | return 0; |
456 | } | 455 | } |
@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode, | |||
496 | 495 | ||
497 | switch (mode) { | 496 | switch (mode) { |
498 | case CLOCK_EVT_MODE_PERIODIC: | 497 | case CLOCK_EVT_MODE_PERIODIC: |
499 | pr_info("sh_cmt: %s used for periodic clock events\n", | 498 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
500 | ced->name); | ||
501 | sh_cmt_clock_event_start(p, 1); | 499 | sh_cmt_clock_event_start(p, 1); |
502 | break; | 500 | break; |
503 | case CLOCK_EVT_MODE_ONESHOT: | 501 | case CLOCK_EVT_MODE_ONESHOT: |
504 | pr_info("sh_cmt: %s used for oneshot clock events\n", | 502 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); |
505 | ced->name); | ||
506 | sh_cmt_clock_event_start(p, 0); | 503 | sh_cmt_clock_event_start(p, 0); |
507 | break; | 504 | break; |
508 | case CLOCK_EVT_MODE_SHUTDOWN: | 505 | case CLOCK_EVT_MODE_SHUTDOWN: |
@@ -543,7 +540,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, | |||
543 | ced->set_next_event = sh_cmt_clock_event_next; | 540 | ced->set_next_event = sh_cmt_clock_event_next; |
544 | ced->set_mode = sh_cmt_clock_event_mode; | 541 | ced->set_mode = sh_cmt_clock_event_mode; |
545 | 542 | ||
546 | pr_info("sh_cmt: %s used for clock events\n", ced->name); | 543 | dev_info(&p->pdev->dev, "used for clock events\n"); |
547 | clockevents_register_device(ced); | 544 | clockevents_register_device(ced); |
548 | } | 545 | } |
549 | 546 | ||
@@ -600,12 +597,12 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
600 | /* map memory, let mapbase point to our channel */ | 597 | /* map memory, let mapbase point to our channel */ |
601 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 598 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
602 | if (p->mapbase == NULL) { | 599 | if (p->mapbase == NULL) { |
603 | pr_err("sh_cmt: failed to remap I/O memory\n"); | 600 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
604 | goto err0; | 601 | goto err0; |
605 | } | 602 | } |
606 | 603 | ||
607 | /* request irq using setup_irq() (too early for request_irq()) */ | 604 | /* request irq using setup_irq() (too early for request_irq()) */ |
608 | p->irqaction.name = cfg->name; | 605 | p->irqaction.name = dev_name(&p->pdev->dev); |
609 | p->irqaction.handler = sh_cmt_interrupt; | 606 | p->irqaction.handler = sh_cmt_interrupt; |
610 | p->irqaction.dev_id = p; | 607 | p->irqaction.dev_id = p; |
611 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; | 608 | p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; |
@@ -613,7 +610,7 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
613 | /* get hold of clock */ | 610 | /* get hold of clock */ |
614 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 611 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
615 | if (IS_ERR(p->clk)) { | 612 | if (IS_ERR(p->clk)) { |
616 | pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk); | 613 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
617 | ret = PTR_ERR(p->clk); | 614 | ret = PTR_ERR(p->clk); |
618 | goto err1; | 615 | goto err1; |
619 | } | 616 | } |
@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
628 | p->clear_bits = ~0xc000; | 625 | p->clear_bits = ~0xc000; |
629 | } | 626 | } |
630 | 627 | ||
631 | ret = sh_cmt_register(p, cfg->name, | 628 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), |
632 | cfg->clockevent_rating, | 629 | cfg->clockevent_rating, |
633 | cfg->clocksource_rating); | 630 | cfg->clocksource_rating); |
634 | if (ret) { | 631 | if (ret) { |
635 | pr_err("sh_cmt: registration failed\n"); | 632 | dev_err(&p->pdev->dev, "registration failed\n"); |
636 | goto err1; | 633 | goto err1; |
637 | } | 634 | } |
638 | 635 | ||
639 | ret = setup_irq(irq, &p->irqaction); | 636 | ret = setup_irq(irq, &p->irqaction); |
640 | if (ret) { | 637 | if (ret) { |
641 | pr_err("sh_cmt: failed to request irq %d\n", irq); | 638 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); |
642 | goto err1; | 639 | goto err1; |
643 | } | 640 | } |
644 | 641 | ||
@@ -653,11 +650,10 @@ err0: | |||
653 | static int __devinit sh_cmt_probe(struct platform_device *pdev) | 650 | static int __devinit sh_cmt_probe(struct platform_device *pdev) |
654 | { | 651 | { |
655 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | 652 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); |
656 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
657 | int ret; | 653 | int ret; |
658 | 654 | ||
659 | if (p) { | 655 | if (p) { |
660 | pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name); | 656 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
661 | return 0; | 657 | return 0; |
662 | } | 658 | } |
663 | 659 | ||
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 4c8a759e60cd..8ce355572d16 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -118,13 +118,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start) | |||
118 | 118 | ||
119 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) | 119 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) |
120 | { | 120 | { |
121 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
122 | int ret; | 121 | int ret; |
123 | 122 | ||
124 | /* enable clock */ | 123 | /* enable clock */ |
125 | ret = clk_enable(p->clk); | 124 | ret = clk_enable(p->clk); |
126 | if (ret) { | 125 | if (ret) { |
127 | pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk); | 126 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
128 | return ret; | 127 | return ret; |
129 | } | 128 | } |
130 | 129 | ||
@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, | |||
193 | 192 | ||
194 | switch (mode) { | 193 | switch (mode) { |
195 | case CLOCK_EVT_MODE_PERIODIC: | 194 | case CLOCK_EVT_MODE_PERIODIC: |
196 | pr_info("sh_mtu2: %s used for periodic clock events\n", | 195 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
197 | ced->name); | ||
198 | sh_mtu2_enable(p); | 196 | sh_mtu2_enable(p); |
199 | break; | 197 | break; |
200 | case CLOCK_EVT_MODE_UNUSED: | 198 | case CLOCK_EVT_MODE_UNUSED: |
@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, | |||
221 | ced->cpumask = cpumask_of(0); | 219 | ced->cpumask = cpumask_of(0); |
222 | ced->set_mode = sh_mtu2_clock_event_mode; | 220 | ced->set_mode = sh_mtu2_clock_event_mode; |
223 | 221 | ||
224 | pr_info("sh_mtu2: %s used for clock events\n", ced->name); | 222 | dev_info(&p->pdev->dev, "used for clock events\n"); |
225 | clockevents_register_device(ced); | 223 | clockevents_register_device(ced); |
226 | 224 | ||
227 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 225 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
228 | if (ret) { | 226 | if (ret) { |
229 | pr_err("sh_mtu2: failed to request irq %d\n", | 227 | dev_err(&p->pdev->dev, "failed to request irq %d\n", |
230 | p->irqaction.irq); | 228 | p->irqaction.irq); |
231 | return; | 229 | return; |
232 | } | 230 | } |
233 | } | 231 | } |
@@ -273,12 +271,12 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
273 | /* map memory, let mapbase point to our channel */ | 271 | /* map memory, let mapbase point to our channel */ |
274 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 272 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
275 | if (p->mapbase == NULL) { | 273 | if (p->mapbase == NULL) { |
276 | pr_err("sh_mtu2: failed to remap I/O memory\n"); | 274 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
277 | goto err0; | 275 | goto err0; |
278 | } | 276 | } |
279 | 277 | ||
280 | /* setup data for setup_irq() (too early for request_irq()) */ | 278 | /* setup data for setup_irq() (too early for request_irq()) */ |
281 | p->irqaction.name = cfg->name; | 279 | p->irqaction.name = dev_name(&p->pdev->dev); |
282 | p->irqaction.handler = sh_mtu2_interrupt; | 280 | p->irqaction.handler = sh_mtu2_interrupt; |
283 | p->irqaction.dev_id = p; | 281 | p->irqaction.dev_id = p; |
284 | p->irqaction.irq = irq; | 282 | p->irqaction.irq = irq; |
@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
287 | /* get hold of clock */ | 285 | /* get hold of clock */ |
288 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 286 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
289 | if (IS_ERR(p->clk)) { | 287 | if (IS_ERR(p->clk)) { |
290 | pr_err("sh_mtu2: cannot get clock \"%s\"\n", cfg->clk); | 288 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
291 | ret = PTR_ERR(p->clk); | 289 | ret = PTR_ERR(p->clk); |
292 | goto err1; | 290 | goto err1; |
293 | } | 291 | } |
294 | 292 | ||
295 | return sh_mtu2_register(p, cfg->name, cfg->clockevent_rating); | 293 | return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev), |
294 | cfg->clockevent_rating); | ||
296 | err1: | 295 | err1: |
297 | iounmap(p->mapbase); | 296 | iounmap(p->mapbase); |
298 | err0: | 297 | err0: |
@@ -302,11 +301,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | |||
302 | static int __devinit sh_mtu2_probe(struct platform_device *pdev) | 301 | static int __devinit sh_mtu2_probe(struct platform_device *pdev) |
303 | { | 302 | { |
304 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); | 303 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); |
305 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
306 | int ret; | 304 | int ret; |
307 | 305 | ||
308 | if (p) { | 306 | if (p) { |
309 | pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name); | 307 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
310 | return 0; | 308 | return 0; |
311 | } | 309 | } |
312 | 310 | ||
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 961f5b5ef6a3..34239453ebaf 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -106,13 +106,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) | |||
106 | 106 | ||
107 | static int sh_tmu_enable(struct sh_tmu_priv *p) | 107 | static int sh_tmu_enable(struct sh_tmu_priv *p) |
108 | { | 108 | { |
109 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | ||
110 | int ret; | 109 | int ret; |
111 | 110 | ||
112 | /* enable clock */ | 111 | /* enable clock */ |
113 | ret = clk_enable(p->clk); | 112 | ret = clk_enable(p->clk); |
114 | if (ret) { | 113 | if (ret) { |
115 | pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk); | 114 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
116 | return ret; | 115 | return ret; |
117 | } | 116 | } |
118 | 117 | ||
@@ -228,7 +227,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, | |||
228 | cs->disable = sh_tmu_clocksource_disable; | 227 | cs->disable = sh_tmu_clocksource_disable; |
229 | cs->mask = CLOCKSOURCE_MASK(32); | 228 | cs->mask = CLOCKSOURCE_MASK(32); |
230 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 229 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
231 | pr_info("sh_tmu: %s used as clock source\n", cs->name); | 230 | dev_info(&p->pdev->dev, "used as clock source\n"); |
232 | clocksource_register(cs); | 231 | clocksource_register(cs); |
233 | return 0; | 232 | return 0; |
234 | } | 233 | } |
@@ -276,13 +275,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode, | |||
276 | 275 | ||
277 | switch (mode) { | 276 | switch (mode) { |
278 | case CLOCK_EVT_MODE_PERIODIC: | 277 | case CLOCK_EVT_MODE_PERIODIC: |
279 | pr_info("sh_tmu: %s used for periodic clock events\n", | 278 | dev_info(&p->pdev->dev, "used for periodic clock events\n"); |
280 | ced->name); | ||
281 | sh_tmu_clock_event_start(p, 1); | 279 | sh_tmu_clock_event_start(p, 1); |
282 | break; | 280 | break; |
283 | case CLOCK_EVT_MODE_ONESHOT: | 281 | case CLOCK_EVT_MODE_ONESHOT: |
284 | pr_info("sh_tmu: %s used for oneshot clock events\n", | 282 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); |
285 | ced->name); | ||
286 | sh_tmu_clock_event_start(p, 0); | 283 | sh_tmu_clock_event_start(p, 0); |
287 | break; | 284 | break; |
288 | case CLOCK_EVT_MODE_UNUSED: | 285 | case CLOCK_EVT_MODE_UNUSED: |
@@ -323,13 +320,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, | |||
323 | ced->set_next_event = sh_tmu_clock_event_next; | 320 | ced->set_next_event = sh_tmu_clock_event_next; |
324 | ced->set_mode = sh_tmu_clock_event_mode; | 321 | ced->set_mode = sh_tmu_clock_event_mode; |
325 | 322 | ||
326 | pr_info("sh_tmu: %s used for clock events\n", ced->name); | 323 | dev_info(&p->pdev->dev, "used for clock events\n"); |
327 | clockevents_register_device(ced); | 324 | clockevents_register_device(ced); |
328 | 325 | ||
329 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 326 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
330 | if (ret) { | 327 | if (ret) { |
331 | pr_err("sh_tmu: failed to request irq %d\n", | 328 | dev_err(&p->pdev->dev, "failed to request irq %d\n", |
332 | p->irqaction.irq); | 329 | p->irqaction.irq); |
333 | return; | 330 | return; |
334 | } | 331 | } |
335 | } | 332 | } |
@@ -378,12 +375,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
378 | /* map memory, let mapbase point to our channel */ | 375 | /* map memory, let mapbase point to our channel */ |
379 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 376 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); |
380 | if (p->mapbase == NULL) { | 377 | if (p->mapbase == NULL) { |
381 | pr_err("sh_tmu: failed to remap I/O memory\n"); | 378 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); |
382 | goto err0; | 379 | goto err0; |
383 | } | 380 | } |
384 | 381 | ||
385 | /* setup data for setup_irq() (too early for request_irq()) */ | 382 | /* setup data for setup_irq() (too early for request_irq()) */ |
386 | p->irqaction.name = cfg->name; | 383 | p->irqaction.name = dev_name(&p->pdev->dev); |
387 | p->irqaction.handler = sh_tmu_interrupt; | 384 | p->irqaction.handler = sh_tmu_interrupt; |
388 | p->irqaction.dev_id = p; | 385 | p->irqaction.dev_id = p; |
389 | p->irqaction.irq = irq; | 386 | p->irqaction.irq = irq; |
@@ -392,12 +389,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
392 | /* get hold of clock */ | 389 | /* get hold of clock */ |
393 | p->clk = clk_get(&p->pdev->dev, cfg->clk); | 390 | p->clk = clk_get(&p->pdev->dev, cfg->clk); |
394 | if (IS_ERR(p->clk)) { | 391 | if (IS_ERR(p->clk)) { |
395 | pr_err("sh_tmu: cannot get clock \"%s\"\n", cfg->clk); | 392 | dev_err(&p->pdev->dev, "cannot get clock\n"); |
396 | ret = PTR_ERR(p->clk); | 393 | ret = PTR_ERR(p->clk); |
397 | goto err1; | 394 | goto err1; |
398 | } | 395 | } |
399 | 396 | ||
400 | return sh_tmu_register(p, cfg->name, | 397 | return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev), |
401 | cfg->clockevent_rating, | 398 | cfg->clockevent_rating, |
402 | cfg->clocksource_rating); | 399 | cfg->clocksource_rating); |
403 | err1: | 400 | err1: |
@@ -409,11 +406,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) | |||
409 | static int __devinit sh_tmu_probe(struct platform_device *pdev) | 406 | static int __devinit sh_tmu_probe(struct platform_device *pdev) |
410 | { | 407 | { |
411 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); | 408 | struct sh_tmu_priv *p = platform_get_drvdata(pdev); |
412 | struct sh_timer_config *cfg = pdev->dev.platform_data; | ||
413 | int ret; | 409 | int ret; |
414 | 410 | ||
415 | if (p) { | 411 | if (p) { |
416 | pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name); | 412 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
417 | return 0; | 413 | return 0; |
418 | } | 414 | } |
419 | 415 | ||
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 | ||
769 | static struct sysfs_ops sysfs_ops = { | 769 | static 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 | ||
24 | static ssize_t show_available_governors(struct sysdev_class *class, | 24 | static 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 | ||
43 | static ssize_t show_current_driver(struct sysdev_class *class, | 44 | static 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 | ||
58 | static ssize_t show_current_governor(struct sysdev_class *class, | 60 | static 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 | ||
73 | static ssize_t store_current_governor(struct sysdev_class *class, | 76 | static 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 | ||
194 | static struct sysfs_ops cpuidle_sysfs_ops = { | 198 | static 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 | ||
280 | static struct sysfs_ops cpuidle_state_sysfs_ops = { | 284 | static 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 | ||
1141 | struct sysfs_ops ioat_sysfs_ops = { | 1141 | const 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); |
347 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 347 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
348 | void ioat_kobject_del(struct ioatdma_device *device); | 348 | void ioat_kobject_del(struct ioatdma_device *device); |
349 | extern struct sysfs_ops ioat_sysfs_ops; | 349 | extern const struct sysfs_ops ioat_sysfs_ops; |
350 | extern struct ioat_sysfs_entry ioat_version_attr; | 350 | extern struct ioat_sysfs_entry ioat_version_attr; |
351 | extern struct ioat_sysfs_entry ioat_cap_attr; | 351 | extern 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' */ |
140 | static struct sysfs_ops device_ctl_info_ops = { | 140 | static 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' */ |
376 | static struct sysfs_ops device_instance_ops = { | 376 | static 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' */ |
479 | static struct sysfs_ops device_block_ops = { | 479 | static 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 | ||
248 | static struct sysfs_ops csrowfs_ops = { | 248 | static 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 */ |
578 | static struct sysfs_ops mci_ops = { | 578 | static 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 */ |
124 | static struct sysfs_ops pci_instance_ops = { | 124 | static 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 | ||
264 | static struct sysfs_ops edac_pci_sysfs_ops = { | 264 | static 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 | ||
125 | static struct sysfs_ops edd_attr_ops = { | 125 | static 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 | ||
365 | static struct sysfs_ops efivar_attr_ops = { | 365 | static 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 | ||
522 | static struct sysfs_ops ibft_attr_ops = { | 522 | static 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 | ||
77 | static struct sysfs_ops memmap_attr_ops = { | 77 | static 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 | */ |
626 | static ssize_t export_store(struct class *class, const char *buf, size_t len) | 626 | static 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 | ||
656 | static ssize_t unexport_store(struct class *class, const char *buf, size_t len) | 658 | static 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 */ | ||
74 | static 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 | |||
80 | static char *drm_devnode(struct device *dev, mode_t *mode) | 73 | static 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 | ||
85 | static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | 78 | static 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 | ||
131 | static struct sysfs_ops ttm_bo_global_ops = { | 131 | static 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 | ||
155 | static struct sysfs_ops ttm_mem_zone_ops = { | 155 | static 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 | ||
853 | static int __init | 853 | static int __devinit |
854 | omap_i2c_probe(struct platform_device *pdev) | 854 | omap_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 | ||
3600 | static struct sysfs_ops cm_counter_ops = { | 3600 | static 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 | ||
82 | static struct sysfs_ops port_sysfs_ops = { | 82 | static 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 | ||
1339 | static ssize_t show_abi_version(struct class *class, char *buf) | 1339 | static 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 | } | ||
1343 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
1344 | 1341 | ||
1345 | static int __init ib_ucm_init(void) | 1342 | static 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 | ||
1369 | error3: | 1366 | error3: |
1370 | class_remove_file(&cm_class, &class_attr_abi_version); | 1367 | class_remove_file(&cm_class, &class_attr_abi_version.attr); |
1371 | error2: | 1368 | error2: |
1372 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); | 1369 | unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES); |
1373 | error1: | 1370 | error1: |
@@ -1377,7 +1374,7 @@ error1: | |||
1377 | static void __exit ib_ucm_cleanup(void) | 1374 | static 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 | } |
966 | static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); | 966 | static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); |
967 | 967 | ||
968 | static ssize_t show_abi_version(struct class *class, char *buf) | 968 | static 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 | } | ||
972 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
973 | 970 | ||
974 | static dev_t overflow_maj; | 971 | static dev_t overflow_maj; |
975 | static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS); | 972 | static 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 | } |
692 | static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); | 692 | static DEVICE_ATTR(abi_version, S_IRUGO, show_dev_abi_version, NULL); |
693 | 693 | ||
694 | static ssize_t show_abi_version(struct class *class, char *buf) | 694 | static 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 | } | ||
698 | static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); | ||
699 | 696 | ||
700 | static dev_t overflow_maj; | 697 | static dev_t overflow_maj; |
701 | static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES); | 698 | static 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 | ||
78 | static struct sysfs_ops dm_sysfs_ops = { | 78 | static 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 | } |
2645 | static struct sysfs_ops rdev_sysfs_ops = { | 2645 | static 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 | ||
4062 | static struct sysfs_ops md_sysfs_ops = { | 4062 | static 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 | ||
1738 | static int __init omap24xxcam_probe(struct platform_device *pdev) | 1738 | static 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 | ||
500 | static ssize_t phantom_show_version(struct class *cls, char *buf) | 500 | static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION); |
501 | { | ||
502 | return sprintf(buf, PHANTOM_VERSION "\n"); | ||
503 | } | ||
504 | |||
505 | static CLASS_ATTR(version, 0444, phantom_show_version, NULL); | ||
506 | 501 | ||
507 | static int __init phantom_init(void) | 502 | static 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) | |||
541 | err_unchr: | 536 | err_unchr: |
542 | unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); | 537 | unregister_chrdev_region(dev, PHANTOM_MAX_MINORS); |
543 | err_attr: | 538 | err_attr: |
544 | class_remove_file(phantom_class, &class_attr_version); | 539 | class_remove_file(phantom_class, &class_attr_version.attr); |
545 | err_class: | 540 | err_class: |
546 | class_destroy(phantom_class); | 541 | class_destroy(phantom_class); |
547 | err: | 542 | err: |
@@ -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); | |||
89 | static DEFINE_SPINLOCK(ubi_devices_lock); | 89 | static 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/' */ |
92 | static ssize_t ubi_version_show(struct class *class, char *buf) | 92 | static 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 | */ |
54 | static ssize_t bonding_show_bonds(struct class *cls, char *buf) | 54 | static 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 | ||
100 | static ssize_t bonding_store_bonds(struct class *cls, | 102 | static 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 | ||
1580 | static struct sysfs_ops veth_pool_ops = { | 1580 | static 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 | ||
387 | static struct sysfs_ops veth_cnx_sysfs_ops = { | 387 | static 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 | ||
444 | static struct sysfs_ops veth_port_sysfs_ops = { | 444 | static 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 | ||
484 | static struct sysfs_ops pdcspath_attr_ops = { | 484 | static 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 | ||
75 | static struct kobj_type legacy_ktype = { | 75 | static 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); |
2509 | done: | 2509 | done: |
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 | ||
32 | static struct sysfs_ops pci_slot_sysfs_ops = { | 32 | static 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 | ||
60 | static int __init hp_wmi_bios_setup(struct platform_device *device); | 60 | static int __devinit hp_wmi_bios_setup(struct platform_device *device); |
61 | static int __exit hp_wmi_bios_remove(struct platform_device *device); | 61 | static int __exit hp_wmi_bios_remove(struct platform_device *device); |
62 | static int hp_wmi_resume_handler(struct device *device); | 62 | static 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 | ||
450 | static int __init hp_wmi_bios_setup(struct platform_device *device) | 450 | static 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 | |||
80 | static int msi_laptop_resume(struct platform_device *device); | ||
81 | |||
82 | #define MSI_STANDARD_EC_DEVICES_EXISTS_ADDRESS 0x2f | ||
83 | |||
69 | static int force; | 84 | static int force; |
70 | module_param(force, bool, 0); | 85 | module_param(force, bool, 0); |
71 | MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); | 86 | MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); |
@@ -74,6 +89,23 @@ static int auto_brightness; | |||
74 | module_param(auto_brightness, int, 0); | 89 | module_param(auto_brightness, int, 0); |
75 | MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); | 90 | MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); |
76 | 91 | ||
92 | static bool old_ec_model; | ||
93 | static int wlan_s, bluetooth_s, threeg_s; | ||
94 | static 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 | */ | ||
106 | static bool load_scm_model; | ||
107 | static struct rfkill *rfk_wlan, *rfk_bluetooth, *rfk_threeg; | ||
108 | |||
77 | /* Hardware access */ | 109 | /* Hardware access */ |
78 | 110 | ||
79 | static int set_lcd_level(int level) | 111 | static 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 | ||
165 | static 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 | |||
133 | static int get_wireless_state(int *wlan, int *bluetooth) | 194 | static 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 | ||
212 | static 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 | |||
230 | static 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 | ||
153 | static int bl_get_brightness(struct backlight_device *b) | 246 | static 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 | ||
284 | static 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 | |||
186 | static ssize_t show_bluetooth(struct device *dev, | 290 | static 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 | ||
308 | static 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 | |||
314 | static 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 | |||
331 | static 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 | |||
199 | static ssize_t show_lcd_level(struct device *dev, | 337 | static 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); | |||
258 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); | 396 | static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); |
259 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); | 397 | static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); |
260 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); | 398 | static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); |
399 | static DEVICE_ATTR(threeg, 0444, show_threeg, NULL); | ||
261 | 400 | ||
262 | static struct attribute *msipf_attributes[] = { | 401 | static 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 | ||
281 | static struct platform_device *msipf_device; | 421 | static struct platform_device *msipf_device; |
@@ -332,6 +472,192 @@ static struct dmi_system_id __initdata msi_dmi_table[] = { | |||
332 | { } | 472 | { } |
333 | }; | 473 | }; |
334 | 474 | ||
475 | static 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 | |||
490 | static 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 | |||
505 | static 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 | |||
515 | static 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 | |||
525 | static struct rfkill_ops rfkill_bluetooth_ops = { | ||
526 | .set_block = rfkill_bluetooth_set | ||
527 | }; | ||
528 | |||
529 | static struct rfkill_ops rfkill_wlan_ops = { | ||
530 | .set_block = rfkill_wlan_set | ||
531 | }; | ||
532 | |||
533 | static struct rfkill_ops rfkill_threeg_ops = { | ||
534 | .set_block = rfkill_threeg_set | ||
535 | }; | ||
536 | |||
537 | static 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 | |||
555 | static 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 | |||
595 | err_threeg: | ||
596 | rfkill_destroy(rfk_threeg); | ||
597 | if (rfk_wlan) | ||
598 | rfkill_unregister(rfk_wlan); | ||
599 | err_wlan: | ||
600 | rfkill_destroy(rfk_wlan); | ||
601 | if (rfk_bluetooth) | ||
602 | rfkill_unregister(rfk_bluetooth); | ||
603 | err_bluetooth: | ||
604 | rfkill_destroy(rfk_bluetooth); | ||
605 | |||
606 | return retval; | ||
607 | } | ||
608 | |||
609 | static 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 | |||
630 | static 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 | |||
335 | static int __init msi_init(void) | 661 | static 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 | |||
435 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); | 784 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*"); |
436 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | 785 | MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); |
437 | MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); | 786 | MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*"); |
787 | MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-N034:*"); | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 4951aa82e9f5..bbea90baf98f 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/ebcdic.h> | 26 | #include <asm/ebcdic.h> |
27 | #include <asm/idals.h> | 27 | #include <asm/idals.h> |
28 | #include <asm/itcw.h> | 28 | #include <asm/itcw.h> |
29 | #include <asm/diag.h> | ||
29 | 30 | ||
30 | /* This is ugly... */ | 31 | /* This is ugly... */ |
31 | #define PRINTK_HEADER "dasd:" | 32 | #define PRINTK_HEADER "dasd:" |
@@ -2212,6 +2213,13 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) | |||
2212 | goto out; | 2213 | goto out; |
2213 | } | 2214 | } |
2214 | 2215 | ||
2216 | if ((mode & FMODE_WRITE) && | ||
2217 | (test_bit(DASD_FLAG_DEVICE_RO, &base->flags) || | ||
2218 | (base->features & DASD_FEATURE_READONLY))) { | ||
2219 | rc = -EROFS; | ||
2220 | goto out; | ||
2221 | } | ||
2222 | |||
2215 | return 0; | 2223 | return 0; |
2216 | 2224 | ||
2217 | out: | 2225 | out: |
@@ -2289,6 +2297,34 @@ dasd_exit(void) | |||
2289 | * SECTION: common functions for ccw_driver use | 2297 | * SECTION: common functions for ccw_driver use |
2290 | */ | 2298 | */ |
2291 | 2299 | ||
2300 | /* | ||
2301 | * Is the device read-only? | ||
2302 | * Note that this function does not report the setting of the | ||
2303 | * readonly device attribute, but how it is configured in z/VM. | ||
2304 | */ | ||
2305 | int dasd_device_is_ro(struct dasd_device *device) | ||
2306 | { | ||
2307 | struct ccw_dev_id dev_id; | ||
2308 | struct diag210 diag_data; | ||
2309 | int rc; | ||
2310 | |||
2311 | if (!MACHINE_IS_VM) | ||
2312 | return 0; | ||
2313 | ccw_device_get_id(device->cdev, &dev_id); | ||
2314 | memset(&diag_data, 0, sizeof(diag_data)); | ||
2315 | diag_data.vrdcdvno = dev_id.devno; | ||
2316 | diag_data.vrdclen = sizeof(diag_data); | ||
2317 | rc = diag210(&diag_data); | ||
2318 | if (rc == 0 || rc == 2) { | ||
2319 | return diag_data.vrdcvfla & 0x80; | ||
2320 | } else { | ||
2321 | DBF_EVENT(DBF_WARNING, "diag210 failed for dev=%04x with rc=%d", | ||
2322 | dev_id.devno, rc); | ||
2323 | return 0; | ||
2324 | } | ||
2325 | } | ||
2326 | EXPORT_SYMBOL_GPL(dasd_device_is_ro); | ||
2327 | |||
2292 | static void dasd_generic_auto_online(void *data, async_cookie_t cookie) | 2328 | static void dasd_generic_auto_online(void *data, async_cookie_t cookie) |
2293 | { | 2329 | { |
2294 | struct ccw_device *cdev = data; | 2330 | struct ccw_device *cdev = data; |
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c index 44796ba4eb9b..51224f76b980 100644 --- a/drivers/s390/block/dasd_3990_erp.c +++ b/drivers/s390/block/dasd_3990_erp.c | |||
@@ -1045,6 +1045,10 @@ dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) | |||
1045 | 1045 | ||
1046 | erp->retries = 5; | 1046 | erp->retries = 5; |
1047 | 1047 | ||
1048 | } else if (sense[1] & SNS1_WRITE_INHIBITED) { | ||
1049 | dev_err(&device->cdev->dev, "An I/O request was rejected" | ||
1050 | " because writing is inhibited\n"); | ||
1051 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); | ||
1048 | } else { | 1052 | } else { |
1049 | /* fatal error - set status to FAILED | 1053 | /* fatal error - set status to FAILED |
1050 | internal error 09 - Command Reject */ | 1054 | internal error 09 - Command Reject */ |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index d49766f3b940..8e23919c8704 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -742,6 +742,7 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
742 | const char *buf, size_t count) | 742 | const char *buf, size_t count) |
743 | { | 743 | { |
744 | struct dasd_devmap *devmap; | 744 | struct dasd_devmap *devmap; |
745 | struct dasd_device *device; | ||
745 | int val; | 746 | int val; |
746 | char *endp; | 747 | char *endp; |
747 | 748 | ||
@@ -758,12 +759,14 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
758 | devmap->features |= DASD_FEATURE_READONLY; | 759 | devmap->features |= DASD_FEATURE_READONLY; |
759 | else | 760 | else |
760 | devmap->features &= ~DASD_FEATURE_READONLY; | 761 | devmap->features &= ~DASD_FEATURE_READONLY; |
761 | if (devmap->device) | 762 | device = devmap->device; |
762 | devmap->device->features = devmap->features; | 763 | if (device) { |
763 | if (devmap->device && devmap->device->block | 764 | device->features = devmap->features; |
764 | && devmap->device->block->gdp) | 765 | val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
765 | set_disk_ro(devmap->device->block->gdp, val); | 766 | } |
766 | spin_unlock(&dasd_devmap_lock); | 767 | spin_unlock(&dasd_devmap_lock); |
768 | if (device && device->block && device->block->gdp) | ||
769 | set_disk_ro(device->block->gdp, val); | ||
767 | return count; | 770 | return count; |
768 | } | 771 | } |
769 | 772 | ||
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 6e14863f5c70..687f323cdc38 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -145,12 +145,10 @@ dasd_diag_erp(struct dasd_device *device) | |||
145 | mdsk_term_io(device); | 145 | mdsk_term_io(device); |
146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); | 146 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); |
147 | if (rc == 4) { | 147 | if (rc == 4) { |
148 | if (!(device->features & DASD_FEATURE_READONLY)) { | 148 | if (!(test_and_set_bit(DASD_FLAG_DEVICE_RO, &device->flags))) |
149 | pr_warning("%s: The access mode of a DIAG device " | 149 | pr_warning("%s: The access mode of a DIAG device " |
150 | "changed to read-only\n", | 150 | "changed to read-only\n", |
151 | dev_name(&device->cdev->dev)); | 151 | dev_name(&device->cdev->dev)); |
152 | device->features |= DASD_FEATURE_READONLY; | ||
153 | } | ||
154 | rc = 0; | 152 | rc = 0; |
155 | } | 153 | } |
156 | if (rc) | 154 | if (rc) |
@@ -449,7 +447,7 @@ dasd_diag_check_device(struct dasd_device *device) | |||
449 | rc = -EIO; | 447 | rc = -EIO; |
450 | } else { | 448 | } else { |
451 | if (rc == 4) | 449 | if (rc == 4) |
452 | device->features |= DASD_FEATURE_READONLY; | 450 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); |
453 | pr_info("%s: New DASD with %ld byte/block, total size %ld " | 451 | pr_info("%s: New DASD with %ld byte/block, total size %ld " |
454 | "KB%s\n", dev_name(&device->cdev->dev), | 452 | "KB%s\n", dev_name(&device->cdev->dev), |
455 | (unsigned long) block->bp_block, | 453 | (unsigned long) block->bp_block, |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 1cca21aafaba..01f4e7a34aa8 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1089,6 +1089,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1089 | struct dasd_eckd_private *private; | 1089 | struct dasd_eckd_private *private; |
1090 | struct dasd_block *block; | 1090 | struct dasd_block *block; |
1091 | int is_known, rc; | 1091 | int is_known, rc; |
1092 | int readonly; | ||
1092 | 1093 | ||
1093 | if (!ccw_device_is_pathgroup(device->cdev)) { | 1094 | if (!ccw_device_is_pathgroup(device->cdev)) { |
1094 | dev_warn(&device->cdev->dev, | 1095 | dev_warn(&device->cdev->dev, |
@@ -1182,15 +1183,20 @@ dasd_eckd_check_characteristics(struct dasd_device *device) | |||
1182 | else | 1183 | else |
1183 | private->real_cyl = private->rdc_data.no_cyl; | 1184 | private->real_cyl = private->rdc_data.no_cyl; |
1184 | 1185 | ||
1186 | readonly = dasd_device_is_ro(device); | ||
1187 | if (readonly) | ||
1188 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); | ||
1189 | |||
1185 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " | 1190 | dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " |
1186 | "with %d cylinders, %d heads, %d sectors\n", | 1191 | "with %d cylinders, %d heads, %d sectors%s\n", |
1187 | private->rdc_data.dev_type, | 1192 | private->rdc_data.dev_type, |
1188 | private->rdc_data.dev_model, | 1193 | private->rdc_data.dev_model, |
1189 | private->rdc_data.cu_type, | 1194 | private->rdc_data.cu_type, |
1190 | private->rdc_data.cu_model.model, | 1195 | private->rdc_data.cu_model.model, |
1191 | private->real_cyl, | 1196 | private->real_cyl, |
1192 | private->rdc_data.trk_per_cyl, | 1197 | private->rdc_data.trk_per_cyl, |
1193 | private->rdc_data.sec_per_trk); | 1198 | private->rdc_data.sec_per_trk, |
1199 | readonly ? ", read-only device" : ""); | ||
1194 | return 0; | 1200 | return 0; |
1195 | 1201 | ||
1196 | out_err3: | 1202 | out_err3: |
@@ -2839,8 +2845,13 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
2839 | char *psf_data, *rssd_result; | 2845 | char *psf_data, *rssd_result; |
2840 | struct dasd_ccw_req *cqr; | 2846 | struct dasd_ccw_req *cqr; |
2841 | struct ccw1 *ccw; | 2847 | struct ccw1 *ccw; |
2848 | char psf0, psf1; | ||
2842 | int rc; | 2849 | int rc; |
2843 | 2850 | ||
2851 | if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) | ||
2852 | return -EACCES; | ||
2853 | psf0 = psf1 = 0; | ||
2854 | |||
2844 | /* Copy parms from caller */ | 2855 | /* Copy parms from caller */ |
2845 | rc = -EFAULT; | 2856 | rc = -EFAULT; |
2846 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) | 2857 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) |
@@ -2869,12 +2880,8 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
2869 | (void __user *)(unsigned long) usrparm.psf_data, | 2880 | (void __user *)(unsigned long) usrparm.psf_data, |
2870 | usrparm.psf_data_len)) | 2881 | usrparm.psf_data_len)) |
2871 | goto out_free; | 2882 | goto out_free; |
2872 | 2883 | psf0 = psf_data[0]; | |
2873 | /* sanity check on syscall header */ | 2884 | psf1 = psf_data[1]; |
2874 | if (psf_data[0] != 0x17 && psf_data[1] != 0xce) { | ||
2875 | rc = -EINVAL; | ||
2876 | goto out_free; | ||
2877 | } | ||
2878 | 2885 | ||
2879 | /* setup CCWs for PSF + RSSD */ | 2886 | /* setup CCWs for PSF + RSSD */ |
2880 | cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device); | 2887 | cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device); |
@@ -2925,7 +2932,9 @@ out_free: | |||
2925 | kfree(rssd_result); | 2932 | kfree(rssd_result); |
2926 | kfree(psf_data); | 2933 | kfree(psf_data); |
2927 | out: | 2934 | out: |
2928 | DBF_DEV_EVENT(DBF_WARNING, device, "Symmetrix ioctl: rc=%d", rc); | 2935 | DBF_DEV_EVENT(DBF_WARNING, device, |
2936 | "Symmetrix ioctl (0x%02x 0x%02x): rc=%d", | ||
2937 | (int) psf0, (int) psf1, rc); | ||
2929 | return rc; | 2938 | return rc; |
2930 | } | 2939 | } |
2931 | 2940 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 0f152444ac77..37282b90eecc 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -124,6 +124,7 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
124 | struct dasd_fba_private *private; | 124 | struct dasd_fba_private *private; |
125 | struct ccw_device *cdev = device->cdev; | 125 | struct ccw_device *cdev = device->cdev; |
126 | int rc; | 126 | int rc; |
127 | int readonly; | ||
127 | 128 | ||
128 | private = (struct dasd_fba_private *) device->private; | 129 | private = (struct dasd_fba_private *) device->private; |
129 | if (!private) { | 130 | if (!private) { |
@@ -162,16 +163,21 @@ dasd_fba_check_characteristics(struct dasd_device *device) | |||
162 | return rc; | 163 | return rc; |
163 | } | 164 | } |
164 | 165 | ||
166 | readonly = dasd_device_is_ro(device); | ||
167 | if (readonly) | ||
168 | set_bit(DASD_FLAG_DEVICE_RO, &device->flags); | ||
169 | |||
165 | dev_info(&device->cdev->dev, | 170 | dev_info(&device->cdev->dev, |
166 | "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB " | 171 | "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB " |
167 | "and %d B/blk\n", | 172 | "and %d B/blk%s\n", |
168 | cdev->id.dev_type, | 173 | cdev->id.dev_type, |
169 | cdev->id.dev_model, | 174 | cdev->id.dev_model, |
170 | cdev->id.cu_type, | 175 | cdev->id.cu_type, |
171 | cdev->id.cu_model, | 176 | cdev->id.cu_model, |
172 | ((private->rdc_data.blk_bdsa * | 177 | ((private->rdc_data.blk_bdsa * |
173 | (private->rdc_data.blk_size >> 9)) >> 11), | 178 | (private->rdc_data.blk_size >> 9)) >> 11), |
174 | private->rdc_data.blk_size); | 179 | private->rdc_data.blk_size, |
180 | readonly ? ", read-only device" : ""); | ||
175 | return 0; | 181 | return 0; |
176 | } | 182 | } |
177 | 183 | ||
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 94f92a1247f2..30a1ca3d08b7 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c | |||
@@ -70,7 +70,8 @@ int dasd_gendisk_alloc(struct dasd_block *block) | |||
70 | } | 70 | } |
71 | len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26)); | 71 | len += sprintf(gdp->disk_name + len, "%c", 'a'+(base->devindex%26)); |
72 | 72 | ||
73 | if (block->base->features & DASD_FEATURE_READONLY) | 73 | if (base->features & DASD_FEATURE_READONLY || |
74 | test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) | ||
74 | set_disk_ro(gdp, 1); | 75 | set_disk_ro(gdp, 1); |
75 | gdp->private_data = block; | 76 | gdp->private_data = block; |
76 | gdp->queue = block->request_queue; | 77 | gdp->queue = block->request_queue; |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index ed73ce550822..a91d4a97d4f2 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -436,6 +436,10 @@ struct dasd_block { | |||
436 | #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ | 436 | #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ |
437 | #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ | 437 | #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ |
438 | #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ | 438 | #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ |
439 | #define DASD_FLAG_DEVICE_RO 6 /* The device itself is read-only. Don't | ||
440 | * confuse this with the user specified | ||
441 | * read-only feature. | ||
442 | */ | ||
439 | 443 | ||
440 | void dasd_put_device_wake(struct dasd_device *); | 444 | void dasd_put_device_wake(struct dasd_device *); |
441 | 445 | ||
@@ -609,6 +613,9 @@ char *dasd_get_sense(struct irb *); | |||
609 | void dasd_device_set_stop_bits(struct dasd_device *, int); | 613 | void dasd_device_set_stop_bits(struct dasd_device *, int); |
610 | void dasd_device_remove_stop_bits(struct dasd_device *, int); | 614 | void dasd_device_remove_stop_bits(struct dasd_device *, int); |
611 | 615 | ||
616 | int dasd_device_is_ro(struct dasd_device *); | ||
617 | |||
618 | |||
612 | /* externals in dasd_devmap.c */ | 619 | /* externals in dasd_devmap.c */ |
613 | extern int dasd_max_devindex; | 620 | extern int dasd_max_devindex; |
614 | extern int dasd_probeonly; | 621 | extern int dasd_probeonly; |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 7039d9cf0fb4..3479f8158a1b 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -199,7 +199,8 @@ dasd_ioctl_format(struct block_device *bdev, void __user *argp) | |||
199 | if (!argp) | 199 | if (!argp) |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | 201 | ||
202 | if (block->base->features & DASD_FEATURE_READONLY) | 202 | if (block->base->features & DASD_FEATURE_READONLY || |
203 | test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | ||
203 | return -EROFS; | 204 | return -EROFS; |
204 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) | 205 | if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) |
205 | return -EFAULT; | 206 | return -EFAULT; |
@@ -349,7 +350,8 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | |||
349 | return -EINVAL; | 350 | return -EINVAL; |
350 | if (get_user(intval, (int __user *)argp)) | 351 | if (get_user(intval, (int __user *)argp)) |
351 | return -EFAULT; | 352 | return -EFAULT; |
352 | 353 | if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags)) | |
354 | return -EROFS; | ||
353 | set_disk_ro(bdev->bd_disk, intval); | 355 | set_disk_ro(bdev->bd_disk, intval); |
354 | return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval); | 356 | return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval); |
355 | } | 357 | } |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index c6abb75c4615..6d229f3523a0 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -764,7 +764,7 @@ static void sch_create_and_recog_new_device(struct subchannel *sch) | |||
764 | static void io_subchannel_register(struct ccw_device *cdev) | 764 | static void io_subchannel_register(struct ccw_device *cdev) |
765 | { | 765 | { |
766 | struct subchannel *sch; | 766 | struct subchannel *sch; |
767 | int ret; | 767 | int ret, adjust_init_count = 1; |
768 | unsigned long flags; | 768 | unsigned long flags; |
769 | 769 | ||
770 | sch = to_subchannel(cdev->dev.parent); | 770 | sch = to_subchannel(cdev->dev.parent); |
@@ -793,6 +793,7 @@ static void io_subchannel_register(struct ccw_device *cdev) | |||
793 | cdev->private->dev_id.ssid, | 793 | cdev->private->dev_id.ssid, |
794 | cdev->private->dev_id.devno); | 794 | cdev->private->dev_id.devno); |
795 | } | 795 | } |
796 | adjust_init_count = 0; | ||
796 | goto out; | 797 | goto out; |
797 | } | 798 | } |
798 | /* | 799 | /* |
@@ -818,7 +819,7 @@ out: | |||
818 | cdev->private->flags.recog_done = 1; | 819 | cdev->private->flags.recog_done = 1; |
819 | wake_up(&cdev->private->wait_q); | 820 | wake_up(&cdev->private->wait_q); |
820 | out_err: | 821 | out_err: |
821 | if (atomic_dec_and_test(&ccw_device_init_count)) | 822 | if (adjust_init_count && atomic_dec_and_test(&ccw_device_init_count)) |
822 | wake_up(&ccw_device_init_wq); | 823 | wake_up(&ccw_device_init_wq); |
823 | } | 824 | } |
824 | 825 | ||
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index c94eb2a0fa2e..6ce83f56d537 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -33,7 +33,6 @@ void qdio_allocate_dbf(struct qdio_initialize *init_data, | |||
33 | DBF_HEX(&init_data->input_handler, sizeof(void *)); | 33 | DBF_HEX(&init_data->input_handler, sizeof(void *)); |
34 | DBF_HEX(&init_data->output_handler, sizeof(void *)); | 34 | DBF_HEX(&init_data->output_handler, sizeof(void *)); |
35 | DBF_HEX(&init_data->int_parm, sizeof(long)); | 35 | DBF_HEX(&init_data->int_parm, sizeof(long)); |
36 | DBF_HEX(&init_data->flags, sizeof(long)); | ||
37 | DBF_HEX(&init_data->input_sbal_addr_array, sizeof(void *)); | 36 | DBF_HEX(&init_data->input_sbal_addr_array, sizeof(void *)); |
38 | DBF_HEX(&init_data->output_sbal_addr_array, sizeof(void *)); | 37 | DBF_HEX(&init_data->output_sbal_addr_array, sizeof(void *)); |
39 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); | 38 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 232ef047ba34..4f8f74311778 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -588,10 +588,11 @@ static void qdio_kick_handler(struct qdio_q *q) | |||
588 | if (q->is_input_q) { | 588 | if (q->is_input_q) { |
589 | qperf_inc(q, inbound_handler); | 589 | qperf_inc(q, inbound_handler); |
590 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); | 590 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "kih s:%02x c:%02x", start, count); |
591 | } else | 591 | } else { |
592 | qperf_inc(q, outbound_handler); | 592 | qperf_inc(q, outbound_handler); |
593 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", | 593 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "koh: s:%02x c:%02x", |
594 | start, count); | 594 | start, count); |
595 | } | ||
595 | 596 | ||
596 | q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count, | 597 | q->handler(q->irq_ptr->cdev, q->qdio_error, q->nr, start, count, |
597 | q->irq_ptr->int_parm); | 598 | q->irq_ptr->int_parm); |
diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig index cb909a5b5047..977bb4d4ed15 100644 --- a/drivers/s390/net/Kconfig +++ b/drivers/s390/net/Kconfig | |||
@@ -43,6 +43,16 @@ config SMSGIUCV | |||
43 | Select this option if you want to be able to receive SMSG messages | 43 | Select this option if you want to be able to receive SMSG messages |
44 | from other VM guest systems. | 44 | from other VM guest systems. |
45 | 45 | ||
46 | config SMSGIUCV_EVENT | ||
47 | tristate "Deliver IUCV special messages as uevents (VM only)" | ||
48 | depends on SMSGIUCV | ||
49 | help | ||
50 | Select this option to deliver CP special messages (SMSGs) as | ||
51 | uevents. The driver handles only those special messages that | ||
52 | start with "APP". | ||
53 | |||
54 | To compile as a module, choose M. The module name is "smsgiucv_app". | ||
55 | |||
46 | config CLAW | 56 | config CLAW |
47 | tristate "CLAW device support" | 57 | tristate "CLAW device support" |
48 | depends on CCW && NETDEVICES | 58 | depends on CCW && NETDEVICES |
diff --git a/drivers/s390/net/Makefile b/drivers/s390/net/Makefile index 6cab5a62f99e..4dfe8c1092da 100644 --- a/drivers/s390/net/Makefile +++ b/drivers/s390/net/Makefile | |||
@@ -6,6 +6,7 @@ ctcm-y += ctcm_main.o ctcm_fsms.o ctcm_mpc.o ctcm_sysfs.o ctcm_dbug.o | |||
6 | obj-$(CONFIG_CTCM) += ctcm.o fsm.o | 6 | obj-$(CONFIG_CTCM) += ctcm.o fsm.o |
7 | obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o | 7 | obj-$(CONFIG_NETIUCV) += netiucv.o fsm.o |
8 | obj-$(CONFIG_SMSGIUCV) += smsgiucv.o | 8 | obj-$(CONFIG_SMSGIUCV) += smsgiucv.o |
9 | obj-$(CONFIG_SMSGIUCV_EVENT) += smsgiucv_app.o | ||
9 | obj-$(CONFIG_LCS) += lcs.o | 10 | obj-$(CONFIG_LCS) += lcs.o |
10 | obj-$(CONFIG_CLAW) += claw.o | 11 | obj-$(CONFIG_CLAW) += claw.o |
11 | qeth-y += qeth_core_sys.o qeth_core_main.o qeth_core_mpc.o | 12 | qeth-y += qeth_core_sys.o qeth_core_main.o qeth_core_mpc.o |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index fa8a519218ac..7d25bdd443cd 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -3805,9 +3805,6 @@ static int qeth_qdio_establish(struct qeth_card *card) | |||
3805 | init_data.input_handler = card->discipline.input_handler; | 3805 | init_data.input_handler = card->discipline.input_handler; |
3806 | init_data.output_handler = card->discipline.output_handler; | 3806 | init_data.output_handler = card->discipline.output_handler; |
3807 | init_data.int_parm = (unsigned long) card; | 3807 | init_data.int_parm = (unsigned long) card; |
3808 | init_data.flags = QDIO_INBOUND_0COPY_SBALS | | ||
3809 | QDIO_OUTBOUND_0COPY_SBALS | | ||
3810 | QDIO_USE_OUTBOUND_PCIS; | ||
3811 | init_data.input_sbal_addr_array = (void **) in_sbal_ptrs; | 3808 | init_data.input_sbal_addr_array = (void **) in_sbal_ptrs; |
3812 | init_data.output_sbal_addr_array = (void **) out_sbal_ptrs; | 3809 | init_data.output_sbal_addr_array = (void **) out_sbal_ptrs; |
3813 | 3810 | ||
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index 67f2485d2372..ecef1edee701 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c | |||
@@ -31,9 +31,9 @@ | |||
31 | 31 | ||
32 | struct smsg_callback { | 32 | struct smsg_callback { |
33 | struct list_head list; | 33 | struct list_head list; |
34 | char *prefix; | 34 | const char *prefix; |
35 | int len; | 35 | int len; |
36 | void (*callback)(char *from, char *str); | 36 | void (*callback)(const char *from, char *str); |
37 | }; | 37 | }; |
38 | 38 | ||
39 | MODULE_AUTHOR | 39 | MODULE_AUTHOR |
@@ -100,8 +100,8 @@ static void smsg_message_pending(struct iucv_path *path, | |||
100 | kfree(buffer); | 100 | kfree(buffer); |
101 | } | 101 | } |
102 | 102 | ||
103 | int smsg_register_callback(char *prefix, | 103 | int smsg_register_callback(const char *prefix, |
104 | void (*callback)(char *from, char *str)) | 104 | void (*callback)(const char *from, char *str)) |
105 | { | 105 | { |
106 | struct smsg_callback *cb; | 106 | struct smsg_callback *cb; |
107 | 107 | ||
@@ -117,8 +117,9 @@ int smsg_register_callback(char *prefix, | |||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | 119 | ||
120 | void smsg_unregister_callback(char *prefix, | 120 | void smsg_unregister_callback(const char *prefix, |
121 | void (*callback)(char *from, char *str)) | 121 | void (*callback)(const char *from, |
122 | char *str)) | ||
122 | { | 123 | { |
123 | struct smsg_callback *cb, *tmp; | 124 | struct smsg_callback *cb, *tmp; |
124 | 125 | ||
@@ -176,7 +177,7 @@ static const struct dev_pm_ops smsg_pm_ops = { | |||
176 | 177 | ||
177 | static struct device_driver smsg_driver = { | 178 | static struct device_driver smsg_driver = { |
178 | .owner = THIS_MODULE, | 179 | .owner = THIS_MODULE, |
179 | .name = "SMSGIUCV", | 180 | .name = SMSGIUCV_DRV_NAME, |
180 | .bus = &iucv_bus, | 181 | .bus = &iucv_bus, |
181 | .pm = &smsg_pm_ops, | 182 | .pm = &smsg_pm_ops, |
182 | }; | 183 | }; |
diff --git a/drivers/s390/net/smsgiucv.h b/drivers/s390/net/smsgiucv.h index 67f5d4f8378d..149a1151608d 100644 --- a/drivers/s390/net/smsgiucv.h +++ b/drivers/s390/net/smsgiucv.h | |||
@@ -5,6 +5,10 @@ | |||
5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) | 5 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) |
6 | */ | 6 | */ |
7 | 7 | ||
8 | int smsg_register_callback(char *, void (*)(char *, char *)); | 8 | #define SMSGIUCV_DRV_NAME "SMSGIUCV" |
9 | void smsg_unregister_callback(char *, void (*)(char *, char *)); | 9 | |
10 | int smsg_register_callback(const char *, | ||
11 | void (*)(const char *, char *)); | ||
12 | void smsg_unregister_callback(const char *, | ||
13 | void (*)(const char *, char *)); | ||
10 | 14 | ||
diff --git a/drivers/s390/net/smsgiucv_app.c b/drivers/s390/net/smsgiucv_app.c new file mode 100644 index 000000000000..91579dc6a2b0 --- /dev/null +++ b/drivers/s390/net/smsgiucv_app.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * Deliver z/VM CP special messages (SMSG) as uevents. | ||
3 | * | ||
4 | * The driver registers for z/VM CP special messages with the | ||
5 | * "APP" prefix. Incoming messages are delivered to user space | ||
6 | * as uevents. | ||
7 | * | ||
8 | * Copyright IBM Corp. 2010 | ||
9 | * Author(s): Hendrik Brueckner <brueckner@linux.vnet.ibm.com> | ||
10 | * | ||
11 | */ | ||
12 | #define KMSG_COMPONENT "smsgiucv_app" | ||
13 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
14 | |||
15 | #include <linux/ctype.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/kobject.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/workqueue.h> | ||
23 | #include <net/iucv/iucv.h> | ||
24 | #include "smsgiucv.h" | ||
25 | |||
26 | /* prefix used for SMSG registration */ | ||
27 | #define SMSG_PREFIX "APP" | ||
28 | |||
29 | /* SMSG related uevent environment variables */ | ||
30 | #define ENV_SENDER_STR "SMSG_SENDER=" | ||
31 | #define ENV_SENDER_LEN (strlen(ENV_SENDER_STR) + 8 + 1) | ||
32 | #define ENV_PREFIX_STR "SMSG_ID=" | ||
33 | #define ENV_PREFIX_LEN (strlen(ENV_PREFIX_STR) + \ | ||
34 | strlen(SMSG_PREFIX) + 1) | ||
35 | #define ENV_TEXT_STR "SMSG_TEXT=" | ||
36 | #define ENV_TEXT_LEN(msg) (strlen(ENV_TEXT_STR) + strlen((msg)) + 1) | ||
37 | |||
38 | /* z/VM user ID which is permitted to send SMSGs | ||
39 | * If the value is undefined or empty (""), special messages are | ||
40 | * accepted from any z/VM user ID. */ | ||
41 | static char *sender; | ||
42 | module_param(sender, charp, 0400); | ||
43 | MODULE_PARM_DESC(sender, "z/VM user ID from which CP SMSGs are accepted"); | ||
44 | |||
45 | /* SMSG device representation */ | ||
46 | static struct device *smsg_app_dev; | ||
47 | |||
48 | /* list element for queuing received messages for delivery */ | ||
49 | struct smsg_app_event { | ||
50 | struct list_head list; | ||
51 | char *buf; | ||
52 | char *envp[4]; | ||
53 | }; | ||
54 | |||
55 | /* queue for outgoing uevents */ | ||
56 | static LIST_HEAD(smsg_event_queue); | ||
57 | static DEFINE_SPINLOCK(smsg_event_queue_lock); | ||
58 | |||
59 | static void smsg_app_event_free(struct smsg_app_event *ev) | ||
60 | { | ||
61 | kfree(ev->buf); | ||
62 | kfree(ev); | ||
63 | } | ||
64 | |||
65 | static struct smsg_app_event *smsg_app_event_alloc(const char *from, | ||
66 | const char *msg) | ||
67 | { | ||
68 | struct smsg_app_event *ev; | ||
69 | |||
70 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); | ||
71 | if (!ev) | ||
72 | return NULL; | ||
73 | |||
74 | ev->buf = kzalloc(ENV_SENDER_LEN + ENV_PREFIX_LEN + | ||
75 | ENV_TEXT_LEN(msg), GFP_ATOMIC); | ||
76 | if (!ev->buf) { | ||
77 | kfree(ev); | ||
78 | return NULL; | ||
79 | } | ||
80 | |||
81 | /* setting up environment pointers into buf */ | ||
82 | ev->envp[0] = ev->buf; | ||
83 | ev->envp[1] = ev->envp[0] + ENV_SENDER_LEN; | ||
84 | ev->envp[2] = ev->envp[1] + ENV_PREFIX_LEN; | ||
85 | ev->envp[3] = NULL; | ||
86 | |||
87 | /* setting up environment: sender, prefix name, and message text */ | ||
88 | snprintf(ev->envp[0], ENV_SENDER_LEN, ENV_SENDER_STR "%s", from); | ||
89 | snprintf(ev->envp[1], ENV_PREFIX_LEN, ENV_PREFIX_STR "%s", SMSG_PREFIX); | ||
90 | snprintf(ev->envp[2], ENV_TEXT_LEN(msg), ENV_TEXT_STR "%s", msg); | ||
91 | |||
92 | return ev; | ||
93 | } | ||
94 | |||
95 | static void smsg_event_work_fn(struct work_struct *work) | ||
96 | { | ||
97 | LIST_HEAD(event_queue); | ||
98 | struct smsg_app_event *p, *n; | ||
99 | struct device *dev; | ||
100 | |||
101 | dev = get_device(smsg_app_dev); | ||
102 | if (!dev) | ||
103 | return; | ||
104 | |||
105 | spin_lock_bh(&smsg_event_queue_lock); | ||
106 | list_splice_init(&smsg_event_queue, &event_queue); | ||
107 | spin_unlock_bh(&smsg_event_queue_lock); | ||
108 | |||
109 | list_for_each_entry_safe(p, n, &event_queue, list) { | ||
110 | list_del(&p->list); | ||
111 | kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, p->envp); | ||
112 | smsg_app_event_free(p); | ||
113 | } | ||
114 | |||
115 | put_device(dev); | ||
116 | } | ||
117 | static DECLARE_WORK(smsg_event_work, smsg_event_work_fn); | ||
118 | |||
119 | static void smsg_app_callback(const char *from, char *msg) | ||
120 | { | ||
121 | struct smsg_app_event *se; | ||
122 | |||
123 | /* check if the originating z/VM user ID matches | ||
124 | * the configured sender. */ | ||
125 | if (sender && strlen(sender) > 0 && strcmp(from, sender) != 0) | ||
126 | return; | ||
127 | |||
128 | /* get start of message text (skip prefix and leading blanks) */ | ||
129 | msg += strlen(SMSG_PREFIX); | ||
130 | while (*msg && isspace(*msg)) | ||
131 | msg++; | ||
132 | if (*msg == '\0') | ||
133 | return; | ||
134 | |||
135 | /* allocate event list element and its environment */ | ||
136 | se = smsg_app_event_alloc(from, msg); | ||
137 | if (!se) | ||
138 | return; | ||
139 | |||
140 | /* queue event and schedule work function */ | ||
141 | spin_lock(&smsg_event_queue_lock); | ||
142 | list_add_tail(&se->list, &smsg_event_queue); | ||
143 | spin_unlock(&smsg_event_queue_lock); | ||
144 | |||
145 | schedule_work(&smsg_event_work); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | static int __init smsgiucv_app_init(void) | ||
150 | { | ||
151 | struct device_driver *smsgiucv_drv; | ||
152 | int rc; | ||
153 | |||
154 | if (!MACHINE_IS_VM) | ||
155 | return -ENODEV; | ||
156 | |||
157 | smsg_app_dev = kzalloc(sizeof(*smsg_app_dev), GFP_KERNEL); | ||
158 | if (!smsg_app_dev) | ||
159 | return -ENOMEM; | ||
160 | |||
161 | smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus); | ||
162 | if (!smsgiucv_drv) { | ||
163 | kfree(smsg_app_dev); | ||
164 | return -ENODEV; | ||
165 | } | ||
166 | |||
167 | rc = dev_set_name(smsg_app_dev, KMSG_COMPONENT); | ||
168 | if (rc) { | ||
169 | kfree(smsg_app_dev); | ||
170 | goto fail_put_driver; | ||
171 | } | ||
172 | smsg_app_dev->bus = &iucv_bus; | ||
173 | smsg_app_dev->parent = iucv_root; | ||
174 | smsg_app_dev->release = (void (*)(struct device *)) kfree; | ||
175 | smsg_app_dev->driver = smsgiucv_drv; | ||
176 | rc = device_register(smsg_app_dev); | ||
177 | if (rc) { | ||
178 | put_device(smsg_app_dev); | ||
179 | goto fail_put_driver; | ||
180 | } | ||
181 | |||
182 | /* register with the smsgiucv device driver */ | ||
183 | rc = smsg_register_callback(SMSG_PREFIX, smsg_app_callback); | ||
184 | if (rc) { | ||
185 | device_unregister(smsg_app_dev); | ||
186 | goto fail_put_driver; | ||
187 | } | ||
188 | |||
189 | rc = 0; | ||
190 | fail_put_driver: | ||
191 | put_driver(smsgiucv_drv); | ||
192 | return rc; | ||
193 | } | ||
194 | module_init(smsgiucv_app_init); | ||
195 | |||
196 | static void __exit smsgiucv_app_exit(void) | ||
197 | { | ||
198 | /* unregister callback */ | ||
199 | smsg_unregister_callback(SMSG_PREFIX, smsg_app_callback); | ||
200 | |||
201 | /* cancel pending work and flush any queued event work */ | ||
202 | cancel_work_sync(&smsg_event_work); | ||
203 | smsg_event_work_fn(&smsg_event_work); | ||
204 | |||
205 | device_unregister(smsg_app_dev); | ||
206 | } | ||
207 | module_exit(smsgiucv_app_exit); | ||
208 | |||
209 | MODULE_LICENSE("GPL v2"); | ||
210 | MODULE_DESCRIPTION("Deliver z/VM CP SMSG as uevents"); | ||
211 | MODULE_AUTHOR("Hendrik Brueckner <brueckner@linux.vnet.ibm.com>"); | ||
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index 71b97ff77cf0..6479273a3094 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -319,8 +319,6 @@ static void zfcp_qdio_setup_init_data(struct qdio_initialize *id, | |||
319 | id->input_handler = zfcp_qdio_int_resp; | 319 | id->input_handler = zfcp_qdio_int_resp; |
320 | id->output_handler = zfcp_qdio_int_req; | 320 | id->output_handler = zfcp_qdio_int_req; |
321 | id->int_parm = (unsigned long) qdio; | 321 | id->int_parm = (unsigned long) qdio; |
322 | id->flags = QDIO_INBOUND_0COPY_SBALS | | ||
323 | QDIO_OUTBOUND_0COPY_SBALS | QDIO_USE_OUTBOUND_PCIS; | ||
324 | id->input_sbal_addr_array = (void **) (qdio->resp_q.sbal); | 322 | id->input_sbal_addr_array = (void **) (qdio->resp_q.sbal); |
325 | id->output_sbal_addr_array = (void **) (qdio->req_q.sbal); | 323 | id->output_sbal_addr_array = (void **) (qdio->req_q.sbal); |
326 | 324 | ||
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 | ||
229 | static int __init sgiwd93_probe(struct platform_device *pdev) | 229 | static 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 | ||
67 | static int __init snirm710_probe(struct platform_device *dev) | 67 | static 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 | ||
773 | static ssize_t version_show(struct class *dev, char *buf) | 773 | static 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 | |||
779 | static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | ||
780 | 775 | ||
781 | static int __init asus_oled_init(void) | 776 | static 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 | ||
811 | static void __exit asus_oled_exit(void) | 806 | static 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 | ||
47 | config 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 | |||
58 | config UIO_AEC | 47 | config 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 | ||
75 | config UIO_SERCOS3 | 64 | config 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 | |||
87 | config UIO_PCI_GENERIC | 77 | config 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 | ||
86 | config 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 | |||
97 | endif | 97 | endif |
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 | |||
2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o | 2 | obj-$(CONFIG_UIO_CIF) += uio_cif.o |
3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o | 3 | obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o |
4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o | 4 | obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o |
5 | obj-$(CONFIG_UIO_SMX) += uio_smx.o | ||
6 | obj-$(CONFIG_UIO_AEC) += uio_aec.o | 5 | obj-$(CONFIG_UIO_AEC) += uio_aec.o |
7 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o | 6 | obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o |
8 | obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o | 7 | obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o |
8 | obj-$(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 | ||
132 | static struct sysfs_ops map_sysfs_ops = { | 132 | static 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 | ||
220 | static struct sysfs_ops portio_sysfs_ops = { | 220 | static 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 | |||
29 | static 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 | |||
47 | static 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 | |||
102 | out_unmap: | ||
103 | iounmap(info->mem[0].internal_addr); | ||
104 | out_release: | ||
105 | pci_release_regions(dev); | ||
106 | out_disable: | ||
107 | pci_disable_device(dev); | ||
108 | out_free: | ||
109 | kfree(info); | ||
110 | return -ENODEV; | ||
111 | } | ||
112 | |||
113 | static 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 | |||
128 | static 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 | |||
150 | static 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 | |||
157 | static int __init netx_init_module(void) | ||
158 | { | ||
159 | return pci_register_driver(&netx_pci_driver); | ||
160 | } | ||
161 | |||
162 | static void __exit netx_exit_module(void) | ||
163 | { | ||
164 | pci_unregister_driver(&netx_pci_driver); | ||
165 | } | ||
166 | |||
167 | module_init(netx_init_module); | ||
168 | module_exit(netx_exit_module); | ||
169 | |||
170 | MODULE_DEVICE_TABLE(pci, netx_pci_ids); | ||
171 | MODULE_LICENSE("GPL v2"); | ||
172 | MODULE_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 | |||
27 | static 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 | |||
41 | static 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 | |||
96 | out_unmap: | ||
97 | iounmap(info->mem[0].internal_addr); | ||
98 | out_free: | ||
99 | kfree(info); | ||
100 | |||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | static 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 | |||
117 | static 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 | |||
126 | static int __init smx_ce_init_module(void) | ||
127 | { | ||
128 | return platform_driver_register(&smx_ce_driver); | ||
129 | } | ||
130 | module_init(smx_ce_init_module); | ||
131 | |||
132 | static void __exit smx_ce_exit_module(void) | ||
133 | { | ||
134 | platform_driver_unregister(&smx_ce_driver); | ||
135 | } | ||
136 | module_exit(smx_ce_exit_module); | ||
137 | |||
138 | MODULE_LICENSE("GPL v2"); | ||
139 | MODULE_VERSION(DRV_VERSION); | ||
140 | MODULE_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 | } |
498 | EXPORT_SYMBOL_GPL(usb_driver_release_interface); | 498 | EXPORT_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 @@ | |||
74 | unsigned long beacon_timeout_ms = 500; | 74 | unsigned long beacon_timeout_ms = 500; |
75 | 75 | ||
76 | static | 76 | static |
77 | ssize_t beacon_timeout_ms_show(struct class *class, char *buf) | 77 | ssize_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 | ||
82 | static | 84 | static |
83 | ssize_t beacon_timeout_ms_store(struct class *class, | 85 | ssize_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 | ||
367 | static inline void uwb_dev_lock(struct uwb_dev *uwb_dev) | 367 | static 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 | ||
372 | static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev) | 372 | static 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 | ||
618 | static | 618 | static const struct sysfs_ops wss_sysfs_ops = { |
619 | struct 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 | ||
1224 | static int __init acornfb_probe(struct platform_device *dev) | 1224 | static 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 | ||
507 | static int __init arcfb_probe(struct platform_device *dev) | 507 | static 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 | ||
290 | static int __init cobalt_lcdfb_probe(struct platform_device *dev) | 290 | static 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 | ||
213 | static int __init efifb_probe(struct platform_device *dev) | 213 | static 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 | ||
605 | int __init epson1355fb_probe(struct platform_device *dev) | 605 | int __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 | ||
1131 | static int __init gbefb_probe(struct platform_device *p_dev) | 1131 | static 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 | ||
554 | static int __init hgafb_probe(struct platform_device *pdev) | 554 | static 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 | ||
328 | static int __init hitfb_probe(struct platform_device *dev) | 328 | static 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 | ||
344 | static struct sysfs_ops manager_sysfs_ops = { | 344 | static 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 | ||
323 | static struct sysfs_ops overlay_sysfs_ops = { | 323 | static 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 | ||
88 | static int __init q40fb_probe(struct platform_device *dev) | 88 | static 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 | ||
1007 | static int __init s3c2410fb_probe(struct platform_device *pdev) | 1007 | static 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 | ||
1012 | static int __init s3c2412fb_probe(struct platform_device *pdev) | 1012 | static 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 | ||
1438 | static int __init sa1100fb_probe(struct platform_device *pdev) | 1438 | static 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 | */ |
748 | static int __init sgivwfb_probe(struct platform_device *dev) | 748 | static 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 | ||
944 | static int sh_mobile_lcdc_remove(struct platform_device *pdev); | 944 | static int sh_mobile_lcdc_remove(struct platform_device *pdev); |
945 | 945 | ||
946 | static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | 946 | static 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 | ||
229 | static int __init vesafb_probe(struct platform_device *dev) | 229 | static 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 | ||
482 | static int __init vfb_probe(struct platform_device *dev) | 482 | static 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 | ||
1296 | static int __init vga16fb_probe(struct platform_device *dev) | 1296 | static 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 | ||
631 | int __init w100fb_probe(struct platform_device *pdev) | 631 | int __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 | ||
75 | static int __init omap_hdq_probe(struct platform_device *pdev); | 75 | static int __devinit omap_hdq_probe(struct platform_device *pdev); |
76 | static int omap_hdq_remove(struct platform_device *pdev); | 76 | static int omap_hdq_remove(struct platform_device *pdev); |
77 | 77 | ||
78 | static struct platform_driver omap_hdq_driver = { | 78 | static 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 | ||
561 | static int __init omap_hdq_probe(struct platform_device *pdev) | 561 | static 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/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3da3f48720a7..bdcdbd53da89 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -55,6 +55,11 @@ config SOFT_WATCHDOG | |||
55 | To compile this driver as a module, choose M here: the | 55 | To compile this driver as a module, choose M here: the |
56 | module will be called softdog. | 56 | module will be called softdog. |
57 | 57 | ||
58 | config MAX63XX_WATCHDOG | ||
59 | tristate "Max63xx watchdog" | ||
60 | help | ||
61 | Support for memory mapped max63{69,70,71,72,73,74} watchdog timer. | ||
62 | |||
58 | config WM831X_WATCHDOG | 63 | config WM831X_WATCHDOG |
59 | tristate "WM831x watchdog" | 64 | tristate "WM831x watchdog" |
60 | depends on MFD_WM831X | 65 | depends on MFD_WM831X |
@@ -289,6 +294,17 @@ config ADX_WATCHDOG | |||
289 | Say Y here if you want support for the watchdog timer on Avionic | 294 | Say Y here if you want support for the watchdog timer on Avionic |
290 | Design Xanthos boards. | 295 | Design Xanthos boards. |
291 | 296 | ||
297 | config TS72XX_WATCHDOG | ||
298 | tristate "TS-72XX SBC Watchdog" | ||
299 | depends on MACH_TS72XX | ||
300 | help | ||
301 | Technologic Systems TS-7200, TS-7250 and TS-7260 boards have | ||
302 | watchdog timer implemented in a external CPLD chip. Say Y here | ||
303 | if you want to support for the watchdog timer on TS-72XX boards. | ||
304 | |||
305 | To compile this driver as a module, choose M here: the | ||
306 | module will be called ts72xx_wdt. | ||
307 | |||
292 | # AVR32 Architecture | 308 | # AVR32 Architecture |
293 | 309 | ||
294 | config AT32AP700X_WDT | 310 | config AT32AP700X_WDT |
@@ -845,10 +861,10 @@ config TXX9_WDT | |||
845 | # POWERPC Architecture | 861 | # POWERPC Architecture |
846 | 862 | ||
847 | config GEF_WDT | 863 | config GEF_WDT |
848 | tristate "GE Fanuc Watchdog Timer" | 864 | tristate "GE Watchdog Timer" |
849 | depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A | 865 | depends on GEF_SBC610 || GEF_SBC310 || GEF_PPC9A |
850 | ---help--- | 866 | ---help--- |
851 | Watchdog timer found in a number of GE Fanuc single board computers. | 867 | Watchdog timer found in a number of GE single board computers. |
852 | 868 | ||
853 | config MPC5200_WDT | 869 | config MPC5200_WDT |
854 | bool "MPC52xx Watchdog Timer" | 870 | bool "MPC52xx Watchdog Timer" |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 475c61100069..5e3cb95bb0e9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -46,6 +46,7 @@ obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o | |||
46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o | 46 | obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o |
47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o | 47 | obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o |
48 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o | 48 | obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o |
49 | obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o | ||
49 | 50 | ||
50 | # AVR32 Architecture | 51 | # AVR32 Architecture |
51 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o | 52 | obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o |
@@ -142,4 +143,5 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o | |||
142 | # Architecture Independant | 143 | # Architecture Independant |
143 | obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o | 144 | obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o |
144 | obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o | 145 | obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o |
146 | obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o | ||
145 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o | 147 | obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o |
diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c index 4d18c874d963..2ffce4d75443 100644 --- a/drivers/watchdog/acquirewdt.c +++ b/drivers/watchdog/acquirewdt.c | |||
@@ -150,7 +150,7 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
150 | int options, retval = -EINVAL; | 150 | int options, retval = -EINVAL; |
151 | void __user *argp = (void __user *)arg; | 151 | void __user *argp = (void __user *)arg; |
152 | int __user *p = argp; | 152 | int __user *p = argp; |
153 | static struct watchdog_info ident = { | 153 | static const struct watchdog_info ident = { |
154 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 154 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
155 | .firmware_version = 1, | 155 | .firmware_version = 1, |
156 | .identity = WATCHDOG_NAME, | 156 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c index 824d076a5cd6..4d40965d2c9f 100644 --- a/drivers/watchdog/advantechwdt.c +++ b/drivers/watchdog/advantechwdt.c | |||
@@ -137,7 +137,7 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
137 | int new_timeout; | 137 | int new_timeout; |
138 | void __user *argp = (void __user *)arg; | 138 | void __user *argp = (void __user *)arg; |
139 | int __user *p = argp; | 139 | int __user *p = argp; |
140 | static struct watchdog_info ident = { | 140 | static const struct watchdog_info ident = { |
141 | .options = WDIOF_KEEPALIVEPING | | 141 | .options = WDIOF_KEEPALIVEPING | |
142 | WDIOF_SETTIMEOUT | | 142 | WDIOF_SETTIMEOUT | |
143 | WDIOF_MAGICCLOSE, | 143 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/adx_wdt.c b/drivers/watchdog/adx_wdt.c index 9d7d155364f8..a5ca7a6ee133 100644 --- a/drivers/watchdog/adx_wdt.c +++ b/drivers/watchdog/adx_wdt.c | |||
@@ -37,7 +37,7 @@ struct adx_wdt { | |||
37 | spinlock_t lock; | 37 | spinlock_t lock; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct watchdog_info adx_wdt_info = { | 40 | static const struct watchdog_info adx_wdt_info = { |
41 | .identity = "Avionic Design Xanthos Watchdog", | 41 | .identity = "Avionic Design Xanthos Watchdog", |
42 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 42 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
43 | }; | 43 | }; |
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c index 937a80fb61e1..1e9caea8ff8a 100644 --- a/drivers/watchdog/alim1535_wdt.c +++ b/drivers/watchdog/alim1535_wdt.c | |||
@@ -180,7 +180,7 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
180 | { | 180 | { |
181 | void __user *argp = (void __user *)arg; | 181 | void __user *argp = (void __user *)arg; |
182 | int __user *p = argp; | 182 | int __user *p = argp; |
183 | static struct watchdog_info ident = { | 183 | static const struct watchdog_info ident = { |
184 | .options = WDIOF_KEEPALIVEPING | | 184 | .options = WDIOF_KEEPALIVEPING | |
185 | WDIOF_SETTIMEOUT | | 185 | WDIOF_SETTIMEOUT | |
186 | WDIOF_MAGICCLOSE, | 186 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c index f90afdb1b255..d8d4da9a483d 100644 --- a/drivers/watchdog/alim7101_wdt.c +++ b/drivers/watchdog/alim7101_wdt.c | |||
@@ -238,7 +238,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
238 | { | 238 | { |
239 | void __user *argp = (void __user *)arg; | 239 | void __user *argp = (void __user *)arg; |
240 | int __user *p = argp; | 240 | int __user *p = argp; |
241 | static struct watchdog_info ident = { | 241 | static const struct watchdog_info ident = { |
242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
243 | | WDIOF_MAGICCLOSE, | 243 | | WDIOF_MAGICCLOSE, |
244 | .firmware_version = 1, | 244 | .firmware_version = 1, |
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c index 2bb95cd308c1..c764c52412e4 100644 --- a/drivers/watchdog/ar7_wdt.c +++ b/drivers/watchdog/ar7_wdt.c | |||
@@ -219,7 +219,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data, | |||
219 | static long ar7_wdt_ioctl(struct file *file, | 219 | static long ar7_wdt_ioctl(struct file *file, |
220 | unsigned int cmd, unsigned long arg) | 220 | unsigned int cmd, unsigned long arg) |
221 | { | 221 | { |
222 | static struct watchdog_info ident = { | 222 | static const struct watchdog_info ident = { |
223 | .identity = LONGNAME, | 223 | .identity = LONGNAME, |
224 | .firmware_version = 1, | 224 | .firmware_version = 1, |
225 | .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | | 225 | .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c index 037847923dcb..6873376f986c 100644 --- a/drivers/watchdog/at32ap700x_wdt.c +++ b/drivers/watchdog/at32ap700x_wdt.c | |||
@@ -202,7 +202,7 @@ static int at32_wdt_get_status(void) | |||
202 | return status; | 202 | return status; |
203 | } | 203 | } |
204 | 204 | ||
205 | static struct watchdog_info at32_wdt_info = { | 205 | static const struct watchdog_info at32_wdt_info = { |
206 | .identity = "at32ap700x watchdog", | 206 | .identity = "at32ap700x watchdog", |
207 | .options = WDIOF_SETTIMEOUT | | 207 | .options = WDIOF_SETTIMEOUT | |
208 | WDIOF_KEEPALIVEPING | | 208 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c index b185dafe1494..b3046dc4b56c 100644 --- a/drivers/watchdog/at91rm9200_wdt.c +++ b/drivers/watchdog/at91rm9200_wdt.c | |||
@@ -121,7 +121,7 @@ static int at91_wdt_settimeout(int new_time) | |||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | static struct watchdog_info at91_wdt_info = { | 124 | static const struct watchdog_info at91_wdt_info = { |
125 | .identity = "at91 watchdog", | 125 | .identity = "at91 watchdog", |
126 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 126 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
127 | }; | 127 | }; |
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 751c003864ad..5f245522397b 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -149,7 +149,7 @@ static ssize_t bcm47xx_wdt_write(struct file *file, const char __user *data, | |||
149 | return len; | 149 | return len; |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct watchdog_info bcm47xx_wdt_info = { | 152 | static const struct watchdog_info bcm47xx_wdt_info = { |
153 | .identity = DRV_NAME, | 153 | .identity = DRV_NAME, |
154 | .options = WDIOF_SETTIMEOUT | | 154 | .options = WDIOF_SETTIMEOUT | |
155 | WDIOF_KEEPALIVEPING | | 155 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 2159e668751c..9c7ccd1e9088 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -19,8 +19,6 @@ | |||
19 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
20 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/notifier.h> | ||
23 | #include <linux/reboot.h> | ||
24 | #include <linux/init.h> | 22 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
26 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
@@ -74,7 +72,7 @@ | |||
74 | 72 | ||
75 | static unsigned int timeout = WATCHDOG_TIMEOUT; | 73 | static unsigned int timeout = WATCHDOG_TIMEOUT; |
76 | static int nowayout = WATCHDOG_NOWAYOUT; | 74 | static int nowayout = WATCHDOG_NOWAYOUT; |
77 | static struct watchdog_info bfin_wdt_info; | 75 | static const struct watchdog_info bfin_wdt_info; |
78 | static unsigned long open_check; | 76 | static unsigned long open_check; |
79 | static char expect_close; | 77 | static char expect_close; |
80 | static DEFINE_SPINLOCK(bfin_wdt_spinlock); | 78 | static DEFINE_SPINLOCK(bfin_wdt_spinlock); |
@@ -309,26 +307,6 @@ static long bfin_wdt_ioctl(struct file *file, | |||
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | ||
312 | /** | ||
313 | * bfin_wdt_notify_sys - Notifier Handler | ||
314 | * @this: notifier block | ||
315 | * @code: notifier event | ||
316 | * @unused: unused | ||
317 | * | ||
318 | * Handles specific events, such as turning off the watchdog during a | ||
319 | * shutdown event. | ||
320 | */ | ||
321 | static int bfin_wdt_notify_sys(struct notifier_block *this, | ||
322 | unsigned long code, void *unused) | ||
323 | { | ||
324 | stampit(); | ||
325 | |||
326 | if (code == SYS_DOWN || code == SYS_HALT) | ||
327 | bfin_wdt_stop(); | ||
328 | |||
329 | return NOTIFY_DONE; | ||
330 | } | ||
331 | |||
332 | #ifdef CONFIG_PM | 310 | #ifdef CONFIG_PM |
333 | static int state_before_suspend; | 311 | static int state_before_suspend; |
334 | 312 | ||
@@ -388,40 +366,28 @@ static struct miscdevice bfin_wdt_miscdev = { | |||
388 | .fops = &bfin_wdt_fops, | 366 | .fops = &bfin_wdt_fops, |
389 | }; | 367 | }; |
390 | 368 | ||
391 | static struct watchdog_info bfin_wdt_info = { | 369 | static const struct watchdog_info bfin_wdt_info = { |
392 | .identity = "Blackfin Watchdog", | 370 | .identity = "Blackfin Watchdog", |
393 | .options = WDIOF_SETTIMEOUT | | 371 | .options = WDIOF_SETTIMEOUT | |
394 | WDIOF_KEEPALIVEPING | | 372 | WDIOF_KEEPALIVEPING | |
395 | WDIOF_MAGICCLOSE, | 373 | WDIOF_MAGICCLOSE, |
396 | }; | 374 | }; |
397 | 375 | ||
398 | static struct notifier_block bfin_wdt_notifier = { | ||
399 | .notifier_call = bfin_wdt_notify_sys, | ||
400 | }; | ||
401 | |||
402 | /** | 376 | /** |
403 | * bfin_wdt_probe - Initialize module | 377 | * bfin_wdt_probe - Initialize module |
404 | * | 378 | * |
405 | * Registers the misc device and notifier handler. Actual device | 379 | * Registers the misc device. Actual device |
406 | * initialization is handled by bfin_wdt_open(). | 380 | * initialization is handled by bfin_wdt_open(). |
407 | */ | 381 | */ |
408 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | 382 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) |
409 | { | 383 | { |
410 | int ret; | 384 | int ret; |
411 | 385 | ||
412 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
413 | if (ret) { | ||
414 | pr_devinit(KERN_ERR PFX | ||
415 | "cannot register reboot notifier (err=%d)\n", ret); | ||
416 | return ret; | ||
417 | } | ||
418 | |||
419 | ret = misc_register(&bfin_wdt_miscdev); | 386 | ret = misc_register(&bfin_wdt_miscdev); |
420 | if (ret) { | 387 | if (ret) { |
421 | pr_devinit(KERN_ERR PFX | 388 | pr_devinit(KERN_ERR PFX |
422 | "cannot register miscdev on minor=%d (err=%d)\n", | 389 | "cannot register miscdev on minor=%d (err=%d)\n", |
423 | WATCHDOG_MINOR, ret); | 390 | WATCHDOG_MINOR, ret); |
424 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
425 | return ret; | 391 | return ret; |
426 | } | 392 | } |
427 | 393 | ||
@@ -434,21 +400,33 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev) | |||
434 | /** | 400 | /** |
435 | * bfin_wdt_remove - Initialize module | 401 | * bfin_wdt_remove - Initialize module |
436 | * | 402 | * |
437 | * Unregisters the misc device and notifier handler. Actual device | 403 | * Unregisters the misc device. Actual device |
438 | * deinitialization is handled by bfin_wdt_close(). | 404 | * deinitialization is handled by bfin_wdt_close(). |
439 | */ | 405 | */ |
440 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | 406 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) |
441 | { | 407 | { |
442 | misc_deregister(&bfin_wdt_miscdev); | 408 | misc_deregister(&bfin_wdt_miscdev); |
443 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
444 | return 0; | 409 | return 0; |
445 | } | 410 | } |
446 | 411 | ||
412 | /** | ||
413 | * bfin_wdt_shutdown - Soft Shutdown Handler | ||
414 | * | ||
415 | * Handles the soft shutdown event. | ||
416 | */ | ||
417 | static void bfin_wdt_shutdown(struct platform_device *pdev) | ||
418 | { | ||
419 | stampit(); | ||
420 | |||
421 | bfin_wdt_stop(); | ||
422 | } | ||
423 | |||
447 | static struct platform_device *bfin_wdt_device; | 424 | static struct platform_device *bfin_wdt_device; |
448 | 425 | ||
449 | static struct platform_driver bfin_wdt_driver = { | 426 | static struct platform_driver bfin_wdt_driver = { |
450 | .probe = bfin_wdt_probe, | 427 | .probe = bfin_wdt_probe, |
451 | .remove = __devexit_p(bfin_wdt_remove), | 428 | .remove = __devexit_p(bfin_wdt_remove), |
429 | .shutdown = bfin_wdt_shutdown, | ||
452 | .suspend = bfin_wdt_suspend, | 430 | .suspend = bfin_wdt_suspend, |
453 | .resume = bfin_wdt_resume, | 431 | .resume = bfin_wdt_resume, |
454 | .driver = { | 432 | .driver = { |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index e8380ef65c1c..8b724aad6825 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -121,7 +121,7 @@ static ssize_t booke_wdt_write(struct file *file, const char __user *buf, | |||
121 | return count; | 121 | return count; |
122 | } | 122 | } |
123 | 123 | ||
124 | static struct watchdog_info ident = { | 124 | static const struct watchdog_info ident = { |
125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 125 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
126 | .identity = "PowerPC Book-E Watchdog", | 126 | .identity = "PowerPC Book-E Watchdog", |
127 | }; | 127 | }; |
diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 923cc68dba26..9291506b8b23 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c | |||
@@ -257,7 +257,7 @@ static long coh901327_ioctl(struct file *file, unsigned int cmd, | |||
257 | struct watchdog_info __user *ident; | 257 | struct watchdog_info __user *ident; |
258 | int __user *i; | 258 | int __user *i; |
259 | } uarg; | 259 | } uarg; |
260 | static struct watchdog_info ident = { | 260 | static const struct watchdog_info ident = { |
261 | .options = WDIOF_CARDRESET | | 261 | .options = WDIOF_CARDRESET | |
262 | WDIOF_SETTIMEOUT | | 262 | WDIOF_SETTIMEOUT | |
263 | WDIOF_KEEPALIVEPING, | 263 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index 71f6d7eec9a8..edd3475f41db 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c | |||
@@ -154,7 +154,7 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd, | |||
154 | void __user *argp = (void __user *)arg; | 154 | void __user *argp = (void __user *)arg; |
155 | int __user *p = argp; | 155 | int __user *p = argp; |
156 | unsigned int value; | 156 | unsigned int value; |
157 | static struct watchdog_info ident = { | 157 | static const struct watchdog_info ident = { |
158 | .options = WDIOF_CARDRESET, | 158 | .options = WDIOF_CARDRESET, |
159 | .identity = "CPU5 WDT", | 159 | .identity = "CPU5 WDT", |
160 | }; | 160 | }; |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 081f2955419e..37ea052d4dee 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -403,7 +403,7 @@ static int cpwd_release(struct inode *inode, struct file *file) | |||
403 | 403 | ||
404 | static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 404 | static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
405 | { | 405 | { |
406 | static struct watchdog_info info = { | 406 | static const struct watchdog_info info = { |
407 | .options = WDIOF_SETTIMEOUT, | 407 | .options = WDIOF_SETTIMEOUT, |
408 | .firmware_version = 1, | 408 | .firmware_version = 1, |
409 | .identity = DRIVER_NAME, | 409 | .identity = DRIVER_NAME, |
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 887136de1857..56162c87f5d8 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c | |||
@@ -142,7 +142,7 @@ davinci_wdt_write(struct file *file, const char *data, size_t len, | |||
142 | return len; | 142 | return len; |
143 | } | 143 | } |
144 | 144 | ||
145 | static struct watchdog_info ident = { | 145 | static const struct watchdog_info ident = { |
146 | .options = WDIOF_KEEPALIVEPING, | 146 | .options = WDIOF_KEEPALIVEPING, |
147 | .identity = "DaVinci Watchdog", | 147 | .identity = "DaVinci Watchdog", |
148 | }; | 148 | }; |
diff --git a/drivers/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c index cdd55e0d09f8..88ed54e50f74 100644 --- a/drivers/watchdog/ep93xx_wdt.c +++ b/drivers/watchdog/ep93xx_wdt.c | |||
@@ -131,7 +131,7 @@ ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, | |||
131 | return len; | 131 | return len; |
132 | } | 132 | } |
133 | 133 | ||
134 | static struct watchdog_info ident = { | 134 | static const struct watchdog_info ident = { |
135 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, | 135 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, |
136 | .identity = "EP93xx Watchdog", | 136 | .identity = "EP93xx Watchdog", |
137 | }; | 137 | }; |
diff --git a/drivers/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c index 9add3541fb42..d1c4e55b1db0 100644 --- a/drivers/watchdog/eurotechwdt.c +++ b/drivers/watchdog/eurotechwdt.c | |||
@@ -238,7 +238,7 @@ static long eurwdt_ioctl(struct file *file, | |||
238 | { | 238 | { |
239 | void __user *argp = (void __user *)arg; | 239 | void __user *argp = (void __user *)arg; |
240 | int __user *p = argp; | 240 | int __user *p = argp; |
241 | static struct watchdog_info ident = { | 241 | static const struct watchdog_info ident = { |
242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 242 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
243 | | WDIOF_MAGICCLOSE, | 243 | | WDIOF_MAGICCLOSE, |
244 | .firmware_version = 1, | 244 | .firmware_version = 1, |
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 734d9806a872..abdbad034a6c 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * GE Fanuc watchdog userspace interface | 2 | * GE watchdog userspace interface |
3 | * | 3 | * |
4 | * Author: Martyn Welch <martyn.welch@gefanuc.com> | 4 | * Author: Martyn Welch <martyn.welch@ge.com> |
5 | * | 5 | * |
6 | * Copyright 2008 GE Fanuc Intelligent Platforms Embedded Systems, Inc. | 6 | * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
@@ -161,11 +161,11 @@ static long gef_wdt_ioctl(struct file *file, unsigned int cmd, | |||
161 | int timeout; | 161 | int timeout; |
162 | int options; | 162 | int options; |
163 | void __user *argp = (void __user *)arg; | 163 | void __user *argp = (void __user *)arg; |
164 | static struct watchdog_info info = { | 164 | static const struct watchdog_info info = { |
165 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | | 165 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | |
166 | WDIOF_KEEPALIVEPING, | 166 | WDIOF_KEEPALIVEPING, |
167 | .firmware_version = 0, | 167 | .firmware_version = 0, |
168 | .identity = "GE Fanuc watchdog", | 168 | .identity = "GE watchdog", |
169 | }; | 169 | }; |
170 | 170 | ||
171 | switch (cmd) { | 171 | switch (cmd) { |
@@ -311,7 +311,7 @@ static struct of_platform_driver gef_wdt_driver = { | |||
311 | 311 | ||
312 | static int __init gef_wdt_init(void) | 312 | static int __init gef_wdt_init(void) |
313 | { | 313 | { |
314 | printk(KERN_INFO "GE Fanuc watchdog driver\n"); | 314 | printk(KERN_INFO "GE watchdog driver\n"); |
315 | return of_register_platform_driver(&gef_wdt_driver); | 315 | return of_register_platform_driver(&gef_wdt_driver); |
316 | } | 316 | } |
317 | 317 | ||
@@ -323,8 +323,8 @@ static void __exit gef_wdt_exit(void) | |||
323 | module_init(gef_wdt_init); | 323 | module_init(gef_wdt_init); |
324 | module_exit(gef_wdt_exit); | 324 | module_exit(gef_wdt_exit); |
325 | 325 | ||
326 | MODULE_AUTHOR("Martyn Welch <martyn.welch@gefanuc.com>"); | 326 | MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>"); |
327 | MODULE_DESCRIPTION("GE Fanuc watchdog driver"); | 327 | MODULE_DESCRIPTION("GE watchdog driver"); |
328 | MODULE_LICENSE("GPL"); | 328 | MODULE_LICENSE("GPL"); |
329 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 329 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
330 | MODULE_ALIAS("platform: gef_wdt"); | 330 | MODULE_ALIAS("platform: gef_wdt"); |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 38252ff828ca..9b49b125ad5a 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
@@ -142,7 +142,7 @@ static long geodewdt_ioctl(struct file *file, unsigned int cmd, | |||
142 | int __user *p = argp; | 142 | int __user *p = argp; |
143 | int interval; | 143 | int interval; |
144 | 144 | ||
145 | static struct watchdog_info ident = { | 145 | static const struct watchdog_info ident = { |
146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | 146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING |
147 | | WDIOF_MAGICCLOSE, | 147 | | WDIOF_MAGICCLOSE, |
148 | .firmware_version = 1, | 148 | .firmware_version = 1, |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index a6c5674c78e6..70c2c24660d0 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -554,7 +554,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data, | |||
554 | return len; | 554 | return len; |
555 | } | 555 | } |
556 | 556 | ||
557 | static struct watchdog_info ident = { | 557 | static const struct watchdog_info ident = { |
558 | .options = WDIOF_SETTIMEOUT | | 558 | .options = WDIOF_SETTIMEOUT | |
559 | WDIOF_KEEPALIVEPING | | 559 | WDIOF_KEEPALIVEPING | |
560 | WDIOF_MAGICCLOSE, | 560 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index 7ba0b11ec525..bb9750a03942 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/miscdevice.h> | 35 | #include <linux/miscdevice.h> |
36 | #include <linux/watchdog.h> | 36 | #include <linux/watchdog.h> |
37 | #include <linux/platform_device.h> | ||
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
40 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
@@ -42,7 +41,7 @@ | |||
42 | #include <linux/io.h> | 41 | #include <linux/io.h> |
43 | 42 | ||
44 | /* Module and version information */ | 43 | /* Module and version information */ |
45 | #define ESB_VERSION "0.04" | 44 | #define ESB_VERSION "0.05" |
46 | #define ESB_MODULE_NAME "i6300ESB timer" | 45 | #define ESB_MODULE_NAME "i6300ESB timer" |
47 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION | 46 | #define ESB_DRIVER_NAME ESB_MODULE_NAME ", v" ESB_VERSION |
48 | #define PFX ESB_MODULE_NAME ": " | 47 | #define PFX ESB_MODULE_NAME ": " |
@@ -65,7 +64,7 @@ | |||
65 | /* Config register bits */ | 64 | /* Config register bits */ |
66 | #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */ | 65 | #define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */ |
67 | #define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */ | 66 | #define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */ |
68 | #define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */ | 67 | #define ESB_WDT_INTTYPE (0x03 << 0) /* Interrupt type on timer1 timeout */ |
69 | 68 | ||
70 | /* Reload register bits */ | 69 | /* Reload register bits */ |
71 | #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ | 70 | #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ |
@@ -82,7 +81,9 @@ static unsigned long timer_alive; | |||
82 | static struct pci_dev *esb_pci; | 81 | static struct pci_dev *esb_pci; |
83 | static unsigned short triggered; /* The status of the watchdog upon boot */ | 82 | static unsigned short triggered; /* The status of the watchdog upon boot */ |
84 | static char esb_expect_close; | 83 | static char esb_expect_close; |
85 | static struct platform_device *esb_platform_device; | 84 | |
85 | /* We can only use 1 card due to the /dev/watchdog restriction */ | ||
86 | static int cards_found; | ||
86 | 87 | ||
87 | /* module parameters */ | 88 | /* module parameters */ |
88 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ | 89 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ |
@@ -111,8 +112,8 @@ MODULE_PARM_DESC(nowayout, | |||
111 | */ | 112 | */ |
112 | static inline void esb_unlock_registers(void) | 113 | static inline void esb_unlock_registers(void) |
113 | { | 114 | { |
114 | writeb(ESB_UNLOCK1, ESB_RELOAD_REG); | 115 | writew(ESB_UNLOCK1, ESB_RELOAD_REG); |
115 | writeb(ESB_UNLOCK2, ESB_RELOAD_REG); | 116 | writew(ESB_UNLOCK2, ESB_RELOAD_REG); |
116 | } | 117 | } |
117 | 118 | ||
118 | static int esb_timer_start(void) | 119 | static int esb_timer_start(void) |
@@ -256,7 +257,7 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
256 | int new_heartbeat; | 257 | int new_heartbeat; |
257 | void __user *argp = (void __user *)arg; | 258 | void __user *argp = (void __user *)arg; |
258 | int __user *p = argp; | 259 | int __user *p = argp; |
259 | static struct watchdog_info ident = { | 260 | static const struct watchdog_info ident = { |
260 | .options = WDIOF_SETTIMEOUT | | 261 | .options = WDIOF_SETTIMEOUT | |
261 | WDIOF_KEEPALIVEPING | | 262 | WDIOF_KEEPALIVEPING | |
262 | WDIOF_MAGICCLOSE, | 263 | WDIOF_MAGICCLOSE, |
@@ -332,11 +333,6 @@ static struct miscdevice esb_miscdev = { | |||
332 | 333 | ||
333 | /* | 334 | /* |
334 | * Data for PCI driver interface | 335 | * Data for PCI driver interface |
335 | * | ||
336 | * This data only exists for exporting the supported | ||
337 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
338 | * register a pci_driver, because someone else might one day | ||
339 | * want to register another driver on the same PCI id. | ||
340 | */ | 336 | */ |
341 | static struct pci_device_id esb_pci_tbl[] = { | 337 | static struct pci_device_id esb_pci_tbl[] = { |
342 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), }, | 338 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_9), }, |
@@ -348,29 +344,19 @@ MODULE_DEVICE_TABLE(pci, esb_pci_tbl); | |||
348 | * Init & exit routines | 344 | * Init & exit routines |
349 | */ | 345 | */ |
350 | 346 | ||
351 | static unsigned char __devinit esb_getdevice(void) | 347 | static unsigned char __devinit esb_getdevice(struct pci_dev *pdev) |
352 | { | 348 | { |
353 | /* | 349 | if (pci_enable_device(pdev)) { |
354 | * Find the PCI device | ||
355 | */ | ||
356 | |||
357 | esb_pci = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
358 | PCI_DEVICE_ID_INTEL_ESB_9, NULL); | ||
359 | |||
360 | if (!esb_pci) | ||
361 | return 0; | ||
362 | |||
363 | if (pci_enable_device(esb_pci)) { | ||
364 | printk(KERN_ERR PFX "failed to enable device\n"); | 350 | printk(KERN_ERR PFX "failed to enable device\n"); |
365 | goto err_devput; | 351 | goto err_devput; |
366 | } | 352 | } |
367 | 353 | ||
368 | if (pci_request_region(esb_pci, 0, ESB_MODULE_NAME)) { | 354 | if (pci_request_region(pdev, 0, ESB_MODULE_NAME)) { |
369 | printk(KERN_ERR PFX "failed to request region\n"); | 355 | printk(KERN_ERR PFX "failed to request region\n"); |
370 | goto err_disable; | 356 | goto err_disable; |
371 | } | 357 | } |
372 | 358 | ||
373 | BASEADDR = pci_ioremap_bar(esb_pci, 0); | 359 | BASEADDR = pci_ioremap_bar(pdev, 0); |
374 | if (BASEADDR == NULL) { | 360 | if (BASEADDR == NULL) { |
375 | /* Something's wrong here, BASEADDR has to be set */ | 361 | /* Something's wrong here, BASEADDR has to be set */ |
376 | printk(KERN_ERR PFX "failed to get BASEADDR\n"); | 362 | printk(KERN_ERR PFX "failed to get BASEADDR\n"); |
@@ -378,14 +364,14 @@ static unsigned char __devinit esb_getdevice(void) | |||
378 | } | 364 | } |
379 | 365 | ||
380 | /* Done */ | 366 | /* Done */ |
367 | esb_pci = pdev; | ||
381 | return 1; | 368 | return 1; |
382 | 369 | ||
383 | err_release: | 370 | err_release: |
384 | pci_release_region(esb_pci, 0); | 371 | pci_release_region(pdev, 0); |
385 | err_disable: | 372 | err_disable: |
386 | pci_disable_device(esb_pci); | 373 | pci_disable_device(pdev); |
387 | err_devput: | 374 | err_devput: |
388 | pci_dev_put(esb_pci); | ||
389 | return 0; | 375 | return 0; |
390 | } | 376 | } |
391 | 377 | ||
@@ -430,12 +416,23 @@ static void __devinit esb_initdevice(void) | |||
430 | esb_timer_set_heartbeat(heartbeat); | 416 | esb_timer_set_heartbeat(heartbeat); |
431 | } | 417 | } |
432 | 418 | ||
433 | static int __devinit esb_probe(struct platform_device *dev) | 419 | static int __devinit esb_probe(struct pci_dev *pdev, |
420 | const struct pci_device_id *ent) | ||
434 | { | 421 | { |
435 | int ret; | 422 | int ret; |
436 | 423 | ||
424 | cards_found++; | ||
425 | if (cards_found == 1) | ||
426 | printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", | ||
427 | ESB_VERSION); | ||
428 | |||
429 | if (cards_found > 1) { | ||
430 | printk(KERN_ERR PFX "This driver only supports 1 device\n"); | ||
431 | return -ENODEV; | ||
432 | } | ||
433 | |||
437 | /* Check whether or not the hardware watchdog is there */ | 434 | /* Check whether or not the hardware watchdog is there */ |
438 | if (!esb_getdevice() || esb_pci == NULL) | 435 | if (!esb_getdevice(pdev) || esb_pci == NULL) |
439 | return -ENODEV; | 436 | return -ENODEV; |
440 | 437 | ||
441 | /* Check that the heartbeat value is within it's range; | 438 | /* Check that the heartbeat value is within it's range; |
@@ -467,11 +464,11 @@ err_unmap: | |||
467 | iounmap(BASEADDR); | 464 | iounmap(BASEADDR); |
468 | pci_release_region(esb_pci, 0); | 465 | pci_release_region(esb_pci, 0); |
469 | pci_disable_device(esb_pci); | 466 | pci_disable_device(esb_pci); |
470 | pci_dev_put(esb_pci); | 467 | esb_pci = NULL; |
471 | return ret; | 468 | return ret; |
472 | } | 469 | } |
473 | 470 | ||
474 | static int __devexit esb_remove(struct platform_device *dev) | 471 | static void __devexit esb_remove(struct pci_dev *pdev) |
475 | { | 472 | { |
476 | /* Stop the timer before we leave */ | 473 | /* Stop the timer before we leave */ |
477 | if (!nowayout) | 474 | if (!nowayout) |
@@ -482,54 +479,30 @@ static int __devexit esb_remove(struct platform_device *dev) | |||
482 | iounmap(BASEADDR); | 479 | iounmap(BASEADDR); |
483 | pci_release_region(esb_pci, 0); | 480 | pci_release_region(esb_pci, 0); |
484 | pci_disable_device(esb_pci); | 481 | pci_disable_device(esb_pci); |
485 | pci_dev_put(esb_pci); | 482 | esb_pci = NULL; |
486 | return 0; | ||
487 | } | 483 | } |
488 | 484 | ||
489 | static void esb_shutdown(struct platform_device *dev) | 485 | static void esb_shutdown(struct pci_dev *pdev) |
490 | { | 486 | { |
491 | esb_timer_stop(); | 487 | esb_timer_stop(); |
492 | } | 488 | } |
493 | 489 | ||
494 | static struct platform_driver esb_platform_driver = { | 490 | static struct pci_driver esb_driver = { |
491 | .name = ESB_MODULE_NAME, | ||
492 | .id_table = esb_pci_tbl, | ||
495 | .probe = esb_probe, | 493 | .probe = esb_probe, |
496 | .remove = __devexit_p(esb_remove), | 494 | .remove = __devexit_p(esb_remove), |
497 | .shutdown = esb_shutdown, | 495 | .shutdown = esb_shutdown, |
498 | .driver = { | ||
499 | .owner = THIS_MODULE, | ||
500 | .name = ESB_MODULE_NAME, | ||
501 | }, | ||
502 | }; | 496 | }; |
503 | 497 | ||
504 | static int __init watchdog_init(void) | 498 | static int __init watchdog_init(void) |
505 | { | 499 | { |
506 | int err; | 500 | return pci_register_driver(&esb_driver); |
507 | |||
508 | printk(KERN_INFO PFX "Intel 6300ESB WatchDog Timer Driver v%s\n", | ||
509 | ESB_VERSION); | ||
510 | |||
511 | err = platform_driver_register(&esb_platform_driver); | ||
512 | if (err) | ||
513 | return err; | ||
514 | |||
515 | esb_platform_device = platform_device_register_simple(ESB_MODULE_NAME, | ||
516 | -1, NULL, 0); | ||
517 | if (IS_ERR(esb_platform_device)) { | ||
518 | err = PTR_ERR(esb_platform_device); | ||
519 | goto unreg_platform_driver; | ||
520 | } | ||
521 | |||
522 | return 0; | ||
523 | |||
524 | unreg_platform_driver: | ||
525 | platform_driver_unregister(&esb_platform_driver); | ||
526 | return err; | ||
527 | } | 501 | } |
528 | 502 | ||
529 | static void __exit watchdog_cleanup(void) | 503 | static void __exit watchdog_cleanup(void) |
530 | { | 504 | { |
531 | platform_device_unregister(esb_platform_device); | 505 | pci_unregister_driver(&esb_driver); |
532 | platform_driver_unregister(&esb_platform_driver); | ||
533 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); | 506 | printk(KERN_INFO PFX "Watchdog Module Unloaded.\n"); |
534 | } | 507 | } |
535 | 508 | ||
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index 4bdb7f1a9077..44bc6aa46edf 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -584,7 +584,7 @@ static long iTCO_wdt_ioctl(struct file *file, unsigned int cmd, | |||
584 | int new_heartbeat; | 584 | int new_heartbeat; |
585 | void __user *argp = (void __user *)arg; | 585 | void __user *argp = (void __user *)arg; |
586 | int __user *p = argp; | 586 | int __user *p = argp; |
587 | static struct watchdog_info ident = { | 587 | static const struct watchdog_info ident = { |
588 | .options = WDIOF_SETTIMEOUT | | 588 | .options = WDIOF_SETTIMEOUT | |
589 | WDIOF_KEEPALIVEPING | | 589 | WDIOF_KEEPALIVEPING | |
590 | WDIOF_MAGICCLOSE, | 590 | WDIOF_MAGICCLOSE, |
@@ -698,7 +698,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
698 | if (iTCO_wdt_private.iTCO_version == 2) { | 698 | if (iTCO_wdt_private.iTCO_version == 2) { |
699 | pci_read_config_dword(pdev, 0xf0, &base_address); | 699 | pci_read_config_dword(pdev, 0xf0, &base_address); |
700 | if ((base_address & 1) == 0) { | 700 | if ((base_address & 1) == 0) { |
701 | printk(KERN_ERR PFX "RCBA is disabled by harddware\n"); | 701 | printk(KERN_ERR PFX "RCBA is disabled by hardware\n"); |
702 | ret = -ENODEV; | 702 | ret = -ENODEV; |
703 | goto out; | 703 | goto out; |
704 | } | 704 | } |
@@ -708,8 +708,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev, | |||
708 | 708 | ||
709 | /* Check chipset's NO_REBOOT bit */ | 709 | /* Check chipset's NO_REBOOT bit */ |
710 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { | 710 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { |
711 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, " | 711 | printk(KERN_INFO PFX "unable to reset NO_REBOOT flag, " |
712 | "reboot disabled by hardware\n"); | 712 | "platform may have disabled it\n"); |
713 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ | 713 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ |
714 | goto out_unmap; | 714 | goto out_unmap; |
715 | } | 715 | } |
@@ -805,6 +805,7 @@ static void __devexit iTCO_wdt_cleanup(void) | |||
805 | 805 | ||
806 | static int __devinit iTCO_wdt_probe(struct platform_device *dev) | 806 | static int __devinit iTCO_wdt_probe(struct platform_device *dev) |
807 | { | 807 | { |
808 | int ret = -ENODEV; | ||
808 | int found = 0; | 809 | int found = 0; |
809 | struct pci_dev *pdev = NULL; | 810 | struct pci_dev *pdev = NULL; |
810 | const struct pci_device_id *ent; | 811 | const struct pci_device_id *ent; |
@@ -814,19 +815,17 @@ static int __devinit iTCO_wdt_probe(struct platform_device *dev) | |||
814 | for_each_pci_dev(pdev) { | 815 | for_each_pci_dev(pdev) { |
815 | ent = pci_match_id(iTCO_wdt_pci_tbl, pdev); | 816 | ent = pci_match_id(iTCO_wdt_pci_tbl, pdev); |
816 | if (ent) { | 817 | if (ent) { |
817 | if (!(iTCO_wdt_init(pdev, ent, dev))) { | 818 | found++; |
818 | found++; | 819 | ret = iTCO_wdt_init(pdev, ent, dev); |
820 | if (!ret) | ||
819 | break; | 821 | break; |
820 | } | ||
821 | } | 822 | } |
822 | } | 823 | } |
823 | 824 | ||
824 | if (!found) { | 825 | if (!found) |
825 | printk(KERN_INFO PFX "No card detected\n"); | 826 | printk(KERN_INFO PFX "No card detected\n"); |
826 | return -ENODEV; | ||
827 | } | ||
828 | 827 | ||
829 | return 0; | 828 | return ret; |
830 | } | 829 | } |
831 | 830 | ||
832 | static int __devexit iTCO_wdt_remove(struct platform_device *dev) | 831 | static int __devexit iTCO_wdt_remove(struct platform_device *dev) |
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c index 4bef3ddff4a5..0149d8dfc81d 100644 --- a/drivers/watchdog/ib700wdt.c +++ b/drivers/watchdog/ib700wdt.c | |||
@@ -174,7 +174,7 @@ static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
174 | void __user *argp = (void __user *)arg; | 174 | void __user *argp = (void __user *)arg; |
175 | int __user *p = argp; | 175 | int __user *p = argp; |
176 | 176 | ||
177 | static struct watchdog_info ident = { | 177 | static const struct watchdog_info ident = { |
178 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | 178 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
179 | | WDIOF_MAGICCLOSE, | 179 | | WDIOF_MAGICCLOSE, |
180 | .firmware_version = 1, | 180 | .firmware_version = 1, |
diff --git a/drivers/watchdog/indydog.c b/drivers/watchdog/indydog.c index bea8a124a559..1cc5609666d1 100644 --- a/drivers/watchdog/indydog.c +++ b/drivers/watchdog/indydog.c | |||
@@ -111,7 +111,7 @@ static long indydog_ioctl(struct file *file, unsigned int cmd, | |||
111 | unsigned long arg) | 111 | unsigned long arg) |
112 | { | 112 | { |
113 | int options, retval = -EINVAL; | 113 | int options, retval = -EINVAL; |
114 | static struct watchdog_info ident = { | 114 | static const struct watchdog_info ident = { |
115 | .options = WDIOF_KEEPALIVEPING, | 115 | .options = WDIOF_KEEPALIVEPING, |
116 | .firmware_version = 0, | 116 | .firmware_version = 0, |
117 | .identity = "Hardware Watchdog for SGI IP22", | 117 | .identity = "Hardware Watchdog for SGI IP22", |
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index daed48ded7fe..f52c162b1bea 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c | |||
@@ -236,7 +236,7 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd, | |||
236 | { | 236 | { |
237 | void __user *argp = (void __user *)arg; | 237 | void __user *argp = (void __user *)arg; |
238 | int __user *p = argp; | 238 | int __user *p = argp; |
239 | static struct watchdog_info ident = { | 239 | static const struct watchdog_info ident = { |
240 | .identity = "IT8712F Watchdog", | 240 | .identity = "IT8712F Watchdog", |
241 | .firmware_version = 1, | 241 | .firmware_version = 1, |
242 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | | 242 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index cc133c531d08..b709b3b2d1ef 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c | |||
@@ -421,7 +421,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, | |||
421 | return count; | 421 | return count; |
422 | } | 422 | } |
423 | 423 | ||
424 | static struct watchdog_info ident = { | 424 | static const struct watchdog_info ident = { |
425 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | 425 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, |
426 | .firmware_version = 1, | 426 | .firmware_version = 1, |
427 | .identity = WATCHDOG_NAME, | 427 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c index 3c79dc587958..e86952a7168c 100644 --- a/drivers/watchdog/ixp2000_wdt.c +++ b/drivers/watchdog/ixp2000_wdt.c | |||
@@ -100,7 +100,7 @@ static ssize_t ixp2000_wdt_write(struct file *file, const char *data, | |||
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | static struct watchdog_info ident = { | 103 | static const struct watchdog_info ident = { |
104 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 104 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
105 | WDIOF_KEEPALIVEPING, | 105 | WDIOF_KEEPALIVEPING, |
106 | .identity = "IXP2000 Watchdog", | 106 | .identity = "IXP2000 Watchdog", |
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index 147b4d5c63b3..e02c0ecda26b 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c | |||
@@ -89,7 +89,7 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos) | |||
89 | return len; | 89 | return len; |
90 | } | 90 | } |
91 | 91 | ||
92 | static struct watchdog_info ident = { | 92 | static const struct watchdog_info ident = { |
93 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | | 93 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | |
94 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 94 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
95 | .identity = "IXP4xx Watchdog", | 95 | .identity = "IXP4xx Watchdog", |
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index e1c82769b08e..2852bb2e3fd9 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c | |||
@@ -145,7 +145,7 @@ static int ks8695_wdt_close(struct inode *inode, struct file *file) | |||
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | 147 | ||
148 | static struct watchdog_info ks8695_wdt_info = { | 148 | static const struct watchdog_info ks8695_wdt_info = { |
149 | .identity = "ks8695 watchdog", | 149 | .identity = "ks8695 watchdog", |
150 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 150 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
151 | }; | 151 | }; |
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index 47d719717a3b..2d118cf022fc 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c | |||
@@ -101,7 +101,7 @@ MODULE_PARM_DESC(nowayout, | |||
101 | 101 | ||
102 | #define PFX "machzwd" | 102 | #define PFX "machzwd" |
103 | 103 | ||
104 | static struct watchdog_info zf_info = { | 104 | static const struct watchdog_info zf_info = { |
105 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 105 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
106 | .firmware_version = 1, | 106 | .firmware_version = 1, |
107 | .identity = "ZF-Logic watchdog", | 107 | .identity = "ZF-Logic watchdog", |
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c new file mode 100644 index 000000000000..6eb91d757604 --- /dev/null +++ b/drivers/watchdog/max63xx_wdt.c | |||
@@ -0,0 +1,397 @@ | |||
1 | /* | ||
2 | * drivers/char/watchdog/max63xx_wdt.c | ||
3 | * | ||
4 | * Driver for max63{69,70,71,72,73,74} watchdog timers | ||
5 | * | ||
6 | * Copyright (C) 2009 Marc Zyngier <maz@misterjones.org> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | * | ||
12 | * This driver assumes the watchdog pins are memory mapped (as it is | ||
13 | * the case for the Arcom Zeus). Should it be connected over GPIOs or | ||
14 | * another interface, some abstraction will have to be introduced. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/moduleparam.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/fs.h> | ||
22 | #include <linux/miscdevice.h> | ||
23 | #include <linux/watchdog.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/bitops.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/uaccess.h> | ||
29 | #include <linux/io.h> | ||
30 | #include <linux/device.h> | ||
31 | |||
32 | #define DEFAULT_HEARTBEAT 60 | ||
33 | #define MAX_HEARTBEAT 60 | ||
34 | |||
35 | static int heartbeat = DEFAULT_HEARTBEAT; | ||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
37 | |||
38 | /* | ||
39 | * Memory mapping: a single byte, 3 first lower bits to select bit 3 | ||
40 | * to ping the watchdog. | ||
41 | */ | ||
42 | #define MAX6369_WDSET (7 << 0) | ||
43 | #define MAX6369_WDI (1 << 3) | ||
44 | |||
45 | static DEFINE_SPINLOCK(io_lock); | ||
46 | |||
47 | static unsigned long wdt_status; | ||
48 | #define WDT_IN_USE 0 | ||
49 | #define WDT_RUNNING 1 | ||
50 | #define WDT_OK_TO_CLOSE 2 | ||
51 | |||
52 | static int nodelay; | ||
53 | static struct resource *wdt_mem; | ||
54 | static void __iomem *wdt_base; | ||
55 | static struct platform_device *max63xx_pdev; | ||
56 | |||
57 | /* | ||
58 | * The timeout values used are actually the absolute minimum the chip | ||
59 | * offers. Typical values on my board are slightly over twice as long | ||
60 | * (10s setting ends up with a 25s timeout), and can be up to 3 times | ||
61 | * the nominal setting (according to the datasheet). So please take | ||
62 | * these values with a grain of salt. Same goes for the initial delay | ||
63 | * "feature". Only max6373/74 have a few settings without this initial | ||
64 | * delay (selected with the "nodelay" parameter). | ||
65 | * | ||
66 | * I also decided to remove from the tables any timeout smaller than a | ||
67 | * second, as it looked completly overkill... | ||
68 | */ | ||
69 | |||
70 | /* Timeouts in second */ | ||
71 | struct max63xx_timeout { | ||
72 | u8 wdset; | ||
73 | u8 tdelay; | ||
74 | u8 twd; | ||
75 | }; | ||
76 | |||
77 | static struct max63xx_timeout max6369_table[] = { | ||
78 | { 5, 1, 1 }, | ||
79 | { 6, 10, 10 }, | ||
80 | { 7, 60, 60 }, | ||
81 | { }, | ||
82 | }; | ||
83 | |||
84 | static struct max63xx_timeout max6371_table[] = { | ||
85 | { 6, 60, 3 }, | ||
86 | { 7, 60, 60 }, | ||
87 | { }, | ||
88 | }; | ||
89 | |||
90 | static struct max63xx_timeout max6373_table[] = { | ||
91 | { 2, 60, 1 }, | ||
92 | { 5, 0, 1 }, | ||
93 | { 1, 3, 3 }, | ||
94 | { 7, 60, 10 }, | ||
95 | { 6, 0, 10 }, | ||
96 | { }, | ||
97 | }; | ||
98 | |||
99 | static struct max63xx_timeout *current_timeout; | ||
100 | |||
101 | static struct max63xx_timeout * | ||
102 | max63xx_select_timeout(struct max63xx_timeout *table, int value) | ||
103 | { | ||
104 | while (table->twd) { | ||
105 | if (value <= table->twd) { | ||
106 | if (nodelay && table->tdelay == 0) | ||
107 | return table; | ||
108 | |||
109 | if (!nodelay) | ||
110 | return table; | ||
111 | } | ||
112 | |||
113 | table++; | ||
114 | } | ||
115 | |||
116 | return NULL; | ||
117 | } | ||
118 | |||
119 | static void max63xx_wdt_ping(void) | ||
120 | { | ||
121 | u8 val; | ||
122 | |||
123 | spin_lock(&io_lock); | ||
124 | |||
125 | val = __raw_readb(wdt_base); | ||
126 | |||
127 | __raw_writeb(val | MAX6369_WDI, wdt_base); | ||
128 | __raw_writeb(val & ~MAX6369_WDI, wdt_base); | ||
129 | |||
130 | spin_unlock(&io_lock); | ||
131 | } | ||
132 | |||
133 | static void max63xx_wdt_enable(struct max63xx_timeout *entry) | ||
134 | { | ||
135 | u8 val; | ||
136 | |||
137 | if (test_and_set_bit(WDT_RUNNING, &wdt_status)) | ||
138 | return; | ||
139 | |||
140 | spin_lock(&io_lock); | ||
141 | |||
142 | val = __raw_readb(wdt_base); | ||
143 | val &= ~MAX6369_WDSET; | ||
144 | val |= entry->wdset; | ||
145 | __raw_writeb(val, wdt_base); | ||
146 | |||
147 | spin_unlock(&io_lock); | ||
148 | |||
149 | /* check for a edge triggered startup */ | ||
150 | if (entry->tdelay == 0) | ||
151 | max63xx_wdt_ping(); | ||
152 | } | ||
153 | |||
154 | static void max63xx_wdt_disable(void) | ||
155 | { | ||
156 | spin_lock(&io_lock); | ||
157 | |||
158 | __raw_writeb(3, wdt_base); | ||
159 | |||
160 | spin_unlock(&io_lock); | ||
161 | |||
162 | clear_bit(WDT_RUNNING, &wdt_status); | ||
163 | } | ||
164 | |||
165 | static int max63xx_wdt_open(struct inode *inode, struct file *file) | ||
166 | { | ||
167 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
168 | return -EBUSY; | ||
169 | |||
170 | max63xx_wdt_enable(current_timeout); | ||
171 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
172 | |||
173 | return nonseekable_open(inode, file); | ||
174 | } | ||
175 | |||
176 | static ssize_t max63xx_wdt_write(struct file *file, const char *data, | ||
177 | size_t len, loff_t *ppos) | ||
178 | { | ||
179 | if (len) { | ||
180 | if (!nowayout) { | ||
181 | size_t i; | ||
182 | |||
183 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
184 | for (i = 0; i != len; i++) { | ||
185 | char c; | ||
186 | |||
187 | if (get_user(c, data + i)) | ||
188 | return -EFAULT; | ||
189 | |||
190 | if (c == 'V') | ||
191 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | max63xx_wdt_ping(); | ||
196 | } | ||
197 | |||
198 | return len; | ||
199 | } | ||
200 | |||
201 | static const struct watchdog_info ident = { | ||
202 | .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | ||
203 | .identity = "max63xx Watchdog", | ||
204 | }; | ||
205 | |||
206 | static long max63xx_wdt_ioctl(struct file *file, unsigned int cmd, | ||
207 | unsigned long arg) | ||
208 | { | ||
209 | int ret = -ENOTTY; | ||
210 | |||
211 | switch (cmd) { | ||
212 | case WDIOC_GETSUPPORT: | ||
213 | ret = copy_to_user((struct watchdog_info *)arg, &ident, | ||
214 | sizeof(ident)) ? -EFAULT : 0; | ||
215 | break; | ||
216 | |||
217 | case WDIOC_GETSTATUS: | ||
218 | case WDIOC_GETBOOTSTATUS: | ||
219 | ret = put_user(0, (int *)arg); | ||
220 | break; | ||
221 | |||
222 | case WDIOC_KEEPALIVE: | ||
223 | max63xx_wdt_ping(); | ||
224 | ret = 0; | ||
225 | break; | ||
226 | |||
227 | case WDIOC_GETTIMEOUT: | ||
228 | ret = put_user(heartbeat, (int *)arg); | ||
229 | break; | ||
230 | } | ||
231 | return ret; | ||
232 | } | ||
233 | |||
234 | static int max63xx_wdt_release(struct inode *inode, struct file *file) | ||
235 | { | ||
236 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
237 | max63xx_wdt_disable(); | ||
238 | else | ||
239 | dev_crit(&max63xx_pdev->dev, | ||
240 | "device closed unexpectedly - timer will not stop\n"); | ||
241 | |||
242 | clear_bit(WDT_IN_USE, &wdt_status); | ||
243 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | static const struct file_operations max63xx_wdt_fops = { | ||
249 | .owner = THIS_MODULE, | ||
250 | .llseek = no_llseek, | ||
251 | .write = max63xx_wdt_write, | ||
252 | .unlocked_ioctl = max63xx_wdt_ioctl, | ||
253 | .open = max63xx_wdt_open, | ||
254 | .release = max63xx_wdt_release, | ||
255 | }; | ||
256 | |||
257 | static struct miscdevice max63xx_wdt_miscdev = { | ||
258 | .minor = WATCHDOG_MINOR, | ||
259 | .name = "watchdog", | ||
260 | .fops = &max63xx_wdt_fops, | ||
261 | }; | ||
262 | |||
263 | static int __devinit max63xx_wdt_probe(struct platform_device *pdev) | ||
264 | { | ||
265 | int ret = 0; | ||
266 | int size; | ||
267 | struct resource *res; | ||
268 | struct device *dev = &pdev->dev; | ||
269 | struct max63xx_timeout *table; | ||
270 | |||
271 | table = (struct max63xx_timeout *)pdev->id_entry->driver_data; | ||
272 | |||
273 | if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) | ||
274 | heartbeat = DEFAULT_HEARTBEAT; | ||
275 | |||
276 | dev_info(dev, "requesting %ds heartbeat\n", heartbeat); | ||
277 | current_timeout = max63xx_select_timeout(table, heartbeat); | ||
278 | |||
279 | if (!current_timeout) { | ||
280 | dev_err(dev, "unable to satisfy heartbeat request\n"); | ||
281 | return -EINVAL; | ||
282 | } | ||
283 | |||
284 | dev_info(dev, "using %ds heartbeat with %ds initial delay\n", | ||
285 | current_timeout->twd, current_timeout->tdelay); | ||
286 | |||
287 | heartbeat = current_timeout->twd; | ||
288 | |||
289 | max63xx_pdev = pdev; | ||
290 | |||
291 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
292 | if (res == NULL) { | ||
293 | dev_err(dev, "failed to get memory region resource\n"); | ||
294 | return -ENOENT; | ||
295 | } | ||
296 | |||
297 | size = resource_size(res); | ||
298 | wdt_mem = request_mem_region(res->start, size, pdev->name); | ||
299 | |||
300 | if (wdt_mem == NULL) { | ||
301 | dev_err(dev, "failed to get memory region\n"); | ||
302 | return -ENOENT; | ||
303 | } | ||
304 | |||
305 | wdt_base = ioremap(res->start, size); | ||
306 | if (!wdt_base) { | ||
307 | dev_err(dev, "failed to map memory region\n"); | ||
308 | ret = -ENOMEM; | ||
309 | goto out_request; | ||
310 | } | ||
311 | |||
312 | ret = misc_register(&max63xx_wdt_miscdev); | ||
313 | if (ret < 0) { | ||
314 | dev_err(dev, "cannot register misc device\n"); | ||
315 | goto out_unmap; | ||
316 | } | ||
317 | |||
318 | return 0; | ||
319 | |||
320 | out_unmap: | ||
321 | iounmap(wdt_base); | ||
322 | out_request: | ||
323 | release_resource(wdt_mem); | ||
324 | kfree(wdt_mem); | ||
325 | |||
326 | return ret; | ||
327 | } | ||
328 | |||
329 | static int __devexit max63xx_wdt_remove(struct platform_device *pdev) | ||
330 | { | ||
331 | misc_deregister(&max63xx_wdt_miscdev); | ||
332 | if (wdt_mem) { | ||
333 | release_resource(wdt_mem); | ||
334 | kfree(wdt_mem); | ||
335 | wdt_mem = NULL; | ||
336 | } | ||
337 | |||
338 | if (wdt_base) | ||
339 | iounmap(wdt_base); | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static struct platform_device_id max63xx_id_table[] = { | ||
345 | { "max6369_wdt", (kernel_ulong_t)max6369_table, }, | ||
346 | { "max6370_wdt", (kernel_ulong_t)max6369_table, }, | ||
347 | { "max6371_wdt", (kernel_ulong_t)max6371_table, }, | ||
348 | { "max6372_wdt", (kernel_ulong_t)max6371_table, }, | ||
349 | { "max6373_wdt", (kernel_ulong_t)max6373_table, }, | ||
350 | { "max6374_wdt", (kernel_ulong_t)max6373_table, }, | ||
351 | { }, | ||
352 | }; | ||
353 | MODULE_DEVICE_TABLE(platform, max63xx_id_table); | ||
354 | |||
355 | static struct platform_driver max63xx_wdt_driver = { | ||
356 | .probe = max63xx_wdt_probe, | ||
357 | .remove = __devexit_p(max63xx_wdt_remove), | ||
358 | .id_table = max63xx_id_table, | ||
359 | .driver = { | ||
360 | .name = "max63xx_wdt", | ||
361 | .owner = THIS_MODULE, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | static int __init max63xx_wdt_init(void) | ||
366 | { | ||
367 | return platform_driver_register(&max63xx_wdt_driver); | ||
368 | } | ||
369 | |||
370 | static void __exit max63xx_wdt_exit(void) | ||
371 | { | ||
372 | platform_driver_unregister(&max63xx_wdt_driver); | ||
373 | } | ||
374 | |||
375 | module_init(max63xx_wdt_init); | ||
376 | module_exit(max63xx_wdt_exit); | ||
377 | |||
378 | MODULE_AUTHOR("Marc Zyngier <maz@misterjones.org>"); | ||
379 | MODULE_DESCRIPTION("max63xx Watchdog Driver"); | ||
380 | |||
381 | module_param(heartbeat, int, 0); | ||
382 | MODULE_PARM_DESC(heartbeat, | ||
383 | "Watchdog heartbeat period in seconds from 1 to " | ||
384 | __MODULE_STRING(MAX_HEARTBEAT) ", default " | ||
385 | __MODULE_STRING(DEFAULT_HEARTBEAT)); | ||
386 | |||
387 | module_param(nowayout, int, 0); | ||
388 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
389 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
390 | |||
391 | module_param(nodelay, int, 0); | ||
392 | MODULE_PARM_DESC(nodelay, | ||
393 | "Force selection of a timeout setting without initial delay " | ||
394 | "(max6373/74 only, default=0)"); | ||
395 | |||
396 | MODULE_LICENSE("GPL"); | ||
397 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c index 407b025cb104..bc820d16699a 100644 --- a/drivers/watchdog/mixcomwd.c +++ b/drivers/watchdog/mixcomwd.c | |||
@@ -201,7 +201,7 @@ static long mixcomwd_ioctl(struct file *file, | |||
201 | void __user *argp = (void __user *)arg; | 201 | void __user *argp = (void __user *)arg; |
202 | int __user *p = argp; | 202 | int __user *p = argp; |
203 | int status; | 203 | int status; |
204 | static struct watchdog_info ident = { | 204 | static const struct watchdog_info ident = { |
205 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 205 | .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
206 | .firmware_version = 1, | 206 | .firmware_version = 1, |
207 | .identity = "MixCOM watchdog", | 207 | .identity = "MixCOM watchdog", |
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 38c588ee694f..4e3941c5e293 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c | |||
@@ -148,7 +148,7 @@ static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd, | |||
148 | { | 148 | { |
149 | void __user *argp = (void __user *)arg; | 149 | void __user *argp = (void __user *)arg; |
150 | int __user *p = argp; | 150 | int __user *p = argp; |
151 | static struct watchdog_info ident = { | 151 | static const struct watchdog_info ident = { |
152 | .options = WDIOF_KEEPALIVEPING, | 152 | .options = WDIOF_KEEPALIVEPING, |
153 | .firmware_version = 1, | 153 | .firmware_version = 1, |
154 | .identity = "MPC8xxx", | 154 | .identity = "MPC8xxx", |
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c index a2dc07c2ed49..b0646dac924e 100644 --- a/drivers/watchdog/mpcore_wdt.c +++ b/drivers/watchdog/mpcore_wdt.c | |||
@@ -213,7 +213,7 @@ static ssize_t mpcore_wdt_write(struct file *file, const char *data, | |||
213 | return len; | 213 | return len; |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct watchdog_info ident = { | 216 | static const struct watchdog_info ident = { |
217 | .options = WDIOF_SETTIMEOUT | | 217 | .options = WDIOF_SETTIMEOUT | |
218 | WDIOF_KEEPALIVEPING | | 218 | WDIOF_KEEPALIVEPING | |
219 | WDIOF_MAGICCLOSE, | 219 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c index a51dbe4c43da..97f8a48d8b78 100644 --- a/drivers/watchdog/mv64x60_wdt.c +++ b/drivers/watchdog/mv64x60_wdt.c | |||
@@ -179,7 +179,7 @@ static long mv64x60_wdt_ioctl(struct file *file, | |||
179 | int timeout; | 179 | int timeout; |
180 | int options; | 180 | int options; |
181 | void __user *argp = (void __user *)arg; | 181 | void __user *argp = (void __user *)arg; |
182 | static struct watchdog_info info = { | 182 | static const struct watchdog_info info = { |
183 | .options = WDIOF_SETTIMEOUT | | 183 | .options = WDIOF_SETTIMEOUT | |
184 | WDIOF_MAGICCLOSE | | 184 | WDIOF_MAGICCLOSE | |
185 | WDIOF_KEEPALIVEPING, | 185 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 1a2b916e3f8d..d3aa2f1fe61d 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c | |||
@@ -407,7 +407,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, | |||
407 | int __user *i; | 407 | int __user *i; |
408 | } uarg; | 408 | } uarg; |
409 | 409 | ||
410 | static struct watchdog_info ident = { | 410 | static const struct watchdog_info ident = { |
411 | .options = WDIOF_KEEPALIVEPING | | 411 | .options = WDIOF_KEEPALIVEPING | |
412 | WDIOF_SETTIMEOUT | | 412 | WDIOF_SETTIMEOUT | |
413 | WDIOF_MAGICCLOSE, | 413 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/pcwd.c b/drivers/watchdog/pcwd.c index aa9512321f3a..06f7922606c0 100644 --- a/drivers/watchdog/pcwd.c +++ b/drivers/watchdog/pcwd.c | |||
@@ -606,7 +606,7 @@ static long pcwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
606 | int temperature; | 606 | int temperature; |
607 | int new_heartbeat; | 607 | int new_heartbeat; |
608 | int __user *argp = (int __user *)arg; | 608 | int __user *argp = (int __user *)arg; |
609 | static struct watchdog_info ident = { | 609 | static const struct watchdog_info ident = { |
610 | .options = WDIOF_OVERHEAT | | 610 | .options = WDIOF_OVERHEAT | |
611 | WDIOF_CARDRESET | | 611 | WDIOF_CARDRESET | |
612 | WDIOF_KEEPALIVEPING | | 612 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c index 698f51bff1bc..64374d636f09 100644 --- a/drivers/watchdog/pcwd_pci.c +++ b/drivers/watchdog/pcwd_pci.c | |||
@@ -481,7 +481,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd, | |||
481 | { | 481 | { |
482 | void __user *argp = (void __user *)arg; | 482 | void __user *argp = (void __user *)arg; |
483 | int __user *p = argp; | 483 | int __user *p = argp; |
484 | static struct watchdog_info ident = { | 484 | static const struct watchdog_info ident = { |
485 | .options = WDIOF_OVERHEAT | | 485 | .options = WDIOF_OVERHEAT | |
486 | WDIOF_CARDRESET | | 486 | WDIOF_CARDRESET | |
487 | WDIOF_KEEPALIVEPING | | 487 | WDIOF_KEEPALIVEPING | |
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 052fe451851f..8e4eacc5bb52 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
@@ -404,7 +404,7 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd, | |||
404 | { | 404 | { |
405 | void __user *argp = (void __user *)arg; | 405 | void __user *argp = (void __user *)arg; |
406 | int __user *p = argp; | 406 | int __user *p = argp; |
407 | static struct watchdog_info ident = { | 407 | static const struct watchdog_info ident = { |
408 | .options = WDIOF_KEEPALIVEPING | | 408 | .options = WDIOF_KEEPALIVEPING | |
409 | WDIOF_SETTIMEOUT | | 409 | WDIOF_SETTIMEOUT | |
410 | WDIOF_MAGICCLOSE, | 410 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c index 2d22e996e996..435ec2aed4fe 100644 --- a/drivers/watchdog/pika_wdt.c +++ b/drivers/watchdog/pika_wdt.c | |||
@@ -52,7 +52,7 @@ static struct { | |||
52 | struct timer_list timer; /* The timer that pings the watchdog */ | 52 | struct timer_list timer; /* The timer that pings the watchdog */ |
53 | } pikawdt_private; | 53 | } pikawdt_private; |
54 | 54 | ||
55 | static struct watchdog_info ident = { | 55 | static const struct watchdog_info ident = { |
56 | .identity = DRV_NAME, | 56 | .identity = DRV_NAME, |
57 | .options = WDIOF_CARDRESET | | 57 | .options = WDIOF_CARDRESET | |
58 | WDIOF_SETTIMEOUT | | 58 | WDIOF_SETTIMEOUT | |
diff --git a/drivers/watchdog/pnx833x_wdt.c b/drivers/watchdog/pnx833x_wdt.c index 538ec2c05197..09102f09e681 100644 --- a/drivers/watchdog/pnx833x_wdt.c +++ b/drivers/watchdog/pnx833x_wdt.c | |||
@@ -141,7 +141,7 @@ static long pnx833x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
141 | int options, new_timeout = 0; | 141 | int options, new_timeout = 0; |
142 | uint32_t timeout, timeout_left = 0; | 142 | uint32_t timeout, timeout_left = 0; |
143 | 143 | ||
144 | static struct watchdog_info ident = { | 144 | static const struct watchdog_info ident = { |
145 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, | 145 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, |
146 | .firmware_version = 0, | 146 | .firmware_version = 0, |
147 | .identity = "Hardware Watchdog for PNX833x", | 147 | .identity = "Hardware Watchdog for PNX833x", |
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c index bf12d06b5877..d4c29b5311a4 100644 --- a/drivers/watchdog/rc32434_wdt.c +++ b/drivers/watchdog/rc32434_wdt.c | |||
@@ -198,7 +198,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, | |||
198 | void __user *argp = (void __user *)arg; | 198 | void __user *argp = (void __user *)arg; |
199 | int new_timeout; | 199 | int new_timeout; |
200 | unsigned int value; | 200 | unsigned int value; |
201 | static struct watchdog_info ident = { | 201 | static const struct watchdog_info ident = { |
202 | .options = WDIOF_SETTIMEOUT | | 202 | .options = WDIOF_SETTIMEOUT | |
203 | WDIOF_KEEPALIVEPING | | 203 | WDIOF_KEEPALIVEPING | |
204 | WDIOF_MAGICCLOSE, | 204 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c index 4976bfd1fce6..69c6adbd8205 100644 --- a/drivers/watchdog/rdc321x_wdt.c +++ b/drivers/watchdog/rdc321x_wdt.c | |||
@@ -149,7 +149,7 @@ static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
149 | { | 149 | { |
150 | void __user *argp = (void __user *)arg; | 150 | void __user *argp = (void __user *)arg; |
151 | unsigned int value; | 151 | unsigned int value; |
152 | static struct watchdog_info ident = { | 152 | static const struct watchdog_info ident = { |
153 | .options = WDIOF_CARDRESET, | 153 | .options = WDIOF_CARDRESET, |
154 | .identity = "RDC321x WDT", | 154 | .identity = "RDC321x WDT", |
155 | }; | 155 | }; |
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index c14ae8676903..ae57bf9e1b03 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
@@ -85,7 +85,7 @@ static int riowd_release(struct inode *inode, struct file *filp) | |||
85 | 85 | ||
86 | static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 86 | static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
87 | { | 87 | { |
88 | static struct watchdog_info info = { | 88 | static const struct watchdog_info info = { |
89 | .options = WDIOF_SETTIMEOUT, | 89 | .options = WDIOF_SETTIMEOUT, |
90 | .firmware_version = 1, | 90 | .firmware_version = 1, |
91 | .identity = DRIVER_NAME, | 91 | .identity = DRIVER_NAME, |
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index e6763d2a567b..8d44c9b6fb5b 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
@@ -111,7 +111,7 @@ out: | |||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | static struct watchdog_info ident = { | 114 | static const struct watchdog_info ident = { |
115 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | | 115 | .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | |
116 | WDIOF_KEEPALIVEPING, | 116 | WDIOF_KEEPALIVEPING, |
117 | .identity = WATCHDOG_NAME, | 117 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 569eb295a7a8..9c40f48804f5 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c | |||
@@ -250,7 +250,7 @@ static long sch311x_wdt_ioctl(struct file *file, unsigned int cmd, | |||
250 | int new_timeout; | 250 | int new_timeout; |
251 | void __user *argp = (void __user *)arg; | 251 | void __user *argp = (void __user *)arg; |
252 | int __user *p = argp; | 252 | int __user *p = argp; |
253 | static struct watchdog_info ident = { | 253 | static const struct watchdog_info ident = { |
254 | .options = WDIOF_KEEPALIVEPING | | 254 | .options = WDIOF_KEEPALIVEPING | |
255 | WDIOF_SETTIMEOUT | | 255 | WDIOF_SETTIMEOUT | |
256 | WDIOF_MAGICCLOSE, | 256 | WDIOF_MAGICCLOSE, |
diff --git a/drivers/watchdog/stmp3xxx_wdt.c b/drivers/watchdog/stmp3xxx_wdt.c index 5dd952681f32..b3421fd2cda8 100644 --- a/drivers/watchdog/stmp3xxx_wdt.c +++ b/drivers/watchdog/stmp3xxx_wdt.c | |||
@@ -94,7 +94,7 @@ static ssize_t stmp3xxx_wdt_write(struct file *file, const char __user *data, | |||
94 | return len; | 94 | return len; |
95 | } | 95 | } |
96 | 96 | ||
97 | static struct watchdog_info ident = { | 97 | static const struct watchdog_info ident = { |
98 | .options = WDIOF_CARDRESET | | 98 | .options = WDIOF_CARDRESET | |
99 | WDIOF_MAGICCLOSE | | 99 | WDIOF_MAGICCLOSE | |
100 | WDIOF_SETTIMEOUT | | 100 | WDIOF_SETTIMEOUT | |
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c new file mode 100644 index 000000000000..565a2c3321e5 --- /dev/null +++ b/drivers/watchdog/ts72xx_wdt.c | |||
@@ -0,0 +1,520 @@ | |||
1 | /* | ||
2 | * Watchdog driver for Technologic Systems TS-72xx based SBCs | ||
3 | * (TS-7200, TS-7250 and TS-7260). These boards have external | ||
4 | * glue logic CPLD chip, which includes programmable watchdog | ||
5 | * timer. | ||
6 | * | ||
7 | * Copyright (c) 2009 Mika Westerberg <mika.westerberg@iki.fi> | ||
8 | * | ||
9 | * This driver is based on ep93xx_wdt and wm831x_wdt drivers. | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | ||
12 | * License version 2. This program is licensed "as is" without any | ||
13 | * warranty of any kind, whether express or implied. | ||
14 | */ | ||
15 | |||
16 | #include <linux/fs.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/miscdevice.h> | ||
21 | #include <linux/mutex.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/watchdog.h> | ||
24 | #include <linux/uaccess.h> | ||
25 | |||
26 | #define TS72XX_WDT_FEED_VAL 0x05 | ||
27 | #define TS72XX_WDT_DEFAULT_TIMEOUT 8 | ||
28 | |||
29 | static int timeout = TS72XX_WDT_DEFAULT_TIMEOUT; | ||
30 | module_param(timeout, int, 0); | ||
31 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. " | ||
32 | "(1 <= timeout <= 8, default=" | ||
33 | __MODULE_STRING(TS72XX_WDT_DEFAULT_TIMEOUT) | ||
34 | ")"); | ||
35 | |||
36 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
37 | module_param(nowayout, int, 0); | ||
38 | MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | ||
39 | |||
40 | /** | ||
41 | * struct ts72xx_wdt - watchdog control structure | ||
42 | * @lock: lock that protects this structure | ||
43 | * @regval: watchdog timeout value suitable for control register | ||
44 | * @flags: flags controlling watchdog device state | ||
45 | * @control_reg: watchdog control register | ||
46 | * @feed_reg: watchdog feed register | ||
47 | * @pdev: back pointer to platform dev | ||
48 | */ | ||
49 | struct ts72xx_wdt { | ||
50 | struct mutex lock; | ||
51 | int regval; | ||
52 | |||
53 | #define TS72XX_WDT_BUSY_FLAG 1 | ||
54 | #define TS72XX_WDT_EXPECT_CLOSE_FLAG 2 | ||
55 | int flags; | ||
56 | |||
57 | void __iomem *control_reg; | ||
58 | void __iomem *feed_reg; | ||
59 | |||
60 | struct platform_device *pdev; | ||
61 | }; | ||
62 | |||
63 | struct platform_device *ts72xx_wdt_pdev; | ||
64 | |||
65 | /* | ||
66 | * TS-72xx Watchdog supports following timeouts (value written | ||
67 | * to control register): | ||
68 | * value description | ||
69 | * ------------------------- | ||
70 | * 0x00 watchdog disabled | ||
71 | * 0x01 250ms | ||
72 | * 0x02 500ms | ||
73 | * 0x03 1s | ||
74 | * 0x04 reserved | ||
75 | * 0x05 2s | ||
76 | * 0x06 4s | ||
77 | * 0x07 8s | ||
78 | * | ||
79 | * Timeouts below 1s are not very usable so we don't | ||
80 | * allow them at all. | ||
81 | * | ||
82 | * We provide two functions that convert between these: | ||
83 | * timeout_to_regval() and regval_to_timeout(). | ||
84 | */ | ||
85 | static const struct { | ||
86 | int timeout; | ||
87 | int regval; | ||
88 | } ts72xx_wdt_map[] = { | ||
89 | { 1, 3 }, | ||
90 | { 2, 5 }, | ||
91 | { 4, 6 }, | ||
92 | { 8, 7 }, | ||
93 | }; | ||
94 | |||
95 | /** | ||
96 | * timeout_to_regval() - converts given timeout to control register value | ||
97 | * @new_timeout: timeout in seconds to be converted | ||
98 | * | ||
99 | * Function converts given @new_timeout into valid value that can | ||
100 | * be programmed into watchdog control register. When conversion is | ||
101 | * not possible, function returns %-EINVAL. | ||
102 | */ | ||
103 | static int timeout_to_regval(int new_timeout) | ||
104 | { | ||
105 | int i; | ||
106 | |||
107 | /* first limit it to 1 - 8 seconds */ | ||
108 | new_timeout = clamp_val(new_timeout, 1, 8); | ||
109 | |||
110 | for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) { | ||
111 | if (ts72xx_wdt_map[i].timeout >= new_timeout) | ||
112 | return ts72xx_wdt_map[i].regval; | ||
113 | } | ||
114 | |||
115 | return -EINVAL; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * regval_to_timeout() - converts control register value to timeout | ||
120 | * @regval: control register value to be converted | ||
121 | * | ||
122 | * Function converts given @regval to timeout in seconds (1, 2, 4 or 8). | ||
123 | * If @regval cannot be converted, function returns %-EINVAL. | ||
124 | */ | ||
125 | static int regval_to_timeout(int regval) | ||
126 | { | ||
127 | int i; | ||
128 | |||
129 | for (i = 0; i < ARRAY_SIZE(ts72xx_wdt_map); i++) { | ||
130 | if (ts72xx_wdt_map[i].regval == regval) | ||
131 | return ts72xx_wdt_map[i].timeout; | ||
132 | } | ||
133 | |||
134 | return -EINVAL; | ||
135 | } | ||
136 | |||
137 | /** | ||
138 | * ts72xx_wdt_kick() - kick the watchdog | ||
139 | * @wdt: watchdog to be kicked | ||
140 | * | ||
141 | * Called with @wdt->lock held. | ||
142 | */ | ||
143 | static inline void ts72xx_wdt_kick(struct ts72xx_wdt *wdt) | ||
144 | { | ||
145 | __raw_writeb(TS72XX_WDT_FEED_VAL, wdt->feed_reg); | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * ts72xx_wdt_start() - starts the watchdog timer | ||
150 | * @wdt: watchdog to be started | ||
151 | * | ||
152 | * This function programs timeout to watchdog timer | ||
153 | * and starts it. | ||
154 | * | ||
155 | * Called with @wdt->lock held. | ||
156 | */ | ||
157 | static void ts72xx_wdt_start(struct ts72xx_wdt *wdt) | ||
158 | { | ||
159 | /* | ||
160 | * To program the wdt, it first must be "fed" and | ||
161 | * only after that (within 30 usecs) the configuration | ||
162 | * can be changed. | ||
163 | */ | ||
164 | ts72xx_wdt_kick(wdt); | ||
165 | __raw_writeb((u8)wdt->regval, wdt->control_reg); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * ts72xx_wdt_stop() - stops the watchdog timer | ||
170 | * @wdt: watchdog to be stopped | ||
171 | * | ||
172 | * Called with @wdt->lock held. | ||
173 | */ | ||
174 | static void ts72xx_wdt_stop(struct ts72xx_wdt *wdt) | ||
175 | { | ||
176 | ts72xx_wdt_kick(wdt); | ||
177 | __raw_writeb(0, wdt->control_reg); | ||
178 | } | ||
179 | |||
180 | static int ts72xx_wdt_open(struct inode *inode, struct file *file) | ||
181 | { | ||
182 | struct ts72xx_wdt *wdt = platform_get_drvdata(ts72xx_wdt_pdev); | ||
183 | int regval; | ||
184 | |||
185 | /* | ||
186 | * Try to convert default timeout to valid register | ||
187 | * value first. | ||
188 | */ | ||
189 | regval = timeout_to_regval(timeout); | ||
190 | if (regval < 0) { | ||
191 | dev_err(&wdt->pdev->dev, | ||
192 | "failed to convert timeout (%d) to register value\n", | ||
193 | timeout); | ||
194 | return -EINVAL; | ||
195 | } | ||
196 | |||
197 | if (mutex_lock_interruptible(&wdt->lock)) | ||
198 | return -ERESTARTSYS; | ||
199 | |||
200 | if ((wdt->flags & TS72XX_WDT_BUSY_FLAG) != 0) { | ||
201 | mutex_unlock(&wdt->lock); | ||
202 | return -EBUSY; | ||
203 | } | ||
204 | |||
205 | wdt->flags = TS72XX_WDT_BUSY_FLAG; | ||
206 | wdt->regval = regval; | ||
207 | file->private_data = wdt; | ||
208 | |||
209 | ts72xx_wdt_start(wdt); | ||
210 | |||
211 | mutex_unlock(&wdt->lock); | ||
212 | return nonseekable_open(inode, file); | ||
213 | } | ||
214 | |||
215 | static int ts72xx_wdt_release(struct inode *inode, struct file *file) | ||
216 | { | ||
217 | struct ts72xx_wdt *wdt = file->private_data; | ||
218 | |||
219 | if (mutex_lock_interruptible(&wdt->lock)) | ||
220 | return -ERESTARTSYS; | ||
221 | |||
222 | if ((wdt->flags & TS72XX_WDT_EXPECT_CLOSE_FLAG) != 0) { | ||
223 | ts72xx_wdt_stop(wdt); | ||
224 | } else { | ||
225 | dev_warn(&wdt->pdev->dev, | ||
226 | "TS-72XX WDT device closed unexpectly. " | ||
227 | "Watchdog timer will not stop!\n"); | ||
228 | /* | ||
229 | * Kick it one more time, to give userland some time | ||
230 | * to recover (for example, respawning the kicker | ||
231 | * daemon). | ||
232 | */ | ||
233 | ts72xx_wdt_kick(wdt); | ||
234 | } | ||
235 | |||
236 | wdt->flags = 0; | ||
237 | |||
238 | mutex_unlock(&wdt->lock); | ||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static ssize_t ts72xx_wdt_write(struct file *file, | ||
243 | const char __user *data, | ||
244 | size_t len, | ||
245 | loff_t *ppos) | ||
246 | { | ||
247 | struct ts72xx_wdt *wdt = file->private_data; | ||
248 | |||
249 | if (!len) | ||
250 | return 0; | ||
251 | |||
252 | if (mutex_lock_interruptible(&wdt->lock)) | ||
253 | return -ERESTARTSYS; | ||
254 | |||
255 | ts72xx_wdt_kick(wdt); | ||
256 | |||
257 | /* | ||
258 | * Support for magic character closing. User process | ||
259 | * writes 'V' into the device, just before it is closed. | ||
260 | * This means that we know that the wdt timer can be | ||
261 | * stopped after user closes the device. | ||
262 | */ | ||
263 | if (!nowayout) { | ||
264 | int i; | ||
265 | |||
266 | for (i = 0; i < len; i++) { | ||
267 | char c; | ||
268 | |||
269 | /* In case it was set long ago */ | ||
270 | wdt->flags &= ~TS72XX_WDT_EXPECT_CLOSE_FLAG; | ||
271 | |||
272 | if (get_user(c, data + i)) { | ||
273 | mutex_unlock(&wdt->lock); | ||
274 | return -EFAULT; | ||
275 | } | ||
276 | if (c == 'V') { | ||
277 | wdt->flags |= TS72XX_WDT_EXPECT_CLOSE_FLAG; | ||
278 | break; | ||
279 | } | ||
280 | } | ||
281 | } | ||
282 | |||
283 | mutex_unlock(&wdt->lock); | ||
284 | return len; | ||
285 | } | ||
286 | |||
287 | static const struct watchdog_info winfo = { | ||
288 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | ||
289 | WDIOF_MAGICCLOSE, | ||
290 | .firmware_version = 1, | ||
291 | .identity = "TS-72XX WDT", | ||
292 | }; | ||
293 | |||
294 | static long ts72xx_wdt_ioctl(struct file *file, unsigned int cmd, | ||
295 | unsigned long arg) | ||
296 | { | ||
297 | struct ts72xx_wdt *wdt = file->private_data; | ||
298 | void __user *argp = (void __user *)arg; | ||
299 | int __user *p = (int __user *)argp; | ||
300 | int error = 0; | ||
301 | |||
302 | if (mutex_lock_interruptible(&wdt->lock)) | ||
303 | return -ERESTARTSYS; | ||
304 | |||
305 | switch (cmd) { | ||
306 | case WDIOC_GETSUPPORT: | ||
307 | error = copy_to_user(argp, &winfo, sizeof(winfo)); | ||
308 | break; | ||
309 | |||
310 | case WDIOC_GETSTATUS: | ||
311 | case WDIOC_GETBOOTSTATUS: | ||
312 | return put_user(0, p); | ||
313 | |||
314 | case WDIOC_KEEPALIVE: | ||
315 | ts72xx_wdt_kick(wdt); | ||
316 | break; | ||
317 | |||
318 | case WDIOC_SETOPTIONS: { | ||
319 | int options; | ||
320 | |||
321 | if (get_user(options, p)) { | ||
322 | error = -EFAULT; | ||
323 | break; | ||
324 | } | ||
325 | |||
326 | error = -EINVAL; | ||
327 | |||
328 | if ((options & WDIOS_DISABLECARD) != 0) { | ||
329 | ts72xx_wdt_stop(wdt); | ||
330 | error = 0; | ||
331 | } | ||
332 | if ((options & WDIOS_ENABLECARD) != 0) { | ||
333 | ts72xx_wdt_start(wdt); | ||
334 | error = 0; | ||
335 | } | ||
336 | |||
337 | break; | ||
338 | } | ||
339 | |||
340 | case WDIOC_SETTIMEOUT: { | ||
341 | int new_timeout; | ||
342 | |||
343 | if (get_user(new_timeout, p)) { | ||
344 | error = -EFAULT; | ||
345 | } else { | ||
346 | int regval; | ||
347 | |||
348 | regval = timeout_to_regval(new_timeout); | ||
349 | if (regval < 0) { | ||
350 | error = -EINVAL; | ||
351 | } else { | ||
352 | ts72xx_wdt_stop(wdt); | ||
353 | wdt->regval = regval; | ||
354 | ts72xx_wdt_start(wdt); | ||
355 | } | ||
356 | } | ||
357 | if (error) | ||
358 | break; | ||
359 | |||
360 | /*FALLTHROUGH*/ | ||
361 | } | ||
362 | |||
363 | case WDIOC_GETTIMEOUT: | ||
364 | if (put_user(regval_to_timeout(wdt->regval), p)) | ||
365 | error = -EFAULT; | ||
366 | break; | ||
367 | |||
368 | default: | ||
369 | error = -ENOTTY; | ||
370 | break; | ||
371 | } | ||
372 | |||
373 | mutex_unlock(&wdt->lock); | ||
374 | return error; | ||
375 | } | ||
376 | |||
377 | static const struct file_operations ts72xx_wdt_fops = { | ||
378 | .owner = THIS_MODULE, | ||
379 | .llseek = no_llseek, | ||
380 | .open = ts72xx_wdt_open, | ||
381 | .release = ts72xx_wdt_release, | ||
382 | .write = ts72xx_wdt_write, | ||
383 | .unlocked_ioctl = ts72xx_wdt_ioctl, | ||
384 | }; | ||
385 | |||
386 | static struct miscdevice ts72xx_wdt_miscdev = { | ||
387 | .minor = WATCHDOG_MINOR, | ||
388 | .name = "watchdog", | ||
389 | .fops = &ts72xx_wdt_fops, | ||
390 | }; | ||
391 | |||
392 | static __devinit int ts72xx_wdt_probe(struct platform_device *pdev) | ||
393 | { | ||
394 | struct ts72xx_wdt *wdt; | ||
395 | struct resource *r1, *r2; | ||
396 | int error = 0; | ||
397 | |||
398 | wdt = kzalloc(sizeof(struct ts72xx_wdt), GFP_KERNEL); | ||
399 | if (!wdt) { | ||
400 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
405 | if (!r1) { | ||
406 | dev_err(&pdev->dev, "failed to get memory resource\n"); | ||
407 | error = -ENODEV; | ||
408 | goto fail; | ||
409 | } | ||
410 | |||
411 | r1 = request_mem_region(r1->start, resource_size(r1), pdev->name); | ||
412 | if (!r1) { | ||
413 | dev_err(&pdev->dev, "cannot request memory region\n"); | ||
414 | error = -EBUSY; | ||
415 | goto fail; | ||
416 | } | ||
417 | |||
418 | wdt->control_reg = ioremap(r1->start, resource_size(r1)); | ||
419 | if (!wdt->control_reg) { | ||
420 | dev_err(&pdev->dev, "failed to map memory\n"); | ||
421 | error = -ENODEV; | ||
422 | goto fail_free_control; | ||
423 | } | ||
424 | |||
425 | r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
426 | if (!r2) { | ||
427 | dev_err(&pdev->dev, "failed to get memory resource\n"); | ||
428 | error = -ENODEV; | ||
429 | goto fail_unmap_control; | ||
430 | } | ||
431 | |||
432 | r2 = request_mem_region(r2->start, resource_size(r2), pdev->name); | ||
433 | if (!r2) { | ||
434 | dev_err(&pdev->dev, "cannot request memory region\n"); | ||
435 | error = -EBUSY; | ||
436 | goto fail_unmap_control; | ||
437 | } | ||
438 | |||
439 | wdt->feed_reg = ioremap(r2->start, resource_size(r2)); | ||
440 | if (!wdt->feed_reg) { | ||
441 | dev_err(&pdev->dev, "failed to map memory\n"); | ||
442 | error = -ENODEV; | ||
443 | goto fail_free_feed; | ||
444 | } | ||
445 | |||
446 | platform_set_drvdata(pdev, wdt); | ||
447 | ts72xx_wdt_pdev = pdev; | ||
448 | wdt->pdev = pdev; | ||
449 | mutex_init(&wdt->lock); | ||
450 | |||
451 | error = misc_register(&ts72xx_wdt_miscdev); | ||
452 | if (error) { | ||
453 | dev_err(&pdev->dev, "failed to register miscdev\n"); | ||
454 | goto fail_unmap_feed; | ||
455 | } | ||
456 | |||
457 | dev_info(&pdev->dev, "TS-72xx Watchdog driver\n"); | ||
458 | |||
459 | return 0; | ||
460 | |||
461 | fail_unmap_feed: | ||
462 | platform_set_drvdata(pdev, NULL); | ||
463 | iounmap(wdt->feed_reg); | ||
464 | fail_free_feed: | ||
465 | release_mem_region(r2->start, resource_size(r2)); | ||
466 | fail_unmap_control: | ||
467 | iounmap(wdt->control_reg); | ||
468 | fail_free_control: | ||
469 | release_mem_region(r1->start, resource_size(r1)); | ||
470 | fail: | ||
471 | kfree(wdt); | ||
472 | return error; | ||
473 | } | ||
474 | |||
475 | static __devexit int ts72xx_wdt_remove(struct platform_device *pdev) | ||
476 | { | ||
477 | struct ts72xx_wdt *wdt = platform_get_drvdata(pdev); | ||
478 | struct resource *res; | ||
479 | int error; | ||
480 | |||
481 | error = misc_deregister(&ts72xx_wdt_miscdev); | ||
482 | platform_set_drvdata(pdev, NULL); | ||
483 | |||
484 | iounmap(wdt->feed_reg); | ||
485 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
486 | release_mem_region(res->start, resource_size(res)); | ||
487 | |||
488 | iounmap(wdt->control_reg); | ||
489 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
490 | release_mem_region(res->start, resource_size(res)); | ||
491 | |||
492 | kfree(wdt); | ||
493 | return error; | ||
494 | } | ||
495 | |||
496 | static struct platform_driver ts72xx_wdt_driver = { | ||
497 | .probe = ts72xx_wdt_probe, | ||
498 | .remove = __devexit_p(ts72xx_wdt_remove), | ||
499 | .driver = { | ||
500 | .name = "ts72xx-wdt", | ||
501 | .owner = THIS_MODULE, | ||
502 | }, | ||
503 | }; | ||
504 | |||
505 | static __init int ts72xx_wdt_init(void) | ||
506 | { | ||
507 | return platform_driver_register(&ts72xx_wdt_driver); | ||
508 | } | ||
509 | module_init(ts72xx_wdt_init); | ||
510 | |||
511 | static __exit void ts72xx_wdt_exit(void) | ||
512 | { | ||
513 | platform_driver_unregister(&ts72xx_wdt_driver); | ||
514 | } | ||
515 | module_exit(ts72xx_wdt_exit); | ||
516 | |||
517 | MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>"); | ||
518 | MODULE_DESCRIPTION("TS-72xx SBC Watchdog"); | ||
519 | MODULE_LICENSE("GPL"); | ||
520 | MODULE_ALIAS("platform:ts72xx-wdt"); | ||
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index d635566e9307..9e9ed7bfabcb 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/miscdevice.h> | 13 | #include <linux/miscdevice.h> |
14 | #include <linux/watchdog.h> | 14 | #include <linux/watchdog.h> |
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/reboot.h> | ||
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
18 | #include <linux/uaccess.h> | 17 | #include <linux/uaccess.h> |
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
@@ -166,14 +165,6 @@ static long txx9wdt_ioctl(struct file *file, unsigned int cmd, | |||
166 | } | 165 | } |
167 | } | 166 | } |
168 | 167 | ||
169 | static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code, | ||
170 | void *unused) | ||
171 | { | ||
172 | if (code == SYS_DOWN || code == SYS_HALT) | ||
173 | txx9wdt_stop(); | ||
174 | return NOTIFY_DONE; | ||
175 | } | ||
176 | |||
177 | static const struct file_operations txx9wdt_fops = { | 168 | static const struct file_operations txx9wdt_fops = { |
178 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
179 | .llseek = no_llseek, | 170 | .llseek = no_llseek, |
@@ -189,10 +180,6 @@ static struct miscdevice txx9wdt_miscdev = { | |||
189 | .fops = &txx9wdt_fops, | 180 | .fops = &txx9wdt_fops, |
190 | }; | 181 | }; |
191 | 182 | ||
192 | static struct notifier_block txx9wdt_notifier = { | ||
193 | .notifier_call = txx9wdt_notify_sys, | ||
194 | }; | ||
195 | |||
196 | static int __init txx9wdt_probe(struct platform_device *dev) | 183 | static int __init txx9wdt_probe(struct platform_device *dev) |
197 | { | 184 | { |
198 | struct resource *res; | 185 | struct resource *res; |
@@ -221,13 +208,8 @@ static int __init txx9wdt_probe(struct platform_device *dev) | |||
221 | if (!txx9wdt_reg) | 208 | if (!txx9wdt_reg) |
222 | goto exit_busy; | 209 | goto exit_busy; |
223 | 210 | ||
224 | ret = register_reboot_notifier(&txx9wdt_notifier); | ||
225 | if (ret) | ||
226 | goto exit; | ||
227 | |||
228 | ret = misc_register(&txx9wdt_miscdev); | 211 | ret = misc_register(&txx9wdt_miscdev); |
229 | if (ret) { | 212 | if (ret) { |
230 | unregister_reboot_notifier(&txx9wdt_notifier); | ||
231 | goto exit; | 213 | goto exit; |
232 | } | 214 | } |
233 | 215 | ||
@@ -249,14 +231,19 @@ exit: | |||
249 | static int __exit txx9wdt_remove(struct platform_device *dev) | 231 | static int __exit txx9wdt_remove(struct platform_device *dev) |
250 | { | 232 | { |
251 | misc_deregister(&txx9wdt_miscdev); | 233 | misc_deregister(&txx9wdt_miscdev); |
252 | unregister_reboot_notifier(&txx9wdt_notifier); | ||
253 | clk_disable(txx9_imclk); | 234 | clk_disable(txx9_imclk); |
254 | clk_put(txx9_imclk); | 235 | clk_put(txx9_imclk); |
255 | return 0; | 236 | return 0; |
256 | } | 237 | } |
257 | 238 | ||
239 | static void txx9wdt_shutdown(struct platform_device *dev) | ||
240 | { | ||
241 | txx9wdt_stop(); | ||
242 | } | ||
243 | |||
258 | static struct platform_driver txx9wdt_driver = { | 244 | static struct platform_driver txx9wdt_driver = { |
259 | .remove = __exit_p(txx9wdt_remove), | 245 | .remove = __exit_p(txx9wdt_remove), |
246 | .shutdown = txx9wdt_shutdown, | ||
260 | .driver = { | 247 | .driver = { |
261 | .name = "txx9wdt", | 248 | .name = "txx9wdt", |
262 | .owner = THIS_MODULE, | 249 | .owner = THIS_MODULE, |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index f201accc4e3d..0f5288df0091 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -201,7 +201,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
201 | void __user *argp = (void __user *)arg; | 201 | void __user *argp = (void __user *)arg; |
202 | int __user *p = argp; | 202 | int __user *p = argp; |
203 | int new_timeout; | 203 | int new_timeout; |
204 | static struct watchdog_info ident = { | 204 | static const struct watchdog_info ident = { |
205 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | 205 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | |
206 | WDIOF_MAGICCLOSE, | 206 | WDIOF_MAGICCLOSE, |
207 | .firmware_version = 1, | 207 | .firmware_version = 1, |
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 0560182a1d09..6e6743d1066f 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c | |||
@@ -371,7 +371,7 @@ static ssize_t wdt_write(struct file *file, const char __user *buf, | |||
371 | * according to their available features. | 371 | * according to their available features. |
372 | */ | 372 | */ |
373 | 373 | ||
374 | static struct watchdog_info ident = { | 374 | static const struct watchdog_info ident = { |
375 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, | 375 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, |
376 | .firmware_version = 1, | 376 | .firmware_version = 1, |
377 | .identity = WATCHDOG_NAME, | 377 | .identity = WATCHDOG_NAME, |
diff --git a/drivers/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c index 5bfb1f2c5319..94ec22b9e66b 100644 --- a/drivers/watchdog/wdrtas.c +++ b/drivers/watchdog/wdrtas.c | |||
@@ -312,7 +312,7 @@ static long wdrtas_ioctl(struct file *file, unsigned int cmd, | |||
312 | { | 312 | { |
313 | int __user *argp = (void __user *)arg; | 313 | int __user *argp = (void __user *)arg; |
314 | int i; | 314 | int i; |
315 | static struct watchdog_info wdinfo = { | 315 | static const struct watchdog_info wdinfo = { |
316 | .options = WDRTAS_SUPPORTED_MASK, | 316 | .options = WDRTAS_SUPPORTED_MASK, |
317 | .firmware_version = 0, | 317 | .firmware_version = 0, |
318 | .identity = "wdrtas", | 318 | .identity = "wdrtas", |
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c index 3bbefe9a2634..bfda2e99dd89 100644 --- a/drivers/watchdog/wdt.c +++ b/drivers/watchdog/wdt.c | |||
@@ -358,7 +358,7 @@ static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
358 | int new_heartbeat; | 358 | int new_heartbeat; |
359 | int status; | 359 | int status; |
360 | 360 | ||
361 | static struct watchdog_info ident = { | 361 | struct watchdog_info ident = { |
362 | .options = WDIOF_SETTIMEOUT| | 362 | .options = WDIOF_SETTIMEOUT| |
363 | WDIOF_MAGICCLOSE| | 363 | WDIOF_MAGICCLOSE| |
364 | WDIOF_KEEPALIVEPING, | 364 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index f368dd87083a..7b22e3cdbc81 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c | |||
@@ -412,7 +412,7 @@ static long wdtpci_ioctl(struct file *file, unsigned int cmd, | |||
412 | int new_heartbeat; | 412 | int new_heartbeat; |
413 | int status; | 413 | int status; |
414 | 414 | ||
415 | static struct watchdog_info ident = { | 415 | struct watchdog_info ident = { |
416 | .options = WDIOF_SETTIMEOUT| | 416 | .options = WDIOF_SETTIMEOUT| |
417 | WDIOF_MAGICCLOSE| | 417 | WDIOF_MAGICCLOSE| |
418 | WDIOF_KEEPALIVEPING, | 418 | WDIOF_KEEPALIVEPING, |
diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index 775bcd807f31..8c4b2d5bb7da 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c | |||
@@ -213,7 +213,7 @@ static ssize_t wm831x_wdt_write(struct file *file, | |||
213 | return count; | 213 | return count; |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct watchdog_info ident = { | 216 | static const struct watchdog_info ident = { |
217 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 217 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
218 | .identity = "WM831x Watchdog", | 218 | .identity = "WM831x Watchdog", |
219 | }; | 219 | }; |
diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index a2d2e8eb2282..89dd7b035295 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c | |||
@@ -177,7 +177,7 @@ static ssize_t wm8350_wdt_write(struct file *file, | |||
177 | return count; | 177 | return count; |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct watchdog_info ident = { | 180 | static const struct watchdog_info ident = { |
181 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | 181 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, |
182 | .identity = "WM8350 Watchdog", | 182 | .identity = "WM8350 Watchdog", |
183 | }; | 183 | }; |
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 | ||
429 | static struct sysfs_ops hyp_sysfs_ops = { | 429 | static 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 | }; |