diff options
224 files changed, 2987 insertions, 2361 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index 757cef8f8491..bb6a0106be11 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -338,7 +338,6 @@ X!Earch/i386/kernel/mca.c | |||
338 | X!Iinclude/linux/device.h | 338 | X!Iinclude/linux/device.h |
339 | --> | 339 | --> |
340 | !Edrivers/base/driver.c | 340 | !Edrivers/base/driver.c |
341 | !Edrivers/base/class_simple.c | ||
342 | !Edrivers/base/core.c | 341 | !Edrivers/base/core.c |
343 | !Edrivers/base/firmware_class.c | 342 | !Edrivers/base/firmware_class.c |
344 | !Edrivers/base/transport_class.c | 343 | !Edrivers/base/transport_class.c |
diff --git a/Documentation/driver-model/device.txt b/Documentation/driver-model/device.txt index 58cc5dc8fd3e..a05ec50f8004 100644 --- a/Documentation/driver-model/device.txt +++ b/Documentation/driver-model/device.txt | |||
@@ -76,6 +76,14 @@ driver_data: Driver-specific data. | |||
76 | 76 | ||
77 | platform_data: Platform data specific to the device. | 77 | platform_data: Platform data specific to the device. |
78 | 78 | ||
79 | Example: for devices on custom boards, as typical of embedded | ||
80 | and SOC based hardware, Linux often uses platform_data to point | ||
81 | to board-specific structures describing devices and how they | ||
82 | are wired. That can include what ports are available, chip | ||
83 | variants, which GPIO pins act in what additional roles, and so | ||
84 | on. This shrinks the "Board Support Packages" (BSPs) and | ||
85 | minimizes board-specific #ifdefs in drivers. | ||
86 | |||
79 | current_state: Current power state of the device. | 87 | current_state: Current power state of the device. |
80 | 88 | ||
81 | saved_state: Pointer to saved state of the device. This is usable by | 89 | saved_state: Pointer to saved state of the device. This is usable by |
diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt index 6031a68dd3f5..fabaca1ab1b0 100644 --- a/Documentation/driver-model/driver.txt +++ b/Documentation/driver-model/driver.txt | |||
@@ -5,21 +5,17 @@ struct device_driver { | |||
5 | char * name; | 5 | char * name; |
6 | struct bus_type * bus; | 6 | struct bus_type * bus; |
7 | 7 | ||
8 | rwlock_t lock; | 8 | struct completion unloaded; |
9 | atomic_t refcount; | 9 | struct kobject kobj; |
10 | |||
11 | list_t bus_list; | ||
12 | list_t devices; | 10 | list_t devices; |
13 | 11 | ||
14 | struct driver_dir_entry dir; | 12 | struct module *owner; |
15 | 13 | ||
16 | int (*probe) (struct device * dev); | 14 | int (*probe) (struct device * dev); |
17 | int (*remove) (struct device * dev); | 15 | int (*remove) (struct device * dev); |
18 | 16 | ||
19 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); | 17 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); |
20 | int (*resume) (struct device * dev, u32 level); | 18 | int (*resume) (struct device * dev, u32 level); |
21 | |||
22 | void (*release) (struct device_driver * drv); | ||
23 | }; | 19 | }; |
24 | 20 | ||
25 | 21 | ||
@@ -51,7 +47,6 @@ being converted completely to the new model. | |||
51 | static struct device_driver eepro100_driver = { | 47 | static struct device_driver eepro100_driver = { |
52 | .name = "eepro100", | 48 | .name = "eepro100", |
53 | .bus = &pci_bus_type, | 49 | .bus = &pci_bus_type, |
54 | .devclass = ðernet_devclass, /* when it's implemented */ | ||
55 | 50 | ||
56 | .probe = eepro100_probe, | 51 | .probe = eepro100_probe, |
57 | .remove = eepro100_remove, | 52 | .remove = eepro100_remove, |
@@ -85,7 +80,6 @@ static struct pci_driver eepro100_driver = { | |||
85 | .driver = { | 80 | .driver = { |
86 | .name = "eepro100", | 81 | .name = "eepro100", |
87 | .bus = &pci_bus_type, | 82 | .bus = &pci_bus_type, |
88 | .devclass = ðernet_devclass, /* when it's implemented */ | ||
89 | .probe = eepro100_probe, | 83 | .probe = eepro100_probe, |
90 | .remove = eepro100_remove, | 84 | .remove = eepro100_remove, |
91 | .suspend = eepro100_suspend, | 85 | .suspend = eepro100_suspend, |
@@ -166,27 +160,32 @@ Callbacks | |||
166 | 160 | ||
167 | int (*probe) (struct device * dev); | 161 | int (*probe) (struct device * dev); |
168 | 162 | ||
169 | probe is called to verify the existence of a certain type of | 163 | The probe() entry is called in task context, with the bus's rwsem locked |
170 | hardware. This is called during the driver binding process, after the | 164 | and the driver partially bound to the device. Drivers commonly use |
171 | bus has verified that the device ID of a device matches one of the | 165 | container_of() to convert "dev" to a bus-specific type, both in probe() |
172 | device IDs supported by the driver. | 166 | and other routines. That type often provides device resource data, such |
173 | 167 | as pci_dev.resource[] or platform_device.resources, which is used in | |
174 | This callback only verifies that there actually is supported hardware | 168 | addition to dev->platform_data to initialize the driver. |
175 | present. It may allocate a driver-specific structure, but it should | 169 | |
176 | not do any initialization of the hardware itself. The device-specific | 170 | This callback holds the driver-specific logic to bind the driver to a |
177 | structure may be stored in the device's driver_data field. | 171 | given device. That includes verifying that the device is present, that |
178 | 172 | it's a version the driver can handle, that driver data structures can | |
179 | int (*init) (struct device * dev); | 173 | be allocated and initialized, and that any hardware can be initialized. |
180 | 174 | Drivers often store a pointer to their state with dev_set_drvdata(). | |
181 | init is called during the binding stage. It is called after probe has | 175 | When the driver has successfully bound itself to that device, then probe() |
182 | successfully returned and the device has been registered with its | 176 | returns zero and the driver model code will finish its part of binding |
183 | class. It is responsible for initializing the hardware. | 177 | the driver to that device. |
178 | |||
179 | A driver's probe() may return a negative errno value to indicate that | ||
180 | the driver did not bind to this device, in which case it should have | ||
181 | released all reasources it allocated. | ||
184 | 182 | ||
185 | int (*remove) (struct device * dev); | 183 | int (*remove) (struct device * dev); |
186 | 184 | ||
187 | remove is called to dissociate a driver with a device. This may be | 185 | remove is called to unbind a driver from a device. This may be |
188 | called if a device is physically removed from the system, if the | 186 | called if a device is physically removed from the system, if the |
189 | driver module is being unloaded, or during a reboot sequence. | 187 | driver module is being unloaded, during a reboot sequence, or |
188 | in other cases. | ||
190 | 189 | ||
191 | It is up to the driver to determine if the device is present or | 190 | It is up to the driver to determine if the device is present or |
192 | not. It should free any resources allocated specifically for the | 191 | not. It should free any resources allocated specifically for the |
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index 60f6c2c4d477..dc276598a65a 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt | |||
@@ -214,7 +214,7 @@ Other notes: | |||
214 | 214 | ||
215 | A very simple (and naive) implementation of a device attribute is: | 215 | A very simple (and naive) implementation of a device attribute is: |
216 | 216 | ||
217 | static ssize_t show_name(struct device * dev, char * buf) | 217 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) |
218 | { | 218 | { |
219 | return sprintf(buf,"%s\n",dev->name); | 219 | return sprintf(buf,"%s\n",dev->name); |
220 | } | 220 | } |
diff --git a/arch/arm/common/amba.c b/arch/arm/common/amba.c index a0507f8c33fe..c6beb751f2a9 100644 --- a/arch/arm/common/amba.c +++ b/arch/arm/common/amba.c | |||
@@ -169,7 +169,7 @@ static void amba_device_release(struct device *dev) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | #define amba_attr(name,fmt,arg...) \ | 171 | #define amba_attr(name,fmt,arg...) \ |
172 | static ssize_t show_##name(struct device *_dev, char *buf) \ | 172 | static ssize_t show_##name(struct device *_dev, struct device_attribute *attr, char *buf) \ |
173 | { \ | 173 | { \ |
174 | struct amba_device *dev = to_amba_device(_dev); \ | 174 | struct amba_device *dev = to_amba_device(_dev); \ |
175 | return sprintf(buf, fmt, arg); \ | 175 | return sprintf(buf, fmt, arg); \ |
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index 3dc15b131f53..6540db691338 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c | |||
@@ -866,19 +866,19 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot) | |||
866 | return ec; | 866 | return ec; |
867 | } | 867 | } |
868 | 868 | ||
869 | static ssize_t ecard_show_irq(struct device *dev, char *buf) | 869 | static ssize_t ecard_show_irq(struct device *dev, struct device_attribute *attr, char *buf) |
870 | { | 870 | { |
871 | struct expansion_card *ec = ECARD_DEV(dev); | 871 | struct expansion_card *ec = ECARD_DEV(dev); |
872 | return sprintf(buf, "%u\n", ec->irq); | 872 | return sprintf(buf, "%u\n", ec->irq); |
873 | } | 873 | } |
874 | 874 | ||
875 | static ssize_t ecard_show_dma(struct device *dev, char *buf) | 875 | static ssize_t ecard_show_dma(struct device *dev, struct device_attribute *attr, char *buf) |
876 | { | 876 | { |
877 | struct expansion_card *ec = ECARD_DEV(dev); | 877 | struct expansion_card *ec = ECARD_DEV(dev); |
878 | return sprintf(buf, "%u\n", ec->dma); | 878 | return sprintf(buf, "%u\n", ec->dma); |
879 | } | 879 | } |
880 | 880 | ||
881 | static ssize_t ecard_show_resources(struct device *dev, char *buf) | 881 | static ssize_t ecard_show_resources(struct device *dev, struct device_attribute *attr, char *buf) |
882 | { | 882 | { |
883 | struct expansion_card *ec = ECARD_DEV(dev); | 883 | struct expansion_card *ec = ECARD_DEV(dev); |
884 | char *str = buf; | 884 | char *str = buf; |
@@ -893,19 +893,19 @@ static ssize_t ecard_show_resources(struct device *dev, char *buf) | |||
893 | return str - buf; | 893 | return str - buf; |
894 | } | 894 | } |
895 | 895 | ||
896 | static ssize_t ecard_show_vendor(struct device *dev, char *buf) | 896 | static ssize_t ecard_show_vendor(struct device *dev, struct device_attribute *attr, char *buf) |
897 | { | 897 | { |
898 | struct expansion_card *ec = ECARD_DEV(dev); | 898 | struct expansion_card *ec = ECARD_DEV(dev); |
899 | return sprintf(buf, "%u\n", ec->cid.manufacturer); | 899 | return sprintf(buf, "%u\n", ec->cid.manufacturer); |
900 | } | 900 | } |
901 | 901 | ||
902 | static ssize_t ecard_show_device(struct device *dev, char *buf) | 902 | static ssize_t ecard_show_device(struct device *dev, struct device_attribute *attr, char *buf) |
903 | { | 903 | { |
904 | struct expansion_card *ec = ECARD_DEV(dev); | 904 | struct expansion_card *ec = ECARD_DEV(dev); |
905 | return sprintf(buf, "%u\n", ec->cid.product); | 905 | return sprintf(buf, "%u\n", ec->cid.product); |
906 | } | 906 | } |
907 | 907 | ||
908 | static ssize_t ecard_show_type(struct device *dev, char *buf) | 908 | static ssize_t ecard_show_type(struct device *dev, struct device_attribute *attr, char *buf) |
909 | { | 909 | { |
910 | struct expansion_card *ec = ECARD_DEV(dev); | 910 | struct expansion_card *ec = ECARD_DEV(dev); |
911 | return sprintf(buf, "%s\n", ec->type == ECARD_EASI ? "EASI" : "IOC"); | 911 | return sprintf(buf, "%s\n", ec->type == ECARD_EASI ? "EASI" : "IOC"); |
diff --git a/arch/arm26/kernel/ecard.c b/arch/arm26/kernel/ecard.c index 824c6b571ad9..f2278aadac8a 100644 --- a/arch/arm26/kernel/ecard.c +++ b/arch/arm26/kernel/ecard.c | |||
@@ -562,31 +562,31 @@ static void __init ecard_init_resources(struct expansion_card *ec) | |||
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | static ssize_t ecard_show_irq(struct device *dev, char *buf) | 565 | static ssize_t ecard_show_irq(struct device *dev, struct device_attribute *attr, char *buf) |
566 | { | 566 | { |
567 | struct expansion_card *ec = ECARD_DEV(dev); | 567 | struct expansion_card *ec = ECARD_DEV(dev); |
568 | return sprintf(buf, "%u\n", ec->irq); | 568 | return sprintf(buf, "%u\n", ec->irq); |
569 | } | 569 | } |
570 | 570 | ||
571 | static ssize_t ecard_show_vendor(struct device *dev, char *buf) | 571 | static ssize_t ecard_show_vendor(struct device *dev, struct device_attribute *attr, char *buf) |
572 | { | 572 | { |
573 | struct expansion_card *ec = ECARD_DEV(dev); | 573 | struct expansion_card *ec = ECARD_DEV(dev); |
574 | return sprintf(buf, "%u\n", ec->cid.manufacturer); | 574 | return sprintf(buf, "%u\n", ec->cid.manufacturer); |
575 | } | 575 | } |
576 | 576 | ||
577 | static ssize_t ecard_show_device(struct device *dev, char *buf) | 577 | static ssize_t ecard_show_device(struct device *dev, struct device_attribute *attr, char *buf) |
578 | { | 578 | { |
579 | struct expansion_card *ec = ECARD_DEV(dev); | 579 | struct expansion_card *ec = ECARD_DEV(dev); |
580 | return sprintf(buf, "%u\n", ec->cid.product); | 580 | return sprintf(buf, "%u\n", ec->cid.product); |
581 | } | 581 | } |
582 | 582 | ||
583 | static ssize_t ecard_show_dma(struct device *dev, char *buf) | 583 | static ssize_t ecard_show_dma(struct device *dev, struct device_attribute *attr, char *buf) |
584 | { | 584 | { |
585 | struct expansion_card *ec = ECARD_DEV(dev); | 585 | struct expansion_card *ec = ECARD_DEV(dev); |
586 | return sprintf(buf, "%u\n", ec->dma); | 586 | return sprintf(buf, "%u\n", ec->dma); |
587 | } | 587 | } |
588 | 588 | ||
589 | static ssize_t ecard_show_resources(struct device *dev, char *buf) | 589 | static ssize_t ecard_show_resources(struct device *dev, struct device_attribute *attr, char *buf) |
590 | { | 590 | { |
591 | struct expansion_card *ec = ECARD_DEV(dev); | 591 | struct expansion_card *ec = ECARD_DEV(dev); |
592 | char *str = buf; | 592 | char *str = buf; |
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c index 2e2756345bb2..4647db4ad6de 100644 --- a/arch/i386/kernel/cpuid.c +++ b/arch/i386/kernel/cpuid.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
46 | #include <asm/system.h> | 46 | #include <asm/system.h> |
47 | 47 | ||
48 | static struct class_simple *cpuid_class; | 48 | static struct class *cpuid_class; |
49 | 49 | ||
50 | #ifdef CONFIG_SMP | 50 | #ifdef CONFIG_SMP |
51 | 51 | ||
@@ -158,12 +158,12 @@ static struct file_operations cpuid_fops = { | |||
158 | .open = cpuid_open, | 158 | .open = cpuid_open, |
159 | }; | 159 | }; |
160 | 160 | ||
161 | static int cpuid_class_simple_device_add(int i) | 161 | static int cpuid_class_device_create(int i) |
162 | { | 162 | { |
163 | int err = 0; | 163 | int err = 0; |
164 | struct class_device *class_err; | 164 | struct class_device *class_err; |
165 | 165 | ||
166 | class_err = class_simple_device_add(cpuid_class, MKDEV(CPUID_MAJOR, i), NULL, "cpu%d",i); | 166 | class_err = class_device_create(cpuid_class, MKDEV(CPUID_MAJOR, i), NULL, "cpu%d",i); |
167 | if (IS_ERR(class_err)) | 167 | if (IS_ERR(class_err)) |
168 | err = PTR_ERR(class_err); | 168 | err = PTR_ERR(class_err); |
169 | return err; | 169 | return err; |
@@ -175,10 +175,10 @@ static int __devinit cpuid_class_cpu_callback(struct notifier_block *nfb, unsign | |||
175 | 175 | ||
176 | switch (action) { | 176 | switch (action) { |
177 | case CPU_ONLINE: | 177 | case CPU_ONLINE: |
178 | cpuid_class_simple_device_add(cpu); | 178 | cpuid_class_device_create(cpu); |
179 | break; | 179 | break; |
180 | case CPU_DEAD: | 180 | case CPU_DEAD: |
181 | class_simple_device_remove(MKDEV(CPUID_MAJOR, cpu)); | 181 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | return NOTIFY_OK; | 184 | return NOTIFY_OK; |
@@ -200,13 +200,13 @@ static int __init cpuid_init(void) | |||
200 | err = -EBUSY; | 200 | err = -EBUSY; |
201 | goto out; | 201 | goto out; |
202 | } | 202 | } |
203 | cpuid_class = class_simple_create(THIS_MODULE, "cpuid"); | 203 | cpuid_class = class_create(THIS_MODULE, "cpuid"); |
204 | if (IS_ERR(cpuid_class)) { | 204 | if (IS_ERR(cpuid_class)) { |
205 | err = PTR_ERR(cpuid_class); | 205 | err = PTR_ERR(cpuid_class); |
206 | goto out_chrdev; | 206 | goto out_chrdev; |
207 | } | 207 | } |
208 | for_each_online_cpu(i) { | 208 | for_each_online_cpu(i) { |
209 | err = cpuid_class_simple_device_add(i); | 209 | err = cpuid_class_device_create(i); |
210 | if (err != 0) | 210 | if (err != 0) |
211 | goto out_class; | 211 | goto out_class; |
212 | } | 212 | } |
@@ -218,9 +218,9 @@ static int __init cpuid_init(void) | |||
218 | out_class: | 218 | out_class: |
219 | i = 0; | 219 | i = 0; |
220 | for_each_online_cpu(i) { | 220 | for_each_online_cpu(i) { |
221 | class_simple_device_remove(MKDEV(CPUID_MAJOR, i)); | 221 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); |
222 | } | 222 | } |
223 | class_simple_destroy(cpuid_class); | 223 | class_destroy(cpuid_class); |
224 | out_chrdev: | 224 | out_chrdev: |
225 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 225 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); |
226 | out: | 226 | out: |
@@ -232,8 +232,8 @@ static void __exit cpuid_exit(void) | |||
232 | int cpu = 0; | 232 | int cpu = 0; |
233 | 233 | ||
234 | for_each_online_cpu(cpu) | 234 | for_each_online_cpu(cpu) |
235 | class_simple_device_remove(MKDEV(CPUID_MAJOR, cpu)); | 235 | class_device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); |
236 | class_simple_destroy(cpuid_class); | 236 | class_destroy(cpuid_class); |
237 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); | 237 | unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); |
238 | unregister_cpu_notifier(&cpuid_class_cpu_notifier); | 238 | unregister_cpu_notifier(&cpuid_class_cpu_notifier); |
239 | } | 239 | } |
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c index 05d9f8f363a6..b2f03c39a6fe 100644 --- a/arch/i386/kernel/msr.c +++ b/arch/i386/kernel/msr.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
45 | #include <asm/system.h> | 45 | #include <asm/system.h> |
46 | 46 | ||
47 | static struct class_simple *msr_class; | 47 | static struct class *msr_class; |
48 | 48 | ||
49 | /* Note: "err" is handled in a funny way below. Otherwise one version | 49 | /* Note: "err" is handled in a funny way below. Otherwise one version |
50 | of gcc or another breaks. */ | 50 | of gcc or another breaks. */ |
@@ -260,12 +260,12 @@ static struct file_operations msr_fops = { | |||
260 | .open = msr_open, | 260 | .open = msr_open, |
261 | }; | 261 | }; |
262 | 262 | ||
263 | static int msr_class_simple_device_add(int i) | 263 | static int msr_class_device_create(int i) |
264 | { | 264 | { |
265 | int err = 0; | 265 | int err = 0; |
266 | struct class_device *class_err; | 266 | struct class_device *class_err; |
267 | 267 | ||
268 | class_err = class_simple_device_add(msr_class, MKDEV(MSR_MAJOR, i), NULL, "msr%d",i); | 268 | class_err = class_device_create(msr_class, MKDEV(MSR_MAJOR, i), NULL, "msr%d",i); |
269 | if (IS_ERR(class_err)) | 269 | if (IS_ERR(class_err)) |
270 | err = PTR_ERR(class_err); | 270 | err = PTR_ERR(class_err); |
271 | return err; | 271 | return err; |
@@ -277,10 +277,10 @@ static int __devinit msr_class_cpu_callback(struct notifier_block *nfb, unsigned | |||
277 | 277 | ||
278 | switch (action) { | 278 | switch (action) { |
279 | case CPU_ONLINE: | 279 | case CPU_ONLINE: |
280 | msr_class_simple_device_add(cpu); | 280 | msr_class_device_create(cpu); |
281 | break; | 281 | break; |
282 | case CPU_DEAD: | 282 | case CPU_DEAD: |
283 | class_simple_device_remove(MKDEV(MSR_MAJOR, cpu)); | 283 | class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); |
284 | break; | 284 | break; |
285 | } | 285 | } |
286 | return NOTIFY_OK; | 286 | return NOTIFY_OK; |
@@ -302,13 +302,13 @@ static int __init msr_init(void) | |||
302 | err = -EBUSY; | 302 | err = -EBUSY; |
303 | goto out; | 303 | goto out; |
304 | } | 304 | } |
305 | msr_class = class_simple_create(THIS_MODULE, "msr"); | 305 | msr_class = class_create(THIS_MODULE, "msr"); |
306 | if (IS_ERR(msr_class)) { | 306 | if (IS_ERR(msr_class)) { |
307 | err = PTR_ERR(msr_class); | 307 | err = PTR_ERR(msr_class); |
308 | goto out_chrdev; | 308 | goto out_chrdev; |
309 | } | 309 | } |
310 | for_each_online_cpu(i) { | 310 | for_each_online_cpu(i) { |
311 | err = msr_class_simple_device_add(i); | 311 | err = msr_class_device_create(i); |
312 | if (err != 0) | 312 | if (err != 0) |
313 | goto out_class; | 313 | goto out_class; |
314 | } | 314 | } |
@@ -320,8 +320,8 @@ static int __init msr_init(void) | |||
320 | out_class: | 320 | out_class: |
321 | i = 0; | 321 | i = 0; |
322 | for_each_online_cpu(i) | 322 | for_each_online_cpu(i) |
323 | class_simple_device_remove(MKDEV(MSR_MAJOR, i)); | 323 | class_device_destroy(msr_class, MKDEV(MSR_MAJOR, i)); |
324 | class_simple_destroy(msr_class); | 324 | class_destroy(msr_class); |
325 | out_chrdev: | 325 | out_chrdev: |
326 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); | 326 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); |
327 | out: | 327 | out: |
@@ -332,8 +332,8 @@ static void __exit msr_exit(void) | |||
332 | { | 332 | { |
333 | int cpu = 0; | 333 | int cpu = 0; |
334 | for_each_online_cpu(cpu) | 334 | for_each_online_cpu(cpu) |
335 | class_simple_device_remove(MKDEV(MSR_MAJOR, cpu)); | 335 | class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); |
336 | class_simple_destroy(msr_class); | 336 | class_destroy(msr_class); |
337 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); | 337 | unregister_chrdev(MSR_MAJOR, "cpu/msr"); |
338 | unregister_cpu_notifier(&msr_class_cpu_notifier); | 338 | unregister_cpu_notifier(&msr_class_cpu_notifier); |
339 | } | 339 | } |
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index ab9b5f35c2a7..a087b274847e 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c | |||
@@ -432,7 +432,7 @@ static int tiocx_reload(struct cx_dev *cx_dev) | |||
432 | return cx_device_reload(cx_dev); | 432 | return cx_device_reload(cx_dev); |
433 | } | 433 | } |
434 | 434 | ||
435 | static ssize_t show_cxdev_control(struct device *dev, char *buf) | 435 | static ssize_t show_cxdev_control(struct device *dev, struct device_attribute *attr, char *buf) |
436 | { | 436 | { |
437 | struct cx_dev *cx_dev = to_cx_dev(dev); | 437 | struct cx_dev *cx_dev = to_cx_dev(dev); |
438 | 438 | ||
@@ -442,7 +442,7 @@ static ssize_t show_cxdev_control(struct device *dev, char *buf) | |||
442 | tiocx_btchar_get(cx_dev->cx_id.nasid)); | 442 | tiocx_btchar_get(cx_dev->cx_id.nasid)); |
443 | } | 443 | } |
444 | 444 | ||
445 | static ssize_t store_cxdev_control(struct device *dev, const char *buf, | 445 | static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf, |
446 | size_t count) | 446 | size_t count) |
447 | { | 447 | { |
448 | int n; | 448 | int n; |
@@ -518,25 +518,22 @@ static int __init tiocx_init(void) | |||
518 | return 0; | 518 | return 0; |
519 | } | 519 | } |
520 | 520 | ||
521 | static void __exit tiocx_exit(void) | 521 | static int cx_remove_device(struct device * dev, void * data) |
522 | { | 522 | { |
523 | struct device *dev; | 523 | struct cx_dev *cx_dev = to_cx_dev(dev); |
524 | struct device *tdev; | 524 | device_remove_file(dev, &dev_attr_cxdev_control); |
525 | cx_device_unregister(cx_dev); | ||
526 | return 0; | ||
527 | } | ||
525 | 528 | ||
529 | static void __exit tiocx_exit(void) | ||
530 | { | ||
526 | DBG("tiocx_exit\n"); | 531 | DBG("tiocx_exit\n"); |
527 | 532 | ||
528 | /* | 533 | /* |
529 | * Unregister devices. | 534 | * Unregister devices. |
530 | */ | 535 | */ |
531 | list_for_each_entry_safe(dev, tdev, &tiocx_bus_type.devices.list, | 536 | bus_for_each_dev(&tiocx_bus_type, NULL, NULL, cx_remove_device); |
532 | bus_list) { | ||
533 | if (dev) { | ||
534 | struct cx_dev *cx_dev = to_cx_dev(dev); | ||
535 | device_remove_file(dev, &dev_attr_cxdev_control); | ||
536 | cx_device_unregister(cx_dev); | ||
537 | } | ||
538 | } | ||
539 | |||
540 | bus_unregister(&tiocx_bus_type); | 537 | bus_unregister(&tiocx_bus_type); |
541 | } | 538 | } |
542 | 539 | ||
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index ebf186656afb..d34bbe7ae0e3 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c | |||
@@ -466,7 +466,7 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv) | |||
466 | } | 466 | } |
467 | 467 | ||
468 | #define pa_dev_attr(name, field, format_string) \ | 468 | #define pa_dev_attr(name, field, format_string) \ |
469 | static ssize_t name##_show(struct device *dev, char *buf) \ | 469 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \ |
470 | { \ | 470 | { \ |
471 | struct parisc_device *padev = to_parisc_device(dev); \ | 471 | struct parisc_device *padev = to_parisc_device(dev); \ |
472 | return sprintf(buf, format_string, padev->field); \ | 472 | return sprintf(buf, format_string, padev->field); \ |
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 47a15306823a..6d7b92d72458 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
@@ -1003,7 +1003,7 @@ pci_create_OF_bus_map(void) | |||
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | static ssize_t pci_show_devspec(struct device *dev, char *buf) | 1006 | static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) |
1007 | { | 1007 | { |
1008 | struct pci_dev *pdev; | 1008 | struct pci_dev *pdev; |
1009 | struct device_node *np; | 1009 | struct device_node *np; |
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c index a5156c5179a6..e5fd2ae503ea 100644 --- a/arch/ppc/syslib/ocp.c +++ b/arch/ppc/syslib/ocp.c | |||
@@ -68,7 +68,7 @@ static int ocp_inited; | |||
68 | /* Sysfs support */ | 68 | /* Sysfs support */ |
69 | #define OCP_DEF_ATTR(field, format_string) \ | 69 | #define OCP_DEF_ATTR(field, format_string) \ |
70 | static ssize_t \ | 70 | static ssize_t \ |
71 | show_##field(struct device *dev, char *buf) \ | 71 | show_##field(struct device *dev, struct device_attribute *attr, char *buf) \ |
72 | { \ | 72 | { \ |
73 | struct ocp_device *odev = to_ocp_dev(dev); \ | 73 | struct ocp_device *odev = to_ocp_dev(dev); \ |
74 | \ | 74 | \ |
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c index 46269ed21aee..49c0e34e2d6b 100644 --- a/arch/ppc/syslib/of_device.c +++ b/arch/ppc/syslib/of_device.c | |||
@@ -161,7 +161,7 @@ void of_unregister_driver(struct of_platform_driver *drv) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static ssize_t dev_show_devspec(struct device *dev, char *buf) | 164 | static ssize_t dev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) |
165 | { | 165 | { |
166 | struct of_device *ofdev; | 166 | struct of_device *ofdev; |
167 | 167 | ||
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c index f4c825a69fa0..66bd5ab7c25a 100644 --- a/arch/ppc64/kernel/of_device.c +++ b/arch/ppc64/kernel/of_device.c | |||
@@ -161,7 +161,7 @@ void of_unregister_driver(struct of_platform_driver *drv) | |||
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static ssize_t dev_show_devspec(struct device *dev, char *buf) | 164 | static ssize_t dev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) |
165 | { | 165 | { |
166 | struct of_device *ofdev; | 166 | struct of_device *ofdev; |
167 | 167 | ||
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c index d786d4b6af0b..2bf0513f3eca 100644 --- a/arch/ppc64/kernel/pci.c +++ b/arch/ppc64/kernel/pci.c | |||
@@ -507,7 +507,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
507 | } | 507 | } |
508 | 508 | ||
509 | #ifdef CONFIG_PPC_MULTIPLATFORM | 509 | #ifdef CONFIG_PPC_MULTIPLATFORM |
510 | static ssize_t pci_show_devspec(struct device *dev, char *buf) | 510 | static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) |
511 | { | 511 | { |
512 | struct pci_dev *pdev; | 512 | struct pci_dev *pdev; |
513 | struct device_node *np; | 513 | struct device_node *np; |
diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index cdd830cb2768..79f2dc7a9833 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c | |||
@@ -300,7 +300,7 @@ static void __devinit vio_dev_release(struct device *dev) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | #ifdef CONFIG_PPC_PSERIES | 302 | #ifdef CONFIG_PPC_PSERIES |
303 | static ssize_t viodev_show_devspec(struct device *dev, char *buf) | 303 | static ssize_t viodev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) |
304 | { | 304 | { |
305 | struct device_node *of_node = dev->platform_data; | 305 | struct device_node *of_node = dev->platform_data; |
306 | 306 | ||
@@ -309,7 +309,7 @@ static ssize_t viodev_show_devspec(struct device *dev, char *buf) | |||
309 | DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL); | 309 | DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL); |
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | static ssize_t viodev_show_name(struct device *dev, char *buf) | 312 | static ssize_t viodev_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
313 | { | 313 | { |
314 | return sprintf(buf, "%s\n", to_vio_dev(dev)->name); | 314 | return sprintf(buf, "%s\n", to_vio_dev(dev)->name); |
315 | } | 315 | } |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 119c94093a13..e85885593280 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -65,14 +65,14 @@ static ssize_t acpi_device_attr_show(struct kobject *kobj, | |||
65 | { | 65 | { |
66 | struct acpi_device *device = to_acpi_device(kobj); | 66 | struct acpi_device *device = to_acpi_device(kobj); |
67 | struct acpi_device_attribute *attribute = to_handle_attr(attr); | 67 | struct acpi_device_attribute *attribute = to_handle_attr(attr); |
68 | return attribute->show ? attribute->show(device, buf) : 0; | 68 | return attribute->show ? attribute->show(device, buf) : -EIO; |
69 | } | 69 | } |
70 | static ssize_t acpi_device_attr_store(struct kobject *kobj, | 70 | static ssize_t acpi_device_attr_store(struct kobject *kobj, |
71 | struct attribute *attr, const char *buf, size_t len) | 71 | struct attribute *attr, const char *buf, size_t len) |
72 | { | 72 | { |
73 | struct acpi_device *device = to_acpi_device(kobj); | 73 | struct acpi_device *device = to_acpi_device(kobj); |
74 | struct acpi_device_attribute *attribute = to_handle_attr(attr); | 74 | struct acpi_device_attribute *attribute = to_handle_attr(attr); |
75 | return attribute->store ? attribute->store(device, buf, len) : len; | 75 | return attribute->store ? attribute->store(device, buf, len) : -EIO; |
76 | } | 76 | } |
77 | 77 | ||
78 | static struct sysfs_ops acpi_device_sysfs_ops = { | 78 | static struct sysfs_ops acpi_device_sysfs_ops = { |
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index a47928a2e575..66d9c4643fc1 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | # Makefile for the Linux device tree | 1 | # Makefile for the Linux device tree |
2 | 2 | ||
3 | obj-y := core.o sys.o bus.o \ | 3 | obj-y := core.o sys.o bus.o dd.o \ |
4 | driver.o class.o class_simple.o platform.o \ | 4 | driver.o class.o platform.o \ |
5 | cpu.o firmware.o init.o map.o dmapool.o \ | 5 | cpu.o firmware.o init.o map.o dmapool.o \ |
6 | attribute_container.o transport_class.o | 6 | attribute_container.o transport_class.o |
7 | obj-y += power/ | 7 | obj-y += power/ |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 8d1e8bd48632..645f62692920 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -4,6 +4,8 @@ extern void bus_remove_device(struct device * dev); | |||
4 | extern int bus_add_driver(struct device_driver *); | 4 | extern int bus_add_driver(struct device_driver *); |
5 | extern void bus_remove_driver(struct device_driver *); | 5 | extern void bus_remove_driver(struct device_driver *); |
6 | 6 | ||
7 | extern void driver_detach(struct device_driver * drv); | ||
8 | |||
7 | static inline struct class_device *to_class_dev(struct kobject *obj) | 9 | static inline struct class_device *to_class_dev(struct kobject *obj) |
8 | { | 10 | { |
9 | return container_of(obj, struct class_device, kobj); | 11 | return container_of(obj, struct class_device, kobj); |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 3cb04bb04c2b..43722af90bdd 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -17,9 +17,6 @@ | |||
17 | #include "base.h" | 17 | #include "base.h" |
18 | #include "power/power.h" | 18 | #include "power/power.h" |
19 | 19 | ||
20 | #define to_dev(node) container_of(node, struct device, bus_list) | ||
21 | #define to_drv(node) container_of(node, struct device_driver, kobj.entry) | ||
22 | |||
23 | #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) | 20 | #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) |
24 | #define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) | 21 | #define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) |
25 | 22 | ||
@@ -36,7 +33,7 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) | |||
36 | { | 33 | { |
37 | struct driver_attribute * drv_attr = to_drv_attr(attr); | 34 | struct driver_attribute * drv_attr = to_drv_attr(attr); |
38 | struct device_driver * drv = to_driver(kobj); | 35 | struct device_driver * drv = to_driver(kobj); |
39 | ssize_t ret = 0; | 36 | ssize_t ret = -EIO; |
40 | 37 | ||
41 | if (drv_attr->show) | 38 | if (drv_attr->show) |
42 | ret = drv_attr->show(drv, buf); | 39 | ret = drv_attr->show(drv, buf); |
@@ -49,7 +46,7 @@ drv_attr_store(struct kobject * kobj, struct attribute * attr, | |||
49 | { | 46 | { |
50 | struct driver_attribute * drv_attr = to_drv_attr(attr); | 47 | struct driver_attribute * drv_attr = to_drv_attr(attr); |
51 | struct device_driver * drv = to_driver(kobj); | 48 | struct device_driver * drv = to_driver(kobj); |
52 | ssize_t ret = 0; | 49 | ssize_t ret = -EIO; |
53 | 50 | ||
54 | if (drv_attr->store) | 51 | if (drv_attr->store) |
55 | ret = drv_attr->store(drv, buf, count); | 52 | ret = drv_attr->store(drv, buf, count); |
@@ -135,50 +132,11 @@ static struct kobj_type ktype_bus = { | |||
135 | 132 | ||
136 | decl_subsys(bus, &ktype_bus, NULL); | 133 | decl_subsys(bus, &ktype_bus, NULL); |
137 | 134 | ||
138 | static int __bus_for_each_dev(struct bus_type *bus, struct device *start, | ||
139 | void *data, int (*fn)(struct device *, void *)) | ||
140 | { | ||
141 | struct list_head *head; | ||
142 | struct device *dev; | ||
143 | int error = 0; | ||
144 | |||
145 | if (!(bus = get_bus(bus))) | ||
146 | return -EINVAL; | ||
147 | |||
148 | head = &bus->devices.list; | ||
149 | dev = list_prepare_entry(start, head, bus_list); | ||
150 | list_for_each_entry_continue(dev, head, bus_list) { | ||
151 | get_device(dev); | ||
152 | error = fn(dev, data); | ||
153 | put_device(dev); | ||
154 | if (error) | ||
155 | break; | ||
156 | } | ||
157 | put_bus(bus); | ||
158 | return error; | ||
159 | } | ||
160 | 135 | ||
161 | static int __bus_for_each_drv(struct bus_type *bus, struct device_driver *start, | 136 | static struct device * next_device(struct klist_iter * i) |
162 | void * data, int (*fn)(struct device_driver *, void *)) | ||
163 | { | 137 | { |
164 | struct list_head *head; | 138 | struct klist_node * n = klist_next(i); |
165 | struct device_driver *drv; | 139 | return n ? container_of(n, struct device, knode_bus) : NULL; |
166 | int error = 0; | ||
167 | |||
168 | if (!(bus = get_bus(bus))) | ||
169 | return -EINVAL; | ||
170 | |||
171 | head = &bus->drivers.list; | ||
172 | drv = list_prepare_entry(start, head, kobj.entry); | ||
173 | list_for_each_entry_continue(drv, head, kobj.entry) { | ||
174 | get_driver(drv); | ||
175 | error = fn(drv, data); | ||
176 | put_driver(drv); | ||
177 | if (error) | ||
178 | break; | ||
179 | } | ||
180 | put_bus(bus); | ||
181 | return error; | ||
182 | } | 140 | } |
183 | 141 | ||
184 | /** | 142 | /** |
@@ -204,12 +162,27 @@ static int __bus_for_each_drv(struct bus_type *bus, struct device_driver *start, | |||
204 | int bus_for_each_dev(struct bus_type * bus, struct device * start, | 162 | int bus_for_each_dev(struct bus_type * bus, struct device * start, |
205 | void * data, int (*fn)(struct device *, void *)) | 163 | void * data, int (*fn)(struct device *, void *)) |
206 | { | 164 | { |
207 | int ret; | 165 | struct klist_iter i; |
166 | struct device * dev; | ||
167 | int error = 0; | ||
208 | 168 | ||
209 | down_read(&bus->subsys.rwsem); | 169 | if (!bus) |
210 | ret = __bus_for_each_dev(bus, start, data, fn); | 170 | return -EINVAL; |
211 | up_read(&bus->subsys.rwsem); | 171 | |
212 | return ret; | 172 | klist_iter_init_node(&bus->klist_devices, &i, |
173 | (start ? &start->knode_bus : NULL)); | ||
174 | while ((dev = next_device(&i)) && !error) | ||
175 | error = fn(dev, data); | ||
176 | klist_iter_exit(&i); | ||
177 | return error; | ||
178 | } | ||
179 | |||
180 | |||
181 | |||
182 | static struct device_driver * next_driver(struct klist_iter * i) | ||
183 | { | ||
184 | struct klist_node * n = klist_next(i); | ||
185 | return n ? container_of(n, struct device_driver, knode_bus) : NULL; | ||
213 | } | 186 | } |
214 | 187 | ||
215 | /** | 188 | /** |
@@ -235,179 +208,19 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, | |||
235 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 208 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, |
236 | void * data, int (*fn)(struct device_driver *, void *)) | 209 | void * data, int (*fn)(struct device_driver *, void *)) |
237 | { | 210 | { |
238 | int ret; | 211 | struct klist_iter i; |
239 | 212 | struct device_driver * drv; | |
240 | down_read(&bus->subsys.rwsem); | 213 | int error = 0; |
241 | ret = __bus_for_each_drv(bus, start, data, fn); | ||
242 | up_read(&bus->subsys.rwsem); | ||
243 | return ret; | ||
244 | } | ||
245 | |||
246 | /** | ||
247 | * device_bind_driver - bind a driver to one device. | ||
248 | * @dev: device. | ||
249 | * | ||
250 | * Allow manual attachment of a driver to a device. | ||
251 | * Caller must have already set @dev->driver. | ||
252 | * | ||
253 | * Note that this does not modify the bus reference count | ||
254 | * nor take the bus's rwsem. Please verify those are accounted | ||
255 | * for before calling this. (It is ok to call with no other effort | ||
256 | * from a driver's probe() method.) | ||
257 | */ | ||
258 | |||
259 | void device_bind_driver(struct device * dev) | ||
260 | { | ||
261 | pr_debug("bound device '%s' to driver '%s'\n", | ||
262 | dev->bus_id, dev->driver->name); | ||
263 | list_add_tail(&dev->driver_list, &dev->driver->devices); | ||
264 | sysfs_create_link(&dev->driver->kobj, &dev->kobj, | ||
265 | kobject_name(&dev->kobj)); | ||
266 | sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver"); | ||
267 | } | ||
268 | |||
269 | |||
270 | /** | ||
271 | * driver_probe_device - attempt to bind device & driver. | ||
272 | * @drv: driver. | ||
273 | * @dev: device. | ||
274 | * | ||
275 | * First, we call the bus's match function, if one present, which | ||
276 | * should compare the device IDs the driver supports with the | ||
277 | * device IDs of the device. Note we don't do this ourselves | ||
278 | * because we don't know the format of the ID structures, nor what | ||
279 | * is to be considered a match and what is not. | ||
280 | * | ||
281 | * If we find a match, we call @drv->probe(@dev) if it exists, and | ||
282 | * call device_bind_driver() above. | ||
283 | */ | ||
284 | int driver_probe_device(struct device_driver * drv, struct device * dev) | ||
285 | { | ||
286 | if (drv->bus->match && !drv->bus->match(dev, drv)) | ||
287 | return -ENODEV; | ||
288 | |||
289 | dev->driver = drv; | ||
290 | if (drv->probe) { | ||
291 | int error = drv->probe(dev); | ||
292 | if (error) { | ||
293 | dev->driver = NULL; | ||
294 | return error; | ||
295 | } | ||
296 | } | ||
297 | |||
298 | device_bind_driver(dev); | ||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | |||
303 | /** | ||
304 | * device_attach - try to attach device to a driver. | ||
305 | * @dev: device. | ||
306 | * | ||
307 | * Walk the list of drivers that the bus has and call | ||
308 | * driver_probe_device() for each pair. If a compatible | ||
309 | * pair is found, break out and return. | ||
310 | */ | ||
311 | int device_attach(struct device * dev) | ||
312 | { | ||
313 | struct bus_type * bus = dev->bus; | ||
314 | struct list_head * entry; | ||
315 | int error; | ||
316 | |||
317 | if (dev->driver) { | ||
318 | device_bind_driver(dev); | ||
319 | return 1; | ||
320 | } | ||
321 | |||
322 | if (bus->match) { | ||
323 | list_for_each(entry, &bus->drivers.list) { | ||
324 | struct device_driver * drv = to_drv(entry); | ||
325 | error = driver_probe_device(drv, dev); | ||
326 | if (!error) | ||
327 | /* success, driver matched */ | ||
328 | return 1; | ||
329 | if (error != -ENODEV && error != -ENXIO) | ||
330 | /* driver matched but the probe failed */ | ||
331 | printk(KERN_WARNING | ||
332 | "%s: probe of %s failed with error %d\n", | ||
333 | drv->name, dev->bus_id, error); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | |||
341 | /** | ||
342 | * driver_attach - try to bind driver to devices. | ||
343 | * @drv: driver. | ||
344 | * | ||
345 | * Walk the list of devices that the bus has on it and try to | ||
346 | * match the driver with each one. If driver_probe_device() | ||
347 | * returns 0 and the @dev->driver is set, we've found a | ||
348 | * compatible pair. | ||
349 | * | ||
350 | * Note that we ignore the -ENODEV error from driver_probe_device(), | ||
351 | * since it's perfectly valid for a driver not to bind to any devices. | ||
352 | */ | ||
353 | void driver_attach(struct device_driver * drv) | ||
354 | { | ||
355 | struct bus_type * bus = drv->bus; | ||
356 | struct list_head * entry; | ||
357 | int error; | ||
358 | |||
359 | if (!bus->match) | ||
360 | return; | ||
361 | |||
362 | list_for_each(entry, &bus->devices.list) { | ||
363 | struct device * dev = container_of(entry, struct device, bus_list); | ||
364 | if (!dev->driver) { | ||
365 | error = driver_probe_device(drv, dev); | ||
366 | if (error && (error != -ENODEV)) | ||
367 | /* driver matched but the probe failed */ | ||
368 | printk(KERN_WARNING | ||
369 | "%s: probe of %s failed with error %d\n", | ||
370 | drv->name, dev->bus_id, error); | ||
371 | } | ||
372 | } | ||
373 | } | ||
374 | |||
375 | |||
376 | /** | ||
377 | * device_release_driver - manually detach device from driver. | ||
378 | * @dev: device. | ||
379 | * | ||
380 | * Manually detach device from driver. | ||
381 | * Note that this is called without incrementing the bus | ||
382 | * reference count nor taking the bus's rwsem. Be sure that | ||
383 | * those are accounted for before calling this function. | ||
384 | */ | ||
385 | |||
386 | void device_release_driver(struct device * dev) | ||
387 | { | ||
388 | struct device_driver * drv = dev->driver; | ||
389 | if (drv) { | ||
390 | sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); | ||
391 | sysfs_remove_link(&dev->kobj, "driver"); | ||
392 | list_del_init(&dev->driver_list); | ||
393 | if (drv->remove) | ||
394 | drv->remove(dev); | ||
395 | dev->driver = NULL; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | 214 | ||
400 | /** | 215 | if (!bus) |
401 | * driver_detach - detach driver from all devices it controls. | 216 | return -EINVAL; |
402 | * @drv: driver. | ||
403 | */ | ||
404 | 217 | ||
405 | static void driver_detach(struct device_driver * drv) | 218 | klist_iter_init_node(&bus->klist_drivers, &i, |
406 | { | 219 | start ? &start->knode_bus : NULL); |
407 | while (!list_empty(&drv->devices)) { | 220 | while ((drv = next_driver(&i)) && !error) |
408 | struct device * dev = container_of(drv->devices.next, struct device, driver_list); | 221 | error = fn(drv, data); |
409 | device_release_driver(dev); | 222 | klist_iter_exit(&i); |
410 | } | 223 | return error; |
411 | } | 224 | } |
412 | 225 | ||
413 | static int device_add_attrs(struct bus_type * bus, struct device * dev) | 226 | static int device_add_attrs(struct bus_type * bus, struct device * dev) |
@@ -456,14 +269,15 @@ int bus_add_device(struct device * dev) | |||
456 | int error = 0; | 269 | int error = 0; |
457 | 270 | ||
458 | if (bus) { | 271 | if (bus) { |
459 | down_write(&dev->bus->subsys.rwsem); | ||
460 | pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); | 272 | pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); |
461 | list_add_tail(&dev->bus_list, &dev->bus->devices.list); | 273 | error = device_attach(dev); |
462 | device_attach(dev); | 274 | klist_add_tail(&bus->klist_devices, &dev->knode_bus); |
463 | up_write(&dev->bus->subsys.rwsem); | 275 | if (error >= 0) |
464 | device_add_attrs(bus, dev); | 276 | error = device_add_attrs(bus, dev); |
465 | sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id); | 277 | if (!error) { |
466 | sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus"); | 278 | sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id); |
279 | sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus"); | ||
280 | } | ||
467 | } | 281 | } |
468 | return error; | 282 | return error; |
469 | } | 283 | } |
@@ -483,11 +297,9 @@ void bus_remove_device(struct device * dev) | |||
483 | sysfs_remove_link(&dev->kobj, "bus"); | 297 | sysfs_remove_link(&dev->kobj, "bus"); |
484 | sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); | 298 | sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); |
485 | device_remove_attrs(dev->bus, dev); | 299 | device_remove_attrs(dev->bus, dev); |
486 | down_write(&dev->bus->subsys.rwsem); | 300 | klist_remove(&dev->knode_bus); |
487 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); | 301 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); |
488 | device_release_driver(dev); | 302 | device_release_driver(dev); |
489 | list_del_init(&dev->bus_list); | ||
490 | up_write(&dev->bus->subsys.rwsem); | ||
491 | put_bus(dev->bus); | 303 | put_bus(dev->bus); |
492 | } | 304 | } |
493 | } | 305 | } |
@@ -547,9 +359,8 @@ int bus_add_driver(struct device_driver * drv) | |||
547 | return error; | 359 | return error; |
548 | } | 360 | } |
549 | 361 | ||
550 | down_write(&bus->subsys.rwsem); | ||
551 | driver_attach(drv); | 362 | driver_attach(drv); |
552 | up_write(&bus->subsys.rwsem); | 363 | klist_add_tail(&bus->klist_drivers, &drv->knode_bus); |
553 | module_add_driver(drv->owner, drv); | 364 | module_add_driver(drv->owner, drv); |
554 | 365 | ||
555 | driver_add_attrs(bus, drv); | 366 | driver_add_attrs(bus, drv); |
@@ -571,10 +382,9 @@ void bus_remove_driver(struct device_driver * drv) | |||
571 | { | 382 | { |
572 | if (drv->bus) { | 383 | if (drv->bus) { |
573 | driver_remove_attrs(drv->bus, drv); | 384 | driver_remove_attrs(drv->bus, drv); |
574 | down_write(&drv->bus->subsys.rwsem); | 385 | klist_remove(&drv->knode_bus); |
575 | pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); | 386 | pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); |
576 | driver_detach(drv); | 387 | driver_detach(drv); |
577 | up_write(&drv->bus->subsys.rwsem); | ||
578 | module_remove_driver(drv); | 388 | module_remove_driver(drv); |
579 | kobject_unregister(&drv->kobj); | 389 | kobject_unregister(&drv->kobj); |
580 | put_bus(drv->bus); | 390 | put_bus(drv->bus); |
@@ -587,7 +397,7 @@ static int bus_rescan_devices_helper(struct device *dev, void *data) | |||
587 | { | 397 | { |
588 | int *count = data; | 398 | int *count = data; |
589 | 399 | ||
590 | if (!dev->driver && device_attach(dev)) | 400 | if (!dev->driver && (device_attach(dev) > 0)) |
591 | (*count)++; | 401 | (*count)++; |
592 | 402 | ||
593 | return 0; | 403 | return 0; |
@@ -607,9 +417,7 @@ int bus_rescan_devices(struct bus_type * bus) | |||
607 | { | 417 | { |
608 | int count = 0; | 418 | int count = 0; |
609 | 419 | ||
610 | down_write(&bus->subsys.rwsem); | 420 | bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper); |
611 | __bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper); | ||
612 | up_write(&bus->subsys.rwsem); | ||
613 | 421 | ||
614 | return count; | 422 | return count; |
615 | } | 423 | } |
@@ -710,6 +518,9 @@ int bus_register(struct bus_type * bus) | |||
710 | retval = kset_register(&bus->drivers); | 518 | retval = kset_register(&bus->drivers); |
711 | if (retval) | 519 | if (retval) |
712 | goto bus_drivers_fail; | 520 | goto bus_drivers_fail; |
521 | |||
522 | klist_init(&bus->klist_devices); | ||
523 | klist_init(&bus->klist_drivers); | ||
713 | bus_add_attrs(bus); | 524 | bus_add_attrs(bus); |
714 | 525 | ||
715 | pr_debug("bus type '%s' registered\n", bus->name); | 526 | pr_debug("bus type '%s' registered\n", bus->name); |
@@ -749,12 +560,6 @@ int __init buses_init(void) | |||
749 | EXPORT_SYMBOL_GPL(bus_for_each_dev); | 560 | EXPORT_SYMBOL_GPL(bus_for_each_dev); |
750 | EXPORT_SYMBOL_GPL(bus_for_each_drv); | 561 | EXPORT_SYMBOL_GPL(bus_for_each_drv); |
751 | 562 | ||
752 | EXPORT_SYMBOL_GPL(driver_probe_device); | ||
753 | EXPORT_SYMBOL_GPL(device_bind_driver); | ||
754 | EXPORT_SYMBOL_GPL(device_release_driver); | ||
755 | EXPORT_SYMBOL_GPL(device_attach); | ||
756 | EXPORT_SYMBOL_GPL(driver_attach); | ||
757 | |||
758 | EXPORT_SYMBOL_GPL(bus_add_device); | 563 | EXPORT_SYMBOL_GPL(bus_add_device); |
759 | EXPORT_SYMBOL_GPL(bus_remove_device); | 564 | EXPORT_SYMBOL_GPL(bus_remove_device); |
760 | EXPORT_SYMBOL_GPL(bus_register); | 565 | EXPORT_SYMBOL_GPL(bus_register); |
diff --git a/drivers/base/class.c b/drivers/base/class.c index d2a2f8f2b4ed..479c12570881 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/kdev_t.h> | 18 | #include <linux/kdev_t.h> |
19 | #include <linux/err.h> | ||
19 | #include "base.h" | 20 | #include "base.h" |
20 | 21 | ||
21 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) | 22 | #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) |
@@ -26,7 +27,7 @@ class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) | |||
26 | { | 27 | { |
27 | struct class_attribute * class_attr = to_class_attr(attr); | 28 | struct class_attribute * class_attr = to_class_attr(attr); |
28 | struct class * dc = to_class(kobj); | 29 | struct class * dc = to_class(kobj); |
29 | ssize_t ret = 0; | 30 | ssize_t ret = -EIO; |
30 | 31 | ||
31 | if (class_attr->show) | 32 | if (class_attr->show) |
32 | ret = class_attr->show(dc, buf); | 33 | ret = class_attr->show(dc, buf); |
@@ -39,7 +40,7 @@ class_attr_store(struct kobject * kobj, struct attribute * attr, | |||
39 | { | 40 | { |
40 | struct class_attribute * class_attr = to_class_attr(attr); | 41 | struct class_attribute * class_attr = to_class_attr(attr); |
41 | struct class * dc = to_class(kobj); | 42 | struct class * dc = to_class(kobj); |
42 | ssize_t ret = 0; | 43 | ssize_t ret = -EIO; |
43 | 44 | ||
44 | if (class_attr->store) | 45 | if (class_attr->store) |
45 | ret = class_attr->store(dc, buf, count); | 46 | ret = class_attr->store(dc, buf, count); |
@@ -162,6 +163,69 @@ void class_unregister(struct class * cls) | |||
162 | subsystem_unregister(&cls->subsys); | 163 | subsystem_unregister(&cls->subsys); |
163 | } | 164 | } |
164 | 165 | ||
166 | static void class_create_release(struct class *cls) | ||
167 | { | ||
168 | kfree(cls); | ||
169 | } | ||
170 | |||
171 | static void class_device_create_release(struct class_device *class_dev) | ||
172 | { | ||
173 | kfree(class_dev); | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * class_create - create a struct class structure | ||
178 | * @owner: pointer to the module that is to "own" this struct class | ||
179 | * @name: pointer to a string for the name of this class. | ||
180 | * | ||
181 | * This is used to create a struct class pointer that can then be used | ||
182 | * in calls to class_device_create(). | ||
183 | * | ||
184 | * Note, the pointer created here is to be destroyed when finished by | ||
185 | * making a call to class_destroy(). | ||
186 | */ | ||
187 | struct class *class_create(struct module *owner, char *name) | ||
188 | { | ||
189 | struct class *cls; | ||
190 | int retval; | ||
191 | |||
192 | cls = kmalloc(sizeof(struct class), GFP_KERNEL); | ||
193 | if (!cls) { | ||
194 | retval = -ENOMEM; | ||
195 | goto error; | ||
196 | } | ||
197 | memset(cls, 0x00, sizeof(struct class)); | ||
198 | |||
199 | cls->name = name; | ||
200 | cls->owner = owner; | ||
201 | cls->class_release = class_create_release; | ||
202 | cls->release = class_device_create_release; | ||
203 | |||
204 | retval = class_register(cls); | ||
205 | if (retval) | ||
206 | goto error; | ||
207 | |||
208 | return cls; | ||
209 | |||
210 | error: | ||
211 | kfree(cls); | ||
212 | return ERR_PTR(retval); | ||
213 | } | ||
214 | |||
215 | /** | ||
216 | * class_destroy - destroys a struct class structure | ||
217 | * @cs: pointer to the struct class that is to be destroyed | ||
218 | * | ||
219 | * Note, the pointer to be destroyed must have been created with a call | ||
220 | * to class_create(). | ||
221 | */ | ||
222 | void class_destroy(struct class *cls) | ||
223 | { | ||
224 | if ((cls == NULL) || (IS_ERR(cls))) | ||
225 | return; | ||
226 | |||
227 | class_unregister(cls); | ||
228 | } | ||
165 | 229 | ||
166 | /* Class Device Stuff */ | 230 | /* Class Device Stuff */ |
167 | 231 | ||
@@ -262,7 +326,7 @@ static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) | |||
262 | return 0; | 326 | return 0; |
263 | } | 327 | } |
264 | 328 | ||
265 | static char *class_hotplug_name(struct kset *kset, struct kobject *kobj) | 329 | static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj) |
266 | { | 330 | { |
267 | struct class_device *class_dev = to_class_dev(kobj); | 331 | struct class_device *class_dev = to_class_dev(kobj); |
268 | 332 | ||
@@ -375,7 +439,6 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf) | |||
375 | { | 439 | { |
376 | return print_dev_t(buf, class_dev->devt); | 440 | return print_dev_t(buf, class_dev->devt); |
377 | } | 441 | } |
378 | static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL); | ||
379 | 442 | ||
380 | void class_device_initialize(struct class_device *class_dev) | 443 | void class_device_initialize(struct class_device *class_dev) |
381 | { | 444 | { |
@@ -412,7 +475,31 @@ int class_device_add(struct class_device *class_dev) | |||
412 | if ((error = kobject_add(&class_dev->kobj))) | 475 | if ((error = kobject_add(&class_dev->kobj))) |
413 | goto register_done; | 476 | goto register_done; |
414 | 477 | ||
415 | /* now take care of our own registration */ | 478 | /* add the needed attributes to this device */ |
479 | if (MAJOR(class_dev->devt)) { | ||
480 | struct class_device_attribute *attr; | ||
481 | attr = kmalloc(sizeof(*attr), GFP_KERNEL); | ||
482 | if (!attr) { | ||
483 | error = -ENOMEM; | ||
484 | kobject_del(&class_dev->kobj); | ||
485 | goto register_done; | ||
486 | } | ||
487 | memset(attr, sizeof(*attr), 0x00); | ||
488 | attr->attr.name = "dev"; | ||
489 | attr->attr.mode = S_IRUGO; | ||
490 | attr->attr.owner = parent->owner; | ||
491 | attr->show = show_dev; | ||
492 | attr->store = NULL; | ||
493 | class_device_create_file(class_dev, attr); | ||
494 | class_dev->devt_attr = attr; | ||
495 | } | ||
496 | |||
497 | class_device_add_attrs(class_dev); | ||
498 | if (class_dev->dev) | ||
499 | sysfs_create_link(&class_dev->kobj, | ||
500 | &class_dev->dev->kobj, "device"); | ||
501 | |||
502 | /* notify any interfaces this device is now here */ | ||
416 | if (parent) { | 503 | if (parent) { |
417 | down(&parent->sem); | 504 | down(&parent->sem); |
418 | list_add_tail(&class_dev->node, &parent->children); | 505 | list_add_tail(&class_dev->node, &parent->children); |
@@ -421,16 +508,8 @@ int class_device_add(struct class_device *class_dev) | |||
421 | class_intf->add(class_dev); | 508 | class_intf->add(class_dev); |
422 | up(&parent->sem); | 509 | up(&parent->sem); |
423 | } | 510 | } |
424 | |||
425 | if (MAJOR(class_dev->devt)) | ||
426 | class_device_create_file(class_dev, &class_device_attr_dev); | ||
427 | |||
428 | class_device_add_attrs(class_dev); | ||
429 | if (class_dev->dev) | ||
430 | sysfs_create_link(&class_dev->kobj, | ||
431 | &class_dev->dev->kobj, "device"); | ||
432 | |||
433 | kobject_hotplug(&class_dev->kobj, KOBJ_ADD); | 511 | kobject_hotplug(&class_dev->kobj, KOBJ_ADD); |
512 | |||
434 | register_done: | 513 | register_done: |
435 | if (error && parent) | 514 | if (error && parent) |
436 | class_put(parent); | 515 | class_put(parent); |
@@ -444,6 +523,58 @@ int class_device_register(struct class_device *class_dev) | |||
444 | return class_device_add(class_dev); | 523 | return class_device_add(class_dev); |
445 | } | 524 | } |
446 | 525 | ||
526 | /** | ||
527 | * class_device_create - creates a class device and registers it with sysfs | ||
528 | * @cs: pointer to the struct class that this device should be registered to. | ||
529 | * @dev: the dev_t for the char device to be added. | ||
530 | * @device: a pointer to a struct device that is assiociated with this class device. | ||
531 | * @fmt: string for the class device's name | ||
532 | * | ||
533 | * This function can be used by char device classes. A struct | ||
534 | * class_device will be created in sysfs, registered to the specified | ||
535 | * class. A "dev" file will be created, showing the dev_t for the | ||
536 | * device. The pointer to the struct class_device will be returned from | ||
537 | * the call. Any further sysfs files that might be required can be | ||
538 | * created using this pointer. | ||
539 | * | ||
540 | * Note: the struct class passed to this function must have previously | ||
541 | * been created with a call to class_create(). | ||
542 | */ | ||
543 | struct class_device *class_device_create(struct class *cls, dev_t devt, | ||
544 | struct device *device, char *fmt, ...) | ||
545 | { | ||
546 | va_list args; | ||
547 | struct class_device *class_dev = NULL; | ||
548 | int retval = -ENODEV; | ||
549 | |||
550 | if (cls == NULL || IS_ERR(cls)) | ||
551 | goto error; | ||
552 | |||
553 | class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL); | ||
554 | if (!class_dev) { | ||
555 | retval = -ENOMEM; | ||
556 | goto error; | ||
557 | } | ||
558 | memset(class_dev, 0x00, sizeof(struct class_device)); | ||
559 | |||
560 | class_dev->devt = devt; | ||
561 | class_dev->dev = device; | ||
562 | class_dev->class = cls; | ||
563 | |||
564 | va_start(args, fmt); | ||
565 | vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); | ||
566 | va_end(args); | ||
567 | retval = class_device_register(class_dev); | ||
568 | if (retval) | ||
569 | goto error; | ||
570 | |||
571 | return class_dev; | ||
572 | |||
573 | error: | ||
574 | kfree(class_dev); | ||
575 | return ERR_PTR(retval); | ||
576 | } | ||
577 | |||
447 | void class_device_del(struct class_device *class_dev) | 578 | void class_device_del(struct class_device *class_dev) |
448 | { | 579 | { |
449 | struct class * parent = class_dev->class; | 580 | struct class * parent = class_dev->class; |
@@ -460,6 +591,11 @@ void class_device_del(struct class_device *class_dev) | |||
460 | 591 | ||
461 | if (class_dev->dev) | 592 | if (class_dev->dev) |
462 | sysfs_remove_link(&class_dev->kobj, "device"); | 593 | sysfs_remove_link(&class_dev->kobj, "device"); |
594 | if (class_dev->devt_attr) { | ||
595 | class_device_remove_file(class_dev, class_dev->devt_attr); | ||
596 | kfree(class_dev->devt_attr); | ||
597 | class_dev->devt_attr = NULL; | ||
598 | } | ||
463 | class_device_remove_attrs(class_dev); | 599 | class_device_remove_attrs(class_dev); |
464 | 600 | ||
465 | kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE); | 601 | kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE); |
@@ -477,6 +613,32 @@ void class_device_unregister(struct class_device *class_dev) | |||
477 | class_device_put(class_dev); | 613 | class_device_put(class_dev); |
478 | } | 614 | } |
479 | 615 | ||
616 | /** | ||
617 | * class_device_destroy - removes a class device that was created with class_device_create() | ||
618 | * @cls: the pointer to the struct class that this device was registered * with. | ||
619 | * @dev: the dev_t of the device that was previously registered. | ||
620 | * | ||
621 | * This call unregisters and cleans up a class device that was created with a | ||
622 | * call to class_device_create() | ||
623 | */ | ||
624 | void class_device_destroy(struct class *cls, dev_t devt) | ||
625 | { | ||
626 | struct class_device *class_dev = NULL; | ||
627 | struct class_device *class_dev_tmp; | ||
628 | |||
629 | down(&cls->sem); | ||
630 | list_for_each_entry(class_dev_tmp, &cls->children, node) { | ||
631 | if (class_dev_tmp->devt == devt) { | ||
632 | class_dev = class_dev_tmp; | ||
633 | break; | ||
634 | } | ||
635 | } | ||
636 | up(&cls->sem); | ||
637 | |||
638 | if (class_dev) | ||
639 | class_device_unregister(class_dev); | ||
640 | } | ||
641 | |||
480 | int class_device_rename(struct class_device *class_dev, char *new_name) | 642 | int class_device_rename(struct class_device *class_dev, char *new_name) |
481 | { | 643 | { |
482 | int error = 0; | 644 | int error = 0; |
@@ -576,6 +738,8 @@ EXPORT_SYMBOL_GPL(class_register); | |||
576 | EXPORT_SYMBOL_GPL(class_unregister); | 738 | EXPORT_SYMBOL_GPL(class_unregister); |
577 | EXPORT_SYMBOL_GPL(class_get); | 739 | EXPORT_SYMBOL_GPL(class_get); |
578 | EXPORT_SYMBOL_GPL(class_put); | 740 | EXPORT_SYMBOL_GPL(class_put); |
741 | EXPORT_SYMBOL_GPL(class_create); | ||
742 | EXPORT_SYMBOL_GPL(class_destroy); | ||
579 | 743 | ||
580 | EXPORT_SYMBOL_GPL(class_device_register); | 744 | EXPORT_SYMBOL_GPL(class_device_register); |
581 | EXPORT_SYMBOL_GPL(class_device_unregister); | 745 | EXPORT_SYMBOL_GPL(class_device_unregister); |
@@ -584,6 +748,8 @@ EXPORT_SYMBOL_GPL(class_device_add); | |||
584 | EXPORT_SYMBOL_GPL(class_device_del); | 748 | EXPORT_SYMBOL_GPL(class_device_del); |
585 | EXPORT_SYMBOL_GPL(class_device_get); | 749 | EXPORT_SYMBOL_GPL(class_device_get); |
586 | EXPORT_SYMBOL_GPL(class_device_put); | 750 | EXPORT_SYMBOL_GPL(class_device_put); |
751 | EXPORT_SYMBOL_GPL(class_device_create); | ||
752 | EXPORT_SYMBOL_GPL(class_device_destroy); | ||
587 | EXPORT_SYMBOL_GPL(class_device_create_file); | 753 | EXPORT_SYMBOL_GPL(class_device_create_file); |
588 | EXPORT_SYMBOL_GPL(class_device_remove_file); | 754 | EXPORT_SYMBOL_GPL(class_device_remove_file); |
589 | EXPORT_SYMBOL_GPL(class_device_create_bin_file); | 755 | EXPORT_SYMBOL_GPL(class_device_create_bin_file); |
diff --git a/drivers/base/class_simple.c b/drivers/base/class_simple.c deleted file mode 100644 index 27699eb20a37..000000000000 --- a/drivers/base/class_simple.c +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /* | ||
2 | * class_simple.c - a "simple" interface for classes for simple char devices. | ||
3 | * | ||
4 | * Copyright (c) 2003-2004 Greg Kroah-Hartman <greg@kroah.com> | ||
5 | * Copyright (c) 2003-2004 IBM Corp. | ||
6 | * | ||
7 | * This file is released under the GPLv2 | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/err.h> | ||
14 | |||
15 | struct class_simple { | ||
16 | struct class class; | ||
17 | }; | ||
18 | #define to_class_simple(d) container_of(d, struct class_simple, class) | ||
19 | |||
20 | struct simple_dev { | ||
21 | struct list_head node; | ||
22 | struct class_device class_dev; | ||
23 | }; | ||
24 | #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) | ||
25 | |||
26 | static LIST_HEAD(simple_dev_list); | ||
27 | static DEFINE_SPINLOCK(simple_dev_list_lock); | ||
28 | |||
29 | static void release_simple_dev(struct class_device *class_dev) | ||
30 | { | ||
31 | struct simple_dev *s_dev = to_simple_dev(class_dev); | ||
32 | kfree(s_dev); | ||
33 | } | ||
34 | |||
35 | static void class_simple_release(struct class *class) | ||
36 | { | ||
37 | struct class_simple *cs = to_class_simple(class); | ||
38 | kfree(cs); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * class_simple_create - create a struct class_simple structure | ||
43 | * @owner: pointer to the module that is to "own" this struct class_simple | ||
44 | * @name: pointer to a string for the name of this class. | ||
45 | * | ||
46 | * This is used to create a struct class_simple pointer that can then be used | ||
47 | * in calls to class_simple_device_add(). This is used when you do not wish to | ||
48 | * create a full blown class support for a type of char devices. | ||
49 | * | ||
50 | * Note, the pointer created here is to be destroyed when finished by making a | ||
51 | * call to class_simple_destroy(). | ||
52 | */ | ||
53 | struct class_simple *class_simple_create(struct module *owner, char *name) | ||
54 | { | ||
55 | struct class_simple *cs; | ||
56 | int retval; | ||
57 | |||
58 | cs = kmalloc(sizeof(*cs), GFP_KERNEL); | ||
59 | if (!cs) { | ||
60 | retval = -ENOMEM; | ||
61 | goto error; | ||
62 | } | ||
63 | memset(cs, 0x00, sizeof(*cs)); | ||
64 | |||
65 | cs->class.name = name; | ||
66 | cs->class.class_release = class_simple_release; | ||
67 | cs->class.release = release_simple_dev; | ||
68 | |||
69 | retval = class_register(&cs->class); | ||
70 | if (retval) | ||
71 | goto error; | ||
72 | |||
73 | return cs; | ||
74 | |||
75 | error: | ||
76 | kfree(cs); | ||
77 | return ERR_PTR(retval); | ||
78 | } | ||
79 | EXPORT_SYMBOL(class_simple_create); | ||
80 | |||
81 | /** | ||
82 | * class_simple_destroy - destroys a struct class_simple structure | ||
83 | * @cs: pointer to the struct class_simple that is to be destroyed | ||
84 | * | ||
85 | * Note, the pointer to be destroyed must have been created with a call to | ||
86 | * class_simple_create(). | ||
87 | */ | ||
88 | void class_simple_destroy(struct class_simple *cs) | ||
89 | { | ||
90 | if ((cs == NULL) || (IS_ERR(cs))) | ||
91 | return; | ||
92 | |||
93 | class_unregister(&cs->class); | ||
94 | } | ||
95 | EXPORT_SYMBOL(class_simple_destroy); | ||
96 | |||
97 | /** | ||
98 | * class_simple_device_add - adds a class device to sysfs for a character driver | ||
99 | * @cs: pointer to the struct class_simple that this device should be registered to. | ||
100 | * @dev: the dev_t for the device to be added. | ||
101 | * @device: a pointer to a struct device that is assiociated with this class device. | ||
102 | * @fmt: string for the class device's name | ||
103 | * | ||
104 | * This function can be used by simple char device classes that do not | ||
105 | * implement their own class device registration. A struct class_device will | ||
106 | * be created in sysfs, registered to the specified class. A "dev" file will | ||
107 | * be created, showing the dev_t for the device. The pointer to the struct | ||
108 | * class_device will be returned from the call. Any further sysfs files that | ||
109 | * might be required can be created using this pointer. | ||
110 | * Note: the struct class_simple passed to this function must have previously been | ||
111 | * created with a call to class_simple_create(). | ||
112 | */ | ||
113 | struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...) | ||
114 | { | ||
115 | va_list args; | ||
116 | struct simple_dev *s_dev = NULL; | ||
117 | int retval; | ||
118 | |||
119 | if ((cs == NULL) || (IS_ERR(cs))) { | ||
120 | retval = -ENODEV; | ||
121 | goto error; | ||
122 | } | ||
123 | |||
124 | s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL); | ||
125 | if (!s_dev) { | ||
126 | retval = -ENOMEM; | ||
127 | goto error; | ||
128 | } | ||
129 | memset(s_dev, 0x00, sizeof(*s_dev)); | ||
130 | |||
131 | s_dev->class_dev.devt = dev; | ||
132 | s_dev->class_dev.dev = device; | ||
133 | s_dev->class_dev.class = &cs->class; | ||
134 | |||
135 | va_start(args, fmt); | ||
136 | vsnprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, fmt, args); | ||
137 | va_end(args); | ||
138 | retval = class_device_register(&s_dev->class_dev); | ||
139 | if (retval) | ||
140 | goto error; | ||
141 | |||
142 | spin_lock(&simple_dev_list_lock); | ||
143 | list_add(&s_dev->node, &simple_dev_list); | ||
144 | spin_unlock(&simple_dev_list_lock); | ||
145 | |||
146 | return &s_dev->class_dev; | ||
147 | |||
148 | error: | ||
149 | kfree(s_dev); | ||
150 | return ERR_PTR(retval); | ||
151 | } | ||
152 | EXPORT_SYMBOL(class_simple_device_add); | ||
153 | |||
154 | /** | ||
155 | * class_simple_set_hotplug - set the hotplug callback in the embedded struct class | ||
156 | * @cs: pointer to the struct class_simple to hold the pointer | ||
157 | * @hotplug: function pointer to the hotplug function | ||
158 | * | ||
159 | * Implement and set a hotplug function to add environment variables specific to this | ||
160 | * class on the hotplug event. | ||
161 | */ | ||
162 | int class_simple_set_hotplug(struct class_simple *cs, | ||
163 | int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size)) | ||
164 | { | ||
165 | if ((cs == NULL) || (IS_ERR(cs))) | ||
166 | return -ENODEV; | ||
167 | cs->class.hotplug = hotplug; | ||
168 | return 0; | ||
169 | } | ||
170 | EXPORT_SYMBOL(class_simple_set_hotplug); | ||
171 | |||
172 | /** | ||
173 | * class_simple_device_remove - removes a class device that was created with class_simple_device_add() | ||
174 | * @dev: the dev_t of the device that was previously registered. | ||
175 | * | ||
176 | * This call unregisters and cleans up a class device that was created with a | ||
177 | * call to class_device_simple_add() | ||
178 | */ | ||
179 | void class_simple_device_remove(dev_t dev) | ||
180 | { | ||
181 | struct simple_dev *s_dev = NULL; | ||
182 | int found = 0; | ||
183 | |||
184 | spin_lock(&simple_dev_list_lock); | ||
185 | list_for_each_entry(s_dev, &simple_dev_list, node) { | ||
186 | if (s_dev->class_dev.devt == dev) { | ||
187 | found = 1; | ||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | if (found) { | ||
192 | list_del(&s_dev->node); | ||
193 | spin_unlock(&simple_dev_list_lock); | ||
194 | class_device_unregister(&s_dev->class_dev); | ||
195 | } else { | ||
196 | spin_unlock(&simple_dev_list_lock); | ||
197 | } | ||
198 | } | ||
199 | EXPORT_SYMBOL(class_simple_device_remove); | ||
diff --git a/drivers/base/core.c b/drivers/base/core.c index fbc223486f81..86d79755fbfb 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -36,10 +36,10 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) | |||
36 | { | 36 | { |
37 | struct device_attribute * dev_attr = to_dev_attr(attr); | 37 | struct device_attribute * dev_attr = to_dev_attr(attr); |
38 | struct device * dev = to_dev(kobj); | 38 | struct device * dev = to_dev(kobj); |
39 | ssize_t ret = 0; | 39 | ssize_t ret = -EIO; |
40 | 40 | ||
41 | if (dev_attr->show) | 41 | if (dev_attr->show) |
42 | ret = dev_attr->show(dev, buf); | 42 | ret = dev_attr->show(dev, dev_attr, buf); |
43 | return ret; | 43 | return ret; |
44 | } | 44 | } |
45 | 45 | ||
@@ -49,10 +49,10 @@ dev_attr_store(struct kobject * kobj, struct attribute * attr, | |||
49 | { | 49 | { |
50 | struct device_attribute * dev_attr = to_dev_attr(attr); | 50 | struct device_attribute * dev_attr = to_dev_attr(attr); |
51 | struct device * dev = to_dev(kobj); | 51 | struct device * dev = to_dev(kobj); |
52 | ssize_t ret = 0; | 52 | ssize_t ret = -EIO; |
53 | 53 | ||
54 | if (dev_attr->store) | 54 | if (dev_attr->store) |
55 | ret = dev_attr->store(dev, buf, count); | 55 | ret = dev_attr->store(dev, dev_attr, buf, count); |
56 | return ret; | 56 | return ret; |
57 | } | 57 | } |
58 | 58 | ||
@@ -102,7 +102,7 @@ static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj) | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | static char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) | 105 | static const char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) |
106 | { | 106 | { |
107 | struct device *dev = to_dev(kobj); | 107 | struct device *dev = to_dev(kobj); |
108 | 108 | ||
@@ -207,11 +207,9 @@ void device_initialize(struct device *dev) | |||
207 | { | 207 | { |
208 | kobj_set_kset_s(dev, devices_subsys); | 208 | kobj_set_kset_s(dev, devices_subsys); |
209 | kobject_init(&dev->kobj); | 209 | kobject_init(&dev->kobj); |
210 | INIT_LIST_HEAD(&dev->node); | 210 | klist_init(&dev->klist_children); |
211 | INIT_LIST_HEAD(&dev->children); | ||
212 | INIT_LIST_HEAD(&dev->driver_list); | ||
213 | INIT_LIST_HEAD(&dev->bus_list); | ||
214 | INIT_LIST_HEAD(&dev->dma_pools); | 211 | INIT_LIST_HEAD(&dev->dma_pools); |
212 | init_MUTEX(&dev->sem); | ||
215 | } | 213 | } |
216 | 214 | ||
217 | /** | 215 | /** |
@@ -250,10 +248,8 @@ int device_add(struct device *dev) | |||
250 | goto PMError; | 248 | goto PMError; |
251 | if ((error = bus_add_device(dev))) | 249 | if ((error = bus_add_device(dev))) |
252 | goto BusError; | 250 | goto BusError; |
253 | down_write(&devices_subsys.rwsem); | ||
254 | if (parent) | 251 | if (parent) |
255 | list_add_tail(&dev->node, &parent->children); | 252 | klist_add_tail(&parent->klist_children, &dev->knode_parent); |
256 | up_write(&devices_subsys.rwsem); | ||
257 | 253 | ||
258 | /* notify platform of device entry */ | 254 | /* notify platform of device entry */ |
259 | if (platform_notify) | 255 | if (platform_notify) |
@@ -336,10 +332,8 @@ void device_del(struct device * dev) | |||
336 | { | 332 | { |
337 | struct device * parent = dev->parent; | 333 | struct device * parent = dev->parent; |
338 | 334 | ||
339 | down_write(&devices_subsys.rwsem); | ||
340 | if (parent) | 335 | if (parent) |
341 | list_del_init(&dev->node); | 336 | klist_remove(&dev->knode_parent); |
342 | up_write(&devices_subsys.rwsem); | ||
343 | 337 | ||
344 | /* Notify the platform of the removal, in case they | 338 | /* Notify the platform of the removal, in case they |
345 | * need to do anything... | 339 | * need to do anything... |
@@ -373,6 +367,12 @@ void device_unregister(struct device * dev) | |||
373 | } | 367 | } |
374 | 368 | ||
375 | 369 | ||
370 | static struct device * next_device(struct klist_iter * i) | ||
371 | { | ||
372 | struct klist_node * n = klist_next(i); | ||
373 | return n ? container_of(n, struct device, knode_parent) : NULL; | ||
374 | } | ||
375 | |||
376 | /** | 376 | /** |
377 | * device_for_each_child - device child iterator. | 377 | * device_for_each_child - device child iterator. |
378 | * @dev: parent struct device. | 378 | * @dev: parent struct device. |
@@ -385,39 +385,20 @@ void device_unregister(struct device * dev) | |||
385 | * We check the return of @fn each time. If it returns anything | 385 | * We check the return of @fn each time. If it returns anything |
386 | * other than 0, we break out and return that value. | 386 | * other than 0, we break out and return that value. |
387 | */ | 387 | */ |
388 | int device_for_each_child(struct device * dev, void * data, | 388 | int device_for_each_child(struct device * parent, void * data, |
389 | int (*fn)(struct device *, void *)) | 389 | int (*fn)(struct device *, void *)) |
390 | { | 390 | { |
391 | struct klist_iter i; | ||
391 | struct device * child; | 392 | struct device * child; |
392 | int error = 0; | 393 | int error = 0; |
393 | 394 | ||
394 | down_read(&devices_subsys.rwsem); | 395 | klist_iter_init(&parent->klist_children, &i); |
395 | list_for_each_entry(child, &dev->children, node) { | 396 | while ((child = next_device(&i)) && !error) |
396 | if((error = fn(child, data))) | 397 | error = fn(child, data); |
397 | break; | 398 | klist_iter_exit(&i); |
398 | } | ||
399 | up_read(&devices_subsys.rwsem); | ||
400 | return error; | 399 | return error; |
401 | } | 400 | } |
402 | 401 | ||
403 | /** | ||
404 | * device_find - locate device on a bus by name. | ||
405 | * @name: name of the device. | ||
406 | * @bus: bus to scan for the device. | ||
407 | * | ||
408 | * Call kset_find_obj() to iterate over list of devices on | ||
409 | * a bus to find device by name. Return device if found. | ||
410 | * | ||
411 | * Note that kset_find_obj increments device's reference count. | ||
412 | */ | ||
413 | struct device *device_find(const char *name, struct bus_type *bus) | ||
414 | { | ||
415 | struct kobject *k = kset_find_obj(&bus->devices, name); | ||
416 | if (k) | ||
417 | return to_dev(k); | ||
418 | return NULL; | ||
419 | } | ||
420 | |||
421 | int __init devices_init(void) | 402 | int __init devices_init(void) |
422 | { | 403 | { |
423 | return subsystem_register(&devices_subsys); | 404 | return subsystem_register(&devices_subsys); |
@@ -433,7 +414,6 @@ EXPORT_SYMBOL_GPL(device_del); | |||
433 | EXPORT_SYMBOL_GPL(device_unregister); | 414 | EXPORT_SYMBOL_GPL(device_unregister); |
434 | EXPORT_SYMBOL_GPL(get_device); | 415 | EXPORT_SYMBOL_GPL(get_device); |
435 | EXPORT_SYMBOL_GPL(put_device); | 416 | EXPORT_SYMBOL_GPL(put_device); |
436 | EXPORT_SYMBOL_GPL(device_find); | ||
437 | 417 | ||
438 | EXPORT_SYMBOL_GPL(device_create_file); | 418 | EXPORT_SYMBOL_GPL(device_create_file); |
439 | EXPORT_SYMBOL_GPL(device_remove_file); | 419 | EXPORT_SYMBOL_GPL(device_remove_file); |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c new file mode 100644 index 000000000000..6db3a789c54f --- /dev/null +++ b/drivers/base/dd.c | |||
@@ -0,0 +1,248 @@ | |||
1 | /* | ||
2 | * drivers/base/dd.c - The core device/driver interactions. | ||
3 | * | ||
4 | * This file contains the (sometimes tricky) code that controls the | ||
5 | * interactions between devices and drivers, which primarily includes | ||
6 | * driver binding and unbinding. | ||
7 | * | ||
8 | * All of this code used to exist in drivers/base/bus.c, but was | ||
9 | * relocated to here in the name of compartmentalization (since it wasn't | ||
10 | * strictly code just for the 'struct bus_type'. | ||
11 | * | ||
12 | * Copyright (c) 2002-5 Patrick Mochel | ||
13 | * Copyright (c) 2002-3 Open Source Development Labs | ||
14 | * | ||
15 | * This file is released under the GPLv2 | ||
16 | */ | ||
17 | |||
18 | #include <linux/device.h> | ||
19 | #include <linux/module.h> | ||
20 | |||
21 | #include "base.h" | ||
22 | #include "power/power.h" | ||
23 | |||
24 | #define to_drv(node) container_of(node, struct device_driver, kobj.entry) | ||
25 | |||
26 | |||
27 | /** | ||
28 | * device_bind_driver - bind a driver to one device. | ||
29 | * @dev: device. | ||
30 | * | ||
31 | * Allow manual attachment of a driver to a device. | ||
32 | * Caller must have already set @dev->driver. | ||
33 | * | ||
34 | * Note that this does not modify the bus reference count | ||
35 | * nor take the bus's rwsem. Please verify those are accounted | ||
36 | * for before calling this. (It is ok to call with no other effort | ||
37 | * from a driver's probe() method.) | ||
38 | * | ||
39 | * This function must be called with @dev->sem held. | ||
40 | */ | ||
41 | void device_bind_driver(struct device * dev) | ||
42 | { | ||
43 | pr_debug("bound device '%s' to driver '%s'\n", | ||
44 | dev->bus_id, dev->driver->name); | ||
45 | klist_add_tail(&dev->driver->klist_devices, &dev->knode_driver); | ||
46 | sysfs_create_link(&dev->driver->kobj, &dev->kobj, | ||
47 | kobject_name(&dev->kobj)); | ||
48 | sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver"); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * driver_probe_device - attempt to bind device & driver. | ||
53 | * @drv: driver. | ||
54 | * @dev: device. | ||
55 | * | ||
56 | * First, we call the bus's match function, if one present, which | ||
57 | * should compare the device IDs the driver supports with the | ||
58 | * device IDs of the device. Note we don't do this ourselves | ||
59 | * because we don't know the format of the ID structures, nor what | ||
60 | * is to be considered a match and what is not. | ||
61 | * | ||
62 | * | ||
63 | * This function returns 1 if a match is found, an error if one | ||
64 | * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise. | ||
65 | * | ||
66 | * This function must be called with @dev->sem held. | ||
67 | */ | ||
68 | static int driver_probe_device(struct device_driver * drv, struct device * dev) | ||
69 | { | ||
70 | int ret = 0; | ||
71 | |||
72 | if (drv->bus->match && !drv->bus->match(dev, drv)) | ||
73 | goto Done; | ||
74 | |||
75 | pr_debug("%s: Matched Device %s with Driver %s\n", | ||
76 | drv->bus->name, dev->bus_id, drv->name); | ||
77 | dev->driver = drv; | ||
78 | if (drv->probe) { | ||
79 | ret = drv->probe(dev); | ||
80 | if (ret) { | ||
81 | dev->driver = NULL; | ||
82 | goto ProbeFailed; | ||
83 | } | ||
84 | } | ||
85 | device_bind_driver(dev); | ||
86 | ret = 1; | ||
87 | pr_debug("%s: Bound Device %s to Driver %s\n", | ||
88 | drv->bus->name, dev->bus_id, drv->name); | ||
89 | goto Done; | ||
90 | |||
91 | ProbeFailed: | ||
92 | if (ret == -ENODEV || ret == -ENXIO) { | ||
93 | /* Driver matched, but didn't support device | ||
94 | * or device not found. | ||
95 | * Not an error; keep going. | ||
96 | */ | ||
97 | ret = 0; | ||
98 | } else { | ||
99 | /* driver matched but the probe failed */ | ||
100 | printk(KERN_WARNING | ||
101 | "%s: probe of %s failed with error %d\n", | ||
102 | drv->name, dev->bus_id, ret); | ||
103 | } | ||
104 | Done: | ||
105 | return ret; | ||
106 | } | ||
107 | |||
108 | static int __device_attach(struct device_driver * drv, void * data) | ||
109 | { | ||
110 | struct device * dev = data; | ||
111 | return driver_probe_device(drv, dev); | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * device_attach - try to attach device to a driver. | ||
116 | * @dev: device. | ||
117 | * | ||
118 | * Walk the list of drivers that the bus has and call | ||
119 | * driver_probe_device() for each pair. If a compatible | ||
120 | * pair is found, break out and return. | ||
121 | * | ||
122 | * Returns 1 if the device was bound to a driver; | ||
123 | * 0 if no matching device was found; error code otherwise. | ||
124 | */ | ||
125 | int device_attach(struct device * dev) | ||
126 | { | ||
127 | int ret = 0; | ||
128 | |||
129 | down(&dev->sem); | ||
130 | if (dev->driver) { | ||
131 | device_bind_driver(dev); | ||
132 | ret = 1; | ||
133 | } else | ||
134 | ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); | ||
135 | up(&dev->sem); | ||
136 | return ret; | ||
137 | } | ||
138 | |||
139 | static int __driver_attach(struct device * dev, void * data) | ||
140 | { | ||
141 | struct device_driver * drv = data; | ||
142 | |||
143 | /* | ||
144 | * Lock device and try to bind to it. We drop the error | ||
145 | * here and always return 0, because we need to keep trying | ||
146 | * to bind to devices and some drivers will return an error | ||
147 | * simply if it didn't support the device. | ||
148 | * | ||
149 | * driver_probe_device() will spit a warning if there | ||
150 | * is an error. | ||
151 | */ | ||
152 | |||
153 | down(&dev->sem); | ||
154 | if (!dev->driver) | ||
155 | driver_probe_device(drv, dev); | ||
156 | up(&dev->sem); | ||
157 | |||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * driver_attach - try to bind driver to devices. | ||
164 | * @drv: driver. | ||
165 | * | ||
166 | * Walk the list of devices that the bus has on it and try to | ||
167 | * match the driver with each one. If driver_probe_device() | ||
168 | * returns 0 and the @dev->driver is set, we've found a | ||
169 | * compatible pair. | ||
170 | */ | ||
171 | void driver_attach(struct device_driver * drv) | ||
172 | { | ||
173 | bus_for_each_dev(drv->bus, NULL, drv, __driver_attach); | ||
174 | } | ||
175 | |||
176 | /** | ||
177 | * device_release_driver - manually detach device from driver. | ||
178 | * @dev: device. | ||
179 | * | ||
180 | * Manually detach device from driver. | ||
181 | * | ||
182 | * __device_release_driver() must be called with @dev->sem held. | ||
183 | */ | ||
184 | |||
185 | static void __device_release_driver(struct device * dev) | ||
186 | { | ||
187 | struct device_driver * drv; | ||
188 | |||
189 | drv = dev->driver; | ||
190 | if (drv) { | ||
191 | get_driver(drv); | ||
192 | sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); | ||
193 | sysfs_remove_link(&dev->kobj, "driver"); | ||
194 | klist_remove(&dev->knode_driver); | ||
195 | |||
196 | if (drv->remove) | ||
197 | drv->remove(dev); | ||
198 | dev->driver = NULL; | ||
199 | put_driver(drv); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | void device_release_driver(struct device * dev) | ||
204 | { | ||
205 | /* | ||
206 | * If anyone calls device_release_driver() recursively from | ||
207 | * within their ->remove callback for the same device, they | ||
208 | * will deadlock right here. | ||
209 | */ | ||
210 | down(&dev->sem); | ||
211 | __device_release_driver(dev); | ||
212 | up(&dev->sem); | ||
213 | } | ||
214 | |||
215 | |||
216 | /** | ||
217 | * driver_detach - detach driver from all devices it controls. | ||
218 | * @drv: driver. | ||
219 | */ | ||
220 | void driver_detach(struct device_driver * drv) | ||
221 | { | ||
222 | struct device * dev; | ||
223 | |||
224 | for (;;) { | ||
225 | spin_lock_irq(&drv->klist_devices.k_lock); | ||
226 | if (list_empty(&drv->klist_devices.k_list)) { | ||
227 | spin_unlock_irq(&drv->klist_devices.k_lock); | ||
228 | break; | ||
229 | } | ||
230 | dev = list_entry(drv->klist_devices.k_list.prev, | ||
231 | struct device, knode_driver.n_node); | ||
232 | get_device(dev); | ||
233 | spin_unlock_irq(&drv->klist_devices.k_lock); | ||
234 | |||
235 | down(&dev->sem); | ||
236 | if (dev->driver == drv) | ||
237 | __device_release_driver(dev); | ||
238 | up(&dev->sem); | ||
239 | put_device(dev); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | |||
244 | EXPORT_SYMBOL_GPL(device_bind_driver); | ||
245 | EXPORT_SYMBOL_GPL(device_release_driver); | ||
246 | EXPORT_SYMBOL_GPL(device_attach); | ||
247 | EXPORT_SYMBOL_GPL(driver_attach); | ||
248 | |||
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index f48833df61a2..c4aebf2f522d 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -41,7 +41,7 @@ struct dma_page { /* cacheable header for 'allocation' bytes */ | |||
41 | static DECLARE_MUTEX (pools_lock); | 41 | static DECLARE_MUTEX (pools_lock); |
42 | 42 | ||
43 | static ssize_t | 43 | static ssize_t |
44 | show_pools (struct device *dev, char *buf) | 44 | show_pools (struct device *dev, struct device_attribute *attr, char *buf) |
45 | { | 45 | { |
46 | unsigned temp; | 46 | unsigned temp; |
47 | unsigned size; | 47 | unsigned size; |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 3b269f7e5213..1b645886e9eb 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -18,6 +18,43 @@ | |||
18 | #define to_dev(node) container_of(node, struct device, driver_list) | 18 | #define to_dev(node) container_of(node, struct device, driver_list) |
19 | #define to_drv(obj) container_of(obj, struct device_driver, kobj) | 19 | #define to_drv(obj) container_of(obj, struct device_driver, kobj) |
20 | 20 | ||
21 | |||
22 | static struct device * next_device(struct klist_iter * i) | ||
23 | { | ||
24 | struct klist_node * n = klist_next(i); | ||
25 | return n ? container_of(n, struct device, knode_driver) : NULL; | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * driver_for_each_device - Iterator for devices bound to a driver. | ||
30 | * @drv: Driver we're iterating. | ||
31 | * @data: Data to pass to the callback. | ||
32 | * @fn: Function to call for each device. | ||
33 | * | ||
34 | * Iterate over the @drv's list of devices calling @fn for each one. | ||
35 | */ | ||
36 | |||
37 | int driver_for_each_device(struct device_driver * drv, struct device * start, | ||
38 | void * data, int (*fn)(struct device *, void *)) | ||
39 | { | ||
40 | struct klist_iter i; | ||
41 | struct device * dev; | ||
42 | int error = 0; | ||
43 | |||
44 | if (!drv) | ||
45 | return -EINVAL; | ||
46 | |||
47 | klist_iter_init_node(&drv->klist_devices, &i, | ||
48 | start ? &start->knode_driver : NULL); | ||
49 | while ((dev = next_device(&i)) && !error) | ||
50 | error = fn(dev, data); | ||
51 | klist_iter_exit(&i); | ||
52 | return error; | ||
53 | } | ||
54 | |||
55 | EXPORT_SYMBOL_GPL(driver_for_each_device); | ||
56 | |||
57 | |||
21 | /** | 58 | /** |
22 | * driver_create_file - create sysfs file for driver. | 59 | * driver_create_file - create sysfs file for driver. |
23 | * @drv: driver. | 60 | * @drv: driver. |
@@ -85,7 +122,7 @@ void put_driver(struct device_driver * drv) | |||
85 | */ | 122 | */ |
86 | int driver_register(struct device_driver * drv) | 123 | int driver_register(struct device_driver * drv) |
87 | { | 124 | { |
88 | INIT_LIST_HEAD(&drv->devices); | 125 | klist_init(&drv->klist_devices); |
89 | init_completion(&drv->unloaded); | 126 | init_completion(&drv->unloaded); |
90 | return bus_add_driver(drv); | 127 | return bus_add_driver(drv); |
91 | } | 128 | } |
diff --git a/drivers/base/node.c b/drivers/base/node.c index 583d57ec49a8..5d4517ccc422 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -136,7 +136,7 @@ static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); | |||
136 | * | 136 | * |
137 | * Initialize and register the node device. | 137 | * Initialize and register the node device. |
138 | */ | 138 | */ |
139 | int __init register_node(struct node *node, int num, struct node *parent) | 139 | int register_node(struct node *node, int num, struct node *parent) |
140 | { | 140 | { |
141 | int error; | 141 | int error; |
142 | 142 | ||
@@ -153,8 +153,24 @@ int __init register_node(struct node *node, int num, struct node *parent) | |||
153 | return error; | 153 | return error; |
154 | } | 154 | } |
155 | 155 | ||
156 | /** | ||
157 | * unregister_node - unregister a node device | ||
158 | * @node: node going away | ||
159 | * | ||
160 | * Unregisters a node device @node. All the devices on the node must be | ||
161 | * unregistered before calling this function. | ||
162 | */ | ||
163 | void unregister_node(struct node *node) | ||
164 | { | ||
165 | sysdev_remove_file(&node->sysdev, &attr_cpumap); | ||
166 | sysdev_remove_file(&node->sysdev, &attr_meminfo); | ||
167 | sysdev_remove_file(&node->sysdev, &attr_numastat); | ||
168 | sysdev_remove_file(&node->sysdev, &attr_distance); | ||
169 | |||
170 | sysdev_unregister(&node->sysdev); | ||
171 | } | ||
156 | 172 | ||
157 | int __init register_node_type(void) | 173 | static int __init register_node_type(void) |
158 | { | 174 | { |
159 | return sysdev_class_register(&node_class); | 175 | return sysdev_class_register(&node_class); |
160 | } | 176 | } |
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index 26468971ef5a..bdd96b03b885 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c | |||
@@ -22,6 +22,9 @@ extern int sysdev_resume(void); | |||
22 | 22 | ||
23 | int resume_device(struct device * dev) | 23 | int resume_device(struct device * dev) |
24 | { | 24 | { |
25 | int error = 0; | ||
26 | |||
27 | down(&dev->sem); | ||
25 | if (dev->power.pm_parent | 28 | if (dev->power.pm_parent |
26 | && dev->power.pm_parent->power.power_state) { | 29 | && dev->power.pm_parent->power.power_state) { |
27 | dev_err(dev, "PM: resume from %d, parent %s still %d\n", | 30 | dev_err(dev, "PM: resume from %d, parent %s still %d\n", |
@@ -31,9 +34,10 @@ int resume_device(struct device * dev) | |||
31 | } | 34 | } |
32 | if (dev->bus && dev->bus->resume) { | 35 | if (dev->bus && dev->bus->resume) { |
33 | dev_dbg(dev,"resuming\n"); | 36 | dev_dbg(dev,"resuming\n"); |
34 | return dev->bus->resume(dev); | 37 | error = dev->bus->resume(dev); |
35 | } | 38 | } |
36 | return 0; | 39 | up(&dev->sem); |
40 | return error; | ||
37 | } | 41 | } |
38 | 42 | ||
39 | 43 | ||
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 0ec44ef840be..2ccee3763acf 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c | |||
@@ -39,6 +39,7 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
39 | { | 39 | { |
40 | int error = 0; | 40 | int error = 0; |
41 | 41 | ||
42 | down(&dev->sem); | ||
42 | if (dev->power.power_state) { | 43 | if (dev->power.power_state) { |
43 | dev_dbg(dev, "PM: suspend %d-->%d\n", | 44 | dev_dbg(dev, "PM: suspend %d-->%d\n", |
44 | dev->power.power_state, state); | 45 | dev->power.power_state, state); |
@@ -58,7 +59,7 @@ int suspend_device(struct device * dev, pm_message_t state) | |||
58 | dev_dbg(dev, "suspending\n"); | 59 | dev_dbg(dev, "suspending\n"); |
59 | error = dev->bus->suspend(dev, state); | 60 | error = dev->bus->suspend(dev, state); |
60 | } | 61 | } |
61 | 62 | up(&dev->sem); | |
62 | return error; | 63 | return error; |
63 | } | 64 | } |
64 | 65 | ||
@@ -113,8 +114,19 @@ int device_suspend(pm_message_t state) | |||
113 | put_device(dev); | 114 | put_device(dev); |
114 | } | 115 | } |
115 | up(&dpm_list_sem); | 116 | up(&dpm_list_sem); |
116 | if (error) | 117 | if (error) { |
118 | /* we failed... before resuming, bring back devices from | ||
119 | * dpm_off_irq list back to main dpm_off list, we do want | ||
120 | * to call resume() on them, in case they partially suspended | ||
121 | * despite returning -EAGAIN | ||
122 | */ | ||
123 | while (!list_empty(&dpm_off_irq)) { | ||
124 | struct list_head * entry = dpm_off_irq.next; | ||
125 | list_del(entry); | ||
126 | list_add(entry, &dpm_off); | ||
127 | } | ||
117 | dpm_resume(); | 128 | dpm_resume(); |
129 | } | ||
118 | up(&dpm_sem); | 130 | up(&dpm_sem); |
119 | return error; | 131 | return error; |
120 | } | 132 | } |
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 6ac96349a8e8..f82b3df9545f 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -24,12 +24,12 @@ | |||
24 | * low-power state. | 24 | * low-power state. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | static ssize_t state_show(struct device * dev, char * buf) | 27 | static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) |
28 | { | 28 | { |
29 | return sprintf(buf, "%u\n", dev->power.power_state); | 29 | return sprintf(buf, "%u\n", dev->power.power_state); |
30 | } | 30 | } |
31 | 31 | ||
32 | static ssize_t state_store(struct device * dev, const char * buf, size_t n) | 32 | static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) |
33 | { | 33 | { |
34 | u32 state; | 34 | u32 state; |
35 | char * rest; | 35 | char * rest; |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 9102e3756f95..f37a13de804a 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -37,7 +37,7 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer) | |||
37 | 37 | ||
38 | if (sysdev_attr->show) | 38 | if (sysdev_attr->show) |
39 | return sysdev_attr->show(sysdev, buffer); | 39 | return sysdev_attr->show(sysdev, buffer); |
40 | return 0; | 40 | return -EIO; |
41 | } | 41 | } |
42 | 42 | ||
43 | 43 | ||
@@ -50,7 +50,7 @@ sysdev_store(struct kobject * kobj, struct attribute * attr, | |||
50 | 50 | ||
51 | if (sysdev_attr->store) | 51 | if (sysdev_attr->store) |
52 | return sysdev_attr->store(sysdev, buffer, count); | 52 | return sysdev_attr->store(sysdev, buffer, count); |
53 | return 0; | 53 | return -EIO; |
54 | } | 54 | } |
55 | 55 | ||
56 | static struct sysfs_ops sysfs_ops = { | 56 | static struct sysfs_ops sysfs_ops = { |
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 14aeca3e2e8c..45a243096187 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -36,7 +36,7 @@ static int emsgs_head_idx, emsgs_tail_idx; | |||
36 | static struct semaphore emsgs_sema; | 36 | static struct semaphore emsgs_sema; |
37 | static spinlock_t emsgs_lock; | 37 | static spinlock_t emsgs_lock; |
38 | static int nblocked_emsgs_readers; | 38 | static int nblocked_emsgs_readers; |
39 | static struct class_simple *aoe_class; | 39 | static struct class *aoe_class; |
40 | static struct aoe_chardev chardevs[] = { | 40 | static struct aoe_chardev chardevs[] = { |
41 | { MINOR_ERR, "err" }, | 41 | { MINOR_ERR, "err" }, |
42 | { MINOR_DISCOVER, "discover" }, | 42 | { MINOR_DISCOVER, "discover" }, |
@@ -218,13 +218,13 @@ aoechr_init(void) | |||
218 | } | 218 | } |
219 | sema_init(&emsgs_sema, 0); | 219 | sema_init(&emsgs_sema, 0); |
220 | spin_lock_init(&emsgs_lock); | 220 | spin_lock_init(&emsgs_lock); |
221 | aoe_class = class_simple_create(THIS_MODULE, "aoe"); | 221 | aoe_class = class_create(THIS_MODULE, "aoe"); |
222 | if (IS_ERR(aoe_class)) { | 222 | if (IS_ERR(aoe_class)) { |
223 | unregister_chrdev(AOE_MAJOR, "aoechr"); | 223 | unregister_chrdev(AOE_MAJOR, "aoechr"); |
224 | return PTR_ERR(aoe_class); | 224 | return PTR_ERR(aoe_class); |
225 | } | 225 | } |
226 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 226 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
227 | class_simple_device_add(aoe_class, | 227 | class_device_create(aoe_class, |
228 | MKDEV(AOE_MAJOR, chardevs[i].minor), | 228 | MKDEV(AOE_MAJOR, chardevs[i].minor), |
229 | NULL, chardevs[i].name); | 229 | NULL, chardevs[i].name); |
230 | 230 | ||
@@ -237,8 +237,8 @@ aoechr_exit(void) | |||
237 | int i; | 237 | int i; |
238 | 238 | ||
239 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 239 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
240 | class_simple_device_remove(MKDEV(AOE_MAJOR, chardevs[i].minor)); | 240 | class_device_destroy(aoe_class, MKDEV(AOE_MAJOR, chardevs[i].minor)); |
241 | class_simple_destroy(aoe_class); | 241 | class_destroy(aoe_class); |
242 | unregister_chrdev(AOE_MAJOR, "aoechr"); | 242 | unregister_chrdev(AOE_MAJOR, "aoechr"); |
243 | } | 243 | } |
244 | 244 | ||
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index a9575bb58a5e..638db06de2be 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c | |||
@@ -2044,7 +2044,7 @@ as_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
2044 | struct as_fs_entry *entry = to_as(attr); | 2044 | struct as_fs_entry *entry = to_as(attr); |
2045 | 2045 | ||
2046 | if (!entry->show) | 2046 | if (!entry->show) |
2047 | return 0; | 2047 | return -EIO; |
2048 | 2048 | ||
2049 | return entry->show(e->elevator_data, page); | 2049 | return entry->show(e->elevator_data, page); |
2050 | } | 2050 | } |
@@ -2057,7 +2057,7 @@ as_attr_store(struct kobject *kobj, struct attribute *attr, | |||
2057 | struct as_fs_entry *entry = to_as(attr); | 2057 | struct as_fs_entry *entry = to_as(attr); |
2058 | 2058 | ||
2059 | if (!entry->store) | 2059 | if (!entry->store) |
2060 | return -EINVAL; | 2060 | return -EIO; |
2061 | 2061 | ||
2062 | return entry->store(e->elevator_data, page, length); | 2062 | return entry->store(e->elevator_data, page, length); |
2063 | } | 2063 | } |
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index 2210bacad56a..3ac47dde64da 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c | |||
@@ -1775,7 +1775,7 @@ cfq_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
1775 | struct cfq_fs_entry *entry = to_cfq(attr); | 1775 | struct cfq_fs_entry *entry = to_cfq(attr); |
1776 | 1776 | ||
1777 | if (!entry->show) | 1777 | if (!entry->show) |
1778 | return 0; | 1778 | return -EIO; |
1779 | 1779 | ||
1780 | return entry->show(e->elevator_data, page); | 1780 | return entry->show(e->elevator_data, page); |
1781 | } | 1781 | } |
@@ -1788,7 +1788,7 @@ cfq_attr_store(struct kobject *kobj, struct attribute *attr, | |||
1788 | struct cfq_fs_entry *entry = to_cfq(attr); | 1788 | struct cfq_fs_entry *entry = to_cfq(attr); |
1789 | 1789 | ||
1790 | if (!entry->store) | 1790 | if (!entry->store) |
1791 | return -EINVAL; | 1791 | return -EIO; |
1792 | 1792 | ||
1793 | return entry->store(e->elevator_data, page, length); | 1793 | return entry->store(e->elevator_data, page, length); |
1794 | } | 1794 | } |
diff --git a/drivers/block/deadline-iosched.c b/drivers/block/deadline-iosched.c index d63d34c671f7..7f79f3dd0165 100644 --- a/drivers/block/deadline-iosched.c +++ b/drivers/block/deadline-iosched.c | |||
@@ -886,7 +886,7 @@ deadline_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
886 | struct deadline_fs_entry *entry = to_deadline(attr); | 886 | struct deadline_fs_entry *entry = to_deadline(attr); |
887 | 887 | ||
888 | if (!entry->show) | 888 | if (!entry->show) |
889 | return 0; | 889 | return -EIO; |
890 | 890 | ||
891 | return entry->show(e->elevator_data, page); | 891 | return entry->show(e->elevator_data, page); |
892 | } | 892 | } |
@@ -899,7 +899,7 @@ deadline_attr_store(struct kobject *kobj, struct attribute *attr, | |||
899 | struct deadline_fs_entry *entry = to_deadline(attr); | 899 | struct deadline_fs_entry *entry = to_deadline(attr); |
900 | 900 | ||
901 | if (!entry->store) | 901 | if (!entry->store) |
902 | return -EINVAL; | 902 | return -EIO; |
903 | 903 | ||
904 | return entry->store(e->elevator_data, page, length); | 904 | return entry->store(e->elevator_data, page, length); |
905 | } | 905 | } |
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 8bbe01d4b487..53f7d846b747 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c | |||
@@ -322,7 +322,7 @@ static ssize_t disk_attr_show(struct kobject *kobj, struct attribute *attr, | |||
322 | struct gendisk *disk = to_disk(kobj); | 322 | struct gendisk *disk = to_disk(kobj); |
323 | struct disk_attribute *disk_attr = | 323 | struct disk_attribute *disk_attr = |
324 | container_of(attr,struct disk_attribute,attr); | 324 | container_of(attr,struct disk_attribute,attr); |
325 | ssize_t ret = 0; | 325 | ssize_t ret = -EIO; |
326 | 326 | ||
327 | if (disk_attr->show) | 327 | if (disk_attr->show) |
328 | ret = disk_attr->show(disk,page); | 328 | ret = disk_attr->show(disk,page); |
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index f20eba22b14b..81fe3a0c1fe7 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -3574,7 +3574,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
3574 | 3574 | ||
3575 | q = container_of(kobj, struct request_queue, kobj); | 3575 | q = container_of(kobj, struct request_queue, kobj); |
3576 | if (!entry->show) | 3576 | if (!entry->show) |
3577 | return 0; | 3577 | return -EIO; |
3578 | 3578 | ||
3579 | return entry->show(q, page); | 3579 | return entry->show(q, page); |
3580 | } | 3580 | } |
@@ -3588,7 +3588,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr, | |||
3588 | 3588 | ||
3589 | q = container_of(kobj, struct request_queue, kobj); | 3589 | q = container_of(kobj, struct request_queue, kobj); |
3590 | if (!entry->store) | 3590 | if (!entry->store) |
3591 | return -EINVAL; | 3591 | return -EIO; |
3592 | 3592 | ||
3593 | return entry->store(q, page, length); | 3593 | return entry->store(q, page, length); |
3594 | } | 3594 | } |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index dbeb107bb971..84d8e291ed96 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -222,7 +222,7 @@ static int pg_identify(struct pg *dev, int log); | |||
222 | 222 | ||
223 | static char pg_scratch[512]; /* scratch block buffer */ | 223 | static char pg_scratch[512]; /* scratch block buffer */ |
224 | 224 | ||
225 | static struct class_simple *pg_class; | 225 | static struct class *pg_class; |
226 | 226 | ||
227 | /* kernel glue structures */ | 227 | /* kernel glue structures */ |
228 | 228 | ||
@@ -666,7 +666,7 @@ static int __init pg_init(void) | |||
666 | err = -1; | 666 | err = -1; |
667 | goto out; | 667 | goto out; |
668 | } | 668 | } |
669 | pg_class = class_simple_create(THIS_MODULE, "pg"); | 669 | pg_class = class_create(THIS_MODULE, "pg"); |
670 | if (IS_ERR(pg_class)) { | 670 | if (IS_ERR(pg_class)) { |
671 | err = PTR_ERR(pg_class); | 671 | err = PTR_ERR(pg_class); |
672 | goto out_chrdev; | 672 | goto out_chrdev; |
@@ -675,7 +675,7 @@ static int __init pg_init(void) | |||
675 | for (unit = 0; unit < PG_UNITS; unit++) { | 675 | for (unit = 0; unit < PG_UNITS; unit++) { |
676 | struct pg *dev = &devices[unit]; | 676 | struct pg *dev = &devices[unit]; |
677 | if (dev->present) { | 677 | if (dev->present) { |
678 | class_simple_device_add(pg_class, MKDEV(major, unit), | 678 | class_device_create(pg_class, MKDEV(major, unit), |
679 | NULL, "pg%u", unit); | 679 | NULL, "pg%u", unit); |
680 | err = devfs_mk_cdev(MKDEV(major, unit), | 680 | err = devfs_mk_cdev(MKDEV(major, unit), |
681 | S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", | 681 | S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", |
@@ -688,8 +688,8 @@ static int __init pg_init(void) | |||
688 | goto out; | 688 | goto out; |
689 | 689 | ||
690 | out_class: | 690 | out_class: |
691 | class_simple_device_remove(MKDEV(major, unit)); | 691 | class_device_destroy(pg_class, MKDEV(major, unit)); |
692 | class_simple_destroy(pg_class); | 692 | class_destroy(pg_class); |
693 | out_chrdev: | 693 | out_chrdev: |
694 | unregister_chrdev(major, "pg"); | 694 | unregister_chrdev(major, "pg"); |
695 | out: | 695 | out: |
@@ -703,11 +703,11 @@ static void __exit pg_exit(void) | |||
703 | for (unit = 0; unit < PG_UNITS; unit++) { | 703 | for (unit = 0; unit < PG_UNITS; unit++) { |
704 | struct pg *dev = &devices[unit]; | 704 | struct pg *dev = &devices[unit]; |
705 | if (dev->present) { | 705 | if (dev->present) { |
706 | class_simple_device_remove(MKDEV(major, unit)); | 706 | class_device_destroy(pg_class, MKDEV(major, unit)); |
707 | devfs_remove("pg/%u", unit); | 707 | devfs_remove("pg/%u", unit); |
708 | } | 708 | } |
709 | } | 709 | } |
710 | class_simple_destroy(pg_class); | 710 | class_destroy(pg_class); |
711 | devfs_remove("pg"); | 711 | devfs_remove("pg"); |
712 | unregister_chrdev(major, name); | 712 | unregister_chrdev(major, name); |
713 | 713 | ||
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 8fbd6922fe0d..5fe8ee86f095 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c | |||
@@ -242,7 +242,7 @@ static struct file_operations pt_fops = { | |||
242 | }; | 242 | }; |
243 | 243 | ||
244 | /* sysfs class support */ | 244 | /* sysfs class support */ |
245 | static struct class_simple *pt_class; | 245 | static struct class *pt_class; |
246 | 246 | ||
247 | static inline int status_reg(struct pi_adapter *pi) | 247 | static inline int status_reg(struct pi_adapter *pi) |
248 | { | 248 | { |
@@ -963,7 +963,7 @@ static int __init pt_init(void) | |||
963 | err = -1; | 963 | err = -1; |
964 | goto out; | 964 | goto out; |
965 | } | 965 | } |
966 | pt_class = class_simple_create(THIS_MODULE, "pt"); | 966 | pt_class = class_create(THIS_MODULE, "pt"); |
967 | if (IS_ERR(pt_class)) { | 967 | if (IS_ERR(pt_class)) { |
968 | err = PTR_ERR(pt_class); | 968 | err = PTR_ERR(pt_class); |
969 | goto out_chrdev; | 969 | goto out_chrdev; |
@@ -972,29 +972,29 @@ static int __init pt_init(void) | |||
972 | devfs_mk_dir("pt"); | 972 | devfs_mk_dir("pt"); |
973 | for (unit = 0; unit < PT_UNITS; unit++) | 973 | for (unit = 0; unit < PT_UNITS; unit++) |
974 | if (pt[unit].present) { | 974 | if (pt[unit].present) { |
975 | class_simple_device_add(pt_class, MKDEV(major, unit), | 975 | class_device_create(pt_class, MKDEV(major, unit), |
976 | NULL, "pt%d", unit); | 976 | NULL, "pt%d", unit); |
977 | err = devfs_mk_cdev(MKDEV(major, unit), | 977 | err = devfs_mk_cdev(MKDEV(major, unit), |
978 | S_IFCHR | S_IRUSR | S_IWUSR, | 978 | S_IFCHR | S_IRUSR | S_IWUSR, |
979 | "pt/%d", unit); | 979 | "pt/%d", unit); |
980 | if (err) { | 980 | if (err) { |
981 | class_simple_device_remove(MKDEV(major, unit)); | 981 | class_device_destroy(pt_class, MKDEV(major, unit)); |
982 | goto out_class; | 982 | goto out_class; |
983 | } | 983 | } |
984 | class_simple_device_add(pt_class, MKDEV(major, unit + 128), | 984 | class_device_create(pt_class, MKDEV(major, unit + 128), |
985 | NULL, "pt%dn", unit); | 985 | NULL, "pt%dn", unit); |
986 | err = devfs_mk_cdev(MKDEV(major, unit + 128), | 986 | err = devfs_mk_cdev(MKDEV(major, unit + 128), |
987 | S_IFCHR | S_IRUSR | S_IWUSR, | 987 | S_IFCHR | S_IRUSR | S_IWUSR, |
988 | "pt/%dn", unit); | 988 | "pt/%dn", unit); |
989 | if (err) { | 989 | if (err) { |
990 | class_simple_device_remove(MKDEV(major, unit + 128)); | 990 | class_device_destroy(pt_class, MKDEV(major, unit + 128)); |
991 | goto out_class; | 991 | goto out_class; |
992 | } | 992 | } |
993 | } | 993 | } |
994 | goto out; | 994 | goto out; |
995 | 995 | ||
996 | out_class: | 996 | out_class: |
997 | class_simple_destroy(pt_class); | 997 | class_destroy(pt_class); |
998 | out_chrdev: | 998 | out_chrdev: |
999 | unregister_chrdev(major, "pt"); | 999 | unregister_chrdev(major, "pt"); |
1000 | out: | 1000 | out: |
@@ -1006,12 +1006,12 @@ static void __exit pt_exit(void) | |||
1006 | int unit; | 1006 | int unit; |
1007 | for (unit = 0; unit < PT_UNITS; unit++) | 1007 | for (unit = 0; unit < PT_UNITS; unit++) |
1008 | if (pt[unit].present) { | 1008 | if (pt[unit].present) { |
1009 | class_simple_device_remove(MKDEV(major, unit)); | 1009 | class_device_destroy(pt_class, MKDEV(major, unit)); |
1010 | devfs_remove("pt/%d", unit); | 1010 | devfs_remove("pt/%d", unit); |
1011 | class_simple_device_remove(MKDEV(major, unit + 128)); | 1011 | class_device_destroy(pt_class, MKDEV(major, unit + 128)); |
1012 | devfs_remove("pt/%dn", unit); | 1012 | devfs_remove("pt/%dn", unit); |
1013 | } | 1013 | } |
1014 | class_simple_destroy(pt_class); | 1014 | class_destroy(pt_class); |
1015 | devfs_remove("pt"); | 1015 | devfs_remove("pt"); |
1016 | unregister_chrdev(major, name); | 1016 | unregister_chrdev(major, name); |
1017 | for (unit = 0; unit < PT_UNITS; unit++) | 1017 | for (unit = 0; unit < PT_UNITS; unit++) |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 19c5e59bcfa8..685f061e69b2 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -430,7 +430,7 @@ static void ub_cmdtr_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd, | |||
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | static ssize_t ub_diag_show(struct device *dev, char *page) | 433 | static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr, char *page) |
434 | { | 434 | { |
435 | struct usb_interface *intf; | 435 | struct usb_interface *intf; |
436 | struct ub_dev *sc; | 436 | struct ub_dev *sc; |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 37d6649011ad..26271e3ca823 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
@@ -144,7 +144,7 @@ static struct dsp56k_device { | |||
144 | int tx_wsize, rx_wsize; | 144 | int tx_wsize, rx_wsize; |
145 | } dsp56k; | 145 | } dsp56k; |
146 | 146 | ||
147 | static struct class_simple *dsp56k_class; | 147 | static struct class *dsp56k_class; |
148 | 148 | ||
149 | static int dsp56k_reset(void) | 149 | static int dsp56k_reset(void) |
150 | { | 150 | { |
@@ -510,12 +510,12 @@ static int __init dsp56k_init_driver(void) | |||
510 | printk("DSP56k driver: Unable to register driver\n"); | 510 | printk("DSP56k driver: Unable to register driver\n"); |
511 | return -ENODEV; | 511 | return -ENODEV; |
512 | } | 512 | } |
513 | dsp56k_class = class_simple_create(THIS_MODULE, "dsp56k"); | 513 | dsp56k_class = class_create(THIS_MODULE, "dsp56k"); |
514 | if (IS_ERR(dsp56k_class)) { | 514 | if (IS_ERR(dsp56k_class)) { |
515 | err = PTR_ERR(dsp56k_class); | 515 | err = PTR_ERR(dsp56k_class); |
516 | goto out_chrdev; | 516 | goto out_chrdev; |
517 | } | 517 | } |
518 | class_simple_device_add(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); | 518 | class_device_create(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); |
519 | 519 | ||
520 | err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0), | 520 | err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0), |
521 | S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k"); | 521 | S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k"); |
@@ -526,8 +526,8 @@ static int __init dsp56k_init_driver(void) | |||
526 | goto out; | 526 | goto out; |
527 | 527 | ||
528 | out_class: | 528 | out_class: |
529 | class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0)); | 529 | class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); |
530 | class_simple_destroy(dsp56k_class); | 530 | class_destroy(dsp56k_class); |
531 | out_chrdev: | 531 | out_chrdev: |
532 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); | 532 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); |
533 | out: | 533 | out: |
@@ -537,8 +537,8 @@ module_init(dsp56k_init_driver); | |||
537 | 537 | ||
538 | static void __exit dsp56k_cleanup_driver(void) | 538 | static void __exit dsp56k_cleanup_driver(void) |
539 | { | 539 | { |
540 | class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0)); | 540 | class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); |
541 | class_simple_destroy(dsp56k_class); | 541 | class_destroy(dsp56k_class); |
542 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); | 542 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); |
543 | devfs_remove("dsp56k"); | 543 | devfs_remove("dsp56k"); |
544 | } | 544 | } |
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index dbac7e54e8e0..5745b74044ec 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c | |||
@@ -99,7 +99,7 @@ static struct file_operations zft_cdev = | |||
99 | .release = zft_close, | 99 | .release = zft_close, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | static struct class_simple *zft_class; | 102 | static struct class *zft_class; |
103 | 103 | ||
104 | /* Open floppy tape device | 104 | /* Open floppy tape device |
105 | */ | 105 | */ |
@@ -329,29 +329,29 @@ KERN_INFO | |||
329 | "installing zftape VFS interface for ftape driver ..."); | 329 | "installing zftape VFS interface for ftape driver ..."); |
330 | TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),); | 330 | TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),); |
331 | 331 | ||
332 | zft_class = class_simple_create(THIS_MODULE, "zft"); | 332 | zft_class = class_create(THIS_MODULE, "zft"); |
333 | for (i = 0; i < 4; i++) { | 333 | for (i = 0; i < 4; i++) { |
334 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); | 334 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); |
335 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i), | 335 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i), |
336 | S_IFCHR | S_IRUSR | S_IWUSR, | 336 | S_IFCHR | S_IRUSR | S_IWUSR, |
337 | "qft%i", i); | 337 | "qft%i", i); |
338 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); | 338 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); |
339 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4), | 339 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4), |
340 | S_IFCHR | S_IRUSR | S_IWUSR, | 340 | S_IFCHR | S_IRUSR | S_IWUSR, |
341 | "nqft%i", i); | 341 | "nqft%i", i); |
342 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); | 342 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); |
343 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16), | 343 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16), |
344 | S_IFCHR | S_IRUSR | S_IWUSR, | 344 | S_IFCHR | S_IRUSR | S_IWUSR, |
345 | "zqft%i", i); | 345 | "zqft%i", i); |
346 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); | 346 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); |
347 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20), | 347 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20), |
348 | S_IFCHR | S_IRUSR | S_IWUSR, | 348 | S_IFCHR | S_IRUSR | S_IWUSR, |
349 | "nzqft%i", i); | 349 | "nzqft%i", i); |
350 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); | 350 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); |
351 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32), | 351 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32), |
352 | S_IFCHR | S_IRUSR | S_IWUSR, | 352 | S_IFCHR | S_IRUSR | S_IWUSR, |
353 | "rawqft%i", i); | 353 | "rawqft%i", i); |
354 | class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); | 354 | class_device_create(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); |
355 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36), | 355 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36), |
356 | S_IFCHR | S_IRUSR | S_IWUSR, | 356 | S_IFCHR | S_IRUSR | S_IWUSR, |
357 | "nrawqft%i", i); | 357 | "nrawqft%i", i); |
@@ -381,19 +381,19 @@ static void zft_exit(void) | |||
381 | } | 381 | } |
382 | for (i = 0; i < 4; i++) { | 382 | for (i = 0; i < 4; i++) { |
383 | devfs_remove("qft%i", i); | 383 | devfs_remove("qft%i", i); |
384 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i)); | 384 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); |
385 | devfs_remove("nqft%i", i); | 385 | devfs_remove("nqft%i", i); |
386 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 4)); | 386 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4)); |
387 | devfs_remove("zqft%i", i); | 387 | devfs_remove("zqft%i", i); |
388 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 16)); | 388 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16)); |
389 | devfs_remove("nzqft%i", i); | 389 | devfs_remove("nzqft%i", i); |
390 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 20)); | 390 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20)); |
391 | devfs_remove("rawqft%i", i); | 391 | devfs_remove("rawqft%i", i); |
392 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 32)); | 392 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32)); |
393 | devfs_remove("nrawqft%i", i); | 393 | devfs_remove("nrawqft%i", i); |
394 | class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 36)); | 394 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); |
395 | } | 395 | } |
396 | class_simple_destroy(zft_class); | 396 | class_destroy(zft_class); |
397 | zft_uninit_mem(); /* release remaining memory, if any */ | 397 | zft_uninit_mem(); /* release remaining memory, if any */ |
398 | printk(KERN_INFO "zftape successfully unloaded.\n"); | 398 | printk(KERN_INFO "zftape successfully unloaded.\n"); |
399 | TRACE_EXIT; | 399 | TRACE_EXIT; |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index abfbdcfd4e72..3236d2404905 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -1466,7 +1466,7 @@ static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod) | |||
1466 | } | 1466 | } |
1467 | /* The sysfs interface for the driver and devices */ | 1467 | /* The sysfs interface for the driver and devices */ |
1468 | 1468 | ||
1469 | static ssize_t hvcs_partner_vtys_show(struct device *dev, char *buf) | 1469 | static ssize_t hvcs_partner_vtys_show(struct device *dev, struct device_attribute *attr, char *buf) |
1470 | { | 1470 | { |
1471 | struct vio_dev *viod = to_vio_dev(dev); | 1471 | struct vio_dev *viod = to_vio_dev(dev); |
1472 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | 1472 | struct hvcs_struct *hvcsd = from_vio_dev(viod); |
@@ -1480,7 +1480,7 @@ static ssize_t hvcs_partner_vtys_show(struct device *dev, char *buf) | |||
1480 | } | 1480 | } |
1481 | static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL); | 1481 | static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL); |
1482 | 1482 | ||
1483 | static ssize_t hvcs_partner_clcs_show(struct device *dev, char *buf) | 1483 | static ssize_t hvcs_partner_clcs_show(struct device *dev, struct device_attribute *attr, char *buf) |
1484 | { | 1484 | { |
1485 | struct vio_dev *viod = to_vio_dev(dev); | 1485 | struct vio_dev *viod = to_vio_dev(dev); |
1486 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | 1486 | struct hvcs_struct *hvcsd = from_vio_dev(viod); |
@@ -1494,7 +1494,7 @@ static ssize_t hvcs_partner_clcs_show(struct device *dev, char *buf) | |||
1494 | } | 1494 | } |
1495 | static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL); | 1495 | static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL); |
1496 | 1496 | ||
1497 | static ssize_t hvcs_current_vty_store(struct device *dev, const char * buf, | 1497 | static ssize_t hvcs_current_vty_store(struct device *dev, struct device_attribute *attr, const char * buf, |
1498 | size_t count) | 1498 | size_t count) |
1499 | { | 1499 | { |
1500 | /* | 1500 | /* |
@@ -1505,7 +1505,7 @@ static ssize_t hvcs_current_vty_store(struct device *dev, const char * buf, | |||
1505 | return -EPERM; | 1505 | return -EPERM; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | static ssize_t hvcs_current_vty_show(struct device *dev, char *buf) | 1508 | static ssize_t hvcs_current_vty_show(struct device *dev, struct device_attribute *attr, char *buf) |
1509 | { | 1509 | { |
1510 | struct vio_dev *viod = to_vio_dev(dev); | 1510 | struct vio_dev *viod = to_vio_dev(dev); |
1511 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | 1511 | struct hvcs_struct *hvcsd = from_vio_dev(viod); |
@@ -1521,7 +1521,7 @@ static ssize_t hvcs_current_vty_show(struct device *dev, char *buf) | |||
1521 | static DEVICE_ATTR(current_vty, | 1521 | static DEVICE_ATTR(current_vty, |
1522 | S_IRUGO | S_IWUSR, hvcs_current_vty_show, hvcs_current_vty_store); | 1522 | S_IRUGO | S_IWUSR, hvcs_current_vty_show, hvcs_current_vty_store); |
1523 | 1523 | ||
1524 | static ssize_t hvcs_vterm_state_store(struct device *dev, const char *buf, | 1524 | static ssize_t hvcs_vterm_state_store(struct device *dev, struct device_attribute *attr, const char *buf, |
1525 | size_t count) | 1525 | size_t count) |
1526 | { | 1526 | { |
1527 | struct vio_dev *viod = to_vio_dev(dev); | 1527 | struct vio_dev *viod = to_vio_dev(dev); |
@@ -1559,7 +1559,7 @@ static ssize_t hvcs_vterm_state_store(struct device *dev, const char *buf, | |||
1559 | return count; | 1559 | return count; |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | static ssize_t hvcs_vterm_state_show(struct device *dev, char *buf) | 1562 | static ssize_t hvcs_vterm_state_show(struct device *dev, struct device_attribute *attr, char *buf) |
1563 | { | 1563 | { |
1564 | struct vio_dev *viod = to_vio_dev(dev); | 1564 | struct vio_dev *viod = to_vio_dev(dev); |
1565 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | 1565 | struct hvcs_struct *hvcsd = from_vio_dev(viod); |
@@ -1574,7 +1574,7 @@ static ssize_t hvcs_vterm_state_show(struct device *dev, char *buf) | |||
1574 | static DEVICE_ATTR(vterm_state, S_IRUGO | S_IWUSR, | 1574 | static DEVICE_ATTR(vterm_state, S_IRUGO | S_IWUSR, |
1575 | hvcs_vterm_state_show, hvcs_vterm_state_store); | 1575 | hvcs_vterm_state_show, hvcs_vterm_state_store); |
1576 | 1576 | ||
1577 | static ssize_t hvcs_index_show(struct device *dev, char *buf) | 1577 | static ssize_t hvcs_index_show(struct device *dev, struct device_attribute *attr, char *buf) |
1578 | { | 1578 | { |
1579 | struct vio_dev *viod = to_vio_dev(dev); | 1579 | struct vio_dev *viod = to_vio_dev(dev); |
1580 | struct hvcs_struct *hvcsd = from_vio_dev(viod); | 1580 | struct hvcs_struct *hvcsd = from_vio_dev(viod); |
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index fca9a978fb73..3b8314b4249a 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c | |||
@@ -302,7 +302,7 @@ static char rirqs[IP2_MAX_BOARDS]; | |||
302 | static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0}; | 302 | static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0}; |
303 | 303 | ||
304 | /* for sysfs class support */ | 304 | /* for sysfs class support */ |
305 | static struct class_simple *ip2_class; | 305 | static struct class *ip2_class; |
306 | 306 | ||
307 | // Some functions to keep track of what irq's we have | 307 | // Some functions to keep track of what irq's we have |
308 | 308 | ||
@@ -414,9 +414,9 @@ cleanup_module(void) | |||
414 | iiResetDelay( i2BoardPtrTable[i] ); | 414 | iiResetDelay( i2BoardPtrTable[i] ); |
415 | /* free io addresses and Tibet */ | 415 | /* free io addresses and Tibet */ |
416 | release_region( ip2config.addr[i], 8 ); | 416 | release_region( ip2config.addr[i], 8 ); |
417 | class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i)); | 417 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); |
418 | devfs_remove("ip2/ipl%d", i); | 418 | devfs_remove("ip2/ipl%d", i); |
419 | class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); | 419 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); |
420 | devfs_remove("ip2/stat%d", i); | 420 | devfs_remove("ip2/stat%d", i); |
421 | } | 421 | } |
422 | /* Disable and remove interrupt handler. */ | 422 | /* Disable and remove interrupt handler. */ |
@@ -425,7 +425,7 @@ cleanup_module(void) | |||
425 | clear_requested_irq( ip2config.irq[i]); | 425 | clear_requested_irq( ip2config.irq[i]); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | class_simple_destroy(ip2_class); | 428 | class_destroy(ip2_class); |
429 | devfs_remove("ip2"); | 429 | devfs_remove("ip2"); |
430 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { | 430 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { |
431 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); | 431 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); |
@@ -700,7 +700,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
700 | printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err ); | 700 | printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err ); |
701 | } else { | 701 | } else { |
702 | /* create the sysfs class */ | 702 | /* create the sysfs class */ |
703 | ip2_class = class_simple_create(THIS_MODULE, "ip2"); | 703 | ip2_class = class_create(THIS_MODULE, "ip2"); |
704 | if (IS_ERR(ip2_class)) { | 704 | if (IS_ERR(ip2_class)) { |
705 | err = PTR_ERR(ip2_class); | 705 | err = PTR_ERR(ip2_class); |
706 | goto out_chrdev; | 706 | goto out_chrdev; |
@@ -722,25 +722,25 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
722 | } | 722 | } |
723 | 723 | ||
724 | if ( NULL != ( pB = i2BoardPtrTable[i] ) ) { | 724 | if ( NULL != ( pB = i2BoardPtrTable[i] ) ) { |
725 | class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR, | 725 | class_device_create(ip2_class, MKDEV(IP2_IPL_MAJOR, |
726 | 4 * i), NULL, "ipl%d", i); | 726 | 4 * i), NULL, "ipl%d", i); |
727 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i), | 727 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i), |
728 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, | 728 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, |
729 | "ip2/ipl%d", i); | 729 | "ip2/ipl%d", i); |
730 | if (err) { | 730 | if (err) { |
731 | class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, | 731 | class_device_destroy(ip2_class, |
732 | 4 * i)); | 732 | MKDEV(IP2_IPL_MAJOR, 4 * i)); |
733 | goto out_class; | 733 | goto out_class; |
734 | } | 734 | } |
735 | 735 | ||
736 | class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR, | 736 | class_device_create(ip2_class, MKDEV(IP2_IPL_MAJOR, |
737 | 4 * i + 1), NULL, "stat%d", i); | 737 | 4 * i + 1), NULL, "stat%d", i); |
738 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1), | 738 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1), |
739 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, | 739 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, |
740 | "ip2/stat%d", i); | 740 | "ip2/stat%d", i); |
741 | if (err) { | 741 | if (err) { |
742 | class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, | 742 | class_device_destroy(ip2_class, |
743 | 4 * i + 1)); | 743 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); |
744 | goto out_class; | 744 | goto out_class; |
745 | } | 745 | } |
746 | 746 | ||
@@ -798,7 +798,7 @@ retry: | |||
798 | goto out; | 798 | goto out; |
799 | 799 | ||
800 | out_class: | 800 | out_class: |
801 | class_simple_destroy(ip2_class); | 801 | class_destroy(ip2_class); |
802 | out_chrdev: | 802 | out_chrdev: |
803 | unregister_chrdev(IP2_IPL_MAJOR, "ip2"); | 803 | unregister_chrdev(IP2_IPL_MAJOR, "ip2"); |
804 | out: | 804 | out: |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 6dc765dc5413..88d1ad656e99 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -520,7 +520,7 @@ MODULE_PARM_DESC(ipmi_major, "Sets the major number of the IPMI device. By" | |||
520 | " interface. Other values will set the major device number" | 520 | " interface. Other values will set the major device number" |
521 | " to that value."); | 521 | " to that value."); |
522 | 522 | ||
523 | static struct class_simple *ipmi_class; | 523 | static struct class *ipmi_class; |
524 | 524 | ||
525 | static void ipmi_new_smi(int if_num) | 525 | static void ipmi_new_smi(int if_num) |
526 | { | 526 | { |
@@ -529,12 +529,12 @@ static void ipmi_new_smi(int if_num) | |||
529 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, | 529 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, |
530 | "ipmidev/%d", if_num); | 530 | "ipmidev/%d", if_num); |
531 | 531 | ||
532 | class_simple_device_add(ipmi_class, dev, NULL, "ipmi%d", if_num); | 532 | class_device_create(ipmi_class, dev, NULL, "ipmi%d", if_num); |
533 | } | 533 | } |
534 | 534 | ||
535 | static void ipmi_smi_gone(int if_num) | 535 | static void ipmi_smi_gone(int if_num) |
536 | { | 536 | { |
537 | class_simple_device_remove(MKDEV(ipmi_major, if_num)); | 537 | class_device_destroy(ipmi_class, MKDEV(ipmi_major, if_num)); |
538 | devfs_remove("ipmidev/%d", if_num); | 538 | devfs_remove("ipmidev/%d", if_num); |
539 | } | 539 | } |
540 | 540 | ||
@@ -555,7 +555,7 @@ static __init int init_ipmi_devintf(void) | |||
555 | printk(KERN_INFO "ipmi device interface version " | 555 | printk(KERN_INFO "ipmi device interface version " |
556 | IPMI_DEVINTF_VERSION "\n"); | 556 | IPMI_DEVINTF_VERSION "\n"); |
557 | 557 | ||
558 | ipmi_class = class_simple_create(THIS_MODULE, "ipmi"); | 558 | ipmi_class = class_create(THIS_MODULE, "ipmi"); |
559 | if (IS_ERR(ipmi_class)) { | 559 | if (IS_ERR(ipmi_class)) { |
560 | printk(KERN_ERR "ipmi: can't register device class\n"); | 560 | printk(KERN_ERR "ipmi: can't register device class\n"); |
561 | return PTR_ERR(ipmi_class); | 561 | return PTR_ERR(ipmi_class); |
@@ -563,7 +563,7 @@ static __init int init_ipmi_devintf(void) | |||
563 | 563 | ||
564 | rv = register_chrdev(ipmi_major, DEVICE_NAME, &ipmi_fops); | 564 | rv = register_chrdev(ipmi_major, DEVICE_NAME, &ipmi_fops); |
565 | if (rv < 0) { | 565 | if (rv < 0) { |
566 | class_simple_destroy(ipmi_class); | 566 | class_destroy(ipmi_class); |
567 | printk(KERN_ERR "ipmi: can't get major %d\n", ipmi_major); | 567 | printk(KERN_ERR "ipmi: can't get major %d\n", ipmi_major); |
568 | return rv; | 568 | return rv; |
569 | } | 569 | } |
@@ -577,7 +577,7 @@ static __init int init_ipmi_devintf(void) | |||
577 | rv = ipmi_smi_watcher_register(&smi_watcher); | 577 | rv = ipmi_smi_watcher_register(&smi_watcher); |
578 | if (rv) { | 578 | if (rv) { |
579 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 579 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
580 | class_simple_destroy(ipmi_class); | 580 | class_destroy(ipmi_class); |
581 | printk(KERN_WARNING "ipmi: can't register smi watcher\n"); | 581 | printk(KERN_WARNING "ipmi: can't register smi watcher\n"); |
582 | return rv; | 582 | return rv; |
583 | } | 583 | } |
@@ -588,7 +588,7 @@ module_init(init_ipmi_devintf); | |||
588 | 588 | ||
589 | static __exit void cleanup_ipmi(void) | 589 | static __exit void cleanup_ipmi(void) |
590 | { | 590 | { |
591 | class_simple_destroy(ipmi_class); | 591 | class_destroy(ipmi_class); |
592 | ipmi_smi_watcher_unregister(&smi_watcher); | 592 | ipmi_smi_watcher_unregister(&smi_watcher); |
593 | devfs_remove(DEVICE_NAME); | 593 | devfs_remove(DEVICE_NAME); |
594 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 594 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 21aed0e8779d..c02a21dbad5d 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -792,7 +792,7 @@ static int stli_timeron; | |||
792 | 792 | ||
793 | /*****************************************************************************/ | 793 | /*****************************************************************************/ |
794 | 794 | ||
795 | static struct class_simple *istallion_class; | 795 | static struct class *istallion_class; |
796 | 796 | ||
797 | #ifdef MODULE | 797 | #ifdef MODULE |
798 | 798 | ||
@@ -854,10 +854,10 @@ static void __exit istallion_module_exit(void) | |||
854 | put_tty_driver(stli_serial); | 854 | put_tty_driver(stli_serial); |
855 | for (i = 0; i < 4; i++) { | 855 | for (i = 0; i < 4; i++) { |
856 | devfs_remove("staliomem/%d", i); | 856 | devfs_remove("staliomem/%d", i); |
857 | class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i)); | 857 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
858 | } | 858 | } |
859 | devfs_remove("staliomem"); | 859 | devfs_remove("staliomem"); |
860 | class_simple_destroy(istallion_class); | 860 | class_destroy(istallion_class); |
861 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 861 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
862 | printk("STALLION: failed to un-register serial memory device, " | 862 | printk("STALLION: failed to un-register serial memory device, " |
863 | "errno=%d\n", -i); | 863 | "errno=%d\n", -i); |
@@ -5242,12 +5242,12 @@ int __init stli_init(void) | |||
5242 | "device\n"); | 5242 | "device\n"); |
5243 | 5243 | ||
5244 | devfs_mk_dir("staliomem"); | 5244 | devfs_mk_dir("staliomem"); |
5245 | istallion_class = class_simple_create(THIS_MODULE, "staliomem"); | 5245 | istallion_class = class_create(THIS_MODULE, "staliomem"); |
5246 | for (i = 0; i < 4; i++) { | 5246 | for (i = 0; i < 4; i++) { |
5247 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), | 5247 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), |
5248 | S_IFCHR | S_IRUSR | S_IWUSR, | 5248 | S_IFCHR | S_IRUSR | S_IWUSR, |
5249 | "staliomem/%d", i); | 5249 | "staliomem/%d", i); |
5250 | class_simple_device_add(istallion_class, MKDEV(STL_SIOMEMMAJOR, i), | 5250 | class_device_create(istallion_class, MKDEV(STL_SIOMEMMAJOR, i), |
5251 | NULL, "staliomem%d", i); | 5251 | NULL, "staliomem%d", i); |
5252 | } | 5252 | } |
5253 | 5253 | ||
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 4dee945031d4..59eebe5a035f 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -146,7 +146,7 @@ | |||
146 | static struct lp_struct lp_table[LP_NO]; | 146 | static struct lp_struct lp_table[LP_NO]; |
147 | 147 | ||
148 | static unsigned int lp_count = 0; | 148 | static unsigned int lp_count = 0; |
149 | static struct class_simple *lp_class; | 149 | static struct class *lp_class; |
150 | 150 | ||
151 | #ifdef CONFIG_LP_CONSOLE | 151 | #ifdef CONFIG_LP_CONSOLE |
152 | static struct parport *console_registered; // initially NULL | 152 | static struct parport *console_registered; // initially NULL |
@@ -804,7 +804,7 @@ static int lp_register(int nr, struct parport *port) | |||
804 | if (reset) | 804 | if (reset) |
805 | lp_reset(nr); | 805 | lp_reset(nr); |
806 | 806 | ||
807 | class_simple_device_add(lp_class, MKDEV(LP_MAJOR, nr), NULL, | 807 | class_device_create(lp_class, MKDEV(LP_MAJOR, nr), NULL, |
808 | "lp%d", nr); | 808 | "lp%d", nr); |
809 | devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, | 809 | devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, |
810 | "printers/%d", nr); | 810 | "printers/%d", nr); |
@@ -907,7 +907,7 @@ static int __init lp_init (void) | |||
907 | } | 907 | } |
908 | 908 | ||
909 | devfs_mk_dir("printers"); | 909 | devfs_mk_dir("printers"); |
910 | lp_class = class_simple_create(THIS_MODULE, "printer"); | 910 | lp_class = class_create(THIS_MODULE, "printer"); |
911 | if (IS_ERR(lp_class)) { | 911 | if (IS_ERR(lp_class)) { |
912 | err = PTR_ERR(lp_class); | 912 | err = PTR_ERR(lp_class); |
913 | goto out_devfs; | 913 | goto out_devfs; |
@@ -930,7 +930,7 @@ static int __init lp_init (void) | |||
930 | return 0; | 930 | return 0; |
931 | 931 | ||
932 | out_class: | 932 | out_class: |
933 | class_simple_destroy(lp_class); | 933 | class_destroy(lp_class); |
934 | out_devfs: | 934 | out_devfs: |
935 | devfs_remove("printers"); | 935 | devfs_remove("printers"); |
936 | unregister_chrdev(LP_MAJOR, "lp"); | 936 | unregister_chrdev(LP_MAJOR, "lp"); |
@@ -981,10 +981,10 @@ static void lp_cleanup_module (void) | |||
981 | continue; | 981 | continue; |
982 | parport_unregister_device(lp_table[offset].dev); | 982 | parport_unregister_device(lp_table[offset].dev); |
983 | devfs_remove("printers/%d", offset); | 983 | devfs_remove("printers/%d", offset); |
984 | class_simple_device_remove(MKDEV(LP_MAJOR, offset)); | 984 | class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); |
985 | } | 985 | } |
986 | devfs_remove("printers"); | 986 | devfs_remove("printers"); |
987 | class_simple_destroy(lp_class); | 987 | class_destroy(lp_class); |
988 | } | 988 | } |
989 | 989 | ||
990 | __setup("lp=", lp_setup); | 990 | __setup("lp=", lp_setup); |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index ac9cfa9701ea..115dbb35334b 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -699,7 +699,7 @@ static inline int mbcs_hw_init(struct mbcs_soft *soft) | |||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
701 | 701 | ||
702 | static ssize_t show_algo(struct device *dev, char *buf) | 702 | static ssize_t show_algo(struct device *dev, struct device_attribute *attr, char *buf) |
703 | { | 703 | { |
704 | struct cx_dev *cx_dev = to_cx_dev(dev); | 704 | struct cx_dev *cx_dev = to_cx_dev(dev); |
705 | struct mbcs_soft *soft = cx_dev->soft; | 705 | struct mbcs_soft *soft = cx_dev->soft; |
@@ -715,7 +715,7 @@ static ssize_t show_algo(struct device *dev, char *buf) | |||
715 | (debug0 >> 32), (debug0 & 0xffffffff)); | 715 | (debug0 >> 32), (debug0 & 0xffffffff)); |
716 | } | 716 | } |
717 | 717 | ||
718 | static ssize_t store_algo(struct device *dev, const char *buf, size_t count) | 718 | static ssize_t store_algo(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
719 | { | 719 | { |
720 | int n; | 720 | int n; |
721 | struct cx_dev *cx_dev = to_cx_dev(dev); | 721 | struct cx_dev *cx_dev = to_cx_dev(dev); |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 947cb3cef816..257b8ee605e5 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -856,7 +856,7 @@ static const struct { | |||
856 | {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops}, | 856 | {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops}, |
857 | }; | 857 | }; |
858 | 858 | ||
859 | static struct class_simple *mem_class; | 859 | static struct class *mem_class; |
860 | 860 | ||
861 | static int __init chr_dev_init(void) | 861 | static int __init chr_dev_init(void) |
862 | { | 862 | { |
@@ -865,10 +865,9 @@ static int __init chr_dev_init(void) | |||
865 | if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) | 865 | if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) |
866 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); | 866 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); |
867 | 867 | ||
868 | mem_class = class_simple_create(THIS_MODULE, "mem"); | 868 | mem_class = class_create(THIS_MODULE, "mem"); |
869 | for (i = 0; i < ARRAY_SIZE(devlist); i++) { | 869 | for (i = 0; i < ARRAY_SIZE(devlist); i++) { |
870 | class_simple_device_add(mem_class, | 870 | class_device_create(mem_class, MKDEV(MEM_MAJOR, devlist[i].minor), |
871 | MKDEV(MEM_MAJOR, devlist[i].minor), | ||
872 | NULL, devlist[i].name); | 871 | NULL, devlist[i].name); |
873 | devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), | 872 | devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), |
874 | S_IFCHR | devlist[i].mode, devlist[i].name); | 873 | S_IFCHR | devlist[i].mode, devlist[i].name); |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 0937544762da..3115d318b997 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -177,10 +177,10 @@ fail: | |||
177 | 177 | ||
178 | /* | 178 | /* |
179 | * TODO for 2.7: | 179 | * TODO for 2.7: |
180 | * - add a struct class_device to struct miscdevice and make all usages of | 180 | * - add a struct kref to struct miscdevice and make all usages of |
181 | * them dynamic. | 181 | * them dynamic. |
182 | */ | 182 | */ |
183 | static struct class_simple *misc_class; | 183 | static struct class *misc_class; |
184 | 184 | ||
185 | static struct file_operations misc_fops = { | 185 | static struct file_operations misc_fops = { |
186 | .owner = THIS_MODULE, | 186 | .owner = THIS_MODULE, |
@@ -238,8 +238,8 @@ int misc_register(struct miscdevice * misc) | |||
238 | } | 238 | } |
239 | dev = MKDEV(MISC_MAJOR, misc->minor); | 239 | dev = MKDEV(MISC_MAJOR, misc->minor); |
240 | 240 | ||
241 | misc->class = class_simple_device_add(misc_class, dev, | 241 | misc->class = class_device_create(misc_class, dev, misc->dev, |
242 | misc->dev, misc->name); | 242 | "%s", misc->name); |
243 | if (IS_ERR(misc->class)) { | 243 | if (IS_ERR(misc->class)) { |
244 | err = PTR_ERR(misc->class); | 244 | err = PTR_ERR(misc->class); |
245 | goto out; | 245 | goto out; |
@@ -248,7 +248,7 @@ int misc_register(struct miscdevice * misc) | |||
248 | err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, | 248 | err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, |
249 | misc->devfs_name); | 249 | misc->devfs_name); |
250 | if (err) { | 250 | if (err) { |
251 | class_simple_device_remove(dev); | 251 | class_device_destroy(misc_class, dev); |
252 | goto out; | 252 | goto out; |
253 | } | 253 | } |
254 | 254 | ||
@@ -281,7 +281,7 @@ int misc_deregister(struct miscdevice * misc) | |||
281 | 281 | ||
282 | down(&misc_sem); | 282 | down(&misc_sem); |
283 | list_del(&misc->list); | 283 | list_del(&misc->list); |
284 | class_simple_device_remove(MKDEV(MISC_MAJOR, misc->minor)); | 284 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); |
285 | devfs_remove(misc->devfs_name); | 285 | devfs_remove(misc->devfs_name); |
286 | if (i < DYNAMIC_MINORS && i>0) { | 286 | if (i < DYNAMIC_MINORS && i>0) { |
287 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); | 287 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); |
@@ -302,7 +302,7 @@ static int __init misc_init(void) | |||
302 | if (ent) | 302 | if (ent) |
303 | ent->proc_fops = &misc_proc_fops; | 303 | ent->proc_fops = &misc_proc_fops; |
304 | #endif | 304 | #endif |
305 | misc_class = class_simple_create(THIS_MODULE, "misc"); | 305 | misc_class = class_create(THIS_MODULE, "misc"); |
306 | if (IS_ERR(misc_class)) | 306 | if (IS_ERR(misc_class)) |
307 | return PTR_ERR(misc_class); | 307 | return PTR_ERR(misc_class); |
308 | #ifdef CONFIG_MVME16x | 308 | #ifdef CONFIG_MVME16x |
@@ -323,7 +323,7 @@ static int __init misc_init(void) | |||
323 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { | 323 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { |
324 | printk("unable to get major %d for misc devices\n", | 324 | printk("unable to get major %d for misc devices\n", |
325 | MISC_MAJOR); | 325 | MISC_MAJOR); |
326 | class_simple_destroy(misc_class); | 326 | class_destroy(misc_class); |
327 | return -EIO; | 327 | return -EIO; |
328 | } | 328 | } |
329 | return 0; | 329 | return 0; |
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index d37625d47746..d568991ac6b3 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
@@ -472,7 +472,7 @@ struct device mwave_device; | |||
472 | 472 | ||
473 | /* Prevent code redundancy, create a macro for mwave_show_* functions. */ | 473 | /* Prevent code redundancy, create a macro for mwave_show_* functions. */ |
474 | #define mwave_show_function(attr_name, format_string, field) \ | 474 | #define mwave_show_function(attr_name, format_string, field) \ |
475 | static ssize_t mwave_show_##attr_name(struct device *dev, char *buf) \ | 475 | static ssize_t mwave_show_##attr_name(struct device *dev, struct device_attribute *attr, char *buf) \ |
476 | { \ | 476 | { \ |
477 | DSP_3780I_CONFIG_SETTINGS *pSettings = \ | 477 | DSP_3780I_CONFIG_SETTINGS *pSettings = \ |
478 | &mwave_s_mdd.rBDData.rDspSettings; \ | 478 | &mwave_s_mdd.rBDData.rDspSettings; \ |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 5eda075c62bd..0e22880432bc 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -737,7 +737,7 @@ static unsigned int pp_poll (struct file * file, poll_table * wait) | |||
737 | return mask; | 737 | return mask; |
738 | } | 738 | } |
739 | 739 | ||
740 | static struct class_simple *ppdev_class; | 740 | static struct class *ppdev_class; |
741 | 741 | ||
742 | static struct file_operations pp_fops = { | 742 | static struct file_operations pp_fops = { |
743 | .owner = THIS_MODULE, | 743 | .owner = THIS_MODULE, |
@@ -752,13 +752,13 @@ static struct file_operations pp_fops = { | |||
752 | 752 | ||
753 | static void pp_attach(struct parport *port) | 753 | static void pp_attach(struct parport *port) |
754 | { | 754 | { |
755 | class_simple_device_add(ppdev_class, MKDEV(PP_MAJOR, port->number), | 755 | class_device_create(ppdev_class, MKDEV(PP_MAJOR, port->number), |
756 | NULL, "parport%d", port->number); | 756 | NULL, "parport%d", port->number); |
757 | } | 757 | } |
758 | 758 | ||
759 | static void pp_detach(struct parport *port) | 759 | static void pp_detach(struct parport *port) |
760 | { | 760 | { |
761 | class_simple_device_remove(MKDEV(PP_MAJOR, port->number)); | 761 | class_device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); |
762 | } | 762 | } |
763 | 763 | ||
764 | static struct parport_driver pp_driver = { | 764 | static struct parport_driver pp_driver = { |
@@ -776,7 +776,7 @@ static int __init ppdev_init (void) | |||
776 | PP_MAJOR); | 776 | PP_MAJOR); |
777 | return -EIO; | 777 | return -EIO; |
778 | } | 778 | } |
779 | ppdev_class = class_simple_create(THIS_MODULE, CHRDEV); | 779 | ppdev_class = class_create(THIS_MODULE, CHRDEV); |
780 | if (IS_ERR(ppdev_class)) { | 780 | if (IS_ERR(ppdev_class)) { |
781 | err = PTR_ERR(ppdev_class); | 781 | err = PTR_ERR(ppdev_class); |
782 | goto out_chrdev; | 782 | goto out_chrdev; |
@@ -798,7 +798,7 @@ out_class: | |||
798 | for (i = 0; i < PARPORT_MAX; i++) | 798 | for (i = 0; i < PARPORT_MAX; i++) |
799 | devfs_remove("parports/%d", i); | 799 | devfs_remove("parports/%d", i); |
800 | devfs_remove("parports"); | 800 | devfs_remove("parports"); |
801 | class_simple_destroy(ppdev_class); | 801 | class_destroy(ppdev_class); |
802 | out_chrdev: | 802 | out_chrdev: |
803 | unregister_chrdev(PP_MAJOR, CHRDEV); | 803 | unregister_chrdev(PP_MAJOR, CHRDEV); |
804 | out: | 804 | out: |
@@ -813,7 +813,7 @@ static void __exit ppdev_cleanup (void) | |||
813 | devfs_remove("parports/%d", i); | 813 | devfs_remove("parports/%d", i); |
814 | parport_unregister_driver(&pp_driver); | 814 | parport_unregister_driver(&pp_driver); |
815 | devfs_remove("parports"); | 815 | devfs_remove("parports"); |
816 | class_simple_destroy(ppdev_class); | 816 | class_destroy(ppdev_class); |
817 | unregister_chrdev (PP_MAJOR, CHRDEV); | 817 | unregister_chrdev (PP_MAJOR, CHRDEV); |
818 | } | 818 | } |
819 | 819 | ||
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index ca5f42bcaad9..f13e5de02207 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -27,7 +27,7 @@ struct raw_device_data { | |||
27 | int inuse; | 27 | int inuse; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static struct class_simple *raw_class; | 30 | static struct class *raw_class; |
31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; | 31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; |
32 | static DECLARE_MUTEX(raw_mutex); | 32 | static DECLARE_MUTEX(raw_mutex); |
33 | static struct file_operations raw_ctl_fops; /* forward declaration */ | 33 | static struct file_operations raw_ctl_fops; /* forward declaration */ |
@@ -127,8 +127,8 @@ raw_ioctl(struct inode *inode, struct file *filp, | |||
127 | 127 | ||
128 | static void bind_device(struct raw_config_request *rq) | 128 | static void bind_device(struct raw_config_request *rq) |
129 | { | 129 | { |
130 | class_simple_device_remove(MKDEV(RAW_MAJOR, rq->raw_minor)); | 130 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); |
131 | class_simple_device_add(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor), | 131 | class_device_create(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor), |
132 | NULL, "raw%d", rq->raw_minor); | 132 | NULL, "raw%d", rq->raw_minor); |
133 | } | 133 | } |
134 | 134 | ||
@@ -200,8 +200,8 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | |||
200 | if (rq.block_major == 0 && rq.block_minor == 0) { | 200 | if (rq.block_major == 0 && rq.block_minor == 0) { |
201 | /* unbind */ | 201 | /* unbind */ |
202 | rawdev->binding = NULL; | 202 | rawdev->binding = NULL; |
203 | class_simple_device_remove(MKDEV(RAW_MAJOR, | 203 | class_device_destroy(raw_class, |
204 | rq.raw_minor)); | 204 | MKDEV(RAW_MAJOR, rq.raw_minor)); |
205 | } else { | 205 | } else { |
206 | rawdev->binding = bdget(dev); | 206 | rawdev->binding = bdget(dev); |
207 | if (rawdev->binding == NULL) | 207 | if (rawdev->binding == NULL) |
@@ -300,14 +300,14 @@ static int __init raw_init(void) | |||
300 | goto error; | 300 | goto error; |
301 | } | 301 | } |
302 | 302 | ||
303 | raw_class = class_simple_create(THIS_MODULE, "raw"); | 303 | raw_class = class_create(THIS_MODULE, "raw"); |
304 | if (IS_ERR(raw_class)) { | 304 | if (IS_ERR(raw_class)) { |
305 | printk(KERN_ERR "Error creating raw class.\n"); | 305 | printk(KERN_ERR "Error creating raw class.\n"); |
306 | cdev_del(&raw_cdev); | 306 | cdev_del(&raw_cdev); |
307 | unregister_chrdev_region(dev, MAX_RAW_MINORS); | 307 | unregister_chrdev_region(dev, MAX_RAW_MINORS); |
308 | goto error; | 308 | goto error; |
309 | } | 309 | } |
310 | class_simple_device_add(raw_class, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); | 310 | class_device_create(raw_class, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); |
311 | 311 | ||
312 | devfs_mk_cdev(MKDEV(RAW_MAJOR, 0), | 312 | devfs_mk_cdev(MKDEV(RAW_MAJOR, 0), |
313 | S_IFCHR | S_IRUGO | S_IWUGO, | 313 | S_IFCHR | S_IRUGO | S_IWUGO, |
@@ -331,8 +331,8 @@ static void __exit raw_exit(void) | |||
331 | devfs_remove("raw/raw%d", i); | 331 | devfs_remove("raw/raw%d", i); |
332 | devfs_remove("raw/rawctl"); | 332 | devfs_remove("raw/rawctl"); |
333 | devfs_remove("raw"); | 333 | devfs_remove("raw"); |
334 | class_simple_device_remove(MKDEV(RAW_MAJOR, 0)); | 334 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); |
335 | class_simple_destroy(raw_class); | 335 | class_destroy(raw_class); |
336 | cdev_del(&raw_cdev); | 336 | cdev_del(&raw_cdev); |
337 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); | 337 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); |
338 | } | 338 | } |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index e3c0b52d943f..261a41bf6d02 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -357,6 +357,8 @@ static struct file_operations scdrv_fops = { | |||
357 | .release = scdrv_release, | 357 | .release = scdrv_release, |
358 | }; | 358 | }; |
359 | 359 | ||
360 | static struct class *snsc_class; | ||
361 | |||
360 | /* | 362 | /* |
361 | * scdrv_init | 363 | * scdrv_init |
362 | * | 364 | * |
@@ -372,7 +374,6 @@ scdrv_init(void) | |||
372 | char *devnamep; | 374 | char *devnamep; |
373 | struct sysctl_data_s *scd; | 375 | struct sysctl_data_s *scd; |
374 | void *salbuf; | 376 | void *salbuf; |
375 | struct class_simple *snsc_class; | ||
376 | dev_t first_dev, dev; | 377 | dev_t first_dev, dev; |
377 | nasid_t event_nasid = ia64_sn_get_console_nasid(); | 378 | nasid_t event_nasid = ia64_sn_get_console_nasid(); |
378 | 379 | ||
@@ -382,7 +383,7 @@ scdrv_init(void) | |||
382 | __FUNCTION__); | 383 | __FUNCTION__); |
383 | return -ENODEV; | 384 | return -ENODEV; |
384 | } | 385 | } |
385 | snsc_class = class_simple_create(THIS_MODULE, SYSCTL_BASENAME); | 386 | snsc_class = class_create(THIS_MODULE, SYSCTL_BASENAME); |
386 | 387 | ||
387 | for (cnode = 0; cnode < numionodes; cnode++) { | 388 | for (cnode = 0; cnode < numionodes; cnode++) { |
388 | geoid = cnodeid_get_geoid(cnode); | 389 | geoid = cnodeid_get_geoid(cnode); |
@@ -436,7 +437,7 @@ scdrv_init(void) | |||
436 | continue; | 437 | continue; |
437 | } | 438 | } |
438 | 439 | ||
439 | class_simple_device_add(snsc_class, dev, NULL, | 440 | class_device_create(snsc_class, dev, NULL, |
440 | "%s", devname); | 441 | "%s", devname); |
441 | 442 | ||
442 | ia64_sn_irtr_intr_enable(scd->scd_nasid, | 443 | ia64_sn_irtr_intr_enable(scd->scd_nasid, |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index b8899f560b5e..951545a6ef2d 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -719,7 +719,7 @@ static struct file_operations stl_fsiomem = { | |||
719 | 719 | ||
720 | /*****************************************************************************/ | 720 | /*****************************************************************************/ |
721 | 721 | ||
722 | static struct class_simple *stallion_class; | 722 | static struct class *stallion_class; |
723 | 723 | ||
724 | /* | 724 | /* |
725 | * Loadable module initialization stuff. | 725 | * Loadable module initialization stuff. |
@@ -777,13 +777,13 @@ static void __exit stallion_module_exit(void) | |||
777 | } | 777 | } |
778 | for (i = 0; i < 4; i++) { | 778 | for (i = 0; i < 4; i++) { |
779 | devfs_remove("staliomem/%d", i); | 779 | devfs_remove("staliomem/%d", i); |
780 | class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i)); | 780 | class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
781 | } | 781 | } |
782 | devfs_remove("staliomem"); | 782 | devfs_remove("staliomem"); |
783 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 783 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
784 | printk("STALLION: failed to un-register serial memory device, " | 784 | printk("STALLION: failed to un-register serial memory device, " |
785 | "errno=%d\n", -i); | 785 | "errno=%d\n", -i); |
786 | class_simple_destroy(stallion_class); | 786 | class_destroy(stallion_class); |
787 | 787 | ||
788 | if (stl_tmpwritebuf != (char *) NULL) | 788 | if (stl_tmpwritebuf != (char *) NULL) |
789 | kfree(stl_tmpwritebuf); | 789 | kfree(stl_tmpwritebuf); |
@@ -3090,12 +3090,12 @@ static int __init stl_init(void) | |||
3090 | printk("STALLION: failed to register serial board device\n"); | 3090 | printk("STALLION: failed to register serial board device\n"); |
3091 | devfs_mk_dir("staliomem"); | 3091 | devfs_mk_dir("staliomem"); |
3092 | 3092 | ||
3093 | stallion_class = class_simple_create(THIS_MODULE, "staliomem"); | 3093 | stallion_class = class_create(THIS_MODULE, "staliomem"); |
3094 | for (i = 0; i < 4; i++) { | 3094 | for (i = 0; i < 4; i++) { |
3095 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), | 3095 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), |
3096 | S_IFCHR|S_IRUSR|S_IWUSR, | 3096 | S_IFCHR|S_IRUSR|S_IWUSR, |
3097 | "staliomem/%d", i); | 3097 | "staliomem/%d", i); |
3098 | class_simple_device_add(stallion_class, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i); | 3098 | class_device_create(stallion_class, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i); |
3099 | } | 3099 | } |
3100 | 3100 | ||
3101 | stl_serial->owner = THIS_MODULE; | 3101 | stl_serial->owner = THIS_MODULE; |
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 0c5ba9dc9063..659335d80ee7 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -90,7 +90,7 @@ static int timeout = TIMAXTIME; /* timeout in tenth of seconds */ | |||
90 | static unsigned int tp_count; /* tipar count */ | 90 | static unsigned int tp_count; /* tipar count */ |
91 | static unsigned long opened; /* opened devices */ | 91 | static unsigned long opened; /* opened devices */ |
92 | 92 | ||
93 | static struct class_simple *tipar_class; | 93 | static struct class *tipar_class; |
94 | 94 | ||
95 | /* --- macros for parport access -------------------------------------- */ | 95 | /* --- macros for parport access -------------------------------------- */ |
96 | 96 | ||
@@ -436,7 +436,7 @@ tipar_register(int nr, struct parport *port) | |||
436 | goto out; | 436 | goto out; |
437 | } | 437 | } |
438 | 438 | ||
439 | class_simple_device_add(tipar_class, MKDEV(TIPAR_MAJOR, | 439 | class_device_create(tipar_class, MKDEV(TIPAR_MAJOR, |
440 | TIPAR_MINOR + nr), NULL, "par%d", nr); | 440 | TIPAR_MINOR + nr), NULL, "par%d", nr); |
441 | /* Use devfs, tree: /dev/ticables/par/[0..2] */ | 441 | /* Use devfs, tree: /dev/ticables/par/[0..2] */ |
442 | err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), | 442 | err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), |
@@ -458,8 +458,8 @@ tipar_register(int nr, struct parport *port) | |||
458 | goto out; | 458 | goto out; |
459 | 459 | ||
460 | out_class: | 460 | out_class: |
461 | class_simple_device_remove(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr)); | 461 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr)); |
462 | class_simple_destroy(tipar_class); | 462 | class_destroy(tipar_class); |
463 | out: | 463 | out: |
464 | return err; | 464 | return err; |
465 | } | 465 | } |
@@ -505,7 +505,7 @@ tipar_init_module(void) | |||
505 | /* Use devfs with tree: /dev/ticables/par/[0..2] */ | 505 | /* Use devfs with tree: /dev/ticables/par/[0..2] */ |
506 | devfs_mk_dir("ticables/par"); | 506 | devfs_mk_dir("ticables/par"); |
507 | 507 | ||
508 | tipar_class = class_simple_create(THIS_MODULE, "ticables"); | 508 | tipar_class = class_create(THIS_MODULE, "ticables"); |
509 | if (IS_ERR(tipar_class)) { | 509 | if (IS_ERR(tipar_class)) { |
510 | err = PTR_ERR(tipar_class); | 510 | err = PTR_ERR(tipar_class); |
511 | goto out_chrdev; | 511 | goto out_chrdev; |
@@ -539,10 +539,10 @@ tipar_cleanup_module(void) | |||
539 | if (table[i].dev == NULL) | 539 | if (table[i].dev == NULL) |
540 | continue; | 540 | continue; |
541 | parport_unregister_device(table[i].dev); | 541 | parport_unregister_device(table[i].dev); |
542 | class_simple_device_remove(MKDEV(TIPAR_MAJOR, i)); | 542 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); |
543 | devfs_remove("ticables/par/%d", i); | 543 | devfs_remove("ticables/par/%d", i); |
544 | } | 544 | } |
545 | class_simple_destroy(tipar_class); | 545 | class_destroy(tipar_class); |
546 | devfs_remove("ticables/par"); | 546 | devfs_remove("ticables/par"); |
547 | 547 | ||
548 | pr_info("tipar: module unloaded\n"); | 548 | pr_info("tipar: module unloaded\n"); |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 87235330fdbe..8ce508b29865 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -212,7 +212,7 @@ static u8 pcrread[] = { | |||
212 | 0, 0, 0, 0 /* PCR index */ | 212 | 0, 0, 0, 0 /* PCR index */ |
213 | }; | 213 | }; |
214 | 214 | ||
215 | static ssize_t show_pcrs(struct device *dev, char *buf) | 215 | static ssize_t show_pcrs(struct device *dev, struct device_attribute *attr, char *buf) |
216 | { | 216 | { |
217 | u8 data[READ_PCR_RESULT_SIZE]; | 217 | u8 data[READ_PCR_RESULT_SIZE]; |
218 | ssize_t len; | 218 | ssize_t len; |
@@ -255,7 +255,7 @@ static u8 readpubek[] = { | |||
255 | 0, 0, 0, 124, /* TPM_ORD_ReadPubek */ | 255 | 0, 0, 0, 124, /* TPM_ORD_ReadPubek */ |
256 | }; | 256 | }; |
257 | 257 | ||
258 | static ssize_t show_pubek(struct device *dev, char *buf) | 258 | static ssize_t show_pubek(struct device *dev, struct device_attribute *attr, char *buf) |
259 | { | 259 | { |
260 | u8 data[READ_PUBEK_RESULT_SIZE]; | 260 | u8 data[READ_PUBEK_RESULT_SIZE]; |
261 | ssize_t len; | 261 | ssize_t len; |
@@ -330,7 +330,7 @@ static u8 cap_manufacturer[] = { | |||
330 | 0, 0, 1, 3 | 330 | 0, 0, 1, 3 |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static ssize_t show_caps(struct device *dev, char *buf) | 333 | static ssize_t show_caps(struct device *dev, struct device_attribute *attr, char *buf) |
334 | { | 334 | { |
335 | u8 data[READ_PUBEK_RESULT_SIZE]; | 335 | u8 data[READ_PUBEK_RESULT_SIZE]; |
336 | ssize_t len; | 336 | ssize_t len; |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 26e5e19ed854..31831030f73f 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2654,7 +2654,7 @@ static void tty_default_put_char(struct tty_struct *tty, unsigned char ch) | |||
2654 | tty->driver->write(tty, &ch, 1); | 2654 | tty->driver->write(tty, &ch, 1); |
2655 | } | 2655 | } |
2656 | 2656 | ||
2657 | static struct class_simple *tty_class; | 2657 | static struct class *tty_class; |
2658 | 2658 | ||
2659 | /** | 2659 | /** |
2660 | * tty_register_device - register a tty device | 2660 | * tty_register_device - register a tty device |
@@ -2687,7 +2687,7 @@ void tty_register_device(struct tty_driver *driver, unsigned index, | |||
2687 | pty_line_name(driver, index, name); | 2687 | pty_line_name(driver, index, name); |
2688 | else | 2688 | else |
2689 | tty_line_name(driver, index, name); | 2689 | tty_line_name(driver, index, name); |
2690 | class_simple_device_add(tty_class, dev, device, name); | 2690 | class_device_create(tty_class, dev, device, name); |
2691 | } | 2691 | } |
2692 | 2692 | ||
2693 | /** | 2693 | /** |
@@ -2701,7 +2701,7 @@ void tty_register_device(struct tty_driver *driver, unsigned index, | |||
2701 | void tty_unregister_device(struct tty_driver *driver, unsigned index) | 2701 | void tty_unregister_device(struct tty_driver *driver, unsigned index) |
2702 | { | 2702 | { |
2703 | devfs_remove("%s%d", driver->devfs_name, index + driver->name_base); | 2703 | devfs_remove("%s%d", driver->devfs_name, index + driver->name_base); |
2704 | class_simple_device_remove(MKDEV(driver->major, driver->minor_start) + index); | 2704 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); |
2705 | } | 2705 | } |
2706 | 2706 | ||
2707 | EXPORT_SYMBOL(tty_register_device); | 2707 | EXPORT_SYMBOL(tty_register_device); |
@@ -2918,7 +2918,7 @@ extern int vty_init(void); | |||
2918 | 2918 | ||
2919 | static int __init tty_class_init(void) | 2919 | static int __init tty_class_init(void) |
2920 | { | 2920 | { |
2921 | tty_class = class_simple_create(THIS_MODULE, "tty"); | 2921 | tty_class = class_create(THIS_MODULE, "tty"); |
2922 | if (IS_ERR(tty_class)) | 2922 | if (IS_ERR(tty_class)) |
2923 | return PTR_ERR(tty_class); | 2923 | return PTR_ERR(tty_class); |
2924 | return 0; | 2924 | return 0; |
@@ -2947,14 +2947,14 @@ static int __init tty_init(void) | |||
2947 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 2947 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
2948 | panic("Couldn't register /dev/tty driver\n"); | 2948 | panic("Couldn't register /dev/tty driver\n"); |
2949 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); | 2949 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); |
2950 | class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); | 2950 | class_device_create(tty_class, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); |
2951 | 2951 | ||
2952 | cdev_init(&console_cdev, &console_fops); | 2952 | cdev_init(&console_cdev, &console_fops); |
2953 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 2953 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
2954 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 2954 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
2955 | panic("Couldn't register /dev/console driver\n"); | 2955 | panic("Couldn't register /dev/console driver\n"); |
2956 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); | 2956 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); |
2957 | class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); | 2957 | class_device_create(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); |
2958 | 2958 | ||
2959 | #ifdef CONFIG_UNIX98_PTYS | 2959 | #ifdef CONFIG_UNIX98_PTYS |
2960 | cdev_init(&ptmx_cdev, &ptmx_fops); | 2960 | cdev_init(&ptmx_cdev, &ptmx_fops); |
@@ -2962,7 +2962,7 @@ static int __init tty_init(void) | |||
2962 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 2962 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
2963 | panic("Couldn't register /dev/ptmx driver\n"); | 2963 | panic("Couldn't register /dev/ptmx driver\n"); |
2964 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); | 2964 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); |
2965 | class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); | 2965 | class_device_create(tty_class, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); |
2966 | #endif | 2966 | #endif |
2967 | 2967 | ||
2968 | #ifdef CONFIG_VT | 2968 | #ifdef CONFIG_VT |
@@ -2971,7 +2971,7 @@ static int __init tty_init(void) | |||
2971 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 2971 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
2972 | panic("Couldn't register /dev/tty0 driver\n"); | 2972 | panic("Couldn't register /dev/tty0 driver\n"); |
2973 | devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); | 2973 | devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); |
2974 | class_simple_device_add(tty_class, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); | 2974 | class_device_create(tty_class, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); |
2975 | 2975 | ||
2976 | vty_init(); | 2976 | vty_init(); |
2977 | #endif | 2977 | #endif |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 7abe405b8657..79c2928a8817 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -474,7 +474,7 @@ static struct file_operations vcs_fops = { | |||
474 | .open = vcs_open, | 474 | .open = vcs_open, |
475 | }; | 475 | }; |
476 | 476 | ||
477 | static struct class_simple *vc_class; | 477 | static struct class *vc_class; |
478 | 478 | ||
479 | void vcs_make_devfs(struct tty_struct *tty) | 479 | void vcs_make_devfs(struct tty_struct *tty) |
480 | { | 480 | { |
@@ -484,26 +484,26 @@ void vcs_make_devfs(struct tty_struct *tty) | |||
484 | devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), | 484 | devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), |
485 | S_IFCHR|S_IRUSR|S_IWUSR, | 485 | S_IFCHR|S_IRUSR|S_IWUSR, |
486 | "vcc/a%u", tty->index + 1); | 486 | "vcc/a%u", tty->index + 1); |
487 | class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1); | 487 | class_device_create(vc_class, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1); |
488 | class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 129), NULL, "vcsa%u", tty->index + 1); | 488 | class_device_create(vc_class, MKDEV(VCS_MAJOR, tty->index + 129), NULL, "vcsa%u", tty->index + 1); |
489 | } | 489 | } |
490 | void vcs_remove_devfs(struct tty_struct *tty) | 490 | void vcs_remove_devfs(struct tty_struct *tty) |
491 | { | 491 | { |
492 | devfs_remove("vcc/%u", tty->index + 1); | 492 | devfs_remove("vcc/%u", tty->index + 1); |
493 | devfs_remove("vcc/a%u", tty->index + 1); | 493 | devfs_remove("vcc/a%u", tty->index + 1); |
494 | class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 1)); | 494 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); |
495 | class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 129)); | 495 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); |
496 | } | 496 | } |
497 | 497 | ||
498 | int __init vcs_init(void) | 498 | int __init vcs_init(void) |
499 | { | 499 | { |
500 | if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) | 500 | if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops)) |
501 | panic("unable to get major %d for vcs device", VCS_MAJOR); | 501 | panic("unable to get major %d for vcs device", VCS_MAJOR); |
502 | vc_class = class_simple_create(THIS_MODULE, "vc"); | 502 | vc_class = class_create(THIS_MODULE, "vc"); |
503 | 503 | ||
504 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); | 504 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); |
505 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); | 505 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); |
506 | class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); | 506 | class_device_create(vc_class, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); |
507 | class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); | 507 | class_device_create(vc_class, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); |
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index aea3cbf5219d..4764b4f9555d 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -237,7 +237,7 @@ static dma_addr_t viotape_unitinfo_token; | |||
237 | 237 | ||
238 | static struct mtget viomtget[VIOTAPE_MAX_TAPE]; | 238 | static struct mtget viomtget[VIOTAPE_MAX_TAPE]; |
239 | 239 | ||
240 | static struct class_simple *tape_class; | 240 | static struct class *tape_class; |
241 | 241 | ||
242 | static struct device *tape_device[VIOTAPE_MAX_TAPE]; | 242 | static struct device *tape_device[VIOTAPE_MAX_TAPE]; |
243 | 243 | ||
@@ -956,9 +956,9 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
956 | state[i].cur_part = 0; | 956 | state[i].cur_part = 0; |
957 | for (j = 0; j < MAX_PARTITIONS; ++j) | 957 | for (j = 0; j < MAX_PARTITIONS; ++j) |
958 | state[i].part_stat_rwi[j] = VIOT_IDLE; | 958 | state[i].part_stat_rwi[j] = VIOT_IDLE; |
959 | class_simple_device_add(tape_class, MKDEV(VIOTAPE_MAJOR, i), NULL, | 959 | class_device_create(tape_class, MKDEV(VIOTAPE_MAJOR, i), NULL, |
960 | "iseries!vt%d", i); | 960 | "iseries!vt%d", i); |
961 | class_simple_device_add(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 961 | class_device_create(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
962 | NULL, "iseries!nvt%d", i); | 962 | NULL, "iseries!nvt%d", i); |
963 | devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, | 963 | devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, |
964 | "iseries/vt%d", i); | 964 | "iseries/vt%d", i); |
@@ -980,8 +980,8 @@ static int viotape_remove(struct vio_dev *vdev) | |||
980 | devfs_remove("iseries/nvt%d", i); | 980 | devfs_remove("iseries/nvt%d", i); |
981 | devfs_remove("iseries/vt%d", i); | 981 | devfs_remove("iseries/vt%d", i); |
982 | devfs_unregister_tape(state[i].dev_handle); | 982 | devfs_unregister_tape(state[i].dev_handle); |
983 | class_simple_device_remove(MKDEV(VIOTAPE_MAJOR, i | 0x80)); | 983 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); |
984 | class_simple_device_remove(MKDEV(VIOTAPE_MAJOR, i)); | 984 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); |
985 | return 0; | 985 | return 0; |
986 | } | 986 | } |
987 | 987 | ||
@@ -1045,7 +1045,7 @@ int __init viotap_init(void) | |||
1045 | goto clear_handler; | 1045 | goto clear_handler; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | tape_class = class_simple_create(THIS_MODULE, "tape"); | 1048 | tape_class = class_create(THIS_MODULE, "tape"); |
1049 | if (IS_ERR(tape_class)) { | 1049 | if (IS_ERR(tape_class)) { |
1050 | printk(VIOTAPE_KERN_WARN "Unable to allocat class\n"); | 1050 | printk(VIOTAPE_KERN_WARN "Unable to allocat class\n"); |
1051 | ret = PTR_ERR(tape_class); | 1051 | ret = PTR_ERR(tape_class); |
@@ -1070,7 +1070,7 @@ int __init viotap_init(void) | |||
1070 | return 0; | 1070 | return 0; |
1071 | 1071 | ||
1072 | unreg_class: | 1072 | unreg_class: |
1073 | class_simple_destroy(tape_class); | 1073 | class_destroy(tape_class); |
1074 | unreg_chrdev: | 1074 | unreg_chrdev: |
1075 | unregister_chrdev(VIOTAPE_MAJOR, "viotape"); | 1075 | unregister_chrdev(VIOTAPE_MAJOR, "viotape"); |
1076 | clear_handler: | 1076 | clear_handler: |
@@ -1110,7 +1110,7 @@ static void __exit viotap_exit(void) | |||
1110 | 1110 | ||
1111 | remove_proc_entry("iSeries/viotape", NULL); | 1111 | remove_proc_entry("iSeries/viotape", NULL); |
1112 | vio_unregister_driver(&viotape_driver); | 1112 | vio_unregister_driver(&viotape_driver); |
1113 | class_simple_destroy(tape_class); | 1113 | class_destroy(tape_class); |
1114 | ret = unregister_chrdev(VIOTAPE_MAJOR, "viotape"); | 1114 | ret = unregister_chrdev(VIOTAPE_MAJOR, "viotape"); |
1115 | if (ret < 0) | 1115 | if (ret < 0) |
1116 | printk(VIOTAPE_KERN_WARN "Error unregistering device: %d\n", | 1116 | printk(VIOTAPE_KERN_WARN "Error unregistering device: %d\n", |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 03b5fb2ddcf4..bf62dfe4976a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -521,7 +521,7 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf) | |||
521 | policy = cpufreq_cpu_get(policy->cpu); | 521 | policy = cpufreq_cpu_get(policy->cpu); |
522 | if (!policy) | 522 | if (!policy) |
523 | return -EINVAL; | 523 | return -EINVAL; |
524 | ret = fattr->show ? fattr->show(policy,buf) : 0; | 524 | ret = fattr->show ? fattr->show(policy,buf) : -EIO; |
525 | cpufreq_cpu_put(policy); | 525 | cpufreq_cpu_put(policy); |
526 | return ret; | 526 | return ret; |
527 | } | 527 | } |
@@ -535,7 +535,7 @@ static ssize_t store(struct kobject * kobj, struct attribute * attr, | |||
535 | policy = cpufreq_cpu_get(policy->cpu); | 535 | policy = cpufreq_cpu_get(policy->cpu); |
536 | if (!policy) | 536 | if (!policy) |
537 | return -EINVAL; | 537 | return -EINVAL; |
538 | ret = fattr->store ? fattr->store(policy,buf,count) : 0; | 538 | ret = fattr->store ? fattr->store(policy,buf,count) : -EIO; |
539 | cpufreq_cpu_put(policy); | 539 | cpufreq_cpu_put(policy); |
540 | return ret; | 540 | return ret; |
541 | } | 541 | } |
diff --git a/drivers/dio/dio-sysfs.c b/drivers/dio/dio-sysfs.c index d30591f69dd9..f46463038847 100644 --- a/drivers/dio/dio-sysfs.c +++ b/drivers/dio/dio-sysfs.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | /* show configuration fields */ | 18 | /* show configuration fields */ |
19 | 19 | ||
20 | static ssize_t dio_show_id(struct device *dev, char *buf) | 20 | static ssize_t dio_show_id(struct device *dev, struct device_attribute *attr, char *buf) |
21 | { | 21 | { |
22 | struct dio_dev *d; | 22 | struct dio_dev *d; |
23 | 23 | ||
@@ -26,7 +26,7 @@ static ssize_t dio_show_id(struct device *dev, char *buf) | |||
26 | } | 26 | } |
27 | static DEVICE_ATTR(id, S_IRUGO, dio_show_id, NULL); | 27 | static DEVICE_ATTR(id, S_IRUGO, dio_show_id, NULL); |
28 | 28 | ||
29 | static ssize_t dio_show_ipl(struct device *dev, char *buf) | 29 | static ssize_t dio_show_ipl(struct device *dev, struct device_attribute *attr, char *buf) |
30 | { | 30 | { |
31 | struct dio_dev *d; | 31 | struct dio_dev *d; |
32 | 32 | ||
@@ -35,7 +35,7 @@ static ssize_t dio_show_ipl(struct device *dev, char *buf) | |||
35 | } | 35 | } |
36 | static DEVICE_ATTR(ipl, S_IRUGO, dio_show_ipl, NULL); | 36 | static DEVICE_ATTR(ipl, S_IRUGO, dio_show_ipl, NULL); |
37 | 37 | ||
38 | static ssize_t dio_show_secid(struct device *dev, char *buf) | 38 | static ssize_t dio_show_secid(struct device *dev, struct device_attribute *attr, char *buf) |
39 | { | 39 | { |
40 | struct dio_dev *d; | 40 | struct dio_dev *d; |
41 | 41 | ||
@@ -44,7 +44,7 @@ static ssize_t dio_show_secid(struct device *dev, char *buf) | |||
44 | } | 44 | } |
45 | static DEVICE_ATTR(secid, S_IRUGO, dio_show_secid, NULL); | 45 | static DEVICE_ATTR(secid, S_IRUGO, dio_show_secid, NULL); |
46 | 46 | ||
47 | static ssize_t dio_show_name(struct device *dev, char *buf) | 47 | static ssize_t dio_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
48 | { | 48 | { |
49 | struct dio_dev *d; | 49 | struct dio_dev *d; |
50 | 50 | ||
@@ -53,7 +53,7 @@ static ssize_t dio_show_name(struct device *dev, char *buf) | |||
53 | } | 53 | } |
54 | static DEVICE_ATTR(name, S_IRUGO, dio_show_name, NULL); | 54 | static DEVICE_ATTR(name, S_IRUGO, dio_show_name, NULL); |
55 | 55 | ||
56 | static ssize_t dio_show_resource(struct device *dev, char *buf) | 56 | static ssize_t dio_show_resource(struct device *dev, struct device_attribute *attr, char *buf) |
57 | { | 57 | { |
58 | struct dio_dev *d = to_dio_dev(dev); | 58 | struct dio_dev *d = to_dio_dev(dev); |
59 | 59 | ||
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 6381ba53853c..1937743c8e29 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
@@ -149,7 +149,7 @@ void eisa_driver_unregister (struct eisa_driver *edrv) | |||
149 | driver_unregister (&edrv->driver); | 149 | driver_unregister (&edrv->driver); |
150 | } | 150 | } |
151 | 151 | ||
152 | static ssize_t eisa_show_sig (struct device *dev, char *buf) | 152 | static ssize_t eisa_show_sig (struct device *dev, struct device_attribute *attr, char *buf) |
153 | { | 153 | { |
154 | struct eisa_device *edev = to_eisa_device (dev); | 154 | struct eisa_device *edev = to_eisa_device (dev); |
155 | return sprintf (buf,"%s\n", edev->id.sig); | 155 | return sprintf (buf,"%s\n", edev->id.sig); |
@@ -157,7 +157,7 @@ static ssize_t eisa_show_sig (struct device *dev, char *buf) | |||
157 | 157 | ||
158 | static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL); | 158 | static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL); |
159 | 159 | ||
160 | static ssize_t eisa_show_state (struct device *dev, char *buf) | 160 | static ssize_t eisa_show_state (struct device *dev, struct device_attribute *attr, char *buf) |
161 | { | 161 | { |
162 | struct eisa_device *edev = to_eisa_device (dev); | 162 | struct eisa_device *edev = to_eisa_device (dev); |
163 | return sprintf (buf,"%d\n", edev->state & EISA_CONFIG_ENABLED); | 163 | return sprintf (buf,"%d\n", edev->state & EISA_CONFIG_ENABLED); |
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c index 33b669e6f977..6996476669f1 100644 --- a/drivers/firmware/edd.c +++ b/drivers/firmware/edd.c | |||
@@ -115,7 +115,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf) | |||
115 | { | 115 | { |
116 | struct edd_device *dev = to_edd_device(kobj); | 116 | struct edd_device *dev = to_edd_device(kobj); |
117 | struct edd_attribute *edd_attr = to_edd_attr(attr); | 117 | struct edd_attribute *edd_attr = to_edd_attr(attr); |
118 | ssize_t ret = 0; | 118 | ssize_t ret = -EIO; |
119 | 119 | ||
120 | if (edd_attr->show) | 120 | if (edd_attr->show) |
121 | ret = edd_attr->show(dev, buf); | 121 | ret = edd_attr->show(dev, buf); |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 0287ff65963b..a3451cb94004 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -352,7 +352,7 @@ static ssize_t efivar_attr_show(struct kobject *kobj, struct attribute *attr, | |||
352 | { | 352 | { |
353 | struct efivar_entry *var = to_efivar_entry(kobj); | 353 | struct efivar_entry *var = to_efivar_entry(kobj); |
354 | struct efivar_attribute *efivar_attr = to_efivar_attr(attr); | 354 | struct efivar_attribute *efivar_attr = to_efivar_attr(attr); |
355 | ssize_t ret = 0; | 355 | ssize_t ret = -EIO; |
356 | 356 | ||
357 | if (!capable(CAP_SYS_ADMIN)) | 357 | if (!capable(CAP_SYS_ADMIN)) |
358 | return -EACCES; | 358 | return -EACCES; |
@@ -368,7 +368,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr, | |||
368 | { | 368 | { |
369 | struct efivar_entry *var = to_efivar_entry(kobj); | 369 | struct efivar_entry *var = to_efivar_entry(kobj); |
370 | struct efivar_attribute *efivar_attr = to_efivar_attr(attr); | 370 | struct efivar_attribute *efivar_attr = to_efivar_attr(attr); |
371 | ssize_t ret = 0; | 371 | ssize_t ret = -EIO; |
372 | 372 | ||
373 | if (!capable(CAP_SYS_ADMIN)) | 373 | if (!capable(CAP_SYS_ADMIN)) |
374 | return -EACCES; | 374 | return -EACCES; |
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c index 9c59a370b6d9..9058c3956710 100644 --- a/drivers/i2c/chips/adm1021.c +++ b/drivers/i2c/chips/adm1021.c | |||
@@ -137,7 +137,7 @@ static struct i2c_driver adm1021_driver = { | |||
137 | }; | 137 | }; |
138 | 138 | ||
139 | #define show(value) \ | 139 | #define show(value) \ |
140 | static ssize_t show_##value(struct device *dev, char *buf) \ | 140 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
141 | { \ | 141 | { \ |
142 | struct adm1021_data *data = adm1021_update_device(dev); \ | 142 | struct adm1021_data *data = adm1021_update_device(dev); \ |
143 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ | 143 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ |
@@ -150,7 +150,7 @@ show(remote_temp_hyst); | |||
150 | show(remote_temp_input); | 150 | show(remote_temp_input); |
151 | 151 | ||
152 | #define show2(value) \ | 152 | #define show2(value) \ |
153 | static ssize_t show_##value(struct device *dev, char *buf) \ | 153 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
154 | { \ | 154 | { \ |
155 | struct adm1021_data *data = adm1021_update_device(dev); \ | 155 | struct adm1021_data *data = adm1021_update_device(dev); \ |
156 | return sprintf(buf, "%d\n", data->value); \ | 156 | return sprintf(buf, "%d\n", data->value); \ |
@@ -159,7 +159,7 @@ show2(alarms); | |||
159 | show2(die_code); | 159 | show2(die_code); |
160 | 160 | ||
161 | #define set(value, reg) \ | 161 | #define set(value, reg) \ |
162 | static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ | 162 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
163 | { \ | 163 | { \ |
164 | struct i2c_client *client = to_i2c_client(dev); \ | 164 | struct i2c_client *client = to_i2c_client(dev); \ |
165 | struct adm1021_data *data = i2c_get_clientdata(client); \ | 165 | struct adm1021_data *data = i2c_get_clientdata(client); \ |
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c index e0771a3d05c9..111f0c86c933 100644 --- a/drivers/i2c/chips/adm1025.c +++ b/drivers/i2c/chips/adm1025.c | |||
@@ -153,19 +153,19 @@ struct adm1025_data { | |||
153 | */ | 153 | */ |
154 | 154 | ||
155 | #define show_in(offset) \ | 155 | #define show_in(offset) \ |
156 | static ssize_t show_in##offset(struct device *dev, char *buf) \ | 156 | static ssize_t show_in##offset(struct device *dev, struct device_attribute *attr, char *buf) \ |
157 | { \ | 157 | { \ |
158 | struct adm1025_data *data = adm1025_update_device(dev); \ | 158 | struct adm1025_data *data = adm1025_update_device(dev); \ |
159 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ | 159 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ |
160 | in_scale[offset])); \ | 160 | in_scale[offset])); \ |
161 | } \ | 161 | } \ |
162 | static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ | 162 | static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
163 | { \ | 163 | { \ |
164 | struct adm1025_data *data = adm1025_update_device(dev); \ | 164 | struct adm1025_data *data = adm1025_update_device(dev); \ |
165 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ | 165 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ |
166 | in_scale[offset])); \ | 166 | in_scale[offset])); \ |
167 | } \ | 167 | } \ |
168 | static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ | 168 | static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
169 | { \ | 169 | { \ |
170 | struct adm1025_data *data = adm1025_update_device(dev); \ | 170 | struct adm1025_data *data = adm1025_update_device(dev); \ |
171 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ | 171 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ |
@@ -180,17 +180,17 @@ show_in(4); | |||
180 | show_in(5); | 180 | show_in(5); |
181 | 181 | ||
182 | #define show_temp(offset) \ | 182 | #define show_temp(offset) \ |
183 | static ssize_t show_temp##offset(struct device *dev, char *buf) \ | 183 | static ssize_t show_temp##offset(struct device *dev, struct device_attribute *attr, char *buf) \ |
184 | { \ | 184 | { \ |
185 | struct adm1025_data *data = adm1025_update_device(dev); \ | 185 | struct adm1025_data *data = adm1025_update_device(dev); \ |
186 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ | 186 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ |
187 | } \ | 187 | } \ |
188 | static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ | 188 | static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
189 | { \ | 189 | { \ |
190 | struct adm1025_data *data = adm1025_update_device(dev); \ | 190 | struct adm1025_data *data = adm1025_update_device(dev); \ |
191 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ | 191 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ |
192 | } \ | 192 | } \ |
193 | static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ | 193 | static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
194 | { \ | 194 | { \ |
195 | struct adm1025_data *data = adm1025_update_device(dev); \ | 195 | struct adm1025_data *data = adm1025_update_device(dev); \ |
196 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ | 196 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ |
@@ -200,7 +200,7 @@ show_temp(1); | |||
200 | show_temp(2); | 200 | show_temp(2); |
201 | 201 | ||
202 | #define set_in(offset) \ | 202 | #define set_in(offset) \ |
203 | static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ | 203 | static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
204 | size_t count) \ | 204 | size_t count) \ |
205 | { \ | 205 | { \ |
206 | struct i2c_client *client = to_i2c_client(dev); \ | 206 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -214,7 +214,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ | |||
214 | up(&data->update_lock); \ | 214 | up(&data->update_lock); \ |
215 | return count; \ | 215 | return count; \ |
216 | } \ | 216 | } \ |
217 | static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ | 217 | static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ |
218 | size_t count) \ | 218 | size_t count) \ |
219 | { \ | 219 | { \ |
220 | struct i2c_client *client = to_i2c_client(dev); \ | 220 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -240,7 +240,7 @@ set_in(4); | |||
240 | set_in(5); | 240 | set_in(5); |
241 | 241 | ||
242 | #define set_temp(offset) \ | 242 | #define set_temp(offset) \ |
243 | static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | 243 | static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
244 | size_t count) \ | 244 | size_t count) \ |
245 | { \ | 245 | { \ |
246 | struct i2c_client *client = to_i2c_client(dev); \ | 246 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -254,7 +254,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | |||
254 | up(&data->update_lock); \ | 254 | up(&data->update_lock); \ |
255 | return count; \ | 255 | return count; \ |
256 | } \ | 256 | } \ |
257 | static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ | 257 | static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ |
258 | size_t count) \ | 258 | size_t count) \ |
259 | { \ | 259 | { \ |
260 | struct i2c_client *client = to_i2c_client(dev); \ | 260 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -275,26 +275,26 @@ static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ | |||
275 | set_temp(1); | 275 | set_temp(1); |
276 | set_temp(2); | 276 | set_temp(2); |
277 | 277 | ||
278 | static ssize_t show_alarms(struct device *dev, char *buf) | 278 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
279 | { | 279 | { |
280 | struct adm1025_data *data = adm1025_update_device(dev); | 280 | struct adm1025_data *data = adm1025_update_device(dev); |
281 | return sprintf(buf, "%u\n", data->alarms); | 281 | return sprintf(buf, "%u\n", data->alarms); |
282 | } | 282 | } |
283 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 283 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
284 | 284 | ||
285 | static ssize_t show_vid(struct device *dev, char *buf) | 285 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
286 | { | 286 | { |
287 | struct adm1025_data *data = adm1025_update_device(dev); | 287 | struct adm1025_data *data = adm1025_update_device(dev); |
288 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); | 288 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); |
289 | } | 289 | } |
290 | static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); | 290 | static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); |
291 | 291 | ||
292 | static ssize_t show_vrm(struct device *dev, char *buf) | 292 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
293 | { | 293 | { |
294 | struct adm1025_data *data = adm1025_update_device(dev); | 294 | struct adm1025_data *data = adm1025_update_device(dev); |
295 | return sprintf(buf, "%u\n", data->vrm); | 295 | return sprintf(buf, "%u\n", data->vrm); |
296 | } | 296 | } |
297 | static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | 297 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
298 | { | 298 | { |
299 | struct i2c_client *client = to_i2c_client(dev); | 299 | struct i2c_client *client = to_i2c_client(dev); |
300 | struct adm1025_data *data = i2c_get_clientdata(client); | 300 | struct adm1025_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c index 39e2f4a900bf..b15fafe8f111 100644 --- a/drivers/i2c/chips/adm1026.c +++ b/drivers/i2c/chips/adm1026.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/jiffies.h> | 30 | #include <linux/jiffies.h> |
31 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
32 | #include <linux/i2c-sensor.h> | 32 | #include <linux/i2c-sensor.h> |
33 | #include <linux/i2c-sysfs.h> | ||
33 | #include <linux/i2c-vid.h> | 34 | #include <linux/i2c-vid.h> |
34 | 35 | ||
35 | /* Addresses to scan */ | 36 | /* Addresses to scan */ |
@@ -711,19 +712,27 @@ static struct adm1026_data *adm1026_update_device(struct device *dev) | |||
711 | return data; | 712 | return data; |
712 | } | 713 | } |
713 | 714 | ||
714 | static ssize_t show_in(struct device *dev, char *buf, int nr) | 715 | static ssize_t show_in(struct device *dev, struct device_attribute *attr, |
716 | char *buf) | ||
715 | { | 717 | { |
718 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
719 | int nr = sensor_attr->index; | ||
716 | struct adm1026_data *data = adm1026_update_device(dev); | 720 | struct adm1026_data *data = adm1026_update_device(dev); |
717 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in[nr])); | 721 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in[nr])); |
718 | } | 722 | } |
719 | static ssize_t show_in_min(struct device *dev, char *buf, int nr) | 723 | static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, |
724 | char *buf) | ||
720 | { | 725 | { |
726 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
727 | int nr = sensor_attr->index; | ||
721 | struct adm1026_data *data = adm1026_update_device(dev); | 728 | struct adm1026_data *data = adm1026_update_device(dev); |
722 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr])); | 729 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr])); |
723 | } | 730 | } |
724 | static ssize_t set_in_min(struct device *dev, const char *buf, | 731 | static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, |
725 | size_t count, int nr) | 732 | const char *buf, size_t count) |
726 | { | 733 | { |
734 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
735 | int nr = sensor_attr->index; | ||
727 | struct i2c_client *client = to_i2c_client(dev); | 736 | struct i2c_client *client = to_i2c_client(dev); |
728 | struct adm1026_data *data = i2c_get_clientdata(client); | 737 | struct adm1026_data *data = i2c_get_clientdata(client); |
729 | int val = simple_strtol(buf, NULL, 10); | 738 | int val = simple_strtol(buf, NULL, 10); |
@@ -734,14 +743,19 @@ static ssize_t set_in_min(struct device *dev, const char *buf, | |||
734 | up(&data->update_lock); | 743 | up(&data->update_lock); |
735 | return count; | 744 | return count; |
736 | } | 745 | } |
737 | static ssize_t show_in_max(struct device *dev, char *buf, int nr) | 746 | static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, |
747 | char *buf) | ||
738 | { | 748 | { |
749 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
750 | int nr = sensor_attr->index; | ||
739 | struct adm1026_data *data = adm1026_update_device(dev); | 751 | struct adm1026_data *data = adm1026_update_device(dev); |
740 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr])); | 752 | return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr])); |
741 | } | 753 | } |
742 | static ssize_t set_in_max(struct device *dev, const char *buf, | 754 | static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, |
743 | size_t count, int nr) | 755 | const char *buf, size_t count) |
744 | { | 756 | { |
757 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
758 | int nr = sensor_attr->index; | ||
745 | struct i2c_client *client = to_i2c_client(dev); | 759 | struct i2c_client *client = to_i2c_client(dev); |
746 | struct adm1026_data *data = i2c_get_clientdata(client); | 760 | struct adm1026_data *data = i2c_get_clientdata(client); |
747 | int val = simple_strtol(buf, NULL, 10); | 761 | int val = simple_strtol(buf, NULL, 10); |
@@ -753,34 +767,13 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
753 | return count; | 767 | return count; |
754 | } | 768 | } |
755 | 769 | ||
756 | #define in_reg(offset) \ | 770 | #define in_reg(offset) \ |
757 | static ssize_t show_in##offset (struct device *dev, char *buf) \ | 771 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \ |
758 | { \ | 772 | NULL, offset); \ |
759 | return show_in(dev, buf, offset); \ | 773 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ |
760 | } \ | 774 | show_in_min, set_in_min, offset); \ |
761 | static ssize_t show_in##offset##_min (struct device *dev, char *buf) \ | 775 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ |
762 | { \ | 776 | show_in_max, set_in_max, offset); |
763 | return show_in_min(dev, buf, offset); \ | ||
764 | } \ | ||
765 | static ssize_t set_in##offset##_min (struct device *dev, \ | ||
766 | const char *buf, size_t count) \ | ||
767 | { \ | ||
768 | return set_in_min(dev, buf, count, offset); \ | ||
769 | } \ | ||
770 | static ssize_t show_in##offset##_max (struct device *dev, char *buf) \ | ||
771 | { \ | ||
772 | return show_in_max(dev, buf, offset); \ | ||
773 | } \ | ||
774 | static ssize_t set_in##offset##_max (struct device *dev, \ | ||
775 | const char *buf, size_t count) \ | ||
776 | { \ | ||
777 | return set_in_max(dev, buf, count, offset); \ | ||
778 | } \ | ||
779 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \ | ||
780 | static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ | ||
781 | show_in##offset##_min, set_in##offset##_min); \ | ||
782 | static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ | ||
783 | show_in##offset##_max, set_in##offset##_max); | ||
784 | 777 | ||
785 | 778 | ||
786 | in_reg(0); | 779 | in_reg(0); |
@@ -800,19 +793,19 @@ in_reg(13); | |||
800 | in_reg(14); | 793 | in_reg(14); |
801 | in_reg(15); | 794 | in_reg(15); |
802 | 795 | ||
803 | static ssize_t show_in16(struct device *dev, char *buf) | 796 | static ssize_t show_in16(struct device *dev, struct device_attribute *attr, char *buf) |
804 | { | 797 | { |
805 | struct adm1026_data *data = adm1026_update_device(dev); | 798 | struct adm1026_data *data = adm1026_update_device(dev); |
806 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in[16]) - | 799 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in[16]) - |
807 | NEG12_OFFSET); | 800 | NEG12_OFFSET); |
808 | } | 801 | } |
809 | static ssize_t show_in16_min(struct device *dev, char *buf) | 802 | static ssize_t show_in16_min(struct device *dev, struct device_attribute *attr, char *buf) |
810 | { | 803 | { |
811 | struct adm1026_data *data = adm1026_update_device(dev); | 804 | struct adm1026_data *data = adm1026_update_device(dev); |
812 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_min[16]) | 805 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_min[16]) |
813 | - NEG12_OFFSET); | 806 | - NEG12_OFFSET); |
814 | } | 807 | } |
815 | static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) | 808 | static ssize_t set_in16_min(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
816 | { | 809 | { |
817 | struct i2c_client *client = to_i2c_client(dev); | 810 | struct i2c_client *client = to_i2c_client(dev); |
818 | struct adm1026_data *data = i2c_get_clientdata(client); | 811 | struct adm1026_data *data = i2c_get_clientdata(client); |
@@ -824,13 +817,13 @@ static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) | |||
824 | up(&data->update_lock); | 817 | up(&data->update_lock); |
825 | return count; | 818 | return count; |
826 | } | 819 | } |
827 | static ssize_t show_in16_max(struct device *dev, char *buf) | 820 | static ssize_t show_in16_max(struct device *dev, struct device_attribute *attr, char *buf) |
828 | { | 821 | { |
829 | struct adm1026_data *data = adm1026_update_device(dev); | 822 | struct adm1026_data *data = adm1026_update_device(dev); |
830 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_max[16]) | 823 | return sprintf(buf,"%d\n", INS_FROM_REG(16, data->in_max[16]) |
831 | - NEG12_OFFSET); | 824 | - NEG12_OFFSET); |
832 | } | 825 | } |
833 | static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) | 826 | static ssize_t set_in16_max(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
834 | { | 827 | { |
835 | struct i2c_client *client = to_i2c_client(dev); | 828 | struct i2c_client *client = to_i2c_client(dev); |
836 | struct adm1026_data *data = i2c_get_clientdata(client); | 829 | struct adm1026_data *data = i2c_get_clientdata(client); |
@@ -843,30 +836,38 @@ static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) | |||
843 | return count; | 836 | return count; |
844 | } | 837 | } |
845 | 838 | ||
846 | static DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL); | 839 | static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL, 16); |
847 | static DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min); | 840 | static SENSOR_DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min, 16); |
848 | static DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max); | 841 | static SENSOR_DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max, 16); |
849 | 842 | ||
850 | 843 | ||
851 | 844 | ||
852 | 845 | ||
853 | /* Now add fan read/write functions */ | 846 | /* Now add fan read/write functions */ |
854 | 847 | ||
855 | static ssize_t show_fan(struct device *dev, char *buf, int nr) | 848 | static ssize_t show_fan(struct device *dev, struct device_attribute *attr, |
849 | char *buf) | ||
856 | { | 850 | { |
851 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
852 | int nr = sensor_attr->index; | ||
857 | struct adm1026_data *data = adm1026_update_device(dev); | 853 | struct adm1026_data *data = adm1026_update_device(dev); |
858 | return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr], | 854 | return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr], |
859 | data->fan_div[nr])); | 855 | data->fan_div[nr])); |
860 | } | 856 | } |
861 | static ssize_t show_fan_min(struct device *dev, char *buf, int nr) | 857 | static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, |
858 | char *buf) | ||
862 | { | 859 | { |
860 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
861 | int nr = sensor_attr->index; | ||
863 | struct adm1026_data *data = adm1026_update_device(dev); | 862 | struct adm1026_data *data = adm1026_update_device(dev); |
864 | return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr], | 863 | return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr], |
865 | data->fan_div[nr])); | 864 | data->fan_div[nr])); |
866 | } | 865 | } |
867 | static ssize_t set_fan_min(struct device *dev, const char *buf, | 866 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, |
868 | size_t count, int nr) | 867 | const char *buf, size_t count) |
869 | { | 868 | { |
869 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
870 | int nr = sensor_attr->index; | ||
870 | struct i2c_client *client = to_i2c_client(dev); | 871 | struct i2c_client *client = to_i2c_client(dev); |
871 | struct adm1026_data *data = i2c_get_clientdata(client); | 872 | struct adm1026_data *data = i2c_get_clientdata(client); |
872 | int val = simple_strtol(buf, NULL, 10); | 873 | int val = simple_strtol(buf, NULL, 10); |
@@ -879,23 +880,11 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, | |||
879 | return count; | 880 | return count; |
880 | } | 881 | } |
881 | 882 | ||
882 | #define fan_offset(offset) \ | 883 | #define fan_offset(offset) \ |
883 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 884 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \ |
884 | { \ | 885 | offset - 1); \ |
885 | return show_fan(dev, buf, offset - 1); \ | 886 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
886 | } \ | 887 | show_fan_min, set_fan_min, offset - 1); |
887 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | ||
888 | { \ | ||
889 | return show_fan_min(dev, buf, offset - 1); \ | ||
890 | } \ | ||
891 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | ||
892 | const char *buf, size_t count) \ | ||
893 | { \ | ||
894 | return set_fan_min(dev, buf, count, offset - 1); \ | ||
895 | } \ | ||
896 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL); \ | ||
897 | static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | ||
898 | show_fan_##offset##_min, set_fan_##offset##_min); | ||
899 | 888 | ||
900 | fan_offset(1); | 889 | fan_offset(1); |
901 | fan_offset(2); | 890 | fan_offset(2); |
@@ -926,14 +915,19 @@ static void fixup_fan_min(struct device *dev, int fan, int old_div) | |||
926 | } | 915 | } |
927 | 916 | ||
928 | /* Now add fan_div read/write functions */ | 917 | /* Now add fan_div read/write functions */ |
929 | static ssize_t show_fan_div(struct device *dev, char *buf, int nr) | 918 | static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, |
919 | char *buf) | ||
930 | { | 920 | { |
921 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
922 | int nr = sensor_attr->index; | ||
931 | struct adm1026_data *data = adm1026_update_device(dev); | 923 | struct adm1026_data *data = adm1026_update_device(dev); |
932 | return sprintf(buf,"%d\n", data->fan_div[nr]); | 924 | return sprintf(buf,"%d\n", data->fan_div[nr]); |
933 | } | 925 | } |
934 | static ssize_t set_fan_div(struct device *dev, const char *buf, | 926 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
935 | size_t count, int nr) | 927 | const char *buf, size_t count) |
936 | { | 928 | { |
929 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
930 | int nr = sensor_attr->index; | ||
937 | struct i2c_client *client = to_i2c_client(dev); | 931 | struct i2c_client *client = to_i2c_client(dev); |
938 | struct adm1026_data *data = i2c_get_clientdata(client); | 932 | struct adm1026_data *data = i2c_get_clientdata(client); |
939 | int val,orig_div,new_div,shift; | 933 | int val,orig_div,new_div,shift; |
@@ -967,17 +961,8 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
967 | } | 961 | } |
968 | 962 | ||
969 | #define fan_offset_div(offset) \ | 963 | #define fan_offset_div(offset) \ |
970 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 964 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ |
971 | { \ | 965 | show_fan_div, set_fan_div, offset - 1); |
972 | return show_fan_div(dev, buf, offset - 1); \ | ||
973 | } \ | ||
974 | static ssize_t set_fan_##offset##_div (struct device *dev, \ | ||
975 | const char *buf, size_t count) \ | ||
976 | { \ | ||
977 | return set_fan_div(dev, buf, count, offset - 1); \ | ||
978 | } \ | ||
979 | static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | ||
980 | show_fan_##offset##_div, set_fan_##offset##_div); | ||
981 | 966 | ||
982 | fan_offset_div(1); | 967 | fan_offset_div(1); |
983 | fan_offset_div(2); | 968 | fan_offset_div(2); |
@@ -989,19 +974,27 @@ fan_offset_div(7); | |||
989 | fan_offset_div(8); | 974 | fan_offset_div(8); |
990 | 975 | ||
991 | /* Temps */ | 976 | /* Temps */ |
992 | static ssize_t show_temp(struct device *dev, char *buf, int nr) | 977 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
978 | char *buf) | ||
993 | { | 979 | { |
980 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
981 | int nr = sensor_attr->index; | ||
994 | struct adm1026_data *data = adm1026_update_device(dev); | 982 | struct adm1026_data *data = adm1026_update_device(dev); |
995 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp[nr])); | 983 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp[nr])); |
996 | } | 984 | } |
997 | static ssize_t show_temp_min(struct device *dev, char *buf, int nr) | 985 | static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, |
986 | char *buf) | ||
998 | { | 987 | { |
988 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
989 | int nr = sensor_attr->index; | ||
999 | struct adm1026_data *data = adm1026_update_device(dev); | 990 | struct adm1026_data *data = adm1026_update_device(dev); |
1000 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr])); | 991 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr])); |
1001 | } | 992 | } |
1002 | static ssize_t set_temp_min(struct device *dev, const char *buf, | 993 | static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, |
1003 | size_t count, int nr) | 994 | const char *buf, size_t count) |
1004 | { | 995 | { |
996 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
997 | int nr = sensor_attr->index; | ||
1005 | struct i2c_client *client = to_i2c_client(dev); | 998 | struct i2c_client *client = to_i2c_client(dev); |
1006 | struct adm1026_data *data = i2c_get_clientdata(client); | 999 | struct adm1026_data *data = i2c_get_clientdata(client); |
1007 | int val = simple_strtol(buf, NULL, 10); | 1000 | int val = simple_strtol(buf, NULL, 10); |
@@ -1013,14 +1006,19 @@ static ssize_t set_temp_min(struct device *dev, const char *buf, | |||
1013 | up(&data->update_lock); | 1006 | up(&data->update_lock); |
1014 | return count; | 1007 | return count; |
1015 | } | 1008 | } |
1016 | static ssize_t show_temp_max(struct device *dev, char *buf, int nr) | 1009 | static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, |
1010 | char *buf) | ||
1017 | { | 1011 | { |
1012 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1013 | int nr = sensor_attr->index; | ||
1018 | struct adm1026_data *data = adm1026_update_device(dev); | 1014 | struct adm1026_data *data = adm1026_update_device(dev); |
1019 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr])); | 1015 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr])); |
1020 | } | 1016 | } |
1021 | static ssize_t set_temp_max(struct device *dev, const char *buf, | 1017 | static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, |
1022 | size_t count, int nr) | 1018 | const char *buf, size_t count) |
1023 | { | 1019 | { |
1020 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1021 | int nr = sensor_attr->index; | ||
1024 | struct i2c_client *client = to_i2c_client(dev); | 1022 | struct i2c_client *client = to_i2c_client(dev); |
1025 | struct adm1026_data *data = i2c_get_clientdata(client); | 1023 | struct adm1026_data *data = i2c_get_clientdata(client); |
1026 | int val = simple_strtol(buf, NULL, 10); | 1024 | int val = simple_strtol(buf, NULL, 10); |
@@ -1032,48 +1030,34 @@ static ssize_t set_temp_max(struct device *dev, const char *buf, | |||
1032 | up(&data->update_lock); | 1030 | up(&data->update_lock); |
1033 | return count; | 1031 | return count; |
1034 | } | 1032 | } |
1035 | #define temp_reg(offset) \ | 1033 | |
1036 | static ssize_t show_temp_##offset (struct device *dev, char *buf) \ | 1034 | #define temp_reg(offset) \ |
1037 | { \ | 1035 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \ |
1038 | return show_temp(dev, buf, offset - 1); \ | 1036 | NULL, offset - 1); \ |
1039 | } \ | 1037 | static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ |
1040 | static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ | 1038 | show_temp_min, set_temp_min, offset - 1); \ |
1041 | { \ | 1039 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ |
1042 | return show_temp_min(dev, buf, offset - 1); \ | 1040 | show_temp_max, set_temp_max, offset - 1); |
1043 | } \ | ||
1044 | static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ | ||
1045 | { \ | ||
1046 | return show_temp_max(dev, buf, offset - 1); \ | ||
1047 | } \ | ||
1048 | static ssize_t set_temp_##offset##_min (struct device *dev, \ | ||
1049 | const char *buf, size_t count) \ | ||
1050 | { \ | ||
1051 | return set_temp_min(dev, buf, count, offset - 1); \ | ||
1052 | } \ | ||
1053 | static ssize_t set_temp_##offset##_max (struct device *dev, \ | ||
1054 | const char *buf, size_t count) \ | ||
1055 | { \ | ||
1056 | return set_temp_max(dev, buf, count, offset - 1); \ | ||
1057 | } \ | ||
1058 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, NULL); \ | ||
1059 | static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ | ||
1060 | show_temp_##offset##_min, set_temp_##offset##_min); \ | ||
1061 | static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ | ||
1062 | show_temp_##offset##_max, set_temp_##offset##_max); | ||
1063 | 1041 | ||
1064 | 1042 | ||
1065 | temp_reg(1); | 1043 | temp_reg(1); |
1066 | temp_reg(2); | 1044 | temp_reg(2); |
1067 | temp_reg(3); | 1045 | temp_reg(3); |
1068 | 1046 | ||
1069 | static ssize_t show_temp_offset(struct device *dev, char *buf, int nr) | 1047 | static ssize_t show_temp_offset(struct device *dev, |
1048 | struct device_attribute *attr, char *buf) | ||
1070 | { | 1049 | { |
1050 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1051 | int nr = sensor_attr->index; | ||
1071 | struct adm1026_data *data = adm1026_update_device(dev); | 1052 | struct adm1026_data *data = adm1026_update_device(dev); |
1072 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_offset[nr])); | 1053 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_offset[nr])); |
1073 | } | 1054 | } |
1074 | static ssize_t set_temp_offset(struct device *dev, const char *buf, | 1055 | static ssize_t set_temp_offset(struct device *dev, |
1075 | size_t count, int nr) | 1056 | struct device_attribute *attr, const char *buf, |
1057 | size_t count) | ||
1076 | { | 1058 | { |
1059 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1060 | int nr = sensor_attr->index; | ||
1077 | struct i2c_client *client = to_i2c_client(dev); | 1061 | struct i2c_client *client = to_i2c_client(dev); |
1078 | struct adm1026_data *data = i2c_get_clientdata(client); | 1062 | struct adm1026_data *data = i2c_get_clientdata(client); |
1079 | int val = simple_strtol(buf, NULL, 10); | 1063 | int val = simple_strtol(buf, NULL, 10); |
@@ -1086,46 +1070,45 @@ static ssize_t set_temp_offset(struct device *dev, const char *buf, | |||
1086 | return count; | 1070 | return count; |
1087 | } | 1071 | } |
1088 | 1072 | ||
1089 | #define temp_offset_reg(offset) \ | 1073 | #define temp_offset_reg(offset) \ |
1090 | static ssize_t show_temp_##offset##_offset (struct device *dev, char *buf) \ | 1074 | static SENSOR_DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \ |
1091 | { \ | 1075 | show_temp_offset, set_temp_offset, offset - 1); |
1092 | return show_temp_offset(dev, buf, offset - 1); \ | ||
1093 | } \ | ||
1094 | static ssize_t set_temp_##offset##_offset (struct device *dev, \ | ||
1095 | const char *buf, size_t count) \ | ||
1096 | { \ | ||
1097 | return set_temp_offset(dev, buf, count, offset - 1); \ | ||
1098 | } \ | ||
1099 | static DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \ | ||
1100 | show_temp_##offset##_offset, set_temp_##offset##_offset); | ||
1101 | 1076 | ||
1102 | temp_offset_reg(1); | 1077 | temp_offset_reg(1); |
1103 | temp_offset_reg(2); | 1078 | temp_offset_reg(2); |
1104 | temp_offset_reg(3); | 1079 | temp_offset_reg(3); |
1105 | 1080 | ||
1106 | static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, char *buf, | 1081 | static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, |
1107 | int nr) | 1082 | struct device_attribute *attr, char *buf) |
1108 | { | 1083 | { |
1084 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1085 | int nr = sensor_attr->index; | ||
1109 | struct adm1026_data *data = adm1026_update_device(dev); | 1086 | struct adm1026_data *data = adm1026_update_device(dev); |
1110 | return sprintf(buf,"%d\n", TEMP_FROM_REG( | 1087 | return sprintf(buf,"%d\n", TEMP_FROM_REG( |
1111 | ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr])); | 1088 | ADM1026_FAN_ACTIVATION_TEMP_HYST + data->temp_tmin[nr])); |
1112 | } | 1089 | } |
1113 | static ssize_t show_temp_auto_point2_temp(struct device *dev, char *buf, | 1090 | static ssize_t show_temp_auto_point2_temp(struct device *dev, |
1114 | int nr) | 1091 | struct device_attribute *attr, char *buf) |
1115 | { | 1092 | { |
1093 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1094 | int nr = sensor_attr->index; | ||
1116 | struct adm1026_data *data = adm1026_update_device(dev); | 1095 | struct adm1026_data *data = adm1026_update_device(dev); |
1117 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr] + | 1096 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr] + |
1118 | ADM1026_FAN_CONTROL_TEMP_RANGE)); | 1097 | ADM1026_FAN_CONTROL_TEMP_RANGE)); |
1119 | } | 1098 | } |
1120 | static ssize_t show_temp_auto_point1_temp(struct device *dev, char *buf, | 1099 | static ssize_t show_temp_auto_point1_temp(struct device *dev, |
1121 | int nr) | 1100 | struct device_attribute *attr, char *buf) |
1122 | { | 1101 | { |
1102 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1103 | int nr = sensor_attr->index; | ||
1123 | struct adm1026_data *data = adm1026_update_device(dev); | 1104 | struct adm1026_data *data = adm1026_update_device(dev); |
1124 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr])); | 1105 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_tmin[nr])); |
1125 | } | 1106 | } |
1126 | static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, | 1107 | static ssize_t set_temp_auto_point1_temp(struct device *dev, |
1127 | size_t count, int nr) | 1108 | struct device_attribute *attr, const char *buf, size_t count) |
1128 | { | 1109 | { |
1110 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1111 | int nr = sensor_attr->index; | ||
1129 | struct i2c_client *client = to_i2c_client(dev); | 1112 | struct i2c_client *client = to_i2c_client(dev); |
1130 | struct adm1026_data *data = i2c_get_clientdata(client); | 1113 | struct adm1026_data *data = i2c_get_clientdata(client); |
1131 | int val = simple_strtol(buf, NULL, 10); | 1114 | int val = simple_strtol(buf, NULL, 10); |
@@ -1138,46 +1121,27 @@ static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, | |||
1138 | return count; | 1121 | return count; |
1139 | } | 1122 | } |
1140 | 1123 | ||
1141 | #define temp_auto_point(offset) \ | 1124 | #define temp_auto_point(offset) \ |
1142 | static ssize_t show_temp##offset##_auto_point1_temp (struct device *dev, \ | 1125 | static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \ |
1143 | char *buf) \ | 1126 | show_temp_auto_point1_temp, set_temp_auto_point1_temp, \ |
1144 | { \ | 1127 | offset - 1); \ |
1145 | return show_temp_auto_point1_temp(dev, buf, offset - 1); \ | 1128 | static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \ |
1146 | } \ | 1129 | show_temp_auto_point1_temp_hyst, NULL, offset - 1); \ |
1147 | static ssize_t set_temp##offset##_auto_point1_temp (struct device *dev, \ | 1130 | static SENSOR_DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \ |
1148 | const char *buf, size_t count) \ | 1131 | show_temp_auto_point2_temp, NULL, offset - 1); |
1149 | { \ | ||
1150 | return set_temp_auto_point1_temp(dev, buf, count, offset - 1); \ | ||
1151 | } \ | ||
1152 | static ssize_t show_temp##offset##_auto_point1_temp_hyst (struct device \ | ||
1153 | *dev, char *buf) \ | ||
1154 | { \ | ||
1155 | return show_temp_auto_point1_temp_hyst(dev, buf, offset - 1); \ | ||
1156 | } \ | ||
1157 | static ssize_t show_temp##offset##_auto_point2_temp (struct device *dev, \ | ||
1158 | char *buf) \ | ||
1159 | { \ | ||
1160 | return show_temp_auto_point2_temp(dev, buf, offset - 1); \ | ||
1161 | } \ | ||
1162 | static DEVICE_ATTR(temp##offset##_auto_point1_temp, S_IRUGO | S_IWUSR, \ | ||
1163 | show_temp##offset##_auto_point1_temp, \ | ||
1164 | set_temp##offset##_auto_point1_temp); \ | ||
1165 | static DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \ | ||
1166 | show_temp##offset##_auto_point1_temp_hyst, NULL); \ | ||
1167 | static DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \ | ||
1168 | show_temp##offset##_auto_point2_temp, NULL); | ||
1169 | 1132 | ||
1170 | temp_auto_point(1); | 1133 | temp_auto_point(1); |
1171 | temp_auto_point(2); | 1134 | temp_auto_point(2); |
1172 | temp_auto_point(3); | 1135 | temp_auto_point(3); |
1173 | 1136 | ||
1174 | static ssize_t show_temp_crit_enable(struct device *dev, char *buf) | 1137 | static ssize_t show_temp_crit_enable(struct device *dev, |
1138 | struct device_attribute *attr, char *buf) | ||
1175 | { | 1139 | { |
1176 | struct adm1026_data *data = adm1026_update_device(dev); | 1140 | struct adm1026_data *data = adm1026_update_device(dev); |
1177 | return sprintf(buf,"%d\n", (data->config1 & CFG1_THERM_HOT) >> 4); | 1141 | return sprintf(buf,"%d\n", (data->config1 & CFG1_THERM_HOT) >> 4); |
1178 | } | 1142 | } |
1179 | static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, | 1143 | static ssize_t set_temp_crit_enable(struct device *dev, |
1180 | size_t count) | 1144 | struct device_attribute *attr, const char *buf, size_t count) |
1181 | { | 1145 | { |
1182 | struct i2c_client *client = to_i2c_client(dev); | 1146 | struct i2c_client *client = to_i2c_client(dev); |
1183 | struct adm1026_data *data = i2c_get_clientdata(client); | 1147 | struct adm1026_data *data = i2c_get_clientdata(client); |
@@ -1193,24 +1157,27 @@ static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, | |||
1193 | return count; | 1157 | return count; |
1194 | } | 1158 | } |
1195 | 1159 | ||
1196 | static DEVICE_ATTR(temp1_crit_enable, S_IRUGO | S_IWUSR, | 1160 | #define temp_crit_enable(offset) \ |
1197 | show_temp_crit_enable, set_temp_crit_enable); | 1161 | static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \ |
1198 | |||
1199 | static DEVICE_ATTR(temp2_crit_enable, S_IRUGO | S_IWUSR, | ||
1200 | show_temp_crit_enable, set_temp_crit_enable); | ||
1201 | |||
1202 | static DEVICE_ATTR(temp3_crit_enable, S_IRUGO | S_IWUSR, | ||
1203 | show_temp_crit_enable, set_temp_crit_enable); | 1162 | show_temp_crit_enable, set_temp_crit_enable); |
1204 | 1163 | ||
1164 | temp_crit_enable(1); | ||
1165 | temp_crit_enable(2); | ||
1166 | temp_crit_enable(3); | ||
1205 | 1167 | ||
1206 | static ssize_t show_temp_crit(struct device *dev, char *buf, int nr) | 1168 | static ssize_t show_temp_crit(struct device *dev, |
1169 | struct device_attribute *attr, char *buf) | ||
1207 | { | 1170 | { |
1171 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1172 | int nr = sensor_attr->index; | ||
1208 | struct adm1026_data *data = adm1026_update_device(dev); | 1173 | struct adm1026_data *data = adm1026_update_device(dev); |
1209 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_crit[nr])); | 1174 | return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_crit[nr])); |
1210 | } | 1175 | } |
1211 | static ssize_t set_temp_crit(struct device *dev, const char *buf, | 1176 | static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, |
1212 | size_t count, int nr) | 1177 | const char *buf, size_t count) |
1213 | { | 1178 | { |
1179 | struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); | ||
1180 | int nr = sensor_attr->index; | ||
1214 | struct i2c_client *client = to_i2c_client(dev); | 1181 | struct i2c_client *client = to_i2c_client(dev); |
1215 | struct adm1026_data *data = i2c_get_clientdata(client); | 1182 | struct adm1026_data *data = i2c_get_clientdata(client); |
1216 | int val = simple_strtol(buf, NULL, 10); | 1183 | int val = simple_strtol(buf, NULL, 10); |
@@ -1223,29 +1190,20 @@ static ssize_t set_temp_crit(struct device *dev, const char *buf, | |||
1223 | return count; | 1190 | return count; |
1224 | } | 1191 | } |
1225 | 1192 | ||
1226 | #define temp_crit_reg(offset) \ | 1193 | #define temp_crit_reg(offset) \ |
1227 | static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ | 1194 | static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \ |
1228 | { \ | 1195 | show_temp_crit, set_temp_crit, offset - 1); |
1229 | return show_temp_crit(dev, buf, offset - 1); \ | ||
1230 | } \ | ||
1231 | static ssize_t set_temp_##offset##_crit (struct device *dev, \ | ||
1232 | const char *buf, size_t count) \ | ||
1233 | { \ | ||
1234 | return set_temp_crit(dev, buf, count, offset - 1); \ | ||
1235 | } \ | ||
1236 | static DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \ | ||
1237 | show_temp_##offset##_crit, set_temp_##offset##_crit); | ||
1238 | 1196 | ||
1239 | temp_crit_reg(1); | 1197 | temp_crit_reg(1); |
1240 | temp_crit_reg(2); | 1198 | temp_crit_reg(2); |
1241 | temp_crit_reg(3); | 1199 | temp_crit_reg(3); |
1242 | 1200 | ||
1243 | static ssize_t show_analog_out_reg(struct device *dev, char *buf) | 1201 | static ssize_t show_analog_out_reg(struct device *dev, struct device_attribute *attr, char *buf) |
1244 | { | 1202 | { |
1245 | struct adm1026_data *data = adm1026_update_device(dev); | 1203 | struct adm1026_data *data = adm1026_update_device(dev); |
1246 | return sprintf(buf,"%d\n", DAC_FROM_REG(data->analog_out)); | 1204 | return sprintf(buf,"%d\n", DAC_FROM_REG(data->analog_out)); |
1247 | } | 1205 | } |
1248 | static ssize_t set_analog_out_reg(struct device *dev, const char *buf, | 1206 | static ssize_t set_analog_out_reg(struct device *dev, struct device_attribute *attr, const char *buf, |
1249 | size_t count) | 1207 | size_t count) |
1250 | { | 1208 | { |
1251 | struct i2c_client *client = to_i2c_client(dev); | 1209 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1262,7 +1220,7 @@ static ssize_t set_analog_out_reg(struct device *dev, const char *buf, | |||
1262 | static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg, | 1220 | static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg, |
1263 | set_analog_out_reg); | 1221 | set_analog_out_reg); |
1264 | 1222 | ||
1265 | static ssize_t show_vid_reg(struct device *dev, char *buf) | 1223 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
1266 | { | 1224 | { |
1267 | struct adm1026_data *data = adm1026_update_device(dev); | 1225 | struct adm1026_data *data = adm1026_update_device(dev); |
1268 | return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); | 1226 | return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); |
@@ -1270,12 +1228,12 @@ static ssize_t show_vid_reg(struct device *dev, char *buf) | |||
1270 | 1228 | ||
1271 | static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); | 1229 | static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); |
1272 | 1230 | ||
1273 | static ssize_t show_vrm_reg(struct device *dev, char *buf) | 1231 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
1274 | { | 1232 | { |
1275 | struct adm1026_data *data = adm1026_update_device(dev); | 1233 | struct adm1026_data *data = adm1026_update_device(dev); |
1276 | return sprintf(buf,"%d\n", data->vrm); | 1234 | return sprintf(buf,"%d\n", data->vrm); |
1277 | } | 1235 | } |
1278 | static ssize_t store_vrm_reg(struct device *dev, const char *buf, | 1236 | static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, |
1279 | size_t count) | 1237 | size_t count) |
1280 | { | 1238 | { |
1281 | struct i2c_client *client = to_i2c_client(dev); | 1239 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1287,7 +1245,7 @@ static ssize_t store_vrm_reg(struct device *dev, const char *buf, | |||
1287 | 1245 | ||
1288 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | 1246 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); |
1289 | 1247 | ||
1290 | static ssize_t show_alarms_reg(struct device *dev, char *buf) | 1248 | static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) |
1291 | { | 1249 | { |
1292 | struct adm1026_data *data = adm1026_update_device(dev); | 1250 | struct adm1026_data *data = adm1026_update_device(dev); |
1293 | return sprintf(buf, "%ld\n", (long) (data->alarms)); | 1251 | return sprintf(buf, "%ld\n", (long) (data->alarms)); |
@@ -1295,12 +1253,12 @@ static ssize_t show_alarms_reg(struct device *dev, char *buf) | |||
1295 | 1253 | ||
1296 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); | 1254 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); |
1297 | 1255 | ||
1298 | static ssize_t show_alarm_mask(struct device *dev, char *buf) | 1256 | static ssize_t show_alarm_mask(struct device *dev, struct device_attribute *attr, char *buf) |
1299 | { | 1257 | { |
1300 | struct adm1026_data *data = adm1026_update_device(dev); | 1258 | struct adm1026_data *data = adm1026_update_device(dev); |
1301 | return sprintf(buf,"%ld\n", data->alarm_mask); | 1259 | return sprintf(buf,"%ld\n", data->alarm_mask); |
1302 | } | 1260 | } |
1303 | static ssize_t set_alarm_mask(struct device *dev, const char *buf, | 1261 | static ssize_t set_alarm_mask(struct device *dev, struct device_attribute *attr, const char *buf, |
1304 | size_t count) | 1262 | size_t count) |
1305 | { | 1263 | { |
1306 | struct i2c_client *client = to_i2c_client(dev); | 1264 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1331,12 +1289,12 @@ static DEVICE_ATTR(alarm_mask, S_IRUGO | S_IWUSR, show_alarm_mask, | |||
1331 | set_alarm_mask); | 1289 | set_alarm_mask); |
1332 | 1290 | ||
1333 | 1291 | ||
1334 | static ssize_t show_gpio(struct device *dev, char *buf) | 1292 | static ssize_t show_gpio(struct device *dev, struct device_attribute *attr, char *buf) |
1335 | { | 1293 | { |
1336 | struct adm1026_data *data = adm1026_update_device(dev); | 1294 | struct adm1026_data *data = adm1026_update_device(dev); |
1337 | return sprintf(buf,"%ld\n", data->gpio); | 1295 | return sprintf(buf,"%ld\n", data->gpio); |
1338 | } | 1296 | } |
1339 | static ssize_t set_gpio(struct device *dev, const char *buf, | 1297 | static ssize_t set_gpio(struct device *dev, struct device_attribute *attr, const char *buf, |
1340 | size_t count) | 1298 | size_t count) |
1341 | { | 1299 | { |
1342 | struct i2c_client *client = to_i2c_client(dev); | 1300 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1359,12 +1317,12 @@ static ssize_t set_gpio(struct device *dev, const char *buf, | |||
1359 | static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio); | 1317 | static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio); |
1360 | 1318 | ||
1361 | 1319 | ||
1362 | static ssize_t show_gpio_mask(struct device *dev, char *buf) | 1320 | static ssize_t show_gpio_mask(struct device *dev, struct device_attribute *attr, char *buf) |
1363 | { | 1321 | { |
1364 | struct adm1026_data *data = adm1026_update_device(dev); | 1322 | struct adm1026_data *data = adm1026_update_device(dev); |
1365 | return sprintf(buf,"%ld\n", data->gpio_mask); | 1323 | return sprintf(buf,"%ld\n", data->gpio_mask); |
1366 | } | 1324 | } |
1367 | static ssize_t set_gpio_mask(struct device *dev, const char *buf, | 1325 | static ssize_t set_gpio_mask(struct device *dev, struct device_attribute *attr, const char *buf, |
1368 | size_t count) | 1326 | size_t count) |
1369 | { | 1327 | { |
1370 | struct i2c_client *client = to_i2c_client(dev); | 1328 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1386,12 +1344,12 @@ static ssize_t set_gpio_mask(struct device *dev, const char *buf, | |||
1386 | 1344 | ||
1387 | static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask); | 1345 | static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask); |
1388 | 1346 | ||
1389 | static ssize_t show_pwm_reg(struct device *dev, char *buf) | 1347 | static ssize_t show_pwm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
1390 | { | 1348 | { |
1391 | struct adm1026_data *data = adm1026_update_device(dev); | 1349 | struct adm1026_data *data = adm1026_update_device(dev); |
1392 | return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm1.pwm)); | 1350 | return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm1.pwm)); |
1393 | } | 1351 | } |
1394 | static ssize_t set_pwm_reg(struct device *dev, const char *buf, | 1352 | static ssize_t set_pwm_reg(struct device *dev, struct device_attribute *attr, const char *buf, |
1395 | size_t count) | 1353 | size_t count) |
1396 | { | 1354 | { |
1397 | struct i2c_client *client = to_i2c_client(dev); | 1355 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1407,12 +1365,12 @@ static ssize_t set_pwm_reg(struct device *dev, const char *buf, | |||
1407 | } | 1365 | } |
1408 | return count; | 1366 | return count; |
1409 | } | 1367 | } |
1410 | static ssize_t show_auto_pwm_min(struct device *dev, char *buf) | 1368 | static ssize_t show_auto_pwm_min(struct device *dev, struct device_attribute *attr, char *buf) |
1411 | { | 1369 | { |
1412 | struct adm1026_data *data = adm1026_update_device(dev); | 1370 | struct adm1026_data *data = adm1026_update_device(dev); |
1413 | return sprintf(buf,"%d\n", data->pwm1.auto_pwm_min); | 1371 | return sprintf(buf,"%d\n", data->pwm1.auto_pwm_min); |
1414 | } | 1372 | } |
1415 | static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, | 1373 | static ssize_t set_auto_pwm_min(struct device *dev, struct device_attribute *attr, const char *buf, |
1416 | size_t count) | 1374 | size_t count) |
1417 | { | 1375 | { |
1418 | struct i2c_client *client = to_i2c_client(dev); | 1376 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1429,16 +1387,16 @@ static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, | |||
1429 | up(&data->update_lock); | 1387 | up(&data->update_lock); |
1430 | return count; | 1388 | return count; |
1431 | } | 1389 | } |
1432 | static ssize_t show_auto_pwm_max(struct device *dev, char *buf) | 1390 | static ssize_t show_auto_pwm_max(struct device *dev, struct device_attribute *attr, char *buf) |
1433 | { | 1391 | { |
1434 | return sprintf(buf,"%d\n", ADM1026_PWM_MAX); | 1392 | return sprintf(buf,"%d\n", ADM1026_PWM_MAX); |
1435 | } | 1393 | } |
1436 | static ssize_t show_pwm_enable(struct device *dev, char *buf) | 1394 | static ssize_t show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf) |
1437 | { | 1395 | { |
1438 | struct adm1026_data *data = adm1026_update_device(dev); | 1396 | struct adm1026_data *data = adm1026_update_device(dev); |
1439 | return sprintf(buf,"%d\n", data->pwm1.enable); | 1397 | return sprintf(buf,"%d\n", data->pwm1.enable); |
1440 | } | 1398 | } |
1441 | static ssize_t set_pwm_enable(struct device *dev, const char *buf, | 1399 | static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr, const char *buf, |
1442 | size_t count) | 1400 | size_t count) |
1443 | { | 1401 | { |
1444 | struct i2c_client *client = to_i2c_client(dev); | 1402 | struct i2c_client *client = to_i2c_client(dev); |
@@ -1597,114 +1555,114 @@ int adm1026_detect(struct i2c_adapter *adapter, int address, | |||
1597 | adm1026_init_client(new_client); | 1555 | adm1026_init_client(new_client); |
1598 | 1556 | ||
1599 | /* Register sysfs hooks */ | 1557 | /* Register sysfs hooks */ |
1600 | device_create_file(&new_client->dev, &dev_attr_in0_input); | 1558 | device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr); |
1601 | device_create_file(&new_client->dev, &dev_attr_in0_max); | 1559 | device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr); |
1602 | device_create_file(&new_client->dev, &dev_attr_in0_min); | 1560 | device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr); |
1603 | device_create_file(&new_client->dev, &dev_attr_in1_input); | 1561 | device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr); |
1604 | device_create_file(&new_client->dev, &dev_attr_in1_max); | 1562 | device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr); |
1605 | device_create_file(&new_client->dev, &dev_attr_in1_min); | 1563 | device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr); |
1606 | device_create_file(&new_client->dev, &dev_attr_in2_input); | 1564 | device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr); |
1607 | device_create_file(&new_client->dev, &dev_attr_in2_max); | 1565 | device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr); |
1608 | device_create_file(&new_client->dev, &dev_attr_in2_min); | 1566 | device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr); |
1609 | device_create_file(&new_client->dev, &dev_attr_in3_input); | 1567 | device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr); |
1610 | device_create_file(&new_client->dev, &dev_attr_in3_max); | 1568 | device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr); |
1611 | device_create_file(&new_client->dev, &dev_attr_in3_min); | 1569 | device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr); |
1612 | device_create_file(&new_client->dev, &dev_attr_in4_input); | 1570 | device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr); |
1613 | device_create_file(&new_client->dev, &dev_attr_in4_max); | 1571 | device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr); |
1614 | device_create_file(&new_client->dev, &dev_attr_in4_min); | 1572 | device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr); |
1615 | device_create_file(&new_client->dev, &dev_attr_in5_input); | 1573 | device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr); |
1616 | device_create_file(&new_client->dev, &dev_attr_in5_max); | 1574 | device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr); |
1617 | device_create_file(&new_client->dev, &dev_attr_in5_min); | 1575 | device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr); |
1618 | device_create_file(&new_client->dev, &dev_attr_in6_input); | 1576 | device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr); |
1619 | device_create_file(&new_client->dev, &dev_attr_in6_max); | 1577 | device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr); |
1620 | device_create_file(&new_client->dev, &dev_attr_in6_min); | 1578 | device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr); |
1621 | device_create_file(&new_client->dev, &dev_attr_in7_input); | 1579 | device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr); |
1622 | device_create_file(&new_client->dev, &dev_attr_in7_max); | 1580 | device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr); |
1623 | device_create_file(&new_client->dev, &dev_attr_in7_min); | 1581 | device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr); |
1624 | device_create_file(&new_client->dev, &dev_attr_in8_input); | 1582 | device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr); |
1625 | device_create_file(&new_client->dev, &dev_attr_in8_max); | 1583 | device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr); |
1626 | device_create_file(&new_client->dev, &dev_attr_in8_min); | 1584 | device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr); |
1627 | device_create_file(&new_client->dev, &dev_attr_in9_input); | 1585 | device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr); |
1628 | device_create_file(&new_client->dev, &dev_attr_in9_max); | 1586 | device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr); |
1629 | device_create_file(&new_client->dev, &dev_attr_in9_min); | 1587 | device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr); |
1630 | device_create_file(&new_client->dev, &dev_attr_in10_input); | 1588 | device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr); |
1631 | device_create_file(&new_client->dev, &dev_attr_in10_max); | 1589 | device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr); |
1632 | device_create_file(&new_client->dev, &dev_attr_in10_min); | 1590 | device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr); |
1633 | device_create_file(&new_client->dev, &dev_attr_in11_input); | 1591 | device_create_file(&new_client->dev, &sensor_dev_attr_in11_input.dev_attr); |
1634 | device_create_file(&new_client->dev, &dev_attr_in11_max); | 1592 | device_create_file(&new_client->dev, &sensor_dev_attr_in11_max.dev_attr); |
1635 | device_create_file(&new_client->dev, &dev_attr_in11_min); | 1593 | device_create_file(&new_client->dev, &sensor_dev_attr_in11_min.dev_attr); |
1636 | device_create_file(&new_client->dev, &dev_attr_in12_input); | 1594 | device_create_file(&new_client->dev, &sensor_dev_attr_in12_input.dev_attr); |
1637 | device_create_file(&new_client->dev, &dev_attr_in12_max); | 1595 | device_create_file(&new_client->dev, &sensor_dev_attr_in12_max.dev_attr); |
1638 | device_create_file(&new_client->dev, &dev_attr_in12_min); | 1596 | device_create_file(&new_client->dev, &sensor_dev_attr_in12_min.dev_attr); |
1639 | device_create_file(&new_client->dev, &dev_attr_in13_input); | 1597 | device_create_file(&new_client->dev, &sensor_dev_attr_in13_input.dev_attr); |
1640 | device_create_file(&new_client->dev, &dev_attr_in13_max); | 1598 | device_create_file(&new_client->dev, &sensor_dev_attr_in13_max.dev_attr); |
1641 | device_create_file(&new_client->dev, &dev_attr_in13_min); | 1599 | device_create_file(&new_client->dev, &sensor_dev_attr_in13_min.dev_attr); |
1642 | device_create_file(&new_client->dev, &dev_attr_in14_input); | 1600 | device_create_file(&new_client->dev, &sensor_dev_attr_in14_input.dev_attr); |
1643 | device_create_file(&new_client->dev, &dev_attr_in14_max); | 1601 | device_create_file(&new_client->dev, &sensor_dev_attr_in14_max.dev_attr); |
1644 | device_create_file(&new_client->dev, &dev_attr_in14_min); | 1602 | device_create_file(&new_client->dev, &sensor_dev_attr_in14_min.dev_attr); |
1645 | device_create_file(&new_client->dev, &dev_attr_in15_input); | 1603 | device_create_file(&new_client->dev, &sensor_dev_attr_in15_input.dev_attr); |
1646 | device_create_file(&new_client->dev, &dev_attr_in15_max); | 1604 | device_create_file(&new_client->dev, &sensor_dev_attr_in15_max.dev_attr); |
1647 | device_create_file(&new_client->dev, &dev_attr_in15_min); | 1605 | device_create_file(&new_client->dev, &sensor_dev_attr_in15_min.dev_attr); |
1648 | device_create_file(&new_client->dev, &dev_attr_in16_input); | 1606 | device_create_file(&new_client->dev, &sensor_dev_attr_in16_input.dev_attr); |
1649 | device_create_file(&new_client->dev, &dev_attr_in16_max); | 1607 | device_create_file(&new_client->dev, &sensor_dev_attr_in16_max.dev_attr); |
1650 | device_create_file(&new_client->dev, &dev_attr_in16_min); | 1608 | device_create_file(&new_client->dev, &sensor_dev_attr_in16_min.dev_attr); |
1651 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | 1609 | device_create_file(&new_client->dev, &sensor_dev_attr_fan1_input.dev_attr); |
1652 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | 1610 | device_create_file(&new_client->dev, &sensor_dev_attr_fan1_div.dev_attr); |
1653 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | 1611 | device_create_file(&new_client->dev, &sensor_dev_attr_fan1_min.dev_attr); |
1654 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | 1612 | device_create_file(&new_client->dev, &sensor_dev_attr_fan2_input.dev_attr); |
1655 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | 1613 | device_create_file(&new_client->dev, &sensor_dev_attr_fan2_div.dev_attr); |
1656 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | 1614 | device_create_file(&new_client->dev, &sensor_dev_attr_fan2_min.dev_attr); |
1657 | device_create_file(&new_client->dev, &dev_attr_fan3_input); | 1615 | device_create_file(&new_client->dev, &sensor_dev_attr_fan3_input.dev_attr); |
1658 | device_create_file(&new_client->dev, &dev_attr_fan3_div); | 1616 | device_create_file(&new_client->dev, &sensor_dev_attr_fan3_div.dev_attr); |
1659 | device_create_file(&new_client->dev, &dev_attr_fan3_min); | 1617 | device_create_file(&new_client->dev, &sensor_dev_attr_fan3_min.dev_attr); |
1660 | device_create_file(&new_client->dev, &dev_attr_fan4_input); | 1618 | device_create_file(&new_client->dev, &sensor_dev_attr_fan4_input.dev_attr); |
1661 | device_create_file(&new_client->dev, &dev_attr_fan4_div); | 1619 | device_create_file(&new_client->dev, &sensor_dev_attr_fan4_div.dev_attr); |
1662 | device_create_file(&new_client->dev, &dev_attr_fan4_min); | 1620 | device_create_file(&new_client->dev, &sensor_dev_attr_fan4_min.dev_attr); |
1663 | device_create_file(&new_client->dev, &dev_attr_fan5_input); | 1621 | device_create_file(&new_client->dev, &sensor_dev_attr_fan5_input.dev_attr); |
1664 | device_create_file(&new_client->dev, &dev_attr_fan5_div); | 1622 | device_create_file(&new_client->dev, &sensor_dev_attr_fan5_div.dev_attr); |
1665 | device_create_file(&new_client->dev, &dev_attr_fan5_min); | 1623 | device_create_file(&new_client->dev, &sensor_dev_attr_fan5_min.dev_attr); |
1666 | device_create_file(&new_client->dev, &dev_attr_fan6_input); | 1624 | device_create_file(&new_client->dev, &sensor_dev_attr_fan6_input.dev_attr); |
1667 | device_create_file(&new_client->dev, &dev_attr_fan6_div); | 1625 | device_create_file(&new_client->dev, &sensor_dev_attr_fan6_div.dev_attr); |
1668 | device_create_file(&new_client->dev, &dev_attr_fan6_min); | 1626 | device_create_file(&new_client->dev, &sensor_dev_attr_fan6_min.dev_attr); |
1669 | device_create_file(&new_client->dev, &dev_attr_fan7_input); | 1627 | device_create_file(&new_client->dev, &sensor_dev_attr_fan7_input.dev_attr); |
1670 | device_create_file(&new_client->dev, &dev_attr_fan7_div); | 1628 | device_create_file(&new_client->dev, &sensor_dev_attr_fan7_div.dev_attr); |
1671 | device_create_file(&new_client->dev, &dev_attr_fan7_min); | 1629 | device_create_file(&new_client->dev, &sensor_dev_attr_fan7_min.dev_attr); |
1672 | device_create_file(&new_client->dev, &dev_attr_fan8_input); | 1630 | device_create_file(&new_client->dev, &sensor_dev_attr_fan8_input.dev_attr); |
1673 | device_create_file(&new_client->dev, &dev_attr_fan8_div); | 1631 | device_create_file(&new_client->dev, &sensor_dev_attr_fan8_div.dev_attr); |
1674 | device_create_file(&new_client->dev, &dev_attr_fan8_min); | 1632 | device_create_file(&new_client->dev, &sensor_dev_attr_fan8_min.dev_attr); |
1675 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | 1633 | device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr); |
1676 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | 1634 | device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr); |
1677 | device_create_file(&new_client->dev, &dev_attr_temp1_min); | 1635 | device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr); |
1678 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | 1636 | device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr); |
1679 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | 1637 | device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr); |
1680 | device_create_file(&new_client->dev, &dev_attr_temp2_min); | 1638 | device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr); |
1681 | device_create_file(&new_client->dev, &dev_attr_temp3_input); | 1639 | device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr); |
1682 | device_create_file(&new_client->dev, &dev_attr_temp3_max); | 1640 | device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr); |
1683 | device_create_file(&new_client->dev, &dev_attr_temp3_min); | 1641 | device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr); |
1684 | device_create_file(&new_client->dev, &dev_attr_temp1_offset); | 1642 | device_create_file(&new_client->dev, &sensor_dev_attr_temp1_offset.dev_attr); |
1685 | device_create_file(&new_client->dev, &dev_attr_temp2_offset); | 1643 | device_create_file(&new_client->dev, &sensor_dev_attr_temp2_offset.dev_attr); |
1686 | device_create_file(&new_client->dev, &dev_attr_temp3_offset); | 1644 | device_create_file(&new_client->dev, &sensor_dev_attr_temp3_offset.dev_attr); |
1687 | device_create_file(&new_client->dev, | 1645 | device_create_file(&new_client->dev, |
1688 | &dev_attr_temp1_auto_point1_temp); | 1646 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr); |
1689 | device_create_file(&new_client->dev, | 1647 | device_create_file(&new_client->dev, |
1690 | &dev_attr_temp2_auto_point1_temp); | 1648 | &sensor_dev_attr_temp2_auto_point1_temp.dev_attr); |
1691 | device_create_file(&new_client->dev, | 1649 | device_create_file(&new_client->dev, |
1692 | &dev_attr_temp3_auto_point1_temp); | 1650 | &sensor_dev_attr_temp3_auto_point1_temp.dev_attr); |
1693 | device_create_file(&new_client->dev, | 1651 | device_create_file(&new_client->dev, |
1694 | &dev_attr_temp1_auto_point1_temp_hyst); | 1652 | &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr); |
1695 | device_create_file(&new_client->dev, | 1653 | device_create_file(&new_client->dev, |
1696 | &dev_attr_temp2_auto_point1_temp_hyst); | 1654 | &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr); |
1697 | device_create_file(&new_client->dev, | 1655 | device_create_file(&new_client->dev, |
1698 | &dev_attr_temp3_auto_point1_temp_hyst); | 1656 | &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr); |
1699 | device_create_file(&new_client->dev, | 1657 | device_create_file(&new_client->dev, |
1700 | &dev_attr_temp1_auto_point2_temp); | 1658 | &sensor_dev_attr_temp1_auto_point2_temp.dev_attr); |
1701 | device_create_file(&new_client->dev, | 1659 | device_create_file(&new_client->dev, |
1702 | &dev_attr_temp2_auto_point2_temp); | 1660 | &sensor_dev_attr_temp2_auto_point2_temp.dev_attr); |
1703 | device_create_file(&new_client->dev, | 1661 | device_create_file(&new_client->dev, |
1704 | &dev_attr_temp3_auto_point2_temp); | 1662 | &sensor_dev_attr_temp3_auto_point2_temp.dev_attr); |
1705 | device_create_file(&new_client->dev, &dev_attr_temp1_crit); | 1663 | device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr); |
1706 | device_create_file(&new_client->dev, &dev_attr_temp2_crit); | 1664 | device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr); |
1707 | device_create_file(&new_client->dev, &dev_attr_temp3_crit); | 1665 | device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr); |
1708 | device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); | 1666 | device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); |
1709 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); | 1667 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); |
1710 | device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); | 1668 | device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); |
diff --git a/drivers/i2c/chips/adm1031.c b/drivers/i2c/chips/adm1031.c index d4385a23f79a..2163dba467c4 100644 --- a/drivers/i2c/chips/adm1031.c +++ b/drivers/i2c/chips/adm1031.c | |||
@@ -292,11 +292,11 @@ set_fan_auto_channel(struct device *dev, const char *buf, size_t count, int nr) | |||
292 | } | 292 | } |
293 | 293 | ||
294 | #define fan_auto_channel_offset(offset) \ | 294 | #define fan_auto_channel_offset(offset) \ |
295 | static ssize_t show_fan_auto_channel_##offset (struct device *dev, char *buf) \ | 295 | static ssize_t show_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
296 | { \ | 296 | { \ |
297 | return show_fan_auto_channel(dev, buf, offset - 1); \ | 297 | return show_fan_auto_channel(dev, buf, offset - 1); \ |
298 | } \ | 298 | } \ |
299 | static ssize_t set_fan_auto_channel_##offset (struct device *dev, \ | 299 | static ssize_t set_fan_auto_channel_##offset (struct device *dev, struct device_attribute *attr, \ |
300 | const char *buf, size_t count) \ | 300 | const char *buf, size_t count) \ |
301 | { \ | 301 | { \ |
302 | return set_fan_auto_channel(dev, buf, count, offset - 1); \ | 302 | return set_fan_auto_channel(dev, buf, count, offset - 1); \ |
@@ -357,24 +357,24 @@ set_auto_temp_max(struct device *dev, const char *buf, size_t count, int nr) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | #define auto_temp_reg(offset) \ | 359 | #define auto_temp_reg(offset) \ |
360 | static ssize_t show_auto_temp_##offset##_off (struct device *dev, char *buf) \ | 360 | static ssize_t show_auto_temp_##offset##_off (struct device *dev, struct device_attribute *attr, char *buf) \ |
361 | { \ | 361 | { \ |
362 | return show_auto_temp_off(dev, buf, offset - 1); \ | 362 | return show_auto_temp_off(dev, buf, offset - 1); \ |
363 | } \ | 363 | } \ |
364 | static ssize_t show_auto_temp_##offset##_min (struct device *dev, char *buf) \ | 364 | static ssize_t show_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
365 | { \ | 365 | { \ |
366 | return show_auto_temp_min(dev, buf, offset - 1); \ | 366 | return show_auto_temp_min(dev, buf, offset - 1); \ |
367 | } \ | 367 | } \ |
368 | static ssize_t show_auto_temp_##offset##_max (struct device *dev, char *buf) \ | 368 | static ssize_t show_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
369 | { \ | 369 | { \ |
370 | return show_auto_temp_max(dev, buf, offset - 1); \ | 370 | return show_auto_temp_max(dev, buf, offset - 1); \ |
371 | } \ | 371 | } \ |
372 | static ssize_t set_auto_temp_##offset##_min (struct device *dev, \ | 372 | static ssize_t set_auto_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
373 | const char *buf, size_t count) \ | 373 | const char *buf, size_t count) \ |
374 | { \ | 374 | { \ |
375 | return set_auto_temp_min(dev, buf, count, offset - 1); \ | 375 | return set_auto_temp_min(dev, buf, count, offset - 1); \ |
376 | } \ | 376 | } \ |
377 | static ssize_t set_auto_temp_##offset##_max (struct device *dev, \ | 377 | static ssize_t set_auto_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ |
378 | const char *buf, size_t count) \ | 378 | const char *buf, size_t count) \ |
379 | { \ | 379 | { \ |
380 | return set_auto_temp_max(dev, buf, count, offset - 1); \ | 380 | return set_auto_temp_max(dev, buf, count, offset - 1); \ |
@@ -421,11 +421,11 @@ set_pwm(struct device *dev, const char *buf, size_t count, int nr) | |||
421 | } | 421 | } |
422 | 422 | ||
423 | #define pwm_reg(offset) \ | 423 | #define pwm_reg(offset) \ |
424 | static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ | 424 | static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
425 | { \ | 425 | { \ |
426 | return show_pwm(dev, buf, offset - 1); \ | 426 | return show_pwm(dev, buf, offset - 1); \ |
427 | } \ | 427 | } \ |
428 | static ssize_t set_pwm_##offset (struct device *dev, \ | 428 | static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \ |
429 | const char *buf, size_t count) \ | 429 | const char *buf, size_t count) \ |
430 | { \ | 430 | { \ |
431 | return set_pwm(dev, buf, count, offset - 1); \ | 431 | return set_pwm(dev, buf, count, offset - 1); \ |
@@ -557,24 +557,24 @@ set_fan_div(struct device *dev, const char *buf, size_t count, int nr) | |||
557 | } | 557 | } |
558 | 558 | ||
559 | #define fan_offset(offset) \ | 559 | #define fan_offset(offset) \ |
560 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 560 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
561 | { \ | 561 | { \ |
562 | return show_fan(dev, buf, offset - 1); \ | 562 | return show_fan(dev, buf, offset - 1); \ |
563 | } \ | 563 | } \ |
564 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 564 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
565 | { \ | 565 | { \ |
566 | return show_fan_min(dev, buf, offset - 1); \ | 566 | return show_fan_min(dev, buf, offset - 1); \ |
567 | } \ | 567 | } \ |
568 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 568 | static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
569 | { \ | 569 | { \ |
570 | return show_fan_div(dev, buf, offset - 1); \ | 570 | return show_fan_div(dev, buf, offset - 1); \ |
571 | } \ | 571 | } \ |
572 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 572 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
573 | const char *buf, size_t count) \ | 573 | const char *buf, size_t count) \ |
574 | { \ | 574 | { \ |
575 | return set_fan_min(dev, buf, count, offset - 1); \ | 575 | return set_fan_min(dev, buf, count, offset - 1); \ |
576 | } \ | 576 | } \ |
577 | static ssize_t set_fan_##offset##_div (struct device *dev, \ | 577 | static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ |
578 | const char *buf, size_t count) \ | 578 | const char *buf, size_t count) \ |
579 | { \ | 579 | { \ |
580 | return set_fan_div(dev, buf, count, offset - 1); \ | 580 | return set_fan_div(dev, buf, count, offset - 1); \ |
@@ -667,33 +667,33 @@ set_temp_crit(struct device *dev, const char *buf, size_t count, int nr) | |||
667 | } | 667 | } |
668 | 668 | ||
669 | #define temp_reg(offset) \ | 669 | #define temp_reg(offset) \ |
670 | static ssize_t show_temp_##offset (struct device *dev, char *buf) \ | 670 | static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
671 | { \ | 671 | { \ |
672 | return show_temp(dev, buf, offset - 1); \ | 672 | return show_temp(dev, buf, offset - 1); \ |
673 | } \ | 673 | } \ |
674 | static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ | 674 | static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
675 | { \ | 675 | { \ |
676 | return show_temp_min(dev, buf, offset - 1); \ | 676 | return show_temp_min(dev, buf, offset - 1); \ |
677 | } \ | 677 | } \ |
678 | static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ | 678 | static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
679 | { \ | 679 | { \ |
680 | return show_temp_max(dev, buf, offset - 1); \ | 680 | return show_temp_max(dev, buf, offset - 1); \ |
681 | } \ | 681 | } \ |
682 | static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ | 682 | static ssize_t show_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, char *buf) \ |
683 | { \ | 683 | { \ |
684 | return show_temp_crit(dev, buf, offset - 1); \ | 684 | return show_temp_crit(dev, buf, offset - 1); \ |
685 | } \ | 685 | } \ |
686 | static ssize_t set_temp_##offset##_min (struct device *dev, \ | 686 | static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
687 | const char *buf, size_t count) \ | 687 | const char *buf, size_t count) \ |
688 | { \ | 688 | { \ |
689 | return set_temp_min(dev, buf, count, offset - 1); \ | 689 | return set_temp_min(dev, buf, count, offset - 1); \ |
690 | } \ | 690 | } \ |
691 | static ssize_t set_temp_##offset##_max (struct device *dev, \ | 691 | static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ |
692 | const char *buf, size_t count) \ | 692 | const char *buf, size_t count) \ |
693 | { \ | 693 | { \ |
694 | return set_temp_max(dev, buf, count, offset - 1); \ | 694 | return set_temp_max(dev, buf, count, offset - 1); \ |
695 | } \ | 695 | } \ |
696 | static ssize_t set_temp_##offset##_crit (struct device *dev, \ | 696 | static ssize_t set_temp_##offset##_crit (struct device *dev, struct device_attribute *attr, \ |
697 | const char *buf, size_t count) \ | 697 | const char *buf, size_t count) \ |
698 | { \ | 698 | { \ |
699 | return set_temp_crit(dev, buf, count, offset - 1); \ | 699 | return set_temp_crit(dev, buf, count, offset - 1); \ |
@@ -712,7 +712,7 @@ temp_reg(2); | |||
712 | temp_reg(3); | 712 | temp_reg(3); |
713 | 713 | ||
714 | /* Alarms */ | 714 | /* Alarms */ |
715 | static ssize_t show_alarms(struct device *dev, char *buf) | 715 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
716 | { | 716 | { |
717 | struct adm1031_data *data = adm1031_update_device(dev); | 717 | struct adm1031_data *data = adm1031_update_device(dev); |
718 | return sprintf(buf, "%d\n", data->alarm); | 718 | return sprintf(buf, "%d\n", data->alarm); |
diff --git a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c index 7f899002bc54..4a47b4493e34 100644 --- a/drivers/i2c/chips/asb100.c +++ b/drivers/i2c/chips/asb100.c | |||
@@ -260,28 +260,28 @@ set_in_reg(MAX, max) | |||
260 | 260 | ||
261 | #define sysfs_in(offset) \ | 261 | #define sysfs_in(offset) \ |
262 | static ssize_t \ | 262 | static ssize_t \ |
263 | show_in##offset (struct device *dev, char *buf) \ | 263 | show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
264 | { \ | 264 | { \ |
265 | return show_in(dev, buf, offset); \ | 265 | return show_in(dev, buf, offset); \ |
266 | } \ | 266 | } \ |
267 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | 267 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
268 | show_in##offset, NULL); \ | 268 | show_in##offset, NULL); \ |
269 | static ssize_t \ | 269 | static ssize_t \ |
270 | show_in##offset##_min (struct device *dev, char *buf) \ | 270 | show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
271 | { \ | 271 | { \ |
272 | return show_in_min(dev, buf, offset); \ | 272 | return show_in_min(dev, buf, offset); \ |
273 | } \ | 273 | } \ |
274 | static ssize_t \ | 274 | static ssize_t \ |
275 | show_in##offset##_max (struct device *dev, char *buf) \ | 275 | show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
276 | { \ | 276 | { \ |
277 | return show_in_max(dev, buf, offset); \ | 277 | return show_in_max(dev, buf, offset); \ |
278 | } \ | 278 | } \ |
279 | static ssize_t set_in##offset##_min (struct device *dev, \ | 279 | static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ |
280 | const char *buf, size_t count) \ | 280 | const char *buf, size_t count) \ |
281 | { \ | 281 | { \ |
282 | return set_in_min(dev, buf, count, offset); \ | 282 | return set_in_min(dev, buf, count, offset); \ |
283 | } \ | 283 | } \ |
284 | static ssize_t set_in##offset##_max (struct device *dev, \ | 284 | static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ |
285 | const char *buf, size_t count) \ | 285 | const char *buf, size_t count) \ |
286 | { \ | 286 | { \ |
287 | return set_in_max(dev, buf, count, offset); \ | 287 | return set_in_max(dev, buf, count, offset); \ |
@@ -389,24 +389,24 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
389 | } | 389 | } |
390 | 390 | ||
391 | #define sysfs_fan(offset) \ | 391 | #define sysfs_fan(offset) \ |
392 | static ssize_t show_fan##offset(struct device *dev, char *buf) \ | 392 | static ssize_t show_fan##offset(struct device *dev, struct device_attribute *attr, char *buf) \ |
393 | { \ | 393 | { \ |
394 | return show_fan(dev, buf, offset - 1); \ | 394 | return show_fan(dev, buf, offset - 1); \ |
395 | } \ | 395 | } \ |
396 | static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ | 396 | static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
397 | { \ | 397 | { \ |
398 | return show_fan_min(dev, buf, offset - 1); \ | 398 | return show_fan_min(dev, buf, offset - 1); \ |
399 | } \ | 399 | } \ |
400 | static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ | 400 | static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ |
401 | { \ | 401 | { \ |
402 | return show_fan_div(dev, buf, offset - 1); \ | 402 | return show_fan_div(dev, buf, offset - 1); \ |
403 | } \ | 403 | } \ |
404 | static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ | 404 | static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
405 | size_t count) \ | 405 | size_t count) \ |
406 | { \ | 406 | { \ |
407 | return set_fan_min(dev, buf, count, offset - 1); \ | 407 | return set_fan_min(dev, buf, count, offset - 1); \ |
408 | } \ | 408 | } \ |
409 | static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ | 409 | static ssize_t set_fan##offset##_div(struct device *dev, struct device_attribute *attr, const char *buf, \ |
410 | size_t count) \ | 410 | size_t count) \ |
411 | { \ | 411 | { \ |
412 | return set_fan_div(dev, buf, count, offset - 1); \ | 412 | return set_fan_div(dev, buf, count, offset - 1); \ |
@@ -482,27 +482,27 @@ set_temp_reg(MAX, temp_max); | |||
482 | set_temp_reg(HYST, temp_hyst); | 482 | set_temp_reg(HYST, temp_hyst); |
483 | 483 | ||
484 | #define sysfs_temp(num) \ | 484 | #define sysfs_temp(num) \ |
485 | static ssize_t show_temp##num(struct device *dev, char *buf) \ | 485 | static ssize_t show_temp##num(struct device *dev, struct device_attribute *attr, char *buf) \ |
486 | { \ | 486 | { \ |
487 | return show_temp(dev, buf, num-1); \ | 487 | return show_temp(dev, buf, num-1); \ |
488 | } \ | 488 | } \ |
489 | static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL); \ | 489 | static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL); \ |
490 | static ssize_t show_temp_max##num(struct device *dev, char *buf) \ | 490 | static ssize_t show_temp_max##num(struct device *dev, struct device_attribute *attr, char *buf) \ |
491 | { \ | 491 | { \ |
492 | return show_temp_max(dev, buf, num-1); \ | 492 | return show_temp_max(dev, buf, num-1); \ |
493 | } \ | 493 | } \ |
494 | static ssize_t set_temp_max##num(struct device *dev, const char *buf, \ | 494 | static ssize_t set_temp_max##num(struct device *dev, struct device_attribute *attr, const char *buf, \ |
495 | size_t count) \ | 495 | size_t count) \ |
496 | { \ | 496 | { \ |
497 | return set_temp_max(dev, buf, count, num-1); \ | 497 | return set_temp_max(dev, buf, count, num-1); \ |
498 | } \ | 498 | } \ |
499 | static DEVICE_ATTR(temp##num##_max, S_IRUGO | S_IWUSR, \ | 499 | static DEVICE_ATTR(temp##num##_max, S_IRUGO | S_IWUSR, \ |
500 | show_temp_max##num, set_temp_max##num); \ | 500 | show_temp_max##num, set_temp_max##num); \ |
501 | static ssize_t show_temp_hyst##num(struct device *dev, char *buf) \ | 501 | static ssize_t show_temp_hyst##num(struct device *dev, struct device_attribute *attr, char *buf) \ |
502 | { \ | 502 | { \ |
503 | return show_temp_hyst(dev, buf, num-1); \ | 503 | return show_temp_hyst(dev, buf, num-1); \ |
504 | } \ | 504 | } \ |
505 | static ssize_t set_temp_hyst##num(struct device *dev, const char *buf, \ | 505 | static ssize_t set_temp_hyst##num(struct device *dev, struct device_attribute *attr, const char *buf, \ |
506 | size_t count) \ | 506 | size_t count) \ |
507 | { \ | 507 | { \ |
508 | return set_temp_hyst(dev, buf, count, num-1); \ | 508 | return set_temp_hyst(dev, buf, count, num-1); \ |
@@ -522,7 +522,7 @@ sysfs_temp(4); | |||
522 | device_create_file(&client->dev, &dev_attr_temp##num##_max_hyst); \ | 522 | device_create_file(&client->dev, &dev_attr_temp##num##_max_hyst); \ |
523 | } while (0) | 523 | } while (0) |
524 | 524 | ||
525 | static ssize_t show_vid(struct device *dev, char *buf) | 525 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
526 | { | 526 | { |
527 | struct asb100_data *data = asb100_update_device(dev); | 527 | struct asb100_data *data = asb100_update_device(dev); |
528 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); | 528 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); |
@@ -533,13 +533,13 @@ static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | |||
533 | device_create_file(&client->dev, &dev_attr_cpu0_vid) | 533 | device_create_file(&client->dev, &dev_attr_cpu0_vid) |
534 | 534 | ||
535 | /* VRM */ | 535 | /* VRM */ |
536 | static ssize_t show_vrm(struct device *dev, char *buf) | 536 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
537 | { | 537 | { |
538 | struct asb100_data *data = asb100_update_device(dev); | 538 | struct asb100_data *data = asb100_update_device(dev); |
539 | return sprintf(buf, "%d\n", data->vrm); | 539 | return sprintf(buf, "%d\n", data->vrm); |
540 | } | 540 | } |
541 | 541 | ||
542 | static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | 542 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
543 | { | 543 | { |
544 | struct i2c_client *client = to_i2c_client(dev); | 544 | struct i2c_client *client = to_i2c_client(dev); |
545 | struct asb100_data *data = i2c_get_clientdata(client); | 545 | struct asb100_data *data = i2c_get_clientdata(client); |
@@ -553,7 +553,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | |||
553 | #define device_create_file_vrm(client) \ | 553 | #define device_create_file_vrm(client) \ |
554 | device_create_file(&client->dev, &dev_attr_vrm); | 554 | device_create_file(&client->dev, &dev_attr_vrm); |
555 | 555 | ||
556 | static ssize_t show_alarms(struct device *dev, char *buf) | 556 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
557 | { | 557 | { |
558 | struct asb100_data *data = asb100_update_device(dev); | 558 | struct asb100_data *data = asb100_update_device(dev); |
559 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms)); | 559 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms)); |
@@ -564,13 +564,13 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | |||
564 | device_create_file(&client->dev, &dev_attr_alarms) | 564 | device_create_file(&client->dev, &dev_attr_alarms) |
565 | 565 | ||
566 | /* 1 PWM */ | 566 | /* 1 PWM */ |
567 | static ssize_t show_pwm1(struct device *dev, char *buf) | 567 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) |
568 | { | 568 | { |
569 | struct asb100_data *data = asb100_update_device(dev); | 569 | struct asb100_data *data = asb100_update_device(dev); |
570 | return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); | 570 | return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); |
571 | } | 571 | } |
572 | 572 | ||
573 | static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | 573 | static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
574 | { | 574 | { |
575 | struct i2c_client *client = to_i2c_client(dev); | 575 | struct i2c_client *client = to_i2c_client(dev); |
576 | struct asb100_data *data = i2c_get_clientdata(client); | 576 | struct asb100_data *data = i2c_get_clientdata(client); |
@@ -584,13 +584,13 @@ static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | |||
584 | return count; | 584 | return count; |
585 | } | 585 | } |
586 | 586 | ||
587 | static ssize_t show_pwm_enable1(struct device *dev, char *buf) | 587 | static ssize_t show_pwm_enable1(struct device *dev, struct device_attribute *attr, char *buf) |
588 | { | 588 | { |
589 | struct asb100_data *data = asb100_update_device(dev); | 589 | struct asb100_data *data = asb100_update_device(dev); |
590 | return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); | 590 | return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); |
591 | } | 591 | } |
592 | 592 | ||
593 | static ssize_t set_pwm_enable1(struct device *dev, const char *buf, | 593 | static ssize_t set_pwm_enable1(struct device *dev, struct device_attribute *attr, const char *buf, |
594 | size_t count) | 594 | size_t count) |
595 | { | 595 | { |
596 | struct i2c_client *client = to_i2c_client(dev); | 596 | struct i2c_client *client = to_i2c_client(dev); |
diff --git a/drivers/i2c/chips/ds1621.c b/drivers/i2c/chips/ds1621.c index bb1fefb2162e..4ae15bd5dcfb 100644 --- a/drivers/i2c/chips/ds1621.c +++ b/drivers/i2c/chips/ds1621.c | |||
@@ -137,7 +137,7 @@ static void ds1621_init_client(struct i2c_client *client) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | #define show(value) \ | 139 | #define show(value) \ |
140 | static ssize_t show_##value(struct device *dev, char *buf) \ | 140 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
141 | { \ | 141 | { \ |
142 | struct ds1621_data *data = ds1621_update_client(dev); \ | 142 | struct ds1621_data *data = ds1621_update_client(dev); \ |
143 | return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ | 143 | return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ |
@@ -148,7 +148,7 @@ show(temp_min); | |||
148 | show(temp_max); | 148 | show(temp_max); |
149 | 149 | ||
150 | #define set_temp(suffix, value, reg) \ | 150 | #define set_temp(suffix, value, reg) \ |
151 | static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ | 151 | static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
152 | size_t count) \ | 152 | size_t count) \ |
153 | { \ | 153 | { \ |
154 | struct i2c_client *client = to_i2c_client(dev); \ | 154 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -165,7 +165,7 @@ static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ | |||
165 | set_temp(min, temp_min, DS1621_REG_TEMP_MIN); | 165 | set_temp(min, temp_min, DS1621_REG_TEMP_MIN); |
166 | set_temp(max, temp_max, DS1621_REG_TEMP_MAX); | 166 | set_temp(max, temp_max, DS1621_REG_TEMP_MAX); |
167 | 167 | ||
168 | static ssize_t show_alarms(struct device *dev, char *buf) | 168 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
169 | { | 169 | { |
170 | struct ds1621_data *data = ds1621_update_client(dev); | 170 | struct ds1621_data *data = ds1621_update_client(dev); |
171 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf)); | 171 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->conf)); |
diff --git a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c index 18e33ac59d0c..c3f37dbec11a 100644 --- a/drivers/i2c/chips/fscher.c +++ b/drivers/i2c/chips/fscher.c | |||
@@ -157,8 +157,8 @@ struct fscher_data { | |||
157 | 157 | ||
158 | #define sysfs_r(kind, sub, offset, reg) \ | 158 | #define sysfs_r(kind, sub, offset, reg) \ |
159 | static ssize_t show_##kind##sub (struct fscher_data *, char *, int); \ | 159 | static ssize_t show_##kind##sub (struct fscher_data *, char *, int); \ |
160 | static ssize_t show_##kind##offset##sub (struct device *, char *); \ | 160 | static ssize_t show_##kind##offset##sub (struct device *, struct device_attribute *attr, char *); \ |
161 | static ssize_t show_##kind##offset##sub (struct device *dev, char *buf) \ | 161 | static ssize_t show_##kind##offset##sub (struct device *dev, struct device_attribute *attr, char *buf) \ |
162 | { \ | 162 | { \ |
163 | struct fscher_data *data = fscher_update_device(dev); \ | 163 | struct fscher_data *data = fscher_update_device(dev); \ |
164 | return show_##kind##sub(data, buf, (offset)); \ | 164 | return show_##kind##sub(data, buf, (offset)); \ |
@@ -166,8 +166,8 @@ static ssize_t show_##kind##offset##sub (struct device *dev, char *buf) \ | |||
166 | 166 | ||
167 | #define sysfs_w(kind, sub, offset, reg) \ | 167 | #define sysfs_w(kind, sub, offset, reg) \ |
168 | static ssize_t set_##kind##sub (struct i2c_client *, struct fscher_data *, const char *, size_t, int, int); \ | 168 | static ssize_t set_##kind##sub (struct i2c_client *, struct fscher_data *, const char *, size_t, int, int); \ |
169 | static ssize_t set_##kind##offset##sub (struct device *, const char *, size_t); \ | 169 | static ssize_t set_##kind##offset##sub (struct device *, struct device_attribute *attr, const char *, size_t); \ |
170 | static ssize_t set_##kind##offset##sub (struct device *dev, const char *buf, size_t count) \ | 170 | static ssize_t set_##kind##offset##sub (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
171 | { \ | 171 | { \ |
172 | struct i2c_client *client = to_i2c_client(dev); \ | 172 | struct i2c_client *client = to_i2c_client(dev); \ |
173 | struct fscher_data *data = i2c_get_clientdata(client); \ | 173 | struct fscher_data *data = i2c_get_clientdata(client); \ |
diff --git a/drivers/i2c/chips/fscpos.c b/drivers/i2c/chips/fscpos.c index 2cac79145c75..3beaa6191ef4 100644 --- a/drivers/i2c/chips/fscpos.c +++ b/drivers/i2c/chips/fscpos.c | |||
@@ -245,19 +245,19 @@ static void reset_fan_alarm(struct i2c_client *client, int nr) | |||
245 | /* Volts */ | 245 | /* Volts */ |
246 | #define VOLT_FROM_REG(val, mult) ((val) * (mult) / 255) | 246 | #define VOLT_FROM_REG(val, mult) ((val) * (mult) / 255) |
247 | 247 | ||
248 | static ssize_t show_volt_12(struct device *dev, char *buf) | 248 | static ssize_t show_volt_12(struct device *dev, struct device_attribute *attr, char *buf) |
249 | { | 249 | { |
250 | struct fscpos_data *data = fscpos_update_device(dev); | 250 | struct fscpos_data *data = fscpos_update_device(dev); |
251 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[0], 14200)); | 251 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[0], 14200)); |
252 | } | 252 | } |
253 | 253 | ||
254 | static ssize_t show_volt_5(struct device *dev, char *buf) | 254 | static ssize_t show_volt_5(struct device *dev, struct device_attribute *attr, char *buf) |
255 | { | 255 | { |
256 | struct fscpos_data *data = fscpos_update_device(dev); | 256 | struct fscpos_data *data = fscpos_update_device(dev); |
257 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[1], 6600)); | 257 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[1], 6600)); |
258 | } | 258 | } |
259 | 259 | ||
260 | static ssize_t show_volt_batt(struct device *dev, char *buf) | 260 | static ssize_t show_volt_batt(struct device *dev, struct device_attribute *attr, char *buf) |
261 | { | 261 | { |
262 | struct fscpos_data *data = fscpos_update_device(dev); | 262 | struct fscpos_data *data = fscpos_update_device(dev); |
263 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[2], 3300)); | 263 | return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[2], 3300)); |
@@ -327,7 +327,7 @@ static ssize_t set_wdog_preset(struct i2c_client *client, struct fscpos_data | |||
327 | } | 327 | } |
328 | 328 | ||
329 | /* Event */ | 329 | /* Event */ |
330 | static ssize_t show_event(struct device *dev, char *buf) | 330 | static ssize_t show_event(struct device *dev, struct device_attribute *attr, char *buf) |
331 | { | 331 | { |
332 | /* bits 5..7 reserved => mask with 0x1f */ | 332 | /* bits 5..7 reserved => mask with 0x1f */ |
333 | struct fscpos_data *data = fscpos_update_device(dev); | 333 | struct fscpos_data *data = fscpos_update_device(dev); |
@@ -338,14 +338,14 @@ static ssize_t show_event(struct device *dev, char *buf) | |||
338 | * Sysfs stuff | 338 | * Sysfs stuff |
339 | */ | 339 | */ |
340 | #define create_getter(kind, sub) \ | 340 | #define create_getter(kind, sub) \ |
341 | static ssize_t sysfs_show_##kind##sub(struct device *dev, char *buf) \ | 341 | static ssize_t sysfs_show_##kind##sub(struct device *dev, struct device_attribute *attr, char *buf) \ |
342 | { \ | 342 | { \ |
343 | struct fscpos_data *data = fscpos_update_device(dev); \ | 343 | struct fscpos_data *data = fscpos_update_device(dev); \ |
344 | return show_##kind##sub(data, buf); \ | 344 | return show_##kind##sub(data, buf); \ |
345 | } | 345 | } |
346 | 346 | ||
347 | #define create_getter_n(kind, offset, sub) \ | 347 | #define create_getter_n(kind, offset, sub) \ |
348 | static ssize_t sysfs_show_##kind##offset##sub(struct device *dev, char\ | 348 | static ssize_t sysfs_show_##kind##offset##sub(struct device *dev, struct device_attribute *attr, char\ |
349 | *buf) \ | 349 | *buf) \ |
350 | { \ | 350 | { \ |
351 | struct fscpos_data *data = fscpos_update_device(dev); \ | 351 | struct fscpos_data *data = fscpos_update_device(dev); \ |
@@ -353,7 +353,7 @@ static ssize_t show_event(struct device *dev, char *buf) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | #define create_setter(kind, sub, reg) \ | 355 | #define create_setter(kind, sub, reg) \ |
356 | static ssize_t sysfs_set_##kind##sub (struct device *dev, const char \ | 356 | static ssize_t sysfs_set_##kind##sub (struct device *dev, struct device_attribute *attr, const char \ |
357 | *buf, size_t count) \ | 357 | *buf, size_t count) \ |
358 | { \ | 358 | { \ |
359 | struct i2c_client *client = to_i2c_client(dev); \ | 359 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -362,7 +362,7 @@ static ssize_t show_event(struct device *dev, char *buf) | |||
362 | } | 362 | } |
363 | 363 | ||
364 | #define create_setter_n(kind, offset, sub, reg) \ | 364 | #define create_setter_n(kind, offset, sub, reg) \ |
365 | static ssize_t sysfs_set_##kind##offset##sub (struct device *dev, \ | 365 | static ssize_t sysfs_set_##kind##offset##sub (struct device *dev, struct device_attribute *attr, \ |
366 | const char *buf, size_t count) \ | 366 | const char *buf, size_t count) \ |
367 | { \ | 367 | { \ |
368 | struct i2c_client *client = to_i2c_client(dev); \ | 368 | struct i2c_client *client = to_i2c_client(dev); \ |
diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c index c82d6ce21205..4316a1562251 100644 --- a/drivers/i2c/chips/gl518sm.c +++ b/drivers/i2c/chips/gl518sm.c | |||
@@ -164,14 +164,14 @@ static struct i2c_driver gl518_driver = { | |||
164 | */ | 164 | */ |
165 | 165 | ||
166 | #define show(type, suffix, value) \ | 166 | #define show(type, suffix, value) \ |
167 | static ssize_t show_##suffix(struct device *dev, char *buf) \ | 167 | static ssize_t show_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
168 | { \ | 168 | { \ |
169 | struct gl518_data *data = gl518_update_device(dev); \ | 169 | struct gl518_data *data = gl518_update_device(dev); \ |
170 | return sprintf(buf, "%d\n", type##_FROM_REG(data->value)); \ | 170 | return sprintf(buf, "%d\n", type##_FROM_REG(data->value)); \ |
171 | } | 171 | } |
172 | 172 | ||
173 | #define show_fan(suffix, value, index) \ | 173 | #define show_fan(suffix, value, index) \ |
174 | static ssize_t show_##suffix(struct device *dev, char *buf) \ | 174 | static ssize_t show_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
175 | { \ | 175 | { \ |
176 | struct gl518_data *data = gl518_update_device(dev); \ | 176 | struct gl518_data *data = gl518_update_device(dev); \ |
177 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value[index], \ | 177 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value[index], \ |
@@ -205,7 +205,7 @@ show(BOOL, beep_enable, beep_enable); | |||
205 | show(BEEP_MASK, beep_mask, beep_mask); | 205 | show(BEEP_MASK, beep_mask, beep_mask); |
206 | 206 | ||
207 | #define set(type, suffix, value, reg) \ | 207 | #define set(type, suffix, value, reg) \ |
208 | static ssize_t set_##suffix(struct device *dev, const char *buf, \ | 208 | static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
209 | size_t count) \ | 209 | size_t count) \ |
210 | { \ | 210 | { \ |
211 | struct i2c_client *client = to_i2c_client(dev); \ | 211 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -220,7 +220,7 @@ static ssize_t set_##suffix(struct device *dev, const char *buf, \ | |||
220 | } | 220 | } |
221 | 221 | ||
222 | #define set_bits(type, suffix, value, reg, mask, shift) \ | 222 | #define set_bits(type, suffix, value, reg, mask, shift) \ |
223 | static ssize_t set_##suffix(struct device *dev, const char *buf, \ | 223 | static ssize_t set_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
224 | size_t count) \ | 224 | size_t count) \ |
225 | { \ | 225 | { \ |
226 | struct i2c_client *client = to_i2c_client(dev); \ | 226 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -258,7 +258,7 @@ set_high(IN, in_max3, voltage_max[3], GL518_REG_VIN3_LIMIT); | |||
258 | set_bits(BOOL, beep_enable, beep_enable, GL518_REG_CONF, 0x04, 2); | 258 | set_bits(BOOL, beep_enable, beep_enable, GL518_REG_CONF, 0x04, 2); |
259 | set(BEEP_MASK, beep_mask, beep_mask, GL518_REG_ALARM); | 259 | set(BEEP_MASK, beep_mask, beep_mask, GL518_REG_ALARM); |
260 | 260 | ||
261 | static ssize_t set_fan_min1(struct device *dev, const char *buf, size_t count) | 261 | static ssize_t set_fan_min1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
262 | { | 262 | { |
263 | struct i2c_client *client = to_i2c_client(dev); | 263 | struct i2c_client *client = to_i2c_client(dev); |
264 | struct gl518_data *data = i2c_get_clientdata(client); | 264 | struct gl518_data *data = i2c_get_clientdata(client); |
@@ -284,7 +284,7 @@ static ssize_t set_fan_min1(struct device *dev, const char *buf, size_t count) | |||
284 | return count; | 284 | return count; |
285 | } | 285 | } |
286 | 286 | ||
287 | static ssize_t set_fan_min2(struct device *dev, const char *buf, size_t count) | 287 | static ssize_t set_fan_min2(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
288 | { | 288 | { |
289 | struct i2c_client *client = to_i2c_client(dev); | 289 | struct i2c_client *client = to_i2c_client(dev); |
290 | struct gl518_data *data = i2c_get_clientdata(client); | 290 | struct gl518_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/gl520sm.c b/drivers/i2c/chips/gl520sm.c index 3fd17e46ffc6..a13a504f5bfa 100644 --- a/drivers/i2c/chips/gl520sm.c +++ b/drivers/i2c/chips/gl520sm.c | |||
@@ -148,8 +148,8 @@ struct gl520_data { | |||
148 | 148 | ||
149 | #define sysfs_r(type, n, item, reg) \ | 149 | #define sysfs_r(type, n, item, reg) \ |
150 | static ssize_t get_##type##item (struct gl520_data *, char *, int); \ | 150 | static ssize_t get_##type##item (struct gl520_data *, char *, int); \ |
151 | static ssize_t get_##type##n##item (struct device *, char *); \ | 151 | static ssize_t get_##type##n##item (struct device *, struct device_attribute *attr, char *); \ |
152 | static ssize_t get_##type##n##item (struct device *dev, char *buf) \ | 152 | static ssize_t get_##type##n##item (struct device *dev, struct device_attribute *attr, char *buf) \ |
153 | { \ | 153 | { \ |
154 | struct gl520_data *data = gl520_update_device(dev); \ | 154 | struct gl520_data *data = gl520_update_device(dev); \ |
155 | return get_##type##item(data, buf, (n)); \ | 155 | return get_##type##item(data, buf, (n)); \ |
@@ -157,8 +157,8 @@ static ssize_t get_##type##n##item (struct device *dev, char *buf) \ | |||
157 | 157 | ||
158 | #define sysfs_w(type, n, item, reg) \ | 158 | #define sysfs_w(type, n, item, reg) \ |
159 | static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \ | 159 | static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \ |
160 | static ssize_t set_##type##n##item (struct device *, const char *, size_t); \ | 160 | static ssize_t set_##type##n##item (struct device *, struct device_attribute *attr, const char *, size_t); \ |
161 | static ssize_t set_##type##n##item (struct device *dev, const char *buf, size_t count) \ | 161 | static ssize_t set_##type##n##item (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
162 | { \ | 162 | { \ |
163 | struct i2c_client *client = to_i2c_client(dev); \ | 163 | struct i2c_client *client = to_i2c_client(dev); \ |
164 | struct gl520_data *data = i2c_get_clientdata(client); \ | 164 | struct gl520_data *data = i2c_get_clientdata(client); \ |
diff --git a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c index cf7e6898754f..007bdf9e7e2a 100644 --- a/drivers/i2c/chips/it87.c +++ b/drivers/i2c/chips/it87.c | |||
@@ -290,7 +290,7 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
290 | 290 | ||
291 | #define show_in_offset(offset) \ | 291 | #define show_in_offset(offset) \ |
292 | static ssize_t \ | 292 | static ssize_t \ |
293 | show_in##offset (struct device *dev, char *buf) \ | 293 | show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
294 | { \ | 294 | { \ |
295 | return show_in(dev, buf, offset); \ | 295 | return show_in(dev, buf, offset); \ |
296 | } \ | 296 | } \ |
@@ -298,21 +298,21 @@ static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); | |||
298 | 298 | ||
299 | #define limit_in_offset(offset) \ | 299 | #define limit_in_offset(offset) \ |
300 | static ssize_t \ | 300 | static ssize_t \ |
301 | show_in##offset##_min (struct device *dev, char *buf) \ | 301 | show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
302 | { \ | 302 | { \ |
303 | return show_in_min(dev, buf, offset); \ | 303 | return show_in_min(dev, buf, offset); \ |
304 | } \ | 304 | } \ |
305 | static ssize_t \ | 305 | static ssize_t \ |
306 | show_in##offset##_max (struct device *dev, char *buf) \ | 306 | show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
307 | { \ | 307 | { \ |
308 | return show_in_max(dev, buf, offset); \ | 308 | return show_in_max(dev, buf, offset); \ |
309 | } \ | 309 | } \ |
310 | static ssize_t set_in##offset##_min (struct device *dev, \ | 310 | static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ |
311 | const char *buf, size_t count) \ | 311 | const char *buf, size_t count) \ |
312 | { \ | 312 | { \ |
313 | return set_in_min(dev, buf, count, offset); \ | 313 | return set_in_min(dev, buf, count, offset); \ |
314 | } \ | 314 | } \ |
315 | static ssize_t set_in##offset##_max (struct device *dev, \ | 315 | static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ |
316 | const char *buf, size_t count) \ | 316 | const char *buf, size_t count) \ |
317 | { \ | 317 | { \ |
318 | return set_in_max(dev, buf, count, offset); \ | 318 | return set_in_max(dev, buf, count, offset); \ |
@@ -383,26 +383,26 @@ static ssize_t set_temp_min(struct device *dev, const char *buf, | |||
383 | return count; | 383 | return count; |
384 | } | 384 | } |
385 | #define show_temp_offset(offset) \ | 385 | #define show_temp_offset(offset) \ |
386 | static ssize_t show_temp_##offset (struct device *dev, char *buf) \ | 386 | static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
387 | { \ | 387 | { \ |
388 | return show_temp(dev, buf, offset - 1); \ | 388 | return show_temp(dev, buf, offset - 1); \ |
389 | } \ | 389 | } \ |
390 | static ssize_t \ | 390 | static ssize_t \ |
391 | show_temp_##offset##_max (struct device *dev, char *buf) \ | 391 | show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
392 | { \ | 392 | { \ |
393 | return show_temp_max(dev, buf, offset - 1); \ | 393 | return show_temp_max(dev, buf, offset - 1); \ |
394 | } \ | 394 | } \ |
395 | static ssize_t \ | 395 | static ssize_t \ |
396 | show_temp_##offset##_min (struct device *dev, char *buf) \ | 396 | show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
397 | { \ | 397 | { \ |
398 | return show_temp_min(dev, buf, offset - 1); \ | 398 | return show_temp_min(dev, buf, offset - 1); \ |
399 | } \ | 399 | } \ |
400 | static ssize_t set_temp_##offset##_max (struct device *dev, \ | 400 | static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ |
401 | const char *buf, size_t count) \ | 401 | const char *buf, size_t count) \ |
402 | { \ | 402 | { \ |
403 | return set_temp_max(dev, buf, count, offset - 1); \ | 403 | return set_temp_max(dev, buf, count, offset - 1); \ |
404 | } \ | 404 | } \ |
405 | static ssize_t set_temp_##offset##_min (struct device *dev, \ | 405 | static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
406 | const char *buf, size_t count) \ | 406 | const char *buf, size_t count) \ |
407 | { \ | 407 | { \ |
408 | return set_temp_min(dev, buf, count, offset - 1); \ | 408 | return set_temp_min(dev, buf, count, offset - 1); \ |
@@ -453,11 +453,11 @@ static ssize_t set_sensor(struct device *dev, const char *buf, | |||
453 | return count; | 453 | return count; |
454 | } | 454 | } |
455 | #define show_sensor_offset(offset) \ | 455 | #define show_sensor_offset(offset) \ |
456 | static ssize_t show_sensor_##offset (struct device *dev, char *buf) \ | 456 | static ssize_t show_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
457 | { \ | 457 | { \ |
458 | return show_sensor(dev, buf, offset - 1); \ | 458 | return show_sensor(dev, buf, offset - 1); \ |
459 | } \ | 459 | } \ |
460 | static ssize_t set_sensor_##offset (struct device *dev, \ | 460 | static ssize_t set_sensor_##offset (struct device *dev, struct device_attribute *attr, \ |
461 | const char *buf, size_t count) \ | 461 | const char *buf, size_t count) \ |
462 | { \ | 462 | { \ |
463 | return set_sensor(dev, buf, count, offset - 1); \ | 463 | return set_sensor(dev, buf, count, offset - 1); \ |
@@ -600,24 +600,24 @@ static ssize_t set_pwm(struct device *dev, const char *buf, | |||
600 | } | 600 | } |
601 | 601 | ||
602 | #define show_fan_offset(offset) \ | 602 | #define show_fan_offset(offset) \ |
603 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 603 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
604 | { \ | 604 | { \ |
605 | return show_fan(dev, buf, offset - 1); \ | 605 | return show_fan(dev, buf, offset - 1); \ |
606 | } \ | 606 | } \ |
607 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 607 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
608 | { \ | 608 | { \ |
609 | return show_fan_min(dev, buf, offset - 1); \ | 609 | return show_fan_min(dev, buf, offset - 1); \ |
610 | } \ | 610 | } \ |
611 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 611 | static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
612 | { \ | 612 | { \ |
613 | return show_fan_div(dev, buf, offset - 1); \ | 613 | return show_fan_div(dev, buf, offset - 1); \ |
614 | } \ | 614 | } \ |
615 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 615 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
616 | const char *buf, size_t count) \ | 616 | const char *buf, size_t count) \ |
617 | { \ | 617 | { \ |
618 | return set_fan_min(dev, buf, count, offset - 1); \ | 618 | return set_fan_min(dev, buf, count, offset - 1); \ |
619 | } \ | 619 | } \ |
620 | static ssize_t set_fan_##offset##_div (struct device *dev, \ | 620 | static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ |
621 | const char *buf, size_t count) \ | 621 | const char *buf, size_t count) \ |
622 | { \ | 622 | { \ |
623 | return set_fan_div(dev, buf, count, offset - 1); \ | 623 | return set_fan_div(dev, buf, count, offset - 1); \ |
@@ -633,21 +633,21 @@ show_fan_offset(2); | |||
633 | show_fan_offset(3); | 633 | show_fan_offset(3); |
634 | 634 | ||
635 | #define show_pwm_offset(offset) \ | 635 | #define show_pwm_offset(offset) \ |
636 | static ssize_t show_pwm##offset##_enable (struct device *dev, \ | 636 | static ssize_t show_pwm##offset##_enable (struct device *dev, struct device_attribute *attr, \ |
637 | char *buf) \ | 637 | char *buf) \ |
638 | { \ | 638 | { \ |
639 | return show_pwm_enable(dev, buf, offset - 1); \ | 639 | return show_pwm_enable(dev, buf, offset - 1); \ |
640 | } \ | 640 | } \ |
641 | static ssize_t show_pwm##offset (struct device *dev, char *buf) \ | 641 | static ssize_t show_pwm##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
642 | { \ | 642 | { \ |
643 | return show_pwm(dev, buf, offset - 1); \ | 643 | return show_pwm(dev, buf, offset - 1); \ |
644 | } \ | 644 | } \ |
645 | static ssize_t set_pwm##offset##_enable (struct device *dev, \ | 645 | static ssize_t set_pwm##offset##_enable (struct device *dev, struct device_attribute *attr, \ |
646 | const char *buf, size_t count) \ | 646 | const char *buf, size_t count) \ |
647 | { \ | 647 | { \ |
648 | return set_pwm_enable(dev, buf, count, offset - 1); \ | 648 | return set_pwm_enable(dev, buf, count, offset - 1); \ |
649 | } \ | 649 | } \ |
650 | static ssize_t set_pwm##offset (struct device *dev, \ | 650 | static ssize_t set_pwm##offset (struct device *dev, struct device_attribute *attr, \ |
651 | const char *buf, size_t count) \ | 651 | const char *buf, size_t count) \ |
652 | { \ | 652 | { \ |
653 | return set_pwm(dev, buf, count, offset - 1); \ | 653 | return set_pwm(dev, buf, count, offset - 1); \ |
@@ -663,7 +663,7 @@ show_pwm_offset(2); | |||
663 | show_pwm_offset(3); | 663 | show_pwm_offset(3); |
664 | 664 | ||
665 | /* Alarms */ | 665 | /* Alarms */ |
666 | static ssize_t show_alarms(struct device *dev, char *buf) | 666 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
667 | { | 667 | { |
668 | struct it87_data *data = it87_update_device(dev); | 668 | struct it87_data *data = it87_update_device(dev); |
669 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); | 669 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); |
@@ -671,13 +671,13 @@ static ssize_t show_alarms(struct device *dev, char *buf) | |||
671 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 671 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
672 | 672 | ||
673 | static ssize_t | 673 | static ssize_t |
674 | show_vrm_reg(struct device *dev, char *buf) | 674 | show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
675 | { | 675 | { |
676 | struct it87_data *data = it87_update_device(dev); | 676 | struct it87_data *data = it87_update_device(dev); |
677 | return sprintf(buf, "%ld\n", (long) data->vrm); | 677 | return sprintf(buf, "%ld\n", (long) data->vrm); |
678 | } | 678 | } |
679 | static ssize_t | 679 | static ssize_t |
680 | store_vrm_reg(struct device *dev, const char *buf, size_t count) | 680 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
681 | { | 681 | { |
682 | struct i2c_client *client = to_i2c_client(dev); | 682 | struct i2c_client *client = to_i2c_client(dev); |
683 | struct it87_data *data = i2c_get_clientdata(client); | 683 | struct it87_data *data = i2c_get_clientdata(client); |
@@ -693,7 +693,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | |||
693 | device_create_file(&client->dev, &dev_attr_vrm) | 693 | device_create_file(&client->dev, &dev_attr_vrm) |
694 | 694 | ||
695 | static ssize_t | 695 | static ssize_t |
696 | show_vid_reg(struct device *dev, char *buf) | 696 | show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
697 | { | 697 | { |
698 | struct it87_data *data = it87_update_device(dev); | 698 | struct it87_data *data = it87_update_device(dev); |
699 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 699 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); |
diff --git a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c index 14cc5af03739..bc68e031392b 100644 --- a/drivers/i2c/chips/lm63.c +++ b/drivers/i2c/chips/lm63.c | |||
@@ -177,7 +177,7 @@ struct lm63_data { | |||
177 | */ | 177 | */ |
178 | 178 | ||
179 | #define show_fan(value) \ | 179 | #define show_fan(value) \ |
180 | static ssize_t show_##value(struct device *dev, char *buf) \ | 180 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
181 | { \ | 181 | { \ |
182 | struct lm63_data *data = lm63_update_device(dev); \ | 182 | struct lm63_data *data = lm63_update_device(dev); \ |
183 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value)); \ | 183 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value)); \ |
@@ -185,7 +185,7 @@ static ssize_t show_##value(struct device *dev, char *buf) \ | |||
185 | show_fan(fan1_input); | 185 | show_fan(fan1_input); |
186 | show_fan(fan1_low); | 186 | show_fan(fan1_low); |
187 | 187 | ||
188 | static ssize_t set_fan1_low(struct device *dev, const char *buf, | 188 | static ssize_t set_fan1_low(struct device *dev, struct device_attribute *attr, const char *buf, |
189 | size_t count) | 189 | size_t count) |
190 | { | 190 | { |
191 | struct i2c_client *client = to_i2c_client(dev); | 191 | struct i2c_client *client = to_i2c_client(dev); |
@@ -202,7 +202,7 @@ static ssize_t set_fan1_low(struct device *dev, const char *buf, | |||
202 | return count; | 202 | return count; |
203 | } | 203 | } |
204 | 204 | ||
205 | static ssize_t show_pwm1(struct device *dev, char *buf) | 205 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *attr, char *buf) |
206 | { | 206 | { |
207 | struct lm63_data *data = lm63_update_device(dev); | 207 | struct lm63_data *data = lm63_update_device(dev); |
208 | return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ? | 208 | return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ? |
@@ -210,7 +210,7 @@ static ssize_t show_pwm1(struct device *dev, char *buf) | |||
210 | (2 * data->pwm1_freq)); | 210 | (2 * data->pwm1_freq)); |
211 | } | 211 | } |
212 | 212 | ||
213 | static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | 213 | static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
214 | { | 214 | { |
215 | struct i2c_client *client = to_i2c_client(dev); | 215 | struct i2c_client *client = to_i2c_client(dev); |
216 | struct lm63_data *data = i2c_get_clientdata(client); | 216 | struct lm63_data *data = i2c_get_clientdata(client); |
@@ -229,20 +229,20 @@ static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | |||
229 | return count; | 229 | return count; |
230 | } | 230 | } |
231 | 231 | ||
232 | static ssize_t show_pwm1_enable(struct device *dev, char *buf) | 232 | static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *attr, char *buf) |
233 | { | 233 | { |
234 | struct lm63_data *data = lm63_update_device(dev); | 234 | struct lm63_data *data = lm63_update_device(dev); |
235 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); | 235 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); |
236 | } | 236 | } |
237 | 237 | ||
238 | #define show_temp8(value) \ | 238 | #define show_temp8(value) \ |
239 | static ssize_t show_##value(struct device *dev, char *buf) \ | 239 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
240 | { \ | 240 | { \ |
241 | struct lm63_data *data = lm63_update_device(dev); \ | 241 | struct lm63_data *data = lm63_update_device(dev); \ |
242 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->value)); \ | 242 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->value)); \ |
243 | } | 243 | } |
244 | #define show_temp11(value) \ | 244 | #define show_temp11(value) \ |
245 | static ssize_t show_##value(struct device *dev, char *buf) \ | 245 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
246 | { \ | 246 | { \ |
247 | struct lm63_data *data = lm63_update_device(dev); \ | 247 | struct lm63_data *data = lm63_update_device(dev); \ |
248 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->value)); \ | 248 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->value)); \ |
@@ -255,7 +255,7 @@ show_temp11(temp2_low); | |||
255 | show_temp8(temp2_crit); | 255 | show_temp8(temp2_crit); |
256 | 256 | ||
257 | #define set_temp8(value, reg) \ | 257 | #define set_temp8(value, reg) \ |
258 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 258 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
259 | size_t count) \ | 259 | size_t count) \ |
260 | { \ | 260 | { \ |
261 | struct i2c_client *client = to_i2c_client(dev); \ | 261 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -269,7 +269,7 @@ static ssize_t set_##value(struct device *dev, const char *buf, \ | |||
269 | return count; \ | 269 | return count; \ |
270 | } | 270 | } |
271 | #define set_temp11(value, reg_msb, reg_lsb) \ | 271 | #define set_temp11(value, reg_msb, reg_lsb) \ |
272 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 272 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
273 | size_t count) \ | 273 | size_t count) \ |
274 | { \ | 274 | { \ |
275 | struct i2c_client *client = to_i2c_client(dev); \ | 275 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -289,7 +289,7 @@ set_temp11(temp2_low, LM63_REG_REMOTE_LOW_MSB, LM63_REG_REMOTE_LOW_LSB); | |||
289 | 289 | ||
290 | /* Hysteresis register holds a relative value, while we want to present | 290 | /* Hysteresis register holds a relative value, while we want to present |
291 | an absolute to user-space */ | 291 | an absolute to user-space */ |
292 | static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) | 292 | static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
293 | { | 293 | { |
294 | struct lm63_data *data = lm63_update_device(dev); | 294 | struct lm63_data *data = lm63_update_device(dev); |
295 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp2_crit) | 295 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp2_crit) |
@@ -298,7 +298,7 @@ static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) | |||
298 | 298 | ||
299 | /* And now the other way around, user-space provides an absolute | 299 | /* And now the other way around, user-space provides an absolute |
300 | hysteresis value and we have to store a relative one */ | 300 | hysteresis value and we have to store a relative one */ |
301 | static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, | 301 | static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, |
302 | size_t count) | 302 | size_t count) |
303 | { | 303 | { |
304 | struct i2c_client *client = to_i2c_client(dev); | 304 | struct i2c_client *client = to_i2c_client(dev); |
@@ -314,7 +314,7 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, | |||
314 | return count; | 314 | return count; |
315 | } | 315 | } |
316 | 316 | ||
317 | static ssize_t show_alarms(struct device *dev, char *buf) | 317 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
318 | { | 318 | { |
319 | struct lm63_data *data = lm63_update_device(dev); | 319 | struct lm63_data *data = lm63_update_device(dev); |
320 | return sprintf(buf, "%u\n", data->alarms); | 320 | return sprintf(buf, "%u\n", data->alarms); |
diff --git a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c index 0e86cc893981..57c51ac37c04 100644 --- a/drivers/i2c/chips/lm75.c +++ b/drivers/i2c/chips/lm75.c | |||
@@ -75,7 +75,7 @@ static struct i2c_driver lm75_driver = { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | #define show(value) \ | 77 | #define show(value) \ |
78 | static ssize_t show_##value(struct device *dev, char *buf) \ | 78 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
79 | { \ | 79 | { \ |
80 | struct lm75_data *data = lm75_update_device(dev); \ | 80 | struct lm75_data *data = lm75_update_device(dev); \ |
81 | return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ | 81 | return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->value)); \ |
@@ -85,7 +85,7 @@ show(temp_hyst); | |||
85 | show(temp_input); | 85 | show(temp_input); |
86 | 86 | ||
87 | #define set(value, reg) \ | 87 | #define set(value, reg) \ |
88 | static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ | 88 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
89 | { \ | 89 | { \ |
90 | struct i2c_client *client = to_i2c_client(dev); \ | 90 | struct i2c_client *client = to_i2c_client(dev); \ |
91 | struct lm75_data *data = i2c_get_clientdata(client); \ | 91 | struct lm75_data *data = i2c_get_clientdata(client); \ |
diff --git a/drivers/i2c/chips/lm77.c b/drivers/i2c/chips/lm77.c index f56b7a37de75..9d15cd5189f6 100644 --- a/drivers/i2c/chips/lm77.c +++ b/drivers/i2c/chips/lm77.c | |||
@@ -103,7 +103,7 @@ static inline int LM77_TEMP_FROM_REG(u16 reg) | |||
103 | 103 | ||
104 | /* read routines for temperature limits */ | 104 | /* read routines for temperature limits */ |
105 | #define show(value) \ | 105 | #define show(value) \ |
106 | static ssize_t show_##value(struct device *dev, char *buf) \ | 106 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
107 | { \ | 107 | { \ |
108 | struct lm77_data *data = lm77_update_device(dev); \ | 108 | struct lm77_data *data = lm77_update_device(dev); \ |
109 | return sprintf(buf, "%d\n", data->value); \ | 109 | return sprintf(buf, "%d\n", data->value); \ |
@@ -116,17 +116,17 @@ show(temp_max); | |||
116 | show(alarms); | 116 | show(alarms); |
117 | 117 | ||
118 | /* read routines for hysteresis values */ | 118 | /* read routines for hysteresis values */ |
119 | static ssize_t show_temp_crit_hyst(struct device *dev, char *buf) | 119 | static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
120 | { | 120 | { |
121 | struct lm77_data *data = lm77_update_device(dev); | 121 | struct lm77_data *data = lm77_update_device(dev); |
122 | return sprintf(buf, "%d\n", data->temp_crit - data->temp_hyst); | 122 | return sprintf(buf, "%d\n", data->temp_crit - data->temp_hyst); |
123 | } | 123 | } |
124 | static ssize_t show_temp_min_hyst(struct device *dev, char *buf) | 124 | static ssize_t show_temp_min_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
125 | { | 125 | { |
126 | struct lm77_data *data = lm77_update_device(dev); | 126 | struct lm77_data *data = lm77_update_device(dev); |
127 | return sprintf(buf, "%d\n", data->temp_min + data->temp_hyst); | 127 | return sprintf(buf, "%d\n", data->temp_min + data->temp_hyst); |
128 | } | 128 | } |
129 | static ssize_t show_temp_max_hyst(struct device *dev, char *buf) | 129 | static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
130 | { | 130 | { |
131 | struct lm77_data *data = lm77_update_device(dev); | 131 | struct lm77_data *data = lm77_update_device(dev); |
132 | return sprintf(buf, "%d\n", data->temp_max - data->temp_hyst); | 132 | return sprintf(buf, "%d\n", data->temp_max - data->temp_hyst); |
@@ -134,7 +134,7 @@ static ssize_t show_temp_max_hyst(struct device *dev, char *buf) | |||
134 | 134 | ||
135 | /* write routines */ | 135 | /* write routines */ |
136 | #define set(value, reg) \ | 136 | #define set(value, reg) \ |
137 | static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ | 137 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
138 | { \ | 138 | { \ |
139 | struct i2c_client *client = to_i2c_client(dev); \ | 139 | struct i2c_client *client = to_i2c_client(dev); \ |
140 | struct lm77_data *data = i2c_get_clientdata(client); \ | 140 | struct lm77_data *data = i2c_get_clientdata(client); \ |
@@ -152,7 +152,7 @@ set(temp_max, LM77_REG_TEMP_MAX); | |||
152 | 152 | ||
153 | /* hysteresis is stored as a relative value on the chip, so it has to be | 153 | /* hysteresis is stored as a relative value on the chip, so it has to be |
154 | converted first */ | 154 | converted first */ |
155 | static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t count) | 155 | static ssize_t set_temp_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
156 | { | 156 | { |
157 | struct i2c_client *client = to_i2c_client(dev); | 157 | struct i2c_client *client = to_i2c_client(dev); |
158 | struct lm77_data *data = i2c_get_clientdata(client); | 158 | struct lm77_data *data = i2c_get_clientdata(client); |
@@ -167,7 +167,7 @@ static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t co | |||
167 | } | 167 | } |
168 | 168 | ||
169 | /* preserve hysteresis when setting T_crit */ | 169 | /* preserve hysteresis when setting T_crit */ |
170 | static ssize_t set_temp_crit(struct device *dev, const char *buf, size_t count) | 170 | static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
171 | { | 171 | { |
172 | struct i2c_client *client = to_i2c_client(dev); | 172 | struct i2c_client *client = to_i2c_client(dev); |
173 | struct lm77_data *data = i2c_get_clientdata(client); | 173 | struct lm77_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c index 6d52d14eb31c..21b195ff3871 100644 --- a/drivers/i2c/chips/lm78.c +++ b/drivers/i2c/chips/lm78.c | |||
@@ -224,28 +224,28 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
224 | 224 | ||
225 | #define show_in_offset(offset) \ | 225 | #define show_in_offset(offset) \ |
226 | static ssize_t \ | 226 | static ssize_t \ |
227 | show_in##offset (struct device *dev, char *buf) \ | 227 | show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
228 | { \ | 228 | { \ |
229 | return show_in(dev, buf, offset); \ | 229 | return show_in(dev, buf, offset); \ |
230 | } \ | 230 | } \ |
231 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | 231 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
232 | show_in##offset, NULL); \ | 232 | show_in##offset, NULL); \ |
233 | static ssize_t \ | 233 | static ssize_t \ |
234 | show_in##offset##_min (struct device *dev, char *buf) \ | 234 | show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
235 | { \ | 235 | { \ |
236 | return show_in_min(dev, buf, offset); \ | 236 | return show_in_min(dev, buf, offset); \ |
237 | } \ | 237 | } \ |
238 | static ssize_t \ | 238 | static ssize_t \ |
239 | show_in##offset##_max (struct device *dev, char *buf) \ | 239 | show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
240 | { \ | 240 | { \ |
241 | return show_in_max(dev, buf, offset); \ | 241 | return show_in_max(dev, buf, offset); \ |
242 | } \ | 242 | } \ |
243 | static ssize_t set_in##offset##_min (struct device *dev, \ | 243 | static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ |
244 | const char *buf, size_t count) \ | 244 | const char *buf, size_t count) \ |
245 | { \ | 245 | { \ |
246 | return set_in_min(dev, buf, count, offset); \ | 246 | return set_in_min(dev, buf, count, offset); \ |
247 | } \ | 247 | } \ |
248 | static ssize_t set_in##offset##_max (struct device *dev, \ | 248 | static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ |
249 | const char *buf, size_t count) \ | 249 | const char *buf, size_t count) \ |
250 | { \ | 250 | { \ |
251 | return set_in_max(dev, buf, count, offset); \ | 251 | return set_in_max(dev, buf, count, offset); \ |
@@ -264,19 +264,19 @@ show_in_offset(5); | |||
264 | show_in_offset(6); | 264 | show_in_offset(6); |
265 | 265 | ||
266 | /* Temperature */ | 266 | /* Temperature */ |
267 | static ssize_t show_temp(struct device *dev, char *buf) | 267 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) |
268 | { | 268 | { |
269 | struct lm78_data *data = lm78_update_device(dev); | 269 | struct lm78_data *data = lm78_update_device(dev); |
270 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); | 270 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); |
271 | } | 271 | } |
272 | 272 | ||
273 | static ssize_t show_temp_over(struct device *dev, char *buf) | 273 | static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) |
274 | { | 274 | { |
275 | struct lm78_data *data = lm78_update_device(dev); | 275 | struct lm78_data *data = lm78_update_device(dev); |
276 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); | 276 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); |
277 | } | 277 | } |
278 | 278 | ||
279 | static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) | 279 | static ssize_t set_temp_over(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
280 | { | 280 | { |
281 | struct i2c_client *client = to_i2c_client(dev); | 281 | struct i2c_client *client = to_i2c_client(dev); |
282 | struct lm78_data *data = i2c_get_clientdata(client); | 282 | struct lm78_data *data = i2c_get_clientdata(client); |
@@ -289,13 +289,13 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) | |||
289 | return count; | 289 | return count; |
290 | } | 290 | } |
291 | 291 | ||
292 | static ssize_t show_temp_hyst(struct device *dev, char *buf) | 292 | static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
293 | { | 293 | { |
294 | struct lm78_data *data = lm78_update_device(dev); | 294 | struct lm78_data *data = lm78_update_device(dev); |
295 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); | 295 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); |
296 | } | 296 | } |
297 | 297 | ||
298 | static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) | 298 | static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
299 | { | 299 | { |
300 | struct i2c_client *client = to_i2c_client(dev); | 300 | struct i2c_client *client = to_i2c_client(dev); |
301 | struct lm78_data *data = i2c_get_clientdata(client); | 301 | struct lm78_data *data = i2c_get_clientdata(client); |
@@ -398,19 +398,19 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
398 | } | 398 | } |
399 | 399 | ||
400 | #define show_fan_offset(offset) \ | 400 | #define show_fan_offset(offset) \ |
401 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 401 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
402 | { \ | 402 | { \ |
403 | return show_fan(dev, buf, offset - 1); \ | 403 | return show_fan(dev, buf, offset - 1); \ |
404 | } \ | 404 | } \ |
405 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 405 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
406 | { \ | 406 | { \ |
407 | return show_fan_min(dev, buf, offset - 1); \ | 407 | return show_fan_min(dev, buf, offset - 1); \ |
408 | } \ | 408 | } \ |
409 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 409 | static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
410 | { \ | 410 | { \ |
411 | return show_fan_div(dev, buf, offset - 1); \ | 411 | return show_fan_div(dev, buf, offset - 1); \ |
412 | } \ | 412 | } \ |
413 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 413 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
414 | const char *buf, size_t count) \ | 414 | const char *buf, size_t count) \ |
415 | { \ | 415 | { \ |
416 | return set_fan_min(dev, buf, count, offset - 1); \ | 416 | return set_fan_min(dev, buf, count, offset - 1); \ |
@@ -419,13 +419,13 @@ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\ | |||
419 | static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | 419 | static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ |
420 | show_fan_##offset##_min, set_fan_##offset##_min); | 420 | show_fan_##offset##_min, set_fan_##offset##_min); |
421 | 421 | ||
422 | static ssize_t set_fan_1_div(struct device *dev, const char *buf, | 422 | static ssize_t set_fan_1_div(struct device *dev, struct device_attribute *attr, const char *buf, |
423 | size_t count) | 423 | size_t count) |
424 | { | 424 | { |
425 | return set_fan_div(dev, buf, count, 0) ; | 425 | return set_fan_div(dev, buf, count, 0) ; |
426 | } | 426 | } |
427 | 427 | ||
428 | static ssize_t set_fan_2_div(struct device *dev, const char *buf, | 428 | static ssize_t set_fan_2_div(struct device *dev, struct device_attribute *attr, const char *buf, |
429 | size_t count) | 429 | size_t count) |
430 | { | 430 | { |
431 | return set_fan_div(dev, buf, count, 1) ; | 431 | return set_fan_div(dev, buf, count, 1) ; |
@@ -443,7 +443,7 @@ static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, | |||
443 | static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); | 443 | static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); |
444 | 444 | ||
445 | /* VID */ | 445 | /* VID */ |
446 | static ssize_t show_vid(struct device *dev, char *buf) | 446 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
447 | { | 447 | { |
448 | struct lm78_data *data = lm78_update_device(dev); | 448 | struct lm78_data *data = lm78_update_device(dev); |
449 | return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); | 449 | return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); |
@@ -451,7 +451,7 @@ static ssize_t show_vid(struct device *dev, char *buf) | |||
451 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 451 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
452 | 452 | ||
453 | /* Alarms */ | 453 | /* Alarms */ |
454 | static ssize_t show_alarms(struct device *dev, char *buf) | 454 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
455 | { | 455 | { |
456 | struct lm78_data *data = lm78_update_device(dev); | 456 | struct lm78_data *data = lm78_update_device(dev); |
457 | return sprintf(buf, "%u\n", data->alarms); | 457 | return sprintf(buf, "%u\n", data->alarms); |
diff --git a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c index a72f431971bb..404057b70e90 100644 --- a/drivers/i2c/chips/lm80.c +++ b/drivers/i2c/chips/lm80.c | |||
@@ -156,7 +156,7 @@ static struct i2c_driver lm80_driver = { | |||
156 | */ | 156 | */ |
157 | 157 | ||
158 | #define show_in(suffix, value) \ | 158 | #define show_in(suffix, value) \ |
159 | static ssize_t show_in_##suffix(struct device *dev, char *buf) \ | 159 | static ssize_t show_in_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
160 | { \ | 160 | { \ |
161 | struct lm80_data *data = lm80_update_device(dev); \ | 161 | struct lm80_data *data = lm80_update_device(dev); \ |
162 | return sprintf(buf, "%d\n", IN_FROM_REG(data->value)); \ | 162 | return sprintf(buf, "%d\n", IN_FROM_REG(data->value)); \ |
@@ -184,7 +184,7 @@ show_in(input5, in[5]); | |||
184 | show_in(input6, in[6]); | 184 | show_in(input6, in[6]); |
185 | 185 | ||
186 | #define set_in(suffix, value, reg) \ | 186 | #define set_in(suffix, value, reg) \ |
187 | static ssize_t set_in_##suffix(struct device *dev, const char *buf, \ | 187 | static ssize_t set_in_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
188 | size_t count) \ | 188 | size_t count) \ |
189 | { \ | 189 | { \ |
190 | struct i2c_client *client = to_i2c_client(dev); \ | 190 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -213,7 +213,7 @@ set_in(max5, in_max[5], LM80_REG_IN_MAX(5)); | |||
213 | set_in(max6, in_max[6], LM80_REG_IN_MAX(6)); | 213 | set_in(max6, in_max[6], LM80_REG_IN_MAX(6)); |
214 | 214 | ||
215 | #define show_fan(suffix, value, div) \ | 215 | #define show_fan(suffix, value, div) \ |
216 | static ssize_t show_fan_##suffix(struct device *dev, char *buf) \ | 216 | static ssize_t show_fan_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
217 | { \ | 217 | { \ |
218 | struct lm80_data *data = lm80_update_device(dev); \ | 218 | struct lm80_data *data = lm80_update_device(dev); \ |
219 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value, \ | 219 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value, \ |
@@ -225,7 +225,7 @@ show_fan(input1, fan[0], fan_div[0]); | |||
225 | show_fan(input2, fan[1], fan_div[1]); | 225 | show_fan(input2, fan[1], fan_div[1]); |
226 | 226 | ||
227 | #define show_fan_div(suffix, value) \ | 227 | #define show_fan_div(suffix, value) \ |
228 | static ssize_t show_fan_div##suffix(struct device *dev, char *buf) \ | 228 | static ssize_t show_fan_div##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
229 | { \ | 229 | { \ |
230 | struct lm80_data *data = lm80_update_device(dev); \ | 230 | struct lm80_data *data = lm80_update_device(dev); \ |
231 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->value)); \ | 231 | return sprintf(buf, "%d\n", DIV_FROM_REG(data->value)); \ |
@@ -234,7 +234,7 @@ show_fan_div(1, fan_div[0]); | |||
234 | show_fan_div(2, fan_div[1]); | 234 | show_fan_div(2, fan_div[1]); |
235 | 235 | ||
236 | #define set_fan(suffix, value, reg, div) \ | 236 | #define set_fan(suffix, value, reg, div) \ |
237 | static ssize_t set_fan_##suffix(struct device *dev, const char *buf, \ | 237 | static ssize_t set_fan_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
238 | size_t count) \ | 238 | size_t count) \ |
239 | { \ | 239 | { \ |
240 | struct i2c_client *client = to_i2c_client(dev); \ | 240 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -292,7 +292,7 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
292 | } | 292 | } |
293 | 293 | ||
294 | #define set_fan_div(number) \ | 294 | #define set_fan_div(number) \ |
295 | static ssize_t set_fan_div##number(struct device *dev, const char *buf, \ | 295 | static ssize_t set_fan_div##number(struct device *dev, struct device_attribute *attr, const char *buf, \ |
296 | size_t count) \ | 296 | size_t count) \ |
297 | { \ | 297 | { \ |
298 | return set_fan_div(dev, buf, count, number - 1); \ | 298 | return set_fan_div(dev, buf, count, number - 1); \ |
@@ -300,14 +300,14 @@ static ssize_t set_fan_div##number(struct device *dev, const char *buf, \ | |||
300 | set_fan_div(1); | 300 | set_fan_div(1); |
301 | set_fan_div(2); | 301 | set_fan_div(2); |
302 | 302 | ||
303 | static ssize_t show_temp_input1(struct device *dev, char *buf) | 303 | static ssize_t show_temp_input1(struct device *dev, struct device_attribute *attr, char *buf) |
304 | { | 304 | { |
305 | struct lm80_data *data = lm80_update_device(dev); | 305 | struct lm80_data *data = lm80_update_device(dev); |
306 | return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp)); | 306 | return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp)); |
307 | } | 307 | } |
308 | 308 | ||
309 | #define show_temp(suffix, value) \ | 309 | #define show_temp(suffix, value) \ |
310 | static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ | 310 | static ssize_t show_temp_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
311 | { \ | 311 | { \ |
312 | struct lm80_data *data = lm80_update_device(dev); \ | 312 | struct lm80_data *data = lm80_update_device(dev); \ |
313 | return sprintf(buf, "%d\n", TEMP_LIMIT_FROM_REG(data->value)); \ | 313 | return sprintf(buf, "%d\n", TEMP_LIMIT_FROM_REG(data->value)); \ |
@@ -318,7 +318,7 @@ show_temp(os_max, temp_os_max); | |||
318 | show_temp(os_hyst, temp_os_hyst); | 318 | show_temp(os_hyst, temp_os_hyst); |
319 | 319 | ||
320 | #define set_temp(suffix, value, reg) \ | 320 | #define set_temp(suffix, value, reg) \ |
321 | static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ | 321 | static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
322 | size_t count) \ | 322 | size_t count) \ |
323 | { \ | 323 | { \ |
324 | struct i2c_client *client = to_i2c_client(dev); \ | 324 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -336,7 +336,7 @@ set_temp(hot_hyst, temp_hot_hyst, LM80_REG_TEMP_HOT_HYST); | |||
336 | set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); | 336 | set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); |
337 | set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); | 337 | set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); |
338 | 338 | ||
339 | static ssize_t show_alarms(struct device *dev, char *buf) | 339 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
340 | { | 340 | { |
341 | struct lm80_data *data = lm80_update_device(dev); | 341 | struct lm80_data *data = lm80_update_device(dev); |
342 | return sprintf(buf, "%u\n", data->alarms); | 342 | return sprintf(buf, "%u\n", data->alarms); |
diff --git a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c index 3dafe60766ad..4d6d7d21e14b 100644 --- a/drivers/i2c/chips/lm83.c +++ b/drivers/i2c/chips/lm83.c | |||
@@ -155,7 +155,7 @@ struct lm83_data { | |||
155 | */ | 155 | */ |
156 | 156 | ||
157 | #define show_temp(suffix, value) \ | 157 | #define show_temp(suffix, value) \ |
158 | static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ | 158 | static ssize_t show_temp_##suffix(struct device *dev, struct device_attribute *attr, char *buf) \ |
159 | { \ | 159 | { \ |
160 | struct lm83_data *data = lm83_update_device(dev); \ | 160 | struct lm83_data *data = lm83_update_device(dev); \ |
161 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ | 161 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ |
@@ -171,7 +171,7 @@ show_temp(high4, temp_high[3]); | |||
171 | show_temp(crit, temp_crit); | 171 | show_temp(crit, temp_crit); |
172 | 172 | ||
173 | #define set_temp(suffix, value, reg) \ | 173 | #define set_temp(suffix, value, reg) \ |
174 | static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ | 174 | static ssize_t set_temp_##suffix(struct device *dev, struct device_attribute *attr, const char *buf, \ |
175 | size_t count) \ | 175 | size_t count) \ |
176 | { \ | 176 | { \ |
177 | struct i2c_client *client = to_i2c_client(dev); \ | 177 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -190,7 +190,7 @@ set_temp(high3, temp_high[2], LM83_REG_W_REMOTE2_HIGH); | |||
190 | set_temp(high4, temp_high[3], LM83_REG_W_REMOTE3_HIGH); | 190 | set_temp(high4, temp_high[3], LM83_REG_W_REMOTE3_HIGH); |
191 | set_temp(crit, temp_crit, LM83_REG_W_TCRIT); | 191 | set_temp(crit, temp_crit, LM83_REG_W_TCRIT); |
192 | 192 | ||
193 | static ssize_t show_alarms(struct device *dev, char *buf) | 193 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
194 | { | 194 | { |
195 | struct lm83_data *data = lm83_update_device(dev); | 195 | struct lm83_data *data = lm83_update_device(dev); |
196 | return sprintf(buf, "%d\n", data->alarms); | 196 | return sprintf(buf, "%d\n", data->alarms); |
diff --git a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c index b1a0dc5f6b34..b1976775b4ba 100644 --- a/drivers/i2c/chips/lm85.c +++ b/drivers/i2c/chips/lm85.c | |||
@@ -426,15 +426,15 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, | |||
426 | } | 426 | } |
427 | 427 | ||
428 | #define show_fan_offset(offset) \ | 428 | #define show_fan_offset(offset) \ |
429 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 429 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
430 | { \ | 430 | { \ |
431 | return show_fan(dev, buf, offset - 1); \ | 431 | return show_fan(dev, buf, offset - 1); \ |
432 | } \ | 432 | } \ |
433 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 433 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
434 | { \ | 434 | { \ |
435 | return show_fan_min(dev, buf, offset - 1); \ | 435 | return show_fan_min(dev, buf, offset - 1); \ |
436 | } \ | 436 | } \ |
437 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 437 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
438 | const char *buf, size_t count) \ | 438 | const char *buf, size_t count) \ |
439 | { \ | 439 | { \ |
440 | return set_fan_min(dev, buf, count, offset - 1); \ | 440 | return set_fan_min(dev, buf, count, offset - 1); \ |
@@ -451,7 +451,7 @@ show_fan_offset(4); | |||
451 | 451 | ||
452 | /* vid, vrm, alarms */ | 452 | /* vid, vrm, alarms */ |
453 | 453 | ||
454 | static ssize_t show_vid_reg(struct device *dev, char *buf) | 454 | static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
455 | { | 455 | { |
456 | struct lm85_data *data = lm85_update_device(dev); | 456 | struct lm85_data *data = lm85_update_device(dev); |
457 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 457 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); |
@@ -459,13 +459,13 @@ static ssize_t show_vid_reg(struct device *dev, char *buf) | |||
459 | 459 | ||
460 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | 460 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); |
461 | 461 | ||
462 | static ssize_t show_vrm_reg(struct device *dev, char *buf) | 462 | static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
463 | { | 463 | { |
464 | struct lm85_data *data = lm85_update_device(dev); | 464 | struct lm85_data *data = lm85_update_device(dev); |
465 | return sprintf(buf, "%ld\n", (long) data->vrm); | 465 | return sprintf(buf, "%ld\n", (long) data->vrm); |
466 | } | 466 | } |
467 | 467 | ||
468 | static ssize_t store_vrm_reg(struct device *dev, const char *buf, size_t count) | 468 | static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
469 | { | 469 | { |
470 | struct i2c_client *client = to_i2c_client(dev); | 470 | struct i2c_client *client = to_i2c_client(dev); |
471 | struct lm85_data *data = i2c_get_clientdata(client); | 471 | struct lm85_data *data = i2c_get_clientdata(client); |
@@ -478,7 +478,7 @@ static ssize_t store_vrm_reg(struct device *dev, const char *buf, size_t count) | |||
478 | 478 | ||
479 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | 479 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); |
480 | 480 | ||
481 | static ssize_t show_alarms_reg(struct device *dev, char *buf) | 481 | static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) |
482 | { | 482 | { |
483 | struct lm85_data *data = lm85_update_device(dev); | 483 | struct lm85_data *data = lm85_update_device(dev); |
484 | return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); | 484 | return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); |
@@ -516,16 +516,16 @@ static ssize_t show_pwm_enable(struct device *dev, char *buf, int nr) | |||
516 | } | 516 | } |
517 | 517 | ||
518 | #define show_pwm_reg(offset) \ | 518 | #define show_pwm_reg(offset) \ |
519 | static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ | 519 | static ssize_t show_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
520 | { \ | 520 | { \ |
521 | return show_pwm(dev, buf, offset - 1); \ | 521 | return show_pwm(dev, buf, offset - 1); \ |
522 | } \ | 522 | } \ |
523 | static ssize_t set_pwm_##offset (struct device *dev, \ | 523 | static ssize_t set_pwm_##offset (struct device *dev, struct device_attribute *attr, \ |
524 | const char *buf, size_t count) \ | 524 | const char *buf, size_t count) \ |
525 | { \ | 525 | { \ |
526 | return set_pwm(dev, buf, count, offset - 1); \ | 526 | return set_pwm(dev, buf, count, offset - 1); \ |
527 | } \ | 527 | } \ |
528 | static ssize_t show_pwm_enable##offset (struct device *dev, char *buf) \ | 528 | static ssize_t show_pwm_enable##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
529 | { \ | 529 | { \ |
530 | return show_pwm_enable(dev, buf, offset - 1); \ | 530 | return show_pwm_enable(dev, buf, offset - 1); \ |
531 | } \ | 531 | } \ |
@@ -585,24 +585,24 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
585 | return count; | 585 | return count; |
586 | } | 586 | } |
587 | #define show_in_reg(offset) \ | 587 | #define show_in_reg(offset) \ |
588 | static ssize_t show_in_##offset (struct device *dev, char *buf) \ | 588 | static ssize_t show_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
589 | { \ | 589 | { \ |
590 | return show_in(dev, buf, offset); \ | 590 | return show_in(dev, buf, offset); \ |
591 | } \ | 591 | } \ |
592 | static ssize_t show_in_##offset##_min (struct device *dev, char *buf) \ | 592 | static ssize_t show_in_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
593 | { \ | 593 | { \ |
594 | return show_in_min(dev, buf, offset); \ | 594 | return show_in_min(dev, buf, offset); \ |
595 | } \ | 595 | } \ |
596 | static ssize_t show_in_##offset##_max (struct device *dev, char *buf) \ | 596 | static ssize_t show_in_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
597 | { \ | 597 | { \ |
598 | return show_in_max(dev, buf, offset); \ | 598 | return show_in_max(dev, buf, offset); \ |
599 | } \ | 599 | } \ |
600 | static ssize_t set_in_##offset##_min (struct device *dev, \ | 600 | static ssize_t set_in_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
601 | const char *buf, size_t count) \ | 601 | const char *buf, size_t count) \ |
602 | { \ | 602 | { \ |
603 | return set_in_min(dev, buf, count, offset); \ | 603 | return set_in_min(dev, buf, count, offset); \ |
604 | } \ | 604 | } \ |
605 | static ssize_t set_in_##offset##_max (struct device *dev, \ | 605 | static ssize_t set_in_##offset##_max (struct device *dev, struct device_attribute *attr, \ |
606 | const char *buf, size_t count) \ | 606 | const char *buf, size_t count) \ |
607 | { \ | 607 | { \ |
608 | return set_in_max(dev, buf, count, offset); \ | 608 | return set_in_max(dev, buf, count, offset); \ |
@@ -666,24 +666,24 @@ static ssize_t set_temp_max(struct device *dev, const char *buf, | |||
666 | return count; | 666 | return count; |
667 | } | 667 | } |
668 | #define show_temp_reg(offset) \ | 668 | #define show_temp_reg(offset) \ |
669 | static ssize_t show_temp_##offset (struct device *dev, char *buf) \ | 669 | static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
670 | { \ | 670 | { \ |
671 | return show_temp(dev, buf, offset - 1); \ | 671 | return show_temp(dev, buf, offset - 1); \ |
672 | } \ | 672 | } \ |
673 | static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ | 673 | static ssize_t show_temp_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
674 | { \ | 674 | { \ |
675 | return show_temp_min(dev, buf, offset - 1); \ | 675 | return show_temp_min(dev, buf, offset - 1); \ |
676 | } \ | 676 | } \ |
677 | static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ | 677 | static ssize_t show_temp_##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
678 | { \ | 678 | { \ |
679 | return show_temp_max(dev, buf, offset - 1); \ | 679 | return show_temp_max(dev, buf, offset - 1); \ |
680 | } \ | 680 | } \ |
681 | static ssize_t set_temp_##offset##_min (struct device *dev, \ | 681 | static ssize_t set_temp_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
682 | const char *buf, size_t count) \ | 682 | const char *buf, size_t count) \ |
683 | { \ | 683 | { \ |
684 | return set_temp_min(dev, buf, count, offset - 1); \ | 684 | return set_temp_min(dev, buf, count, offset - 1); \ |
685 | } \ | 685 | } \ |
686 | static ssize_t set_temp_##offset##_max (struct device *dev, \ | 686 | static ssize_t set_temp_##offset##_max (struct device *dev, struct device_attribute *attr, \ |
687 | const char *buf, size_t count) \ | 687 | const char *buf, size_t count) \ |
688 | { \ | 688 | { \ |
689 | return set_temp_max(dev, buf, count, offset - 1); \ | 689 | return set_temp_max(dev, buf, count, offset - 1); \ |
@@ -786,42 +786,42 @@ static ssize_t set_pwm_auto_pwm_freq(struct device *dev, const char *buf, | |||
786 | return count; | 786 | return count; |
787 | } | 787 | } |
788 | #define pwm_auto(offset) \ | 788 | #define pwm_auto(offset) \ |
789 | static ssize_t show_pwm##offset##_auto_channels (struct device *dev, \ | 789 | static ssize_t show_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ |
790 | char *buf) \ | 790 | char *buf) \ |
791 | { \ | 791 | { \ |
792 | return show_pwm_auto_channels(dev, buf, offset - 1); \ | 792 | return show_pwm_auto_channels(dev, buf, offset - 1); \ |
793 | } \ | 793 | } \ |
794 | static ssize_t set_pwm##offset##_auto_channels (struct device *dev, \ | 794 | static ssize_t set_pwm##offset##_auto_channels (struct device *dev, struct device_attribute *attr, \ |
795 | const char *buf, size_t count) \ | 795 | const char *buf, size_t count) \ |
796 | { \ | 796 | { \ |
797 | return set_pwm_auto_channels(dev, buf, count, offset - 1); \ | 797 | return set_pwm_auto_channels(dev, buf, count, offset - 1); \ |
798 | } \ | 798 | } \ |
799 | static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, \ | 799 | static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \ |
800 | char *buf) \ | 800 | char *buf) \ |
801 | { \ | 801 | { \ |
802 | return show_pwm_auto_pwm_min(dev, buf, offset - 1); \ | 802 | return show_pwm_auto_pwm_min(dev, buf, offset - 1); \ |
803 | } \ | 803 | } \ |
804 | static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, \ | 804 | static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, struct device_attribute *attr, \ |
805 | const char *buf, size_t count) \ | 805 | const char *buf, size_t count) \ |
806 | { \ | 806 | { \ |
807 | return set_pwm_auto_pwm_min(dev, buf, count, offset - 1); \ | 807 | return set_pwm_auto_pwm_min(dev, buf, count, offset - 1); \ |
808 | } \ | 808 | } \ |
809 | static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, \ | 809 | static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \ |
810 | char *buf) \ | 810 | char *buf) \ |
811 | { \ | 811 | { \ |
812 | return show_pwm_auto_pwm_minctl(dev, buf, offset - 1); \ | 812 | return show_pwm_auto_pwm_minctl(dev, buf, offset - 1); \ |
813 | } \ | 813 | } \ |
814 | static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, \ | 814 | static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, struct device_attribute *attr, \ |
815 | const char *buf, size_t count) \ | 815 | const char *buf, size_t count) \ |
816 | { \ | 816 | { \ |
817 | return set_pwm_auto_pwm_minctl(dev, buf, count, offset - 1); \ | 817 | return set_pwm_auto_pwm_minctl(dev, buf, count, offset - 1); \ |
818 | } \ | 818 | } \ |
819 | static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, \ | 819 | static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, struct device_attribute *attr, \ |
820 | char *buf) \ | 820 | char *buf) \ |
821 | { \ | 821 | { \ |
822 | return show_pwm_auto_pwm_freq(dev, buf, offset - 1); \ | 822 | return show_pwm_auto_pwm_freq(dev, buf, offset - 1); \ |
823 | } \ | 823 | } \ |
824 | static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, \ | 824 | static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, struct device_attribute *attr, \ |
825 | const char *buf, size_t count) \ | 825 | const char *buf, size_t count) \ |
826 | { \ | 826 | { \ |
827 | return set_pwm_auto_pwm_freq(dev, buf, count, offset - 1); \ | 827 | return set_pwm_auto_pwm_freq(dev, buf, count, offset - 1); \ |
@@ -962,42 +962,42 @@ static ssize_t set_temp_auto_temp_crit(struct device *dev, const char *buf, | |||
962 | return count; | 962 | return count; |
963 | } | 963 | } |
964 | #define temp_auto(offset) \ | 964 | #define temp_auto(offset) \ |
965 | static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, \ | 965 | static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ |
966 | char *buf) \ | 966 | char *buf) \ |
967 | { \ | 967 | { \ |
968 | return show_temp_auto_temp_off(dev, buf, offset - 1); \ | 968 | return show_temp_auto_temp_off(dev, buf, offset - 1); \ |
969 | } \ | 969 | } \ |
970 | static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, \ | 970 | static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, struct device_attribute *attr, \ |
971 | const char *buf, size_t count) \ | 971 | const char *buf, size_t count) \ |
972 | { \ | 972 | { \ |
973 | return set_temp_auto_temp_off(dev, buf, count, offset - 1); \ | 973 | return set_temp_auto_temp_off(dev, buf, count, offset - 1); \ |
974 | } \ | 974 | } \ |
975 | static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, \ | 975 | static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \ |
976 | char *buf) \ | 976 | char *buf) \ |
977 | { \ | 977 | { \ |
978 | return show_temp_auto_temp_min(dev, buf, offset - 1); \ | 978 | return show_temp_auto_temp_min(dev, buf, offset - 1); \ |
979 | } \ | 979 | } \ |
980 | static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, \ | 980 | static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, struct device_attribute *attr, \ |
981 | const char *buf, size_t count) \ | 981 | const char *buf, size_t count) \ |
982 | { \ | 982 | { \ |
983 | return set_temp_auto_temp_min(dev, buf, count, offset - 1); \ | 983 | return set_temp_auto_temp_min(dev, buf, count, offset - 1); \ |
984 | } \ | 984 | } \ |
985 | static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, \ | 985 | static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \ |
986 | char *buf) \ | 986 | char *buf) \ |
987 | { \ | 987 | { \ |
988 | return show_temp_auto_temp_max(dev, buf, offset - 1); \ | 988 | return show_temp_auto_temp_max(dev, buf, offset - 1); \ |
989 | } \ | 989 | } \ |
990 | static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, \ | 990 | static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, struct device_attribute *attr, \ |
991 | const char *buf, size_t count) \ | 991 | const char *buf, size_t count) \ |
992 | { \ | 992 | { \ |
993 | return set_temp_auto_temp_max(dev, buf, count, offset - 1); \ | 993 | return set_temp_auto_temp_max(dev, buf, count, offset - 1); \ |
994 | } \ | 994 | } \ |
995 | static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, \ | 995 | static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \ |
996 | char *buf) \ | 996 | char *buf) \ |
997 | { \ | 997 | { \ |
998 | return show_temp_auto_temp_crit(dev, buf, offset - 1); \ | 998 | return show_temp_auto_temp_crit(dev, buf, offset - 1); \ |
999 | } \ | 999 | } \ |
1000 | static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, \ | 1000 | static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, struct device_attribute *attr, \ |
1001 | const char *buf, size_t count) \ | 1001 | const char *buf, size_t count) \ |
1002 | { \ | 1002 | { \ |
1003 | return set_temp_auto_temp_crit(dev, buf, count, offset - 1); \ | 1003 | return set_temp_auto_temp_crit(dev, buf, count, offset - 1); \ |
diff --git a/drivers/i2c/chips/lm87.c b/drivers/i2c/chips/lm87.c index 98cabd665063..4372b61a0882 100644 --- a/drivers/i2c/chips/lm87.c +++ b/drivers/i2c/chips/lm87.c | |||
@@ -218,19 +218,19 @@ static inline int lm87_write_value(struct i2c_client *client, u8 reg, u8 value) | |||
218 | } | 218 | } |
219 | 219 | ||
220 | #define show_in(offset) \ | 220 | #define show_in(offset) \ |
221 | static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ | 221 | static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
222 | { \ | 222 | { \ |
223 | struct lm87_data *data = lm87_update_device(dev); \ | 223 | struct lm87_data *data = lm87_update_device(dev); \ |
224 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ | 224 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ |
225 | data->in_scale[offset])); \ | 225 | data->in_scale[offset])); \ |
226 | } \ | 226 | } \ |
227 | static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ | 227 | static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
228 | { \ | 228 | { \ |
229 | struct lm87_data *data = lm87_update_device(dev); \ | 229 | struct lm87_data *data = lm87_update_device(dev); \ |
230 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ | 230 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ |
231 | data->in_scale[offset])); \ | 231 | data->in_scale[offset])); \ |
232 | } \ | 232 | } \ |
233 | static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ | 233 | static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
234 | { \ | 234 | { \ |
235 | struct lm87_data *data = lm87_update_device(dev); \ | 235 | struct lm87_data *data = lm87_update_device(dev); \ |
236 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ | 236 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ |
@@ -274,13 +274,13 @@ static void set_in_max(struct device *dev, const char *buf, int nr) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | #define set_in(offset) \ | 276 | #define set_in(offset) \ |
277 | static ssize_t set_in##offset##_min(struct device *dev, \ | 277 | static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, \ |
278 | const char *buf, size_t count) \ | 278 | const char *buf, size_t count) \ |
279 | { \ | 279 | { \ |
280 | set_in_min(dev, buf, offset); \ | 280 | set_in_min(dev, buf, offset); \ |
281 | return count; \ | 281 | return count; \ |
282 | } \ | 282 | } \ |
283 | static ssize_t set_in##offset##_max(struct device *dev, \ | 283 | static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, \ |
284 | const char *buf, size_t count) \ | 284 | const char *buf, size_t count) \ |
285 | { \ | 285 | { \ |
286 | set_in_max(dev, buf, offset); \ | 286 | set_in_max(dev, buf, offset); \ |
@@ -300,17 +300,17 @@ set_in(6); | |||
300 | set_in(7); | 300 | set_in(7); |
301 | 301 | ||
302 | #define show_temp(offset) \ | 302 | #define show_temp(offset) \ |
303 | static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ | 303 | static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
304 | { \ | 304 | { \ |
305 | struct lm87_data *data = lm87_update_device(dev); \ | 305 | struct lm87_data *data = lm87_update_device(dev); \ |
306 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ | 306 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ |
307 | } \ | 307 | } \ |
308 | static ssize_t show_temp##offset##_low(struct device *dev, char *buf) \ | 308 | static ssize_t show_temp##offset##_low(struct device *dev, struct device_attribute *attr, char *buf) \ |
309 | { \ | 309 | { \ |
310 | struct lm87_data *data = lm87_update_device(dev); \ | 310 | struct lm87_data *data = lm87_update_device(dev); \ |
311 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[offset-1])); \ | 311 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_low[offset-1])); \ |
312 | } \ | 312 | } \ |
313 | static ssize_t show_temp##offset##_high(struct device *dev, char *buf) \ | 313 | static ssize_t show_temp##offset##_high(struct device *dev, struct device_attribute *attr, char *buf) \ |
314 | { \ | 314 | { \ |
315 | struct lm87_data *data = lm87_update_device(dev); \ | 315 | struct lm87_data *data = lm87_update_device(dev); \ |
316 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[offset-1])); \ | 316 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_high[offset-1])); \ |
@@ -346,13 +346,13 @@ static void set_temp_high(struct device *dev, const char *buf, int nr) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | #define set_temp(offset) \ | 348 | #define set_temp(offset) \ |
349 | static ssize_t set_temp##offset##_low(struct device *dev, \ | 349 | static ssize_t set_temp##offset##_low(struct device *dev, struct device_attribute *attr, \ |
350 | const char *buf, size_t count) \ | 350 | const char *buf, size_t count) \ |
351 | { \ | 351 | { \ |
352 | set_temp_low(dev, buf, offset-1); \ | 352 | set_temp_low(dev, buf, offset-1); \ |
353 | return count; \ | 353 | return count; \ |
354 | } \ | 354 | } \ |
355 | static ssize_t set_temp##offset##_high(struct device *dev, \ | 355 | static ssize_t set_temp##offset##_high(struct device *dev, struct device_attribute *attr, \ |
356 | const char *buf, size_t count) \ | 356 | const char *buf, size_t count) \ |
357 | { \ | 357 | { \ |
358 | set_temp_high(dev, buf, offset-1); \ | 358 | set_temp_high(dev, buf, offset-1); \ |
@@ -366,13 +366,13 @@ set_temp(1); | |||
366 | set_temp(2); | 366 | set_temp(2); |
367 | set_temp(3); | 367 | set_temp(3); |
368 | 368 | ||
369 | static ssize_t show_temp_crit_int(struct device *dev, char *buf) | 369 | static ssize_t show_temp_crit_int(struct device *dev, struct device_attribute *attr, char *buf) |
370 | { | 370 | { |
371 | struct lm87_data *data = lm87_update_device(dev); | 371 | struct lm87_data *data = lm87_update_device(dev); |
372 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_int)); | 372 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_int)); |
373 | } | 373 | } |
374 | 374 | ||
375 | static ssize_t show_temp_crit_ext(struct device *dev, char *buf) | 375 | static ssize_t show_temp_crit_ext(struct device *dev, struct device_attribute *attr, char *buf) |
376 | { | 376 | { |
377 | struct lm87_data *data = lm87_update_device(dev); | 377 | struct lm87_data *data = lm87_update_device(dev); |
378 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_ext)); | 378 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit_ext)); |
@@ -383,19 +383,19 @@ static DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit_ext, NULL); | |||
383 | static DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit_ext, NULL); | 383 | static DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit_ext, NULL); |
384 | 384 | ||
385 | #define show_fan(offset) \ | 385 | #define show_fan(offset) \ |
386 | static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ | 386 | static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
387 | { \ | 387 | { \ |
388 | struct lm87_data *data = lm87_update_device(dev); \ | 388 | struct lm87_data *data = lm87_update_device(dev); \ |
389 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[offset-1], \ | 389 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[offset-1], \ |
390 | FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ | 390 | FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ |
391 | } \ | 391 | } \ |
392 | static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ | 392 | static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
393 | { \ | 393 | { \ |
394 | struct lm87_data *data = lm87_update_device(dev); \ | 394 | struct lm87_data *data = lm87_update_device(dev); \ |
395 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[offset-1], \ | 395 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[offset-1], \ |
396 | FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ | 396 | FAN_DIV_FROM_REG(data->fan_div[offset-1]))); \ |
397 | } \ | 397 | } \ |
398 | static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ | 398 | static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ |
399 | { \ | 399 | { \ |
400 | struct lm87_data *data = lm87_update_device(dev); \ | 400 | struct lm87_data *data = lm87_update_device(dev); \ |
401 | return sprintf(buf, "%d\n", FAN_DIV_FROM_REG(data->fan_div[offset-1])); \ | 401 | return sprintf(buf, "%d\n", FAN_DIV_FROM_REG(data->fan_div[offset-1])); \ |
@@ -465,13 +465,13 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
465 | } | 465 | } |
466 | 466 | ||
467 | #define set_fan(offset) \ | 467 | #define set_fan(offset) \ |
468 | static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ | 468 | static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
469 | size_t count) \ | 469 | size_t count) \ |
470 | { \ | 470 | { \ |
471 | set_fan_min(dev, buf, offset-1); \ | 471 | set_fan_min(dev, buf, offset-1); \ |
472 | return count; \ | 472 | return count; \ |
473 | } \ | 473 | } \ |
474 | static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ | 474 | static ssize_t set_fan##offset##_div(struct device *dev, struct device_attribute *attr, const char *buf, \ |
475 | size_t count) \ | 475 | size_t count) \ |
476 | { \ | 476 | { \ |
477 | return set_fan_div(dev, buf, count, offset-1); \ | 477 | return set_fan_div(dev, buf, count, offset-1); \ |
@@ -483,26 +483,26 @@ static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | |||
483 | set_fan(1); | 483 | set_fan(1); |
484 | set_fan(2); | 484 | set_fan(2); |
485 | 485 | ||
486 | static ssize_t show_alarms(struct device *dev, char *buf) | 486 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
487 | { | 487 | { |
488 | struct lm87_data *data = lm87_update_device(dev); | 488 | struct lm87_data *data = lm87_update_device(dev); |
489 | return sprintf(buf, "%d\n", data->alarms); | 489 | return sprintf(buf, "%d\n", data->alarms); |
490 | } | 490 | } |
491 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 491 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
492 | 492 | ||
493 | static ssize_t show_vid(struct device *dev, char *buf) | 493 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
494 | { | 494 | { |
495 | struct lm87_data *data = lm87_update_device(dev); | 495 | struct lm87_data *data = lm87_update_device(dev); |
496 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); | 496 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); |
497 | } | 497 | } |
498 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 498 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
499 | 499 | ||
500 | static ssize_t show_vrm(struct device *dev, char *buf) | 500 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
501 | { | 501 | { |
502 | struct lm87_data *data = lm87_update_device(dev); | 502 | struct lm87_data *data = lm87_update_device(dev); |
503 | return sprintf(buf, "%d\n", data->vrm); | 503 | return sprintf(buf, "%d\n", data->vrm); |
504 | } | 504 | } |
505 | static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | 505 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
506 | { | 506 | { |
507 | struct i2c_client *client = to_i2c_client(dev); | 507 | struct i2c_client *client = to_i2c_client(dev); |
508 | struct lm87_data *data = i2c_get_clientdata(client); | 508 | struct lm87_data *data = i2c_get_clientdata(client); |
@@ -511,12 +511,12 @@ static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | |||
511 | } | 511 | } |
512 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | 512 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); |
513 | 513 | ||
514 | static ssize_t show_aout(struct device *dev, char *buf) | 514 | static ssize_t show_aout(struct device *dev, struct device_attribute *attr, char *buf) |
515 | { | 515 | { |
516 | struct lm87_data *data = lm87_update_device(dev); | 516 | struct lm87_data *data = lm87_update_device(dev); |
517 | return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout)); | 517 | return sprintf(buf, "%d\n", AOUT_FROM_REG(data->aout)); |
518 | } | 518 | } |
519 | static ssize_t set_aout(struct device *dev, const char *buf, size_t count) | 519 | static ssize_t set_aout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
520 | { | 520 | { |
521 | struct i2c_client *client = to_i2c_client(dev); | 521 | struct i2c_client *client = to_i2c_client(dev); |
522 | struct lm87_data *data = i2c_get_clientdata(client); | 522 | struct lm87_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c index 2c00ff83babc..9b127a07f56b 100644 --- a/drivers/i2c/chips/lm90.c +++ b/drivers/i2c/chips/lm90.c | |||
@@ -218,7 +218,7 @@ struct lm90_data { | |||
218 | */ | 218 | */ |
219 | 219 | ||
220 | #define show_temp(value, converter) \ | 220 | #define show_temp(value, converter) \ |
221 | static ssize_t show_##value(struct device *dev, char *buf) \ | 221 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
222 | { \ | 222 | { \ |
223 | struct lm90_data *data = lm90_update_device(dev); \ | 223 | struct lm90_data *data = lm90_update_device(dev); \ |
224 | return sprintf(buf, "%d\n", converter(data->value)); \ | 224 | return sprintf(buf, "%d\n", converter(data->value)); \ |
@@ -233,7 +233,7 @@ show_temp(temp_crit1, TEMP1_FROM_REG); | |||
233 | show_temp(temp_crit2, TEMP1_FROM_REG); | 233 | show_temp(temp_crit2, TEMP1_FROM_REG); |
234 | 234 | ||
235 | #define set_temp1(value, reg) \ | 235 | #define set_temp1(value, reg) \ |
236 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 236 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
237 | size_t count) \ | 237 | size_t count) \ |
238 | { \ | 238 | { \ |
239 | struct i2c_client *client = to_i2c_client(dev); \ | 239 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -250,7 +250,7 @@ static ssize_t set_##value(struct device *dev, const char *buf, \ | |||
250 | return count; \ | 250 | return count; \ |
251 | } | 251 | } |
252 | #define set_temp2(value, regh, regl) \ | 252 | #define set_temp2(value, regh, regl) \ |
253 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 253 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
254 | size_t count) \ | 254 | size_t count) \ |
255 | { \ | 255 | { \ |
256 | struct i2c_client *client = to_i2c_client(dev); \ | 256 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -275,7 +275,7 @@ set_temp1(temp_crit1, LM90_REG_W_LOCAL_CRIT); | |||
275 | set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT); | 275 | set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT); |
276 | 276 | ||
277 | #define show_temp_hyst(value, basereg) \ | 277 | #define show_temp_hyst(value, basereg) \ |
278 | static ssize_t show_##value(struct device *dev, char *buf) \ | 278 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
279 | { \ | 279 | { \ |
280 | struct lm90_data *data = lm90_update_device(dev); \ | 280 | struct lm90_data *data = lm90_update_device(dev); \ |
281 | return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->basereg) \ | 281 | return sprintf(buf, "%d\n", TEMP1_FROM_REG(data->basereg) \ |
@@ -284,7 +284,7 @@ static ssize_t show_##value(struct device *dev, char *buf) \ | |||
284 | show_temp_hyst(temp_hyst1, temp_crit1); | 284 | show_temp_hyst(temp_hyst1, temp_crit1); |
285 | show_temp_hyst(temp_hyst2, temp_crit2); | 285 | show_temp_hyst(temp_hyst2, temp_crit2); |
286 | 286 | ||
287 | static ssize_t set_temp_hyst1(struct device *dev, const char *buf, | 287 | static ssize_t set_temp_hyst1(struct device *dev, struct device_attribute *attr, const char *buf, |
288 | size_t count) | 288 | size_t count) |
289 | { | 289 | { |
290 | struct i2c_client *client = to_i2c_client(dev); | 290 | struct i2c_client *client = to_i2c_client(dev); |
@@ -300,7 +300,7 @@ static ssize_t set_temp_hyst1(struct device *dev, const char *buf, | |||
300 | return count; | 300 | return count; |
301 | } | 301 | } |
302 | 302 | ||
303 | static ssize_t show_alarms(struct device *dev, char *buf) | 303 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
304 | { | 304 | { |
305 | struct lm90_data *data = lm90_update_device(dev); | 305 | struct lm90_data *data = lm90_update_device(dev); |
306 | return sprintf(buf, "%d\n", data->alarms); | 306 | return sprintf(buf, "%d\n", data->alarms); |
diff --git a/drivers/i2c/chips/lm92.c b/drivers/i2c/chips/lm92.c index fe6e83d70a72..215c8e40ffdd 100644 --- a/drivers/i2c/chips/lm92.c +++ b/drivers/i2c/chips/lm92.c | |||
@@ -140,7 +140,7 @@ static struct lm92_data *lm92_update_device(struct device *dev) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | #define show_temp(value) \ | 142 | #define show_temp(value) \ |
143 | static ssize_t show_##value(struct device *dev, char *buf) \ | 143 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
144 | { \ | 144 | { \ |
145 | struct lm92_data *data = lm92_update_device(dev); \ | 145 | struct lm92_data *data = lm92_update_device(dev); \ |
146 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ | 146 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ |
@@ -151,7 +151,7 @@ show_temp(temp1_min); | |||
151 | show_temp(temp1_max); | 151 | show_temp(temp1_max); |
152 | 152 | ||
153 | #define set_temp(value, reg) \ | 153 | #define set_temp(value, reg) \ |
154 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 154 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
155 | size_t count) \ | 155 | size_t count) \ |
156 | { \ | 156 | { \ |
157 | struct i2c_client *client = to_i2c_client(dev); \ | 157 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -168,26 +168,26 @@ set_temp(temp1_crit, LM92_REG_TEMP_CRIT); | |||
168 | set_temp(temp1_min, LM92_REG_TEMP_LOW); | 168 | set_temp(temp1_min, LM92_REG_TEMP_LOW); |
169 | set_temp(temp1_max, LM92_REG_TEMP_HIGH); | 169 | set_temp(temp1_max, LM92_REG_TEMP_HIGH); |
170 | 170 | ||
171 | static ssize_t show_temp1_crit_hyst(struct device *dev, char *buf) | 171 | static ssize_t show_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
172 | { | 172 | { |
173 | struct lm92_data *data = lm92_update_device(dev); | 173 | struct lm92_data *data = lm92_update_device(dev); |
174 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_crit) | 174 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_crit) |
175 | - TEMP_FROM_REG(data->temp1_hyst)); | 175 | - TEMP_FROM_REG(data->temp1_hyst)); |
176 | } | 176 | } |
177 | static ssize_t show_temp1_max_hyst(struct device *dev, char *buf) | 177 | static ssize_t show_temp1_max_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
178 | { | 178 | { |
179 | struct lm92_data *data = lm92_update_device(dev); | 179 | struct lm92_data *data = lm92_update_device(dev); |
180 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_max) | 180 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_max) |
181 | - TEMP_FROM_REG(data->temp1_hyst)); | 181 | - TEMP_FROM_REG(data->temp1_hyst)); |
182 | } | 182 | } |
183 | static ssize_t show_temp1_min_hyst(struct device *dev, char *buf) | 183 | static ssize_t show_temp1_min_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
184 | { | 184 | { |
185 | struct lm92_data *data = lm92_update_device(dev); | 185 | struct lm92_data *data = lm92_update_device(dev); |
186 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_min) | 186 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp1_min) |
187 | + TEMP_FROM_REG(data->temp1_hyst)); | 187 | + TEMP_FROM_REG(data->temp1_hyst)); |
188 | } | 188 | } |
189 | 189 | ||
190 | static ssize_t set_temp1_crit_hyst(struct device *dev, const char *buf, | 190 | static ssize_t set_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, |
191 | size_t count) | 191 | size_t count) |
192 | { | 192 | { |
193 | struct i2c_client *client = to_i2c_client(dev); | 193 | struct i2c_client *client = to_i2c_client(dev); |
@@ -202,7 +202,7 @@ static ssize_t set_temp1_crit_hyst(struct device *dev, const char *buf, | |||
202 | return count; | 202 | return count; |
203 | } | 203 | } |
204 | 204 | ||
205 | static ssize_t show_alarms(struct device *dev, char *buf) | 205 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
206 | { | 206 | { |
207 | struct lm92_data *data = lm92_update_device(dev); | 207 | struct lm92_data *data = lm92_update_device(dev); |
208 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); | 208 | return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->temp1_input)); |
diff --git a/drivers/i2c/chips/max1619.c b/drivers/i2c/chips/max1619.c index 5afa961a5e10..30a196155fd9 100644 --- a/drivers/i2c/chips/max1619.c +++ b/drivers/i2c/chips/max1619.c | |||
@@ -122,7 +122,7 @@ struct max1619_data { | |||
122 | */ | 122 | */ |
123 | 123 | ||
124 | #define show_temp(value) \ | 124 | #define show_temp(value) \ |
125 | static ssize_t show_##value(struct device *dev, char *buf) \ | 125 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
126 | { \ | 126 | { \ |
127 | struct max1619_data *data = max1619_update_device(dev); \ | 127 | struct max1619_data *data = max1619_update_device(dev); \ |
128 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ | 128 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \ |
@@ -135,7 +135,7 @@ show_temp(temp_crit2); | |||
135 | show_temp(temp_hyst2); | 135 | show_temp(temp_hyst2); |
136 | 136 | ||
137 | #define set_temp2(value, reg) \ | 137 | #define set_temp2(value, reg) \ |
138 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 138 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
139 | size_t count) \ | 139 | size_t count) \ |
140 | { \ | 140 | { \ |
141 | struct i2c_client *client = to_i2c_client(dev); \ | 141 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -154,7 +154,7 @@ set_temp2(temp_high2, MAX1619_REG_W_REMOTE_HIGH); | |||
154 | set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT); | 154 | set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT); |
155 | set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST); | 155 | set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST); |
156 | 156 | ||
157 | static ssize_t show_alarms(struct device *dev, char *buf) | 157 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
158 | { | 158 | { |
159 | struct max1619_data *data = max1619_update_device(dev); | 159 | struct max1619_data *data = max1619_update_device(dev); |
160 | return sprintf(buf, "%d\n", data->alarms); | 160 | return sprintf(buf, "%d\n", data->alarms); |
diff --git a/drivers/i2c/chips/pc87360.c b/drivers/i2c/chips/pc87360.c index 6d94c36c9218..65637b2cd170 100644 --- a/drivers/i2c/chips/pc87360.c +++ b/drivers/i2c/chips/pc87360.c | |||
@@ -282,31 +282,31 @@ static ssize_t set_fan_min(struct device *dev, const char *buf, | |||
282 | } | 282 | } |
283 | 283 | ||
284 | #define show_and_set_fan(offset) \ | 284 | #define show_and_set_fan(offset) \ |
285 | static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ | 285 | static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
286 | { \ | 286 | { \ |
287 | struct pc87360_data *data = pc87360_update_device(dev); \ | 287 | struct pc87360_data *data = pc87360_update_device(dev); \ |
288 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \ | 288 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \ |
289 | FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ | 289 | FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ |
290 | } \ | 290 | } \ |
291 | static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ | 291 | static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
292 | { \ | 292 | { \ |
293 | struct pc87360_data *data = pc87360_update_device(dev); \ | 293 | struct pc87360_data *data = pc87360_update_device(dev); \ |
294 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \ | 294 | return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \ |
295 | FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ | 295 | FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ |
296 | } \ | 296 | } \ |
297 | static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ | 297 | static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \ |
298 | { \ | 298 | { \ |
299 | struct pc87360_data *data = pc87360_update_device(dev); \ | 299 | struct pc87360_data *data = pc87360_update_device(dev); \ |
300 | return sprintf(buf, "%u\n", \ | 300 | return sprintf(buf, "%u\n", \ |
301 | FAN_DIV_FROM_REG(data->fan_status[offset-1])); \ | 301 | FAN_DIV_FROM_REG(data->fan_status[offset-1])); \ |
302 | } \ | 302 | } \ |
303 | static ssize_t show_fan##offset##_status(struct device *dev, char *buf) \ | 303 | static ssize_t show_fan##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ |
304 | { \ | 304 | { \ |
305 | struct pc87360_data *data = pc87360_update_device(dev); \ | 305 | struct pc87360_data *data = pc87360_update_device(dev); \ |
306 | return sprintf(buf, "%u\n", \ | 306 | return sprintf(buf, "%u\n", \ |
307 | FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \ | 307 | FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \ |
308 | } \ | 308 | } \ |
309 | static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ | 309 | static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
310 | size_t count) \ | 310 | size_t count) \ |
311 | { \ | 311 | { \ |
312 | return set_fan_min(dev, buf, count, offset-1); \ | 312 | return set_fan_min(dev, buf, count, offset-1); \ |
@@ -324,7 +324,7 @@ show_and_set_fan(2) | |||
324 | show_and_set_fan(3) | 324 | show_and_set_fan(3) |
325 | 325 | ||
326 | #define show_and_set_pwm(offset) \ | 326 | #define show_and_set_pwm(offset) \ |
327 | static ssize_t show_pwm##offset(struct device *dev, char *buf) \ | 327 | static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *attr, char *buf) \ |
328 | { \ | 328 | { \ |
329 | struct pc87360_data *data = pc87360_update_device(dev); \ | 329 | struct pc87360_data *data = pc87360_update_device(dev); \ |
330 | return sprintf(buf, "%u\n", \ | 330 | return sprintf(buf, "%u\n", \ |
@@ -332,7 +332,7 @@ static ssize_t show_pwm##offset(struct device *dev, char *buf) \ | |||
332 | FAN_CONFIG_INVERT(data->fan_conf, \ | 332 | FAN_CONFIG_INVERT(data->fan_conf, \ |
333 | offset-1))); \ | 333 | offset-1))); \ |
334 | } \ | 334 | } \ |
335 | static ssize_t set_pwm##offset(struct device *dev, const char *buf, \ | 335 | static ssize_t set_pwm##offset(struct device *dev, struct device_attribute *attr, const char *buf, \ |
336 | size_t count) \ | 336 | size_t count) \ |
337 | { \ | 337 | { \ |
338 | struct i2c_client *client = to_i2c_client(dev); \ | 338 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -354,30 +354,30 @@ show_and_set_pwm(2) | |||
354 | show_and_set_pwm(3) | 354 | show_and_set_pwm(3) |
355 | 355 | ||
356 | #define show_and_set_in(offset) \ | 356 | #define show_and_set_in(offset) \ |
357 | static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ | 357 | static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
358 | { \ | 358 | { \ |
359 | struct pc87360_data *data = pc87360_update_device(dev); \ | 359 | struct pc87360_data *data = pc87360_update_device(dev); \ |
360 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ | 360 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ |
361 | data->in_vref)); \ | 361 | data->in_vref)); \ |
362 | } \ | 362 | } \ |
363 | static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ | 363 | static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
364 | { \ | 364 | { \ |
365 | struct pc87360_data *data = pc87360_update_device(dev); \ | 365 | struct pc87360_data *data = pc87360_update_device(dev); \ |
366 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ | 366 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ |
367 | data->in_vref)); \ | 367 | data->in_vref)); \ |
368 | } \ | 368 | } \ |
369 | static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ | 369 | static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
370 | { \ | 370 | { \ |
371 | struct pc87360_data *data = pc87360_update_device(dev); \ | 371 | struct pc87360_data *data = pc87360_update_device(dev); \ |
372 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ | 372 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ |
373 | data->in_vref)); \ | 373 | data->in_vref)); \ |
374 | } \ | 374 | } \ |
375 | static ssize_t show_in##offset##_status(struct device *dev, char *buf) \ | 375 | static ssize_t show_in##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ |
376 | { \ | 376 | { \ |
377 | struct pc87360_data *data = pc87360_update_device(dev); \ | 377 | struct pc87360_data *data = pc87360_update_device(dev); \ |
378 | return sprintf(buf, "%u\n", data->in_status[offset]); \ | 378 | return sprintf(buf, "%u\n", data->in_status[offset]); \ |
379 | } \ | 379 | } \ |
380 | static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ | 380 | static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
381 | size_t count) \ | 381 | size_t count) \ |
382 | { \ | 382 | { \ |
383 | struct i2c_client *client = to_i2c_client(dev); \ | 383 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -391,7 +391,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ | |||
391 | up(&data->update_lock); \ | 391 | up(&data->update_lock); \ |
392 | return count; \ | 392 | return count; \ |
393 | } \ | 393 | } \ |
394 | static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ | 394 | static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ |
395 | size_t count) \ | 395 | size_t count) \ |
396 | { \ | 396 | { \ |
397 | struct i2c_client *client = to_i2c_client(dev); \ | 397 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -427,36 +427,36 @@ show_and_set_in(9) | |||
427 | show_and_set_in(10) | 427 | show_and_set_in(10) |
428 | 428 | ||
429 | #define show_and_set_therm(offset) \ | 429 | #define show_and_set_therm(offset) \ |
430 | static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ | 430 | static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
431 | { \ | 431 | { \ |
432 | struct pc87360_data *data = pc87360_update_device(dev); \ | 432 | struct pc87360_data *data = pc87360_update_device(dev); \ |
433 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \ | 433 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \ |
434 | data->in_vref)); \ | 434 | data->in_vref)); \ |
435 | } \ | 435 | } \ |
436 | static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ | 436 | static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
437 | { \ | 437 | { \ |
438 | struct pc87360_data *data = pc87360_update_device(dev); \ | 438 | struct pc87360_data *data = pc87360_update_device(dev); \ |
439 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \ | 439 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \ |
440 | data->in_vref)); \ | 440 | data->in_vref)); \ |
441 | } \ | 441 | } \ |
442 | static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ | 442 | static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
443 | { \ | 443 | { \ |
444 | struct pc87360_data *data = pc87360_update_device(dev); \ | 444 | struct pc87360_data *data = pc87360_update_device(dev); \ |
445 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \ | 445 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \ |
446 | data->in_vref)); \ | 446 | data->in_vref)); \ |
447 | } \ | 447 | } \ |
448 | static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ | 448 | static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \ |
449 | { \ | 449 | { \ |
450 | struct pc87360_data *data = pc87360_update_device(dev); \ | 450 | struct pc87360_data *data = pc87360_update_device(dev); \ |
451 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \ | 451 | return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \ |
452 | data->in_vref)); \ | 452 | data->in_vref)); \ |
453 | } \ | 453 | } \ |
454 | static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ | 454 | static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ |
455 | { \ | 455 | { \ |
456 | struct pc87360_data *data = pc87360_update_device(dev); \ | 456 | struct pc87360_data *data = pc87360_update_device(dev); \ |
457 | return sprintf(buf, "%u\n", data->in_status[offset+7]); \ | 457 | return sprintf(buf, "%u\n", data->in_status[offset+7]); \ |
458 | } \ | 458 | } \ |
459 | static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | 459 | static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
460 | size_t count) \ | 460 | size_t count) \ |
461 | { \ | 461 | { \ |
462 | struct i2c_client *client = to_i2c_client(dev); \ | 462 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -470,7 +470,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | |||
470 | up(&data->update_lock); \ | 470 | up(&data->update_lock); \ |
471 | return count; \ | 471 | return count; \ |
472 | } \ | 472 | } \ |
473 | static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ | 473 | static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ |
474 | size_t count) \ | 474 | size_t count) \ |
475 | { \ | 475 | { \ |
476 | struct i2c_client *client = to_i2c_client(dev); \ | 476 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -484,7 +484,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ | |||
484 | up(&data->update_lock); \ | 484 | up(&data->update_lock); \ |
485 | return count; \ | 485 | return count; \ |
486 | } \ | 486 | } \ |
487 | static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ | 487 | static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \ |
488 | size_t count) \ | 488 | size_t count) \ |
489 | { \ | 489 | { \ |
490 | struct i2c_client *client = to_i2c_client(dev); \ | 490 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -512,19 +512,19 @@ show_and_set_therm(4) | |||
512 | show_and_set_therm(5) | 512 | show_and_set_therm(5) |
513 | show_and_set_therm(6) | 513 | show_and_set_therm(6) |
514 | 514 | ||
515 | static ssize_t show_vid(struct device *dev, char *buf) | 515 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
516 | { | 516 | { |
517 | struct pc87360_data *data = pc87360_update_device(dev); | 517 | struct pc87360_data *data = pc87360_update_device(dev); |
518 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); | 518 | return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); |
519 | } | 519 | } |
520 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 520 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
521 | 521 | ||
522 | static ssize_t show_vrm(struct device *dev, char *buf) | 522 | static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) |
523 | { | 523 | { |
524 | struct pc87360_data *data = pc87360_update_device(dev); | 524 | struct pc87360_data *data = pc87360_update_device(dev); |
525 | return sprintf(buf, "%u\n", data->vrm); | 525 | return sprintf(buf, "%u\n", data->vrm); |
526 | } | 526 | } |
527 | static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | 527 | static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
528 | { | 528 | { |
529 | struct i2c_client *client = to_i2c_client(dev); | 529 | struct i2c_client *client = to_i2c_client(dev); |
530 | struct pc87360_data *data = i2c_get_clientdata(client); | 530 | struct pc87360_data *data = i2c_get_clientdata(client); |
@@ -533,7 +533,7 @@ static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) | |||
533 | } | 533 | } |
534 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | 534 | static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); |
535 | 535 | ||
536 | static ssize_t show_in_alarms(struct device *dev, char *buf) | 536 | static ssize_t show_in_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
537 | { | 537 | { |
538 | struct pc87360_data *data = pc87360_update_device(dev); | 538 | struct pc87360_data *data = pc87360_update_device(dev); |
539 | return sprintf(buf, "%u\n", data->in_alarms); | 539 | return sprintf(buf, "%u\n", data->in_alarms); |
@@ -541,32 +541,32 @@ static ssize_t show_in_alarms(struct device *dev, char *buf) | |||
541 | static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); | 541 | static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); |
542 | 542 | ||
543 | #define show_and_set_temp(offset) \ | 543 | #define show_and_set_temp(offset) \ |
544 | static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ | 544 | static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
545 | { \ | 545 | { \ |
546 | struct pc87360_data *data = pc87360_update_device(dev); \ | 546 | struct pc87360_data *data = pc87360_update_device(dev); \ |
547 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ | 547 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ |
548 | } \ | 548 | } \ |
549 | static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ | 549 | static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ |
550 | { \ | 550 | { \ |
551 | struct pc87360_data *data = pc87360_update_device(dev); \ | 551 | struct pc87360_data *data = pc87360_update_device(dev); \ |
552 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ | 552 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ |
553 | } \ | 553 | } \ |
554 | static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ | 554 | static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \ |
555 | { \ | 555 | { \ |
556 | struct pc87360_data *data = pc87360_update_device(dev); \ | 556 | struct pc87360_data *data = pc87360_update_device(dev); \ |
557 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ | 557 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ |
558 | }\ | 558 | }\ |
559 | static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ | 559 | static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \ |
560 | { \ | 560 | { \ |
561 | struct pc87360_data *data = pc87360_update_device(dev); \ | 561 | struct pc87360_data *data = pc87360_update_device(dev); \ |
562 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \ | 562 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \ |
563 | }\ | 563 | }\ |
564 | static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ | 564 | static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \ |
565 | { \ | 565 | { \ |
566 | struct pc87360_data *data = pc87360_update_device(dev); \ | 566 | struct pc87360_data *data = pc87360_update_device(dev); \ |
567 | return sprintf(buf, "%d\n", data->temp_status[offset-1]); \ | 567 | return sprintf(buf, "%d\n", data->temp_status[offset-1]); \ |
568 | }\ | 568 | }\ |
569 | static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | 569 | static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \ |
570 | size_t count) \ | 570 | size_t count) \ |
571 | { \ | 571 | { \ |
572 | struct i2c_client *client = to_i2c_client(dev); \ | 572 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -580,7 +580,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ | |||
580 | up(&data->update_lock); \ | 580 | up(&data->update_lock); \ |
581 | return count; \ | 581 | return count; \ |
582 | } \ | 582 | } \ |
583 | static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ | 583 | static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \ |
584 | size_t count) \ | 584 | size_t count) \ |
585 | { \ | 585 | { \ |
586 | struct i2c_client *client = to_i2c_client(dev); \ | 586 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -594,7 +594,7 @@ static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ | |||
594 | up(&data->update_lock); \ | 594 | up(&data->update_lock); \ |
595 | return count; \ | 595 | return count; \ |
596 | } \ | 596 | } \ |
597 | static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ | 597 | static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \ |
598 | size_t count) \ | 598 | size_t count) \ |
599 | { \ | 599 | { \ |
600 | struct i2c_client *client = to_i2c_client(dev); \ | 600 | struct i2c_client *client = to_i2c_client(dev); \ |
@@ -622,7 +622,7 @@ show_and_set_temp(1) | |||
622 | show_and_set_temp(2) | 622 | show_and_set_temp(2) |
623 | show_and_set_temp(3) | 623 | show_and_set_temp(3) |
624 | 624 | ||
625 | static ssize_t show_temp_alarms(struct device *dev, char *buf) | 625 | static ssize_t show_temp_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
626 | { | 626 | { |
627 | struct pc87360_data *data = pc87360_update_device(dev); | 627 | struct pc87360_data *data = pc87360_update_device(dev); |
628 | return sprintf(buf, "%u\n", data->temp_alarms); | 628 | return sprintf(buf, "%u\n", data->temp_alarms); |
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 48b4e22eaffe..4956e9effd75 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c | |||
@@ -76,7 +76,7 @@ static struct i2c_driver pcf8574_driver = { | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | /* following are the sysfs callback functions */ | 78 | /* following are the sysfs callback functions */ |
79 | static ssize_t show_read(struct device *dev, char *buf) | 79 | static ssize_t show_read(struct device *dev, struct device_attribute *attr, char *buf) |
80 | { | 80 | { |
81 | struct i2c_client *client = to_i2c_client(dev); | 81 | struct i2c_client *client = to_i2c_client(dev); |
82 | struct pcf8574_data *data = i2c_get_clientdata(client); | 82 | struct pcf8574_data *data = i2c_get_clientdata(client); |
@@ -86,13 +86,13 @@ static ssize_t show_read(struct device *dev, char *buf) | |||
86 | 86 | ||
87 | static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); | 87 | static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); |
88 | 88 | ||
89 | static ssize_t show_write(struct device *dev, char *buf) | 89 | static ssize_t show_write(struct device *dev, struct device_attribute *attr, char *buf) |
90 | { | 90 | { |
91 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); | 91 | struct pcf8574_data *data = i2c_get_clientdata(to_i2c_client(dev)); |
92 | return sprintf(buf, "%u\n", data->write); | 92 | return sprintf(buf, "%u\n", data->write); |
93 | } | 93 | } |
94 | 94 | ||
95 | static ssize_t set_write(struct device *dev, const char *buf, | 95 | static ssize_t set_write(struct device *dev, struct device_attribute *attr, const char *buf, |
96 | size_t count) | 96 | size_t count) |
97 | { | 97 | { |
98 | struct i2c_client *client = to_i2c_client(dev); | 98 | struct i2c_client *client = to_i2c_client(dev); |
diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index b6b927d8b372..db812ade8564 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c | |||
@@ -100,7 +100,7 @@ static struct i2c_driver pcf8591_driver = { | |||
100 | 100 | ||
101 | /* following are the sysfs callback functions */ | 101 | /* following are the sysfs callback functions */ |
102 | #define show_in_channel(channel) \ | 102 | #define show_in_channel(channel) \ |
103 | static ssize_t show_in##channel##_input(struct device *dev, char *buf) \ | 103 | static ssize_t show_in##channel##_input(struct device *dev, struct device_attribute *attr, char *buf) \ |
104 | { \ | 104 | { \ |
105 | return sprintf(buf, "%d\n", pcf8591_read_channel(dev, channel));\ | 105 | return sprintf(buf, "%d\n", pcf8591_read_channel(dev, channel));\ |
106 | } \ | 106 | } \ |
@@ -112,13 +112,13 @@ show_in_channel(1); | |||
112 | show_in_channel(2); | 112 | show_in_channel(2); |
113 | show_in_channel(3); | 113 | show_in_channel(3); |
114 | 114 | ||
115 | static ssize_t show_out0_ouput(struct device *dev, char *buf) | 115 | static ssize_t show_out0_ouput(struct device *dev, struct device_attribute *attr, char *buf) |
116 | { | 116 | { |
117 | struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); | 117 | struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); |
118 | return sprintf(buf, "%d\n", data->aout * 10); | 118 | return sprintf(buf, "%d\n", data->aout * 10); |
119 | } | 119 | } |
120 | 120 | ||
121 | static ssize_t set_out0_output(struct device *dev, const char *buf, size_t count) | 121 | static ssize_t set_out0_output(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
122 | { | 122 | { |
123 | unsigned int value; | 123 | unsigned int value; |
124 | struct i2c_client *client = to_i2c_client(dev); | 124 | struct i2c_client *client = to_i2c_client(dev); |
@@ -134,13 +134,13 @@ static ssize_t set_out0_output(struct device *dev, const char *buf, size_t count | |||
134 | static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, | 134 | static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, |
135 | show_out0_ouput, set_out0_output); | 135 | show_out0_ouput, set_out0_output); |
136 | 136 | ||
137 | static ssize_t show_out0_enable(struct device *dev, char *buf) | 137 | static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf) |
138 | { | 138 | { |
139 | struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); | 139 | struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); |
140 | return sprintf(buf, "%u\n", !(!(data->control & PCF8591_CONTROL_AOEF))); | 140 | return sprintf(buf, "%u\n", !(!(data->control & PCF8591_CONTROL_AOEF))); |
141 | } | 141 | } |
142 | 142 | ||
143 | static ssize_t set_out0_enable(struct device *dev, const char *buf, size_t count) | 143 | static ssize_t set_out0_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
144 | { | 144 | { |
145 | struct i2c_client *client = to_i2c_client(dev); | 145 | struct i2c_client *client = to_i2c_client(dev); |
146 | struct pcf8591_data *data = i2c_get_clientdata(client); | 146 | struct pcf8591_data *data = i2c_get_clientdata(client); |
diff --git a/drivers/i2c/chips/sis5595.c b/drivers/i2c/chips/sis5595.c index 7ea84532df32..c6650727a27d 100644 --- a/drivers/i2c/chips/sis5595.c +++ b/drivers/i2c/chips/sis5595.c | |||
@@ -256,28 +256,28 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
256 | 256 | ||
257 | #define show_in_offset(offset) \ | 257 | #define show_in_offset(offset) \ |
258 | static ssize_t \ | 258 | static ssize_t \ |
259 | show_in##offset (struct device *dev, char *buf) \ | 259 | show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
260 | { \ | 260 | { \ |
261 | return show_in(dev, buf, offset); \ | 261 | return show_in(dev, buf, offset); \ |
262 | } \ | 262 | } \ |
263 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | 263 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
264 | show_in##offset, NULL); \ | 264 | show_in##offset, NULL); \ |
265 | static ssize_t \ | 265 | static ssize_t \ |
266 | show_in##offset##_min (struct device *dev, char *buf) \ | 266 | show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
267 | { \ | 267 | { \ |
268 | return show_in_min(dev, buf, offset); \ | 268 | return show_in_min(dev, buf, offset); \ |
269 | } \ | 269 | } \ |
270 | static ssize_t \ | 270 | static ssize_t \ |
271 | show_in##offset##_max (struct device *dev, char *buf) \ | 271 | show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
272 | { \ | 272 | { \ |
273 | return show_in_max(dev, buf, offset); \ | 273 | return show_in_max(dev, buf, offset); \ |
274 | } \ | 274 | } \ |
275 | static ssize_t set_in##offset##_min (struct device *dev, \ | 275 | static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ |
276 | const char *buf, size_t count) \ | 276 | const char *buf, size_t count) \ |
277 | { \ | 277 | { \ |
278 | return set_in_min(dev, buf, count, offset); \ | 278 | return set_in_min(dev, buf, count, offset); \ |
279 | } \ | 279 | } \ |
280 | static ssize_t set_in##offset##_max (struct device *dev, \ | 280 | static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ |
281 | const char *buf, size_t count) \ | 281 | const char *buf, size_t count) \ |
282 | { \ | 282 | { \ |
283 | return set_in_max(dev, buf, count, offset); \ | 283 | return set_in_max(dev, buf, count, offset); \ |
@@ -294,19 +294,19 @@ show_in_offset(3); | |||
294 | show_in_offset(4); | 294 | show_in_offset(4); |
295 | 295 | ||
296 | /* Temperature */ | 296 | /* Temperature */ |
297 | static ssize_t show_temp(struct device *dev, char *buf) | 297 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) |
298 | { | 298 | { |
299 | struct sis5595_data *data = sis5595_update_device(dev); | 299 | struct sis5595_data *data = sis5595_update_device(dev); |
300 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); | 300 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); |
301 | } | 301 | } |
302 | 302 | ||
303 | static ssize_t show_temp_over(struct device *dev, char *buf) | 303 | static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) |
304 | { | 304 | { |
305 | struct sis5595_data *data = sis5595_update_device(dev); | 305 | struct sis5595_data *data = sis5595_update_device(dev); |
306 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); | 306 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); |
307 | } | 307 | } |
308 | 308 | ||
309 | static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) | 309 | static ssize_t set_temp_over(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
310 | { | 310 | { |
311 | struct i2c_client *client = to_i2c_client(dev); | 311 | struct i2c_client *client = to_i2c_client(dev); |
312 | struct sis5595_data *data = i2c_get_clientdata(client); | 312 | struct sis5595_data *data = i2c_get_clientdata(client); |
@@ -319,13 +319,13 @@ static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) | |||
319 | return count; | 319 | return count; |
320 | } | 320 | } |
321 | 321 | ||
322 | static ssize_t show_temp_hyst(struct device *dev, char *buf) | 322 | static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *attr, char *buf) |
323 | { | 323 | { |
324 | struct sis5595_data *data = sis5595_update_device(dev); | 324 | struct sis5595_data *data = sis5595_update_device(dev); |
325 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); | 325 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst)); |
326 | } | 326 | } |
327 | 327 | ||
328 | static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) | 328 | static ssize_t set_temp_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
329 | { | 329 | { |
330 | struct i2c_client *client = to_i2c_client(dev); | 330 | struct i2c_client *client = to_i2c_client(dev); |
331 | struct sis5595_data *data = i2c_get_clientdata(client); | 331 | struct sis5595_data *data = i2c_get_clientdata(client); |
@@ -426,19 +426,19 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
426 | } | 426 | } |
427 | 427 | ||
428 | #define show_fan_offset(offset) \ | 428 | #define show_fan_offset(offset) \ |
429 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 429 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
430 | { \ | 430 | { \ |
431 | return show_fan(dev, buf, offset - 1); \ | 431 | return show_fan(dev, buf, offset - 1); \ |
432 | } \ | 432 | } \ |
433 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 433 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
434 | { \ | 434 | { \ |
435 | return show_fan_min(dev, buf, offset - 1); \ | 435 | return show_fan_min(dev, buf, offset - 1); \ |
436 | } \ | 436 | } \ |
437 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 437 | static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
438 | { \ | 438 | { \ |
439 | return show_fan_div(dev, buf, offset - 1); \ | 439 | return show_fan_div(dev, buf, offset - 1); \ |
440 | } \ | 440 | } \ |
441 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 441 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
442 | const char *buf, size_t count) \ | 442 | const char *buf, size_t count) \ |
443 | { \ | 443 | { \ |
444 | return set_fan_min(dev, buf, count, offset - 1); \ | 444 | return set_fan_min(dev, buf, count, offset - 1); \ |
@@ -450,13 +450,13 @@ static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | |||
450 | show_fan_offset(1); | 450 | show_fan_offset(1); |
451 | show_fan_offset(2); | 451 | show_fan_offset(2); |
452 | 452 | ||
453 | static ssize_t set_fan_1_div(struct device *dev, const char *buf, | 453 | static ssize_t set_fan_1_div(struct device *dev, struct device_attribute *attr, const char *buf, |
454 | size_t count) | 454 | size_t count) |
455 | { | 455 | { |
456 | return set_fan_div(dev, buf, count, 0) ; | 456 | return set_fan_div(dev, buf, count, 0) ; |
457 | } | 457 | } |
458 | 458 | ||
459 | static ssize_t set_fan_2_div(struct device *dev, const char *buf, | 459 | static ssize_t set_fan_2_div(struct device *dev, struct device_attribute *attr, const char *buf, |
460 | size_t count) | 460 | size_t count) |
461 | { | 461 | { |
462 | return set_fan_div(dev, buf, count, 1) ; | 462 | return set_fan_div(dev, buf, count, 1) ; |
@@ -467,7 +467,7 @@ static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR, | |||
467 | show_fan_2_div, set_fan_2_div); | 467 | show_fan_2_div, set_fan_2_div); |
468 | 468 | ||
469 | /* Alarms */ | 469 | /* Alarms */ |
470 | static ssize_t show_alarms(struct device *dev, char *buf) | 470 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
471 | { | 471 | { |
472 | struct sis5595_data *data = sis5595_update_device(dev); | 472 | struct sis5595_data *data = sis5595_update_device(dev); |
473 | return sprintf(buf, "%d\n", data->alarms); | 473 | return sprintf(buf, "%d\n", data->alarms); |
diff --git a/drivers/i2c/chips/smsc47b397.c b/drivers/i2c/chips/smsc47b397.c index 1119c76791d9..251ac2659554 100644 --- a/drivers/i2c/chips/smsc47b397.c +++ b/drivers/i2c/chips/smsc47b397.c | |||
@@ -172,7 +172,7 @@ static ssize_t show_temp(struct device *dev, char *buf, int nr) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | #define sysfs_temp(num) \ | 174 | #define sysfs_temp(num) \ |
175 | static ssize_t show_temp##num(struct device *dev, char *buf) \ | 175 | static ssize_t show_temp##num(struct device *dev, struct device_attribute *attr, char *buf) \ |
176 | { \ | 176 | { \ |
177 | return show_temp(dev, buf, num-1); \ | 177 | return show_temp(dev, buf, num-1); \ |
178 | } \ | 178 | } \ |
@@ -201,7 +201,7 @@ static ssize_t show_fan(struct device *dev, char *buf, int nr) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | #define sysfs_fan(num) \ | 203 | #define sysfs_fan(num) \ |
204 | static ssize_t show_fan##num(struct device *dev, char *buf) \ | 204 | static ssize_t show_fan##num(struct device *dev, struct device_attribute *attr, char *buf) \ |
205 | { \ | 205 | { \ |
206 | return show_fan(dev, buf, num-1); \ | 206 | return show_fan(dev, buf, num-1); \ |
207 | } \ | 207 | } \ |
diff --git a/drivers/i2c/chips/smsc47m1.c b/drivers/i2c/chips/smsc47m1.c index 0e12ca369413..13d6d4a8bc7d 100644 --- a/drivers/i2c/chips/smsc47m1.c +++ b/drivers/i2c/chips/smsc47m1.c | |||
@@ -184,7 +184,7 @@ static ssize_t get_pwm_en(struct device *dev, char *buf, int nr) | |||
184 | return sprintf(buf, "%d\n", PWM_EN_FROM_REG(data->pwm[nr])); | 184 | return sprintf(buf, "%d\n", PWM_EN_FROM_REG(data->pwm[nr])); |
185 | } | 185 | } |
186 | 186 | ||
187 | static ssize_t get_alarms(struct device *dev, char *buf) | 187 | static ssize_t get_alarms(struct device *dev, struct device_attribute *attr, char *buf) |
188 | { | 188 | { |
189 | struct smsc47m1_data *data = smsc47m1_update_device(dev, 0); | 189 | struct smsc47m1_data *data = smsc47m1_update_device(dev, 0); |
190 | return sprintf(buf, "%d\n", data->alarms); | 190 | return sprintf(buf, "%d\n", data->alarms); |
@@ -298,42 +298,42 @@ static ssize_t set_pwm_en(struct device *dev, const char *buf, | |||
298 | } | 298 | } |
299 | 299 | ||
300 | #define fan_present(offset) \ | 300 | #define fan_present(offset) \ |
301 | static ssize_t get_fan##offset (struct device *dev, char *buf) \ | 301 | static ssize_t get_fan##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
302 | { \ | 302 | { \ |
303 | return get_fan(dev, buf, offset - 1); \ | 303 | return get_fan(dev, buf, offset - 1); \ |
304 | } \ | 304 | } \ |
305 | static ssize_t get_fan##offset##_min (struct device *dev, char *buf) \ | 305 | static ssize_t get_fan##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
306 | { \ | 306 | { \ |
307 | return get_fan_min(dev, buf, offset - 1); \ | 307 | return get_fan_min(dev, buf, offset - 1); \ |
308 | } \ | 308 | } \ |
309 | static ssize_t set_fan##offset##_min (struct device *dev, \ | 309 | static ssize_t set_fan##offset##_min (struct device *dev, struct device_attribute *attr, \ |
310 | const char *buf, size_t count) \ | 310 | const char *buf, size_t count) \ |
311 | { \ | 311 | { \ |
312 | return set_fan_min(dev, buf, count, offset - 1); \ | 312 | return set_fan_min(dev, buf, count, offset - 1); \ |
313 | } \ | 313 | } \ |
314 | static ssize_t get_fan##offset##_div (struct device *dev, char *buf) \ | 314 | static ssize_t get_fan##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
315 | { \ | 315 | { \ |
316 | return get_fan_div(dev, buf, offset - 1); \ | 316 | return get_fan_div(dev, buf, offset - 1); \ |
317 | } \ | 317 | } \ |
318 | static ssize_t set_fan##offset##_div (struct device *dev, \ | 318 | static ssize_t set_fan##offset##_div (struct device *dev, struct device_attribute *attr, \ |
319 | const char *buf, size_t count) \ | 319 | const char *buf, size_t count) \ |
320 | { \ | 320 | { \ |
321 | return set_fan_div(dev, buf, count, offset - 1); \ | 321 | return set_fan_div(dev, buf, count, offset - 1); \ |
322 | } \ | 322 | } \ |
323 | static ssize_t get_pwm##offset (struct device *dev, char *buf) \ | 323 | static ssize_t get_pwm##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
324 | { \ | 324 | { \ |
325 | return get_pwm(dev, buf, offset - 1); \ | 325 | return get_pwm(dev, buf, offset - 1); \ |
326 | } \ | 326 | } \ |
327 | static ssize_t set_pwm##offset (struct device *dev, \ | 327 | static ssize_t set_pwm##offset (struct device *dev, struct device_attribute *attr, \ |
328 | const char *buf, size_t count) \ | 328 | const char *buf, size_t count) \ |
329 | { \ | 329 | { \ |
330 | return set_pwm(dev, buf, count, offset - 1); \ | 330 | return set_pwm(dev, buf, count, offset - 1); \ |
331 | } \ | 331 | } \ |
332 | static ssize_t get_pwm##offset##_en (struct device *dev, char *buf) \ | 332 | static ssize_t get_pwm##offset##_en (struct device *dev, struct device_attribute *attr, char *buf) \ |
333 | { \ | 333 | { \ |
334 | return get_pwm_en(dev, buf, offset - 1); \ | 334 | return get_pwm_en(dev, buf, offset - 1); \ |
335 | } \ | 335 | } \ |
336 | static ssize_t set_pwm##offset##_en (struct device *dev, \ | 336 | static ssize_t set_pwm##offset##_en (struct device *dev, struct device_attribute *attr, \ |
337 | const char *buf, size_t count) \ | 337 | const char *buf, size_t count) \ |
338 | { \ | 338 | { \ |
339 | return set_pwm_en(dev, buf, count, offset - 1); \ | 339 | return set_pwm_en(dev, buf, count, offset - 1); \ |
diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c index 6614a59cecd4..fefc24a9251a 100644 --- a/drivers/i2c/chips/via686a.c +++ b/drivers/i2c/chips/via686a.c | |||
@@ -386,26 +386,26 @@ static ssize_t set_in_max(struct device *dev, const char *buf, | |||
386 | } | 386 | } |
387 | #define show_in_offset(offset) \ | 387 | #define show_in_offset(offset) \ |
388 | static ssize_t \ | 388 | static ssize_t \ |
389 | show_in##offset (struct device *dev, char *buf) \ | 389 | show_in##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
390 | { \ | 390 | { \ |
391 | return show_in(dev, buf, offset); \ | 391 | return show_in(dev, buf, offset); \ |
392 | } \ | 392 | } \ |
393 | static ssize_t \ | 393 | static ssize_t \ |
394 | show_in##offset##_min (struct device *dev, char *buf) \ | 394 | show_in##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
395 | { \ | 395 | { \ |
396 | return show_in_min(dev, buf, offset); \ | 396 | return show_in_min(dev, buf, offset); \ |
397 | } \ | 397 | } \ |
398 | static ssize_t \ | 398 | static ssize_t \ |
399 | show_in##offset##_max (struct device *dev, char *buf) \ | 399 | show_in##offset##_max (struct device *dev, struct device_attribute *attr, char *buf) \ |
400 | { \ | 400 | { \ |
401 | return show_in_max(dev, buf, offset); \ | 401 | return show_in_max(dev, buf, offset); \ |
402 | } \ | 402 | } \ |
403 | static ssize_t set_in##offset##_min (struct device *dev, \ | 403 | static ssize_t set_in##offset##_min (struct device *dev, struct device_attribute *attr, \ |
404 | const char *buf, size_t count) \ | 404 | const char *buf, size_t count) \ |
405 | { \ | 405 | { \ |
406 | return set_in_min(dev, buf, count, offset); \ | 406 | return set_in_min(dev, buf, count, offset); \ |
407 | } \ | 407 | } \ |
408 | static ssize_t set_in##offset##_max (struct device *dev, \ | 408 | static ssize_t set_in##offset##_max (struct device *dev, struct device_attribute *attr, \ |
409 | const char *buf, size_t count) \ | 409 | const char *buf, size_t count) \ |
410 | { \ | 410 | { \ |
411 | return set_in_max(dev, buf, count, offset); \ | 411 | return set_in_max(dev, buf, count, offset); \ |
@@ -460,26 +460,26 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, | |||
460 | return count; | 460 | return count; |
461 | } | 461 | } |
462 | #define show_temp_offset(offset) \ | 462 | #define show_temp_offset(offset) \ |
463 | static ssize_t show_temp_##offset (struct device *dev, char *buf) \ | 463 | static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
464 | { \ | 464 | { \ |
465 | return show_temp(dev, buf, offset - 1); \ | 465 | return show_temp(dev, buf, offset - 1); \ |
466 | } \ | 466 | } \ |
467 | static ssize_t \ | 467 | static ssize_t \ |
468 | show_temp_##offset##_over (struct device *dev, char *buf) \ | 468 | show_temp_##offset##_over (struct device *dev, struct device_attribute *attr, char *buf) \ |
469 | { \ | 469 | { \ |
470 | return show_temp_over(dev, buf, offset - 1); \ | 470 | return show_temp_over(dev, buf, offset - 1); \ |
471 | } \ | 471 | } \ |
472 | static ssize_t \ | 472 | static ssize_t \ |
473 | show_temp_##offset##_hyst (struct device *dev, char *buf) \ | 473 | show_temp_##offset##_hyst (struct device *dev, struct device_attribute *attr, char *buf) \ |
474 | { \ | 474 | { \ |
475 | return show_temp_hyst(dev, buf, offset - 1); \ | 475 | return show_temp_hyst(dev, buf, offset - 1); \ |
476 | } \ | 476 | } \ |
477 | static ssize_t set_temp_##offset##_over (struct device *dev, \ | 477 | static ssize_t set_temp_##offset##_over (struct device *dev, struct device_attribute *attr, \ |
478 | const char *buf, size_t count) \ | 478 | const char *buf, size_t count) \ |
479 | { \ | 479 | { \ |
480 | return set_temp_over(dev, buf, count, offset - 1); \ | 480 | return set_temp_over(dev, buf, count, offset - 1); \ |
481 | } \ | 481 | } \ |
482 | static ssize_t set_temp_##offset##_hyst (struct device *dev, \ | 482 | static ssize_t set_temp_##offset##_hyst (struct device *dev, struct device_attribute *attr, \ |
483 | const char *buf, size_t count) \ | 483 | const char *buf, size_t count) \ |
484 | { \ | 484 | { \ |
485 | return set_temp_hyst(dev, buf, count, offset - 1); \ | 485 | return set_temp_hyst(dev, buf, count, offset - 1); \ |
@@ -538,24 +538,24 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, | |||
538 | } | 538 | } |
539 | 539 | ||
540 | #define show_fan_offset(offset) \ | 540 | #define show_fan_offset(offset) \ |
541 | static ssize_t show_fan_##offset (struct device *dev, char *buf) \ | 541 | static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
542 | { \ | 542 | { \ |
543 | return show_fan(dev, buf, offset - 1); \ | 543 | return show_fan(dev, buf, offset - 1); \ |
544 | } \ | 544 | } \ |
545 | static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ | 545 | static ssize_t show_fan_##offset##_min (struct device *dev, struct device_attribute *attr, char *buf) \ |
546 | { \ | 546 | { \ |
547 | return show_fan_min(dev, buf, offset - 1); \ | 547 | return show_fan_min(dev, buf, offset - 1); \ |
548 | } \ | 548 | } \ |
549 | static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ | 549 | static ssize_t show_fan_##offset##_div (struct device *dev, struct device_attribute *attr, char *buf) \ |
550 | { \ | 550 | { \ |
551 | return show_fan_div(dev, buf, offset - 1); \ | 551 | return show_fan_div(dev, buf, offset - 1); \ |
552 | } \ | 552 | } \ |
553 | static ssize_t set_fan_##offset##_min (struct device *dev, \ | 553 | static ssize_t set_fan_##offset##_min (struct device *dev, struct device_attribute *attr, \ |
554 | const char *buf, size_t count) \ | 554 | const char *buf, size_t count) \ |
555 | { \ | 555 | { \ |
556 | return set_fan_min(dev, buf, count, offset - 1); \ | 556 | return set_fan_min(dev, buf, count, offset - 1); \ |
557 | } \ | 557 | } \ |
558 | static ssize_t set_fan_##offset##_div (struct device *dev, \ | 558 | static ssize_t set_fan_##offset##_div (struct device *dev, struct device_attribute *attr, \ |
559 | const char *buf, size_t count) \ | 559 | const char *buf, size_t count) \ |
560 | { \ | 560 | { \ |
561 | return set_fan_div(dev, buf, count, offset - 1); \ | 561 | return set_fan_div(dev, buf, count, offset - 1); \ |
@@ -570,7 +570,7 @@ show_fan_offset(1); | |||
570 | show_fan_offset(2); | 570 | show_fan_offset(2); |
571 | 571 | ||
572 | /* Alarms */ | 572 | /* Alarms */ |
573 | static ssize_t show_alarms(struct device *dev, char *buf) { | 573 | static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf) { |
574 | struct via686a_data *data = via686a_update_device(dev); | 574 | struct via686a_data *data = via686a_update_device(dev); |
575 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); | 575 | return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms)); |
576 | } | 576 | } |
diff --git a/drivers/i2c/chips/w83627hf.c b/drivers/i2c/chips/w83627hf.c index b1da5ed696d3..4f1bff572c1c 100644 --- a/drivers/i2c/chips/w83627hf.c +++ b/drivers/i2c/chips/w83627hf.c | |||
@@ -368,19 +368,19 @@ store_in_reg(MAX, max) | |||
368 | 368 | ||
369 | #define sysfs_in_offset(offset) \ | 369 | #define sysfs_in_offset(offset) \ |
370 | static ssize_t \ | 370 | static ssize_t \ |
371 | show_regs_in_##offset (struct device *dev, char *buf) \ | 371 | show_regs_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
372 | { \ | 372 | { \ |
373 | return show_in(dev, buf, offset); \ | 373 | return show_in(dev, buf, offset); \ |
374 | } \ | 374 | } \ |
375 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); | 375 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); |
376 | 376 | ||
377 | #define sysfs_in_reg_offset(reg, offset) \ | 377 | #define sysfs_in_reg_offset(reg, offset) \ |
378 | static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ | 378 | static ssize_t show_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
379 | { \ | 379 | { \ |
380 | return show_in_##reg (dev, buf, offset); \ | 380 | return show_in_##reg (dev, buf, offset); \ |
381 | } \ | 381 | } \ |
382 | static ssize_t \ | 382 | static ssize_t \ |
383 | store_regs_in_##reg##offset (struct device *dev, \ | 383 | store_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, \ |
384 | const char *buf, size_t count) \ | 384 | const char *buf, size_t count) \ |
385 | { \ | 385 | { \ |
386 | return store_in_##reg (dev, buf, count, offset); \ | 386 | return store_in_##reg (dev, buf, count, offset); \ |
@@ -419,25 +419,25 @@ static ssize_t show_in_0(struct w83627hf_data *data, char *buf, u8 reg) | |||
419 | return sprintf(buf,"%ld\n", in0); | 419 | return sprintf(buf,"%ld\n", in0); |
420 | } | 420 | } |
421 | 421 | ||
422 | static ssize_t show_regs_in_0(struct device *dev, char *buf) | 422 | static ssize_t show_regs_in_0(struct device *dev, struct device_attribute *attr, char *buf) |
423 | { | 423 | { |
424 | struct w83627hf_data *data = w83627hf_update_device(dev); | 424 | struct w83627hf_data *data = w83627hf_update_device(dev); |
425 | return show_in_0(data, buf, data->in[0]); | 425 | return show_in_0(data, buf, data->in[0]); |
426 | } | 426 | } |
427 | 427 | ||
428 | static ssize_t show_regs_in_min0(struct device *dev, char *buf) | 428 | static ssize_t show_regs_in_min0(struct device *dev, struct device_attribute *attr, char *buf) |
429 | { | 429 | { |
430 | struct w83627hf_data *data = w83627hf_update_device(dev); | 430 | struct w83627hf_data *data = w83627hf_update_device(dev); |
431 | return show_in_0(data, buf, data->in_min[0]); | 431 | return show_in_0(data, buf, data->in_min[0]); |
432 | } | 432 | } |
433 | 433 | ||
434 | static ssize_t show_regs_in_max0(struct device *dev, char *buf) | 434 | static ssize_t show_regs_in_max0(struct device *dev, struct device_attribute *attr, char *buf) |
435 | { | 435 | { |
436 | struct w83627hf_data *data = w83627hf_update_device(dev); | 436 | struct w83627hf_data *data = w83627hf_update_device(dev); |
437 | return show_in_0(data, buf, data->in_max[0]); | 437 | return show_in_0(data, buf, data->in_max[0]); |
438 | } | 438 | } |
439 | 439 | ||
440 | static ssize_t store_regs_in_min0(struct device *dev, | 440 | static ssize_t store_regs_in_min0(struct device *dev, struct device_attribute *attr, |
441 | const char *buf, size_t count) | 441 | const char *buf, size_t count) |
442 | { | 442 | { |
443 | struct i2c_client *client = to_i2c_client(dev); | 443 | struct i2c_client *client = to_i2c_client(dev); |
@@ -462,7 +462,7 @@ static ssize_t store_regs_in_min0(struct device *dev, | |||
462 | return count; | 462 | return count; |
463 | } | 463 | } |
464 | 464 | ||
465 | static ssize_t store_regs_in_max0(struct device *dev, | 465 | static ssize_t store_regs_in_max0(struct device *dev, struct device_attribute *attr, |
466 | const char *buf, size_t count) | 466 | const char *buf, size_t count) |
467 | { | 467 | { |
468 | struct i2c_client *client = to_i2c_client(dev); | 468 | struct i2c_client *client = to_i2c_client(dev); |
@@ -531,19 +531,19 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr) | |||
531 | } | 531 | } |
532 | 532 | ||
533 | #define sysfs_fan_offset(offset) \ | 533 | #define sysfs_fan_offset(offset) \ |
534 | static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ | 534 | static ssize_t show_regs_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
535 | { \ | 535 | { \ |
536 | return show_fan(dev, buf, offset); \ | 536 | return show_fan(dev, buf, offset); \ |
537 | } \ | 537 | } \ |
538 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); | 538 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); |
539 | 539 | ||
540 | #define sysfs_fan_min_offset(offset) \ | 540 | #define sysfs_fan_min_offset(offset) \ |
541 | static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ | 541 | static ssize_t show_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
542 | { \ | 542 | { \ |
543 | return show_fan_min(dev, buf, offset); \ | 543 | return show_fan_min(dev, buf, offset); \ |
544 | } \ | 544 | } \ |
545 | static ssize_t \ | 545 | static ssize_t \ |
546 | store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ | 546 | store_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
547 | { \ | 547 | { \ |
548 | return store_fan_min(dev, buf, count, offset); \ | 548 | return store_fan_min(dev, buf, count, offset); \ |
549 | } \ | 549 | } \ |
@@ -608,19 +608,19 @@ store_temp_reg(HYST, max_hyst); | |||
608 | 608 | ||
609 | #define sysfs_temp_offset(offset) \ | 609 | #define sysfs_temp_offset(offset) \ |
610 | static ssize_t \ | 610 | static ssize_t \ |
611 | show_regs_temp_##offset (struct device *dev, char *buf) \ | 611 | show_regs_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
612 | { \ | 612 | { \ |
613 | return show_temp(dev, buf, offset); \ | 613 | return show_temp(dev, buf, offset); \ |
614 | } \ | 614 | } \ |
615 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); | 615 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); |
616 | 616 | ||
617 | #define sysfs_temp_reg_offset(reg, offset) \ | 617 | #define sysfs_temp_reg_offset(reg, offset) \ |
618 | static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ | 618 | static ssize_t show_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
619 | { \ | 619 | { \ |
620 | return show_temp_##reg (dev, buf, offset); \ | 620 | return show_temp_##reg (dev, buf, offset); \ |
621 | } \ | 621 | } \ |
622 | static ssize_t \ | 622 | static ssize_t \ |
623 | store_regs_temp_##reg##offset (struct device *dev, \ | 623 | store_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, \ |
624 | const char *buf, size_t count) \ | 624 | const char *buf, size_t count) \ |
625 | { \ | 625 | { \ |
626 | return store_temp_##reg (dev, buf, count, offset); \ | 626 | return store_temp_##reg (dev, buf, count, offset); \ |
@@ -645,7 +645,7 @@ device_create_file(&client->dev, &dev_attr_temp##offset##_max_hyst); \ | |||
645 | } while (0) | 645 | } while (0) |
646 | 646 | ||
647 | static ssize_t | 647 | static ssize_t |
648 | show_vid_reg(struct device *dev, char *buf) | 648 | show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
649 | { | 649 | { |
650 | struct w83627hf_data *data = w83627hf_update_device(dev); | 650 | struct w83627hf_data *data = w83627hf_update_device(dev); |
651 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 651 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); |
@@ -655,13 +655,13 @@ static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | |||
655 | device_create_file(&client->dev, &dev_attr_cpu0_vid) | 655 | device_create_file(&client->dev, &dev_attr_cpu0_vid) |
656 | 656 | ||
657 | static ssize_t | 657 | static ssize_t |
658 | show_vrm_reg(struct device *dev, char *buf) | 658 | show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
659 | { | 659 | { |
660 | struct w83627hf_data *data = w83627hf_update_device(dev); | 660 | struct w83627hf_data *data = w83627hf_update_device(dev); |
661 | return sprintf(buf, "%ld\n", (long) data->vrm); | 661 | return sprintf(buf, "%ld\n", (long) data->vrm); |
662 | } | 662 | } |
663 | static ssize_t | 663 | static ssize_t |
664 | store_vrm_reg(struct device *dev, const char *buf, size_t count) | 664 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
665 | { | 665 | { |
666 | struct i2c_client *client = to_i2c_client(dev); | 666 | struct i2c_client *client = to_i2c_client(dev); |
667 | struct w83627hf_data *data = i2c_get_clientdata(client); | 667 | struct w83627hf_data *data = i2c_get_clientdata(client); |
@@ -677,7 +677,7 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | |||
677 | device_create_file(&client->dev, &dev_attr_vrm) | 677 | device_create_file(&client->dev, &dev_attr_vrm) |
678 | 678 | ||
679 | static ssize_t | 679 | static ssize_t |
680 | show_alarms_reg(struct device *dev, char *buf) | 680 | show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) |
681 | { | 681 | { |
682 | struct w83627hf_data *data = w83627hf_update_device(dev); | 682 | struct w83627hf_data *data = w83627hf_update_device(dev); |
683 | return sprintf(buf, "%ld\n", (long) data->alarms); | 683 | return sprintf(buf, "%ld\n", (long) data->alarms); |
@@ -687,7 +687,7 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); | |||
687 | device_create_file(&client->dev, &dev_attr_alarms) | 687 | device_create_file(&client->dev, &dev_attr_alarms) |
688 | 688 | ||
689 | #define show_beep_reg(REG, reg) \ | 689 | #define show_beep_reg(REG, reg) \ |
690 | static ssize_t show_beep_##reg (struct device *dev, char *buf) \ | 690 | static ssize_t show_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ |
691 | { \ | 691 | { \ |
692 | struct w83627hf_data *data = w83627hf_update_device(dev); \ | 692 | struct w83627hf_data *data = w83627hf_update_device(dev); \ |
693 | return sprintf(buf,"%ld\n", \ | 693 | return sprintf(buf,"%ld\n", \ |
@@ -732,12 +732,12 @@ store_beep_reg(struct device *dev, const char *buf, size_t count, | |||
732 | } | 732 | } |
733 | 733 | ||
734 | #define sysfs_beep(REG, reg) \ | 734 | #define sysfs_beep(REG, reg) \ |
735 | static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ | 735 | static ssize_t show_regs_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ |
736 | { \ | 736 | { \ |
737 | return show_beep_##reg(dev, buf); \ | 737 | return show_beep_##reg(dev, attr, buf); \ |
738 | } \ | 738 | } \ |
739 | static ssize_t \ | 739 | static ssize_t \ |
740 | store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ | 740 | store_regs_beep_##reg (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
741 | { \ | 741 | { \ |
742 | return store_beep_reg(dev, buf, count, BEEP_##REG); \ | 742 | return store_beep_reg(dev, buf, count, BEEP_##REG); \ |
743 | } \ | 743 | } \ |
@@ -801,12 +801,12 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
801 | } | 801 | } |
802 | 802 | ||
803 | #define sysfs_fan_div(offset) \ | 803 | #define sysfs_fan_div(offset) \ |
804 | static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ | 804 | static ssize_t show_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
805 | { \ | 805 | { \ |
806 | return show_fan_div_reg(dev, buf, offset); \ | 806 | return show_fan_div_reg(dev, buf, offset); \ |
807 | } \ | 807 | } \ |
808 | static ssize_t \ | 808 | static ssize_t \ |
809 | store_regs_fan_div_##offset (struct device *dev, \ | 809 | store_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, \ |
810 | const char *buf, size_t count) \ | 810 | const char *buf, size_t count) \ |
811 | { \ | 811 | { \ |
812 | return store_fan_div_reg(dev, buf, count, offset - 1); \ | 812 | return store_fan_div_reg(dev, buf, count, offset - 1); \ |
@@ -861,12 +861,12 @@ store_pwm_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
861 | } | 861 | } |
862 | 862 | ||
863 | #define sysfs_pwm(offset) \ | 863 | #define sysfs_pwm(offset) \ |
864 | static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ | 864 | static ssize_t show_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
865 | { \ | 865 | { \ |
866 | return show_pwm_reg(dev, buf, offset); \ | 866 | return show_pwm_reg(dev, buf, offset); \ |
867 | } \ | 867 | } \ |
868 | static ssize_t \ | 868 | static ssize_t \ |
869 | store_regs_pwm_##offset (struct device *dev, const char *buf, size_t count) \ | 869 | store_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
870 | { \ | 870 | { \ |
871 | return store_pwm_reg(dev, buf, count, offset); \ | 871 | return store_pwm_reg(dev, buf, count, offset); \ |
872 | } \ | 872 | } \ |
@@ -937,12 +937,12 @@ store_sensor_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
937 | } | 937 | } |
938 | 938 | ||
939 | #define sysfs_sensor(offset) \ | 939 | #define sysfs_sensor(offset) \ |
940 | static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ | 940 | static ssize_t show_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
941 | { \ | 941 | { \ |
942 | return show_sensor_reg(dev, buf, offset); \ | 942 | return show_sensor_reg(dev, buf, offset); \ |
943 | } \ | 943 | } \ |
944 | static ssize_t \ | 944 | static ssize_t \ |
945 | store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ | 945 | store_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
946 | { \ | 946 | { \ |
947 | return store_sensor_reg(dev, buf, count, offset); \ | 947 | return store_sensor_reg(dev, buf, count, offset); \ |
948 | } \ | 948 | } \ |
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c index 4954e465c419..c3926d2d8ac6 100644 --- a/drivers/i2c/chips/w83781d.c +++ b/drivers/i2c/chips/w83781d.c | |||
@@ -309,18 +309,18 @@ store_in_reg(MAX, max); | |||
309 | 309 | ||
310 | #define sysfs_in_offset(offset) \ | 310 | #define sysfs_in_offset(offset) \ |
311 | static ssize_t \ | 311 | static ssize_t \ |
312 | show_regs_in_##offset (struct device *dev, char *buf) \ | 312 | show_regs_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
313 | { \ | 313 | { \ |
314 | return show_in(dev, buf, offset); \ | 314 | return show_in(dev, buf, offset); \ |
315 | } \ | 315 | } \ |
316 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); | 316 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); |
317 | 317 | ||
318 | #define sysfs_in_reg_offset(reg, offset) \ | 318 | #define sysfs_in_reg_offset(reg, offset) \ |
319 | static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ | 319 | static ssize_t show_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
320 | { \ | 320 | { \ |
321 | return show_in_##reg (dev, buf, offset); \ | 321 | return show_in_##reg (dev, buf, offset); \ |
322 | } \ | 322 | } \ |
323 | static ssize_t store_regs_in_##reg##offset (struct device *dev, const char *buf, size_t count) \ | 323 | static ssize_t store_regs_in_##reg##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
324 | { \ | 324 | { \ |
325 | return store_in_##reg (dev, buf, count, offset); \ | 325 | return store_in_##reg (dev, buf, count, offset); \ |
326 | } \ | 326 | } \ |
@@ -378,18 +378,18 @@ store_fan_min(struct device *dev, const char *buf, size_t count, int nr) | |||
378 | } | 378 | } |
379 | 379 | ||
380 | #define sysfs_fan_offset(offset) \ | 380 | #define sysfs_fan_offset(offset) \ |
381 | static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ | 381 | static ssize_t show_regs_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
382 | { \ | 382 | { \ |
383 | return show_fan(dev, buf, offset); \ | 383 | return show_fan(dev, buf, offset); \ |
384 | } \ | 384 | } \ |
385 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); | 385 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); |
386 | 386 | ||
387 | #define sysfs_fan_min_offset(offset) \ | 387 | #define sysfs_fan_min_offset(offset) \ |
388 | static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ | 388 | static ssize_t show_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
389 | { \ | 389 | { \ |
390 | return show_fan_min(dev, buf, offset); \ | 390 | return show_fan_min(dev, buf, offset); \ |
391 | } \ | 391 | } \ |
392 | static ssize_t store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ | 392 | static ssize_t store_regs_fan_min##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
393 | { \ | 393 | { \ |
394 | return store_fan_min(dev, buf, count, offset); \ | 394 | return store_fan_min(dev, buf, count, offset); \ |
395 | } \ | 395 | } \ |
@@ -452,18 +452,18 @@ store_temp_reg(HYST, max_hyst); | |||
452 | 452 | ||
453 | #define sysfs_temp_offset(offset) \ | 453 | #define sysfs_temp_offset(offset) \ |
454 | static ssize_t \ | 454 | static ssize_t \ |
455 | show_regs_temp_##offset (struct device *dev, char *buf) \ | 455 | show_regs_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
456 | { \ | 456 | { \ |
457 | return show_temp(dev, buf, offset); \ | 457 | return show_temp(dev, buf, offset); \ |
458 | } \ | 458 | } \ |
459 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); | 459 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); |
460 | 460 | ||
461 | #define sysfs_temp_reg_offset(reg, offset) \ | 461 | #define sysfs_temp_reg_offset(reg, offset) \ |
462 | static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ | 462 | static ssize_t show_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
463 | { \ | 463 | { \ |
464 | return show_temp_##reg (dev, buf, offset); \ | 464 | return show_temp_##reg (dev, buf, offset); \ |
465 | } \ | 465 | } \ |
466 | static ssize_t store_regs_temp_##reg##offset (struct device *dev, const char *buf, size_t count) \ | 466 | static ssize_t store_regs_temp_##reg##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
467 | { \ | 467 | { \ |
468 | return store_temp_##reg (dev, buf, count, offset); \ | 468 | return store_temp_##reg (dev, buf, count, offset); \ |
469 | } \ | 469 | } \ |
@@ -486,7 +486,7 @@ device_create_file(&client->dev, &dev_attr_temp##offset##_max_hyst); \ | |||
486 | } while (0) | 486 | } while (0) |
487 | 487 | ||
488 | static ssize_t | 488 | static ssize_t |
489 | show_vid_reg(struct device *dev, char *buf) | 489 | show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) |
490 | { | 490 | { |
491 | struct w83781d_data *data = w83781d_update_device(dev); | 491 | struct w83781d_data *data = w83781d_update_device(dev); |
492 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); | 492 | return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); |
@@ -497,14 +497,14 @@ DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); | |||
497 | #define device_create_file_vid(client) \ | 497 | #define device_create_file_vid(client) \ |
498 | device_create_file(&client->dev, &dev_attr_cpu0_vid); | 498 | device_create_file(&client->dev, &dev_attr_cpu0_vid); |
499 | static ssize_t | 499 | static ssize_t |
500 | show_vrm_reg(struct device *dev, char *buf) | 500 | show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) |
501 | { | 501 | { |
502 | struct w83781d_data *data = w83781d_update_device(dev); | 502 | struct w83781d_data *data = w83781d_update_device(dev); |
503 | return sprintf(buf, "%ld\n", (long) data->vrm); | 503 | return sprintf(buf, "%ld\n", (long) data->vrm); |
504 | } | 504 | } |
505 | 505 | ||
506 | static ssize_t | 506 | static ssize_t |
507 | store_vrm_reg(struct device *dev, const char *buf, size_t count) | 507 | store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
508 | { | 508 | { |
509 | struct i2c_client *client = to_i2c_client(dev); | 509 | struct i2c_client *client = to_i2c_client(dev); |
510 | struct w83781d_data *data = i2c_get_clientdata(client); | 510 | struct w83781d_data *data = i2c_get_clientdata(client); |
@@ -521,7 +521,7 @@ DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); | |||
521 | #define device_create_file_vrm(client) \ | 521 | #define device_create_file_vrm(client) \ |
522 | device_create_file(&client->dev, &dev_attr_vrm); | 522 | device_create_file(&client->dev, &dev_attr_vrm); |
523 | static ssize_t | 523 | static ssize_t |
524 | show_alarms_reg(struct device *dev, char *buf) | 524 | show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) |
525 | { | 525 | { |
526 | struct w83781d_data *data = w83781d_update_device(dev); | 526 | struct w83781d_data *data = w83781d_update_device(dev); |
527 | return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); | 527 | return sprintf(buf, "%ld\n", (long) ALARMS_FROM_REG(data->alarms)); |
@@ -531,13 +531,13 @@ static | |||
531 | DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); | 531 | DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); |
532 | #define device_create_file_alarms(client) \ | 532 | #define device_create_file_alarms(client) \ |
533 | device_create_file(&client->dev, &dev_attr_alarms); | 533 | device_create_file(&client->dev, &dev_attr_alarms); |
534 | static ssize_t show_beep_mask (struct device *dev, char *buf) | 534 | static ssize_t show_beep_mask (struct device *dev, struct device_attribute *attr, char *buf) |
535 | { | 535 | { |
536 | struct w83781d_data *data = w83781d_update_device(dev); | 536 | struct w83781d_data *data = w83781d_update_device(dev); |
537 | return sprintf(buf, "%ld\n", | 537 | return sprintf(buf, "%ld\n", |
538 | (long)BEEP_MASK_FROM_REG(data->beep_mask, data->type)); | 538 | (long)BEEP_MASK_FROM_REG(data->beep_mask, data->type)); |
539 | } | 539 | } |
540 | static ssize_t show_beep_enable (struct device *dev, char *buf) | 540 | static ssize_t show_beep_enable (struct device *dev, struct device_attribute *attr, char *buf) |
541 | { | 541 | { |
542 | struct w83781d_data *data = w83781d_update_device(dev); | 542 | struct w83781d_data *data = w83781d_update_device(dev); |
543 | return sprintf(buf, "%ld\n", | 543 | return sprintf(buf, "%ld\n", |
@@ -583,11 +583,11 @@ store_beep_reg(struct device *dev, const char *buf, size_t count, | |||
583 | } | 583 | } |
584 | 584 | ||
585 | #define sysfs_beep(REG, reg) \ | 585 | #define sysfs_beep(REG, reg) \ |
586 | static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ | 586 | static ssize_t show_regs_beep_##reg (struct device *dev, struct device_attribute *attr, char *buf) \ |
587 | { \ | 587 | { \ |
588 | return show_beep_##reg(dev, buf); \ | 588 | return show_beep_##reg(dev, attr, buf); \ |
589 | } \ | 589 | } \ |
590 | static ssize_t store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ | 590 | static ssize_t store_regs_beep_##reg (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
591 | { \ | 591 | { \ |
592 | return store_beep_reg(dev, buf, count, BEEP_##REG); \ | 592 | return store_beep_reg(dev, buf, count, BEEP_##REG); \ |
593 | } \ | 593 | } \ |
@@ -653,11 +653,11 @@ store_fan_div_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
653 | } | 653 | } |
654 | 654 | ||
655 | #define sysfs_fan_div(offset) \ | 655 | #define sysfs_fan_div(offset) \ |
656 | static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ | 656 | static ssize_t show_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
657 | { \ | 657 | { \ |
658 | return show_fan_div_reg(dev, buf, offset); \ | 658 | return show_fan_div_reg(dev, buf, offset); \ |
659 | } \ | 659 | } \ |
660 | static ssize_t store_regs_fan_div_##offset (struct device *dev, const char *buf, size_t count) \ | 660 | static ssize_t store_regs_fan_div_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
661 | { \ | 661 | { \ |
662 | return store_fan_div_reg(dev, buf, count, offset - 1); \ | 662 | return store_fan_div_reg(dev, buf, count, offset - 1); \ |
663 | } \ | 663 | } \ |
@@ -737,11 +737,11 @@ store_pwmenable_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
737 | } | 737 | } |
738 | 738 | ||
739 | #define sysfs_pwm(offset) \ | 739 | #define sysfs_pwm(offset) \ |
740 | static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ | 740 | static ssize_t show_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
741 | { \ | 741 | { \ |
742 | return show_pwm_reg(dev, buf, offset); \ | 742 | return show_pwm_reg(dev, buf, offset); \ |
743 | } \ | 743 | } \ |
744 | static ssize_t store_regs_pwm_##offset (struct device *dev, \ | 744 | static ssize_t store_regs_pwm_##offset (struct device *dev, struct device_attribute *attr, \ |
745 | const char *buf, size_t count) \ | 745 | const char *buf, size_t count) \ |
746 | { \ | 746 | { \ |
747 | return store_pwm_reg(dev, buf, count, offset); \ | 747 | return store_pwm_reg(dev, buf, count, offset); \ |
@@ -750,11 +750,11 @@ static DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | |||
750 | show_regs_pwm_##offset, store_regs_pwm_##offset); | 750 | show_regs_pwm_##offset, store_regs_pwm_##offset); |
751 | 751 | ||
752 | #define sysfs_pwmenable(offset) \ | 752 | #define sysfs_pwmenable(offset) \ |
753 | static ssize_t show_regs_pwmenable_##offset (struct device *dev, char *buf) \ | 753 | static ssize_t show_regs_pwmenable_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
754 | { \ | 754 | { \ |
755 | return show_pwmenable_reg(dev, buf, offset); \ | 755 | return show_pwmenable_reg(dev, buf, offset); \ |
756 | } \ | 756 | } \ |
757 | static ssize_t store_regs_pwmenable_##offset (struct device *dev, \ | 757 | static ssize_t store_regs_pwmenable_##offset (struct device *dev, struct device_attribute *attr, \ |
758 | const char *buf, size_t count) \ | 758 | const char *buf, size_t count) \ |
759 | { \ | 759 | { \ |
760 | return store_pwmenable_reg(dev, buf, count, offset); \ | 760 | return store_pwmenable_reg(dev, buf, count, offset); \ |
@@ -832,11 +832,11 @@ store_sensor_reg(struct device *dev, const char *buf, size_t count, int nr) | |||
832 | } | 832 | } |
833 | 833 | ||
834 | #define sysfs_sensor(offset) \ | 834 | #define sysfs_sensor(offset) \ |
835 | static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ | 835 | static ssize_t show_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, char *buf) \ |
836 | { \ | 836 | { \ |
837 | return show_sensor_reg(dev, buf, offset); \ | 837 | return show_sensor_reg(dev, buf, offset); \ |
838 | } \ | 838 | } \ |
839 | static ssize_t store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ | 839 | static ssize_t store_regs_sensor_##offset (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
840 | { \ | 840 | { \ |
841 | return store_sensor_reg(dev, buf, count, offset); \ | 841 | return store_sensor_reg(dev, buf, count, offset); \ |
842 | } \ | 842 | } \ |
diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c index 59bbc5881fa6..74d4b58e4237 100644 --- a/drivers/i2c/chips/w83l785ts.c +++ b/drivers/i2c/chips/w83l785ts.c | |||
@@ -118,13 +118,13 @@ struct w83l785ts_data { | |||
118 | * Sysfs stuff | 118 | * Sysfs stuff |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static ssize_t show_temp(struct device *dev, char *buf) | 121 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) |
122 | { | 122 | { |
123 | struct w83l785ts_data *data = w83l785ts_update_device(dev); | 123 | struct w83l785ts_data *data = w83l785ts_update_device(dev); |
124 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); | 124 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp)); |
125 | } | 125 | } |
126 | 126 | ||
127 | static ssize_t show_temp_over(struct device *dev, char *buf) | 127 | static ssize_t show_temp_over(struct device *dev, struct device_attribute *attr, char *buf) |
128 | { | 128 | { |
129 | struct w83l785ts_data *data = w83l785ts_update_device(dev); | 129 | struct w83l785ts_data *data = w83l785ts_update_device(dev); |
130 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); | 130 | return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over)); |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 9011627d7eb0..a22e53badacb 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -103,7 +103,7 @@ static struct class i2c_adapter_class = { | |||
103 | .release = &i2c_adapter_class_dev_release, | 103 | .release = &i2c_adapter_class_dev_release, |
104 | }; | 104 | }; |
105 | 105 | ||
106 | static ssize_t show_adapter_name(struct device *dev, char *buf) | 106 | static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) |
107 | { | 107 | { |
108 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); | 108 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); |
109 | return sprintf(buf, "%s\n", adap->name); | 109 | return sprintf(buf, "%s\n", adap->name); |
@@ -117,7 +117,7 @@ static void i2c_client_release(struct device *dev) | |||
117 | complete(&client->released); | 117 | complete(&client->released); |
118 | } | 118 | } |
119 | 119 | ||
120 | static ssize_t show_client_name(struct device *dev, char *buf) | 120 | static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) |
121 | { | 121 | { |
122 | struct i2c_client *client = to_i2c_client(dev); | 122 | struct i2c_client *client = to_i2c_client(dev); |
123 | return sprintf(buf, "%s\n", client->name); | 123 | return sprintf(buf, "%s\n", client->name); |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 68c7a5f07842..4538b0235ca3 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -2343,8 +2343,8 @@ static void dv1394_remove_host (struct hpsb_host *host) | |||
2343 | dv1394_un_init(video); | 2343 | dv1394_un_init(video); |
2344 | } while (video != NULL); | 2344 | } while (video != NULL); |
2345 | 2345 | ||
2346 | class_simple_device_remove(MKDEV( | 2346 | class_device_destroy(hpsb_protocol_class, |
2347 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); | 2347 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2))); |
2348 | devfs_remove("ieee1394/dv/host%d/NTSC", id); | 2348 | devfs_remove("ieee1394/dv/host%d/NTSC", id); |
2349 | devfs_remove("ieee1394/dv/host%d/PAL", id); | 2349 | devfs_remove("ieee1394/dv/host%d/PAL", id); |
2350 | devfs_remove("ieee1394/dv/host%d", id); | 2350 | devfs_remove("ieee1394/dv/host%d", id); |
@@ -2361,7 +2361,7 @@ static void dv1394_add_host (struct hpsb_host *host) | |||
2361 | 2361 | ||
2362 | ohci = (struct ti_ohci *)host->hostdata; | 2362 | ohci = (struct ti_ohci *)host->hostdata; |
2363 | 2363 | ||
2364 | class_simple_device_add(hpsb_protocol_class, MKDEV( | 2364 | class_device_create(hpsb_protocol_class, MKDEV( |
2365 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), | 2365 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), |
2366 | NULL, "dv1394-%d", id); | 2366 | NULL, "dv1394-%d", id); |
2367 | devfs_mk_dir("ieee1394/dv/host%d", id); | 2367 | devfs_mk_dir("ieee1394/dv/host%d", id); |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index a294e45c77cd..2d9a9b74e687 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -67,7 +67,7 @@ MODULE_LICENSE("GPL"); | |||
67 | 67 | ||
68 | /* Some globals used */ | 68 | /* Some globals used */ |
69 | const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" }; | 69 | const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" }; |
70 | struct class_simple *hpsb_protocol_class; | 70 | struct class *hpsb_protocol_class; |
71 | 71 | ||
72 | #ifdef CONFIG_IEEE1394_VERBOSEDEBUG | 72 | #ifdef CONFIG_IEEE1394_VERBOSEDEBUG |
73 | static void dump_packet(const char *text, quadlet_t *data, int size) | 73 | static void dump_packet(const char *text, quadlet_t *data, int size) |
@@ -1121,7 +1121,7 @@ static int __init ieee1394_init(void) | |||
1121 | if (ret < 0) | 1121 | if (ret < 0) |
1122 | goto release_all_bus; | 1122 | goto release_all_bus; |
1123 | 1123 | ||
1124 | hpsb_protocol_class = class_simple_create(THIS_MODULE, "ieee1394_protocol"); | 1124 | hpsb_protocol_class = class_create(THIS_MODULE, "ieee1394_protocol"); |
1125 | if (IS_ERR(hpsb_protocol_class)) { | 1125 | if (IS_ERR(hpsb_protocol_class)) { |
1126 | ret = PTR_ERR(hpsb_protocol_class); | 1126 | ret = PTR_ERR(hpsb_protocol_class); |
1127 | goto release_class_host; | 1127 | goto release_class_host; |
@@ -1159,7 +1159,7 @@ static int __init ieee1394_init(void) | |||
1159 | cleanup_csr: | 1159 | cleanup_csr: |
1160 | cleanup_csr(); | 1160 | cleanup_csr(); |
1161 | release_class_protocol: | 1161 | release_class_protocol: |
1162 | class_simple_destroy(hpsb_protocol_class); | 1162 | class_destroy(hpsb_protocol_class); |
1163 | release_class_host: | 1163 | release_class_host: |
1164 | class_unregister(&hpsb_host_class); | 1164 | class_unregister(&hpsb_host_class); |
1165 | release_all_bus: | 1165 | release_all_bus: |
@@ -1189,7 +1189,7 @@ static void __exit ieee1394_cleanup(void) | |||
1189 | 1189 | ||
1190 | cleanup_csr(); | 1190 | cleanup_csr(); |
1191 | 1191 | ||
1192 | class_simple_destroy(hpsb_protocol_class); | 1192 | class_destroy(hpsb_protocol_class); |
1193 | class_unregister(&hpsb_host_class); | 1193 | class_unregister(&hpsb_host_class); |
1194 | for (i = 0; fw_bus_attrs[i]; i++) | 1194 | for (i = 0; fw_bus_attrs[i]; i++) |
1195 | bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]); | 1195 | bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]); |
diff --git a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h index c4b4408e2e05..73bd8efd2b6c 100644 --- a/drivers/ieee1394/ieee1394_core.h +++ b/drivers/ieee1394/ieee1394_core.h | |||
@@ -223,6 +223,7 @@ extern int hpsb_disable_irm; | |||
223 | /* Our sysfs bus entry */ | 223 | /* Our sysfs bus entry */ |
224 | extern struct bus_type ieee1394_bus_type; | 224 | extern struct bus_type ieee1394_bus_type; |
225 | extern struct class hpsb_host_class; | 225 | extern struct class hpsb_host_class; |
226 | extern struct class_simple *hpsb_protocol_class; | 226 | extern struct class *hpsb_protocol_class; |
227 | 227 | ||
228 | #endif /* _IEEE1394_CORE_H */ | 228 | #endif /* _IEEE1394_CORE_H */ |
229 | |||
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 83e66ed97ab5..32abb6dda888 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -220,7 +220,7 @@ struct device nodemgr_dev_template_host = { | |||
220 | 220 | ||
221 | 221 | ||
222 | #define fw_attr(class, class_type, field, type, format_string) \ | 222 | #define fw_attr(class, class_type, field, type, format_string) \ |
223 | static ssize_t fw_show_##class##_##field (struct device *dev, char *buf)\ | 223 | static ssize_t fw_show_##class##_##field (struct device *dev, struct device_attribute *attr, char *buf)\ |
224 | { \ | 224 | { \ |
225 | class_type *class; \ | 225 | class_type *class; \ |
226 | class = container_of(dev, class_type, device); \ | 226 | class = container_of(dev, class_type, device); \ |
@@ -232,7 +232,7 @@ static struct device_attribute dev_attr_##class##_##field = { \ | |||
232 | }; | 232 | }; |
233 | 233 | ||
234 | #define fw_attr_td(class, class_type, td_kv) \ | 234 | #define fw_attr_td(class, class_type, td_kv) \ |
235 | static ssize_t fw_show_##class##_##td_kv (struct device *dev, char *buf)\ | 235 | static ssize_t fw_show_##class##_##td_kv (struct device *dev, struct device_attribute *attr, char *buf)\ |
236 | { \ | 236 | { \ |
237 | int len; \ | 237 | int len; \ |
238 | class_type *class = container_of(dev, class_type, device); \ | 238 | class_type *class = container_of(dev, class_type, device); \ |
@@ -265,7 +265,7 @@ static struct driver_attribute driver_attr_drv_##field = { \ | |||
265 | }; | 265 | }; |
266 | 266 | ||
267 | 267 | ||
268 | static ssize_t fw_show_ne_bus_options(struct device *dev, char *buf) | 268 | static ssize_t fw_show_ne_bus_options(struct device *dev, struct device_attribute *attr, char *buf) |
269 | { | 269 | { |
270 | struct node_entry *ne = container_of(dev, struct node_entry, device); | 270 | struct node_entry *ne = container_of(dev, struct node_entry, device); |
271 | 271 | ||
@@ -281,7 +281,7 @@ static ssize_t fw_show_ne_bus_options(struct device *dev, char *buf) | |||
281 | static DEVICE_ATTR(bus_options,S_IRUGO,fw_show_ne_bus_options,NULL); | 281 | static DEVICE_ATTR(bus_options,S_IRUGO,fw_show_ne_bus_options,NULL); |
282 | 282 | ||
283 | 283 | ||
284 | static ssize_t fw_show_ne_tlabels_free(struct device *dev, char *buf) | 284 | static ssize_t fw_show_ne_tlabels_free(struct device *dev, struct device_attribute *attr, char *buf) |
285 | { | 285 | { |
286 | struct node_entry *ne = container_of(dev, struct node_entry, device); | 286 | struct node_entry *ne = container_of(dev, struct node_entry, device); |
287 | return sprintf(buf, "%d\n", atomic_read(&ne->tpool->count.count) + 1); | 287 | return sprintf(buf, "%d\n", atomic_read(&ne->tpool->count.count) + 1); |
@@ -289,7 +289,7 @@ static ssize_t fw_show_ne_tlabels_free(struct device *dev, char *buf) | |||
289 | static DEVICE_ATTR(tlabels_free,S_IRUGO,fw_show_ne_tlabels_free,NULL); | 289 | static DEVICE_ATTR(tlabels_free,S_IRUGO,fw_show_ne_tlabels_free,NULL); |
290 | 290 | ||
291 | 291 | ||
292 | static ssize_t fw_show_ne_tlabels_allocations(struct device *dev, char *buf) | 292 | static ssize_t fw_show_ne_tlabels_allocations(struct device *dev, struct device_attribute *attr, char *buf) |
293 | { | 293 | { |
294 | struct node_entry *ne = container_of(dev, struct node_entry, device); | 294 | struct node_entry *ne = container_of(dev, struct node_entry, device); |
295 | return sprintf(buf, "%u\n", ne->tpool->allocations); | 295 | return sprintf(buf, "%u\n", ne->tpool->allocations); |
@@ -297,7 +297,7 @@ static ssize_t fw_show_ne_tlabels_allocations(struct device *dev, char *buf) | |||
297 | static DEVICE_ATTR(tlabels_allocations,S_IRUGO,fw_show_ne_tlabels_allocations,NULL); | 297 | static DEVICE_ATTR(tlabels_allocations,S_IRUGO,fw_show_ne_tlabels_allocations,NULL); |
298 | 298 | ||
299 | 299 | ||
300 | static ssize_t fw_show_ne_tlabels_mask(struct device *dev, char *buf) | 300 | static ssize_t fw_show_ne_tlabels_mask(struct device *dev, struct device_attribute *attr, char *buf) |
301 | { | 301 | { |
302 | struct node_entry *ne = container_of(dev, struct node_entry, device); | 302 | struct node_entry *ne = container_of(dev, struct node_entry, device); |
303 | #if (BITS_PER_LONG <= 32) | 303 | #if (BITS_PER_LONG <= 32) |
@@ -309,7 +309,7 @@ static ssize_t fw_show_ne_tlabels_mask(struct device *dev, char *buf) | |||
309 | static DEVICE_ATTR(tlabels_mask, S_IRUGO, fw_show_ne_tlabels_mask, NULL); | 309 | static DEVICE_ATTR(tlabels_mask, S_IRUGO, fw_show_ne_tlabels_mask, NULL); |
310 | 310 | ||
311 | 311 | ||
312 | static ssize_t fw_set_ignore_driver(struct device *dev, const char *buf, size_t count) | 312 | static ssize_t fw_set_ignore_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
313 | { | 313 | { |
314 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); | 314 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); |
315 | int state = simple_strtoul(buf, NULL, 10); | 315 | int state = simple_strtoul(buf, NULL, 10); |
@@ -324,7 +324,7 @@ static ssize_t fw_set_ignore_driver(struct device *dev, const char *buf, size_t | |||
324 | 324 | ||
325 | return count; | 325 | return count; |
326 | } | 326 | } |
327 | static ssize_t fw_get_ignore_driver(struct device *dev, char *buf) | 327 | static ssize_t fw_get_ignore_driver(struct device *dev, struct device_attribute *attr, char *buf) |
328 | { | 328 | { |
329 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); | 329 | struct unit_directory *ud = container_of(dev, struct unit_directory, device); |
330 | 330 | ||
@@ -695,14 +695,15 @@ static void nodemgr_remove_ne(struct node_entry *ne) | |||
695 | put_device(dev); | 695 | put_device(dev); |
696 | } | 696 | } |
697 | 697 | ||
698 | static int __nodemgr_remove_host_dev(struct device *dev, void *data) | ||
699 | { | ||
700 | nodemgr_remove_ne(container_of(dev, struct node_entry, device)); | ||
701 | return 0; | ||
702 | } | ||
698 | 703 | ||
699 | static void nodemgr_remove_host_dev(struct device *dev) | 704 | static void nodemgr_remove_host_dev(struct device *dev) |
700 | { | 705 | { |
701 | struct device *ne_dev, *next; | 706 | device_for_each_child(dev, NULL, __nodemgr_remove_host_dev); |
702 | |||
703 | list_for_each_entry_safe(ne_dev, next, &dev->children, node) | ||
704 | nodemgr_remove_ne(container_of(ne_dev, struct node_entry, device)); | ||
705 | |||
706 | sysfs_remove_link(&dev->kobj, "irm_id"); | 707 | sysfs_remove_link(&dev->kobj, "irm_id"); |
707 | sysfs_remove_link(&dev->kobj, "busmgr_id"); | 708 | sysfs_remove_link(&dev->kobj, "busmgr_id"); |
708 | sysfs_remove_link(&dev->kobj, "host_id"); | 709 | sysfs_remove_link(&dev->kobj, "host_id"); |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 6a08a8982ea8..7419af450bd1 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -2901,7 +2901,7 @@ static int __init init_raw1394(void) | |||
2901 | 2901 | ||
2902 | hpsb_register_highlevel(&raw1394_highlevel); | 2902 | hpsb_register_highlevel(&raw1394_highlevel); |
2903 | 2903 | ||
2904 | if (IS_ERR(class_simple_device_add(hpsb_protocol_class, MKDEV( | 2904 | if (IS_ERR(class_device_create(hpsb_protocol_class, MKDEV( |
2905 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), | 2905 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), |
2906 | NULL, RAW1394_DEVICE_NAME))) { | 2906 | NULL, RAW1394_DEVICE_NAME))) { |
2907 | ret = -EFAULT; | 2907 | ret = -EFAULT; |
@@ -2934,8 +2934,8 @@ static int __init init_raw1394(void) | |||
2934 | 2934 | ||
2935 | out_dev: | 2935 | out_dev: |
2936 | devfs_remove(RAW1394_DEVICE_NAME); | 2936 | devfs_remove(RAW1394_DEVICE_NAME); |
2937 | class_simple_device_remove(MKDEV( | 2937 | class_device_destroy(hpsb_protocol_class, |
2938 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); | 2938 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); |
2939 | out_unreg: | 2939 | out_unreg: |
2940 | hpsb_unregister_highlevel(&raw1394_highlevel); | 2940 | hpsb_unregister_highlevel(&raw1394_highlevel); |
2941 | out: | 2941 | out: |
@@ -2944,8 +2944,8 @@ out: | |||
2944 | 2944 | ||
2945 | static void __exit cleanup_raw1394(void) | 2945 | static void __exit cleanup_raw1394(void) |
2946 | { | 2946 | { |
2947 | class_simple_device_remove(MKDEV( | 2947 | class_device_destroy(hpsb_protocol_class, |
2948 | IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); | 2948 | MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16)); |
2949 | cdev_del(&raw1394_cdev); | 2949 | cdev_del(&raw1394_cdev); |
2950 | devfs_remove(RAW1394_DEVICE_NAME); | 2950 | devfs_remove(RAW1394_DEVICE_NAME); |
2951 | hpsb_unregister_highlevel(&raw1394_highlevel); | 2951 | hpsb_unregister_highlevel(&raw1394_highlevel); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 2bae300aad46..32368f3428ec 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -2648,7 +2648,7 @@ static const char *sbp2scsi_info (struct Scsi_Host *host) | |||
2648 | return "SCSI emulation for IEEE-1394 SBP-2 Devices"; | 2648 | return "SCSI emulation for IEEE-1394 SBP-2 Devices"; |
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, char *buf) | 2651 | static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, char *buf) |
2652 | { | 2652 | { |
2653 | struct scsi_device *sdev; | 2653 | struct scsi_device *sdev; |
2654 | struct scsi_id_instance_data *scsi_id; | 2654 | struct scsi_id_instance_data *scsi_id; |
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index d68c4658f2fc..06759b36afea 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -1370,7 +1370,7 @@ static void video1394_add_host (struct hpsb_host *host) | |||
1370 | hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); | 1370 | hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); |
1371 | 1371 | ||
1372 | minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; | 1372 | minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; |
1373 | class_simple_device_add(hpsb_protocol_class, MKDEV( | 1373 | class_device_create(hpsb_protocol_class, MKDEV( |
1374 | IEEE1394_MAJOR, minor), | 1374 | IEEE1394_MAJOR, minor), |
1375 | NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); | 1375 | NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id); |
1376 | devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), | 1376 | devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor), |
@@ -1384,7 +1384,7 @@ static void video1394_remove_host (struct hpsb_host *host) | |||
1384 | struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host); | 1384 | struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host); |
1385 | 1385 | ||
1386 | if (ohci) { | 1386 | if (ohci) { |
1387 | class_simple_device_remove(MKDEV(IEEE1394_MAJOR, | 1387 | class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR, |
1388 | IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); | 1388 | IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id)); |
1389 | devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id); | 1389 | devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id); |
1390 | } | 1390 | } |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 3a413f72ff6d..90d51b179abe 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -40,9 +40,7 @@ struct ib_port { | |||
40 | struct kobject kobj; | 40 | struct kobject kobj; |
41 | struct ib_device *ibdev; | 41 | struct ib_device *ibdev; |
42 | struct attribute_group gid_group; | 42 | struct attribute_group gid_group; |
43 | struct attribute **gid_attr; | ||
44 | struct attribute_group pkey_group; | 43 | struct attribute_group pkey_group; |
45 | struct attribute **pkey_attr; | ||
46 | u8 port_num; | 44 | u8 port_num; |
47 | }; | 45 | }; |
48 | 46 | ||
@@ -60,8 +58,9 @@ struct port_attribute port_attr_##_name = __ATTR(_name, _mode, _show, _store) | |||
60 | struct port_attribute port_attr_##_name = __ATTR_RO(_name) | 58 | struct port_attribute port_attr_##_name = __ATTR_RO(_name) |
61 | 59 | ||
62 | struct port_table_attribute { | 60 | struct port_table_attribute { |
63 | struct port_attribute attr; | 61 | struct port_attribute attr; |
64 | int index; | 62 | char name[8]; |
63 | int index; | ||
65 | }; | 64 | }; |
66 | 65 | ||
67 | static ssize_t port_attr_show(struct kobject *kobj, | 66 | static ssize_t port_attr_show(struct kobject *kobj, |
@@ -72,7 +71,7 @@ static ssize_t port_attr_show(struct kobject *kobj, | |||
72 | struct ib_port *p = container_of(kobj, struct ib_port, kobj); | 71 | struct ib_port *p = container_of(kobj, struct ib_port, kobj); |
73 | 72 | ||
74 | if (!port_attr->show) | 73 | if (!port_attr->show) |
75 | return 0; | 74 | return -EIO; |
76 | 75 | ||
77 | return port_attr->show(p, port_attr, buf); | 76 | return port_attr->show(p, port_attr, buf); |
78 | } | 77 | } |
@@ -398,17 +397,16 @@ static void ib_port_release(struct kobject *kobj) | |||
398 | struct attribute *a; | 397 | struct attribute *a; |
399 | int i; | 398 | int i; |
400 | 399 | ||
401 | for (i = 0; (a = p->gid_attr[i]); ++i) { | 400 | for (i = 0; (a = p->gid_group.attrs[i]); ++i) |
402 | kfree(a->name); | ||
403 | kfree(a); | 401 | kfree(a); |
404 | } | ||
405 | 402 | ||
406 | for (i = 0; (a = p->pkey_attr[i]); ++i) { | 403 | kfree(p->gid_group.attrs); |
407 | kfree(a->name); | 404 | |
405 | for (i = 0; (a = p->pkey_group.attrs[i]); ++i) | ||
408 | kfree(a); | 406 | kfree(a); |
409 | } | ||
410 | 407 | ||
411 | kfree(p->gid_attr); | 408 | kfree(p->pkey_group.attrs); |
409 | |||
412 | kfree(p); | 410 | kfree(p); |
413 | } | 411 | } |
414 | 412 | ||
@@ -449,58 +447,45 @@ static int ib_device_hotplug(struct class_device *cdev, char **envp, | |||
449 | return 0; | 447 | return 0; |
450 | } | 448 | } |
451 | 449 | ||
452 | static int alloc_group(struct attribute ***attr, | 450 | static struct attribute ** |
453 | ssize_t (*show)(struct ib_port *, | 451 | alloc_group_attrs(ssize_t (*show)(struct ib_port *, |
454 | struct port_attribute *, char *buf), | 452 | struct port_attribute *, char *buf), |
455 | int len) | 453 | int len) |
456 | { | 454 | { |
457 | struct port_table_attribute ***tab_attr = | 455 | struct attribute **tab_attr; |
458 | (struct port_table_attribute ***) attr; | 456 | struct port_table_attribute *element; |
459 | int i; | 457 | int i; |
460 | int ret; | ||
461 | |||
462 | *tab_attr = kmalloc((1 + len) * sizeof *tab_attr, GFP_KERNEL); | ||
463 | if (!*tab_attr) | ||
464 | return -ENOMEM; | ||
465 | 458 | ||
466 | memset(*tab_attr, 0, (1 + len) * sizeof *tab_attr); | 459 | tab_attr = kcalloc(1 + len, sizeof(struct attribute *), GFP_KERNEL); |
460 | if (!tab_attr) | ||
461 | return NULL; | ||
467 | 462 | ||
468 | for (i = 0; i < len; ++i) { | 463 | for (i = 0; i < len; i++) { |
469 | (*tab_attr)[i] = kmalloc(sizeof *(*tab_attr)[i], GFP_KERNEL); | 464 | element = kcalloc(1, sizeof(struct port_table_attribute), |
470 | if (!(*tab_attr)[i]) { | 465 | GFP_KERNEL); |
471 | ret = -ENOMEM; | 466 | if (!element) |
472 | goto err; | 467 | goto err; |
473 | } | ||
474 | memset((*tab_attr)[i], 0, sizeof *(*tab_attr)[i]); | ||
475 | (*tab_attr)[i]->attr.attr.name = kmalloc(8, GFP_KERNEL); | ||
476 | if (!(*tab_attr)[i]->attr.attr.name) { | ||
477 | ret = -ENOMEM; | ||
478 | goto err; | ||
479 | } | ||
480 | 468 | ||
481 | if (snprintf((*tab_attr)[i]->attr.attr.name, 8, "%d", i) >= 8) { | 469 | if (snprintf(element->name, sizeof(element->name), |
482 | ret = -ENOMEM; | 470 | "%d", i) >= sizeof(element->name)) |
483 | goto err; | 471 | goto err; |
484 | } | ||
485 | 472 | ||
486 | (*tab_attr)[i]->attr.attr.mode = S_IRUGO; | 473 | element->attr.attr.name = element->name; |
487 | (*tab_attr)[i]->attr.attr.owner = THIS_MODULE; | 474 | element->attr.attr.mode = S_IRUGO; |
488 | (*tab_attr)[i]->attr.show = show; | 475 | element->attr.attr.owner = THIS_MODULE; |
489 | (*tab_attr)[i]->index = i; | 476 | element->attr.show = show; |
490 | } | 477 | element->index = i; |
491 | |||
492 | return 0; | ||
493 | 478 | ||
494 | err: | 479 | tab_attr[i] = &element->attr.attr; |
495 | for (i = 0; i < len; ++i) { | ||
496 | if ((*tab_attr)[i]) | ||
497 | kfree((*tab_attr)[i]->attr.attr.name); | ||
498 | kfree((*tab_attr)[i]); | ||
499 | } | 480 | } |
500 | 481 | ||
501 | kfree(*tab_attr); | 482 | return tab_attr; |
502 | 483 | ||
503 | return ret; | 484 | err: |
485 | while (--i >= 0) | ||
486 | kfree(tab_attr[i]); | ||
487 | kfree(tab_attr); | ||
488 | return NULL; | ||
504 | } | 489 | } |
505 | 490 | ||
506 | static int add_port(struct ib_device *device, int port_num) | 491 | static int add_port(struct ib_device *device, int port_num) |
@@ -541,23 +526,20 @@ static int add_port(struct ib_device *device, int port_num) | |||
541 | if (ret) | 526 | if (ret) |
542 | goto err_put; | 527 | goto err_put; |
543 | 528 | ||
544 | ret = alloc_group(&p->gid_attr, show_port_gid, attr.gid_tbl_len); | ||
545 | if (ret) | ||
546 | goto err_remove_pma; | ||
547 | |||
548 | p->gid_group.name = "gids"; | 529 | p->gid_group.name = "gids"; |
549 | p->gid_group.attrs = p->gid_attr; | 530 | p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); |
531 | if (!p->gid_group.attrs) | ||
532 | goto err_remove_pma; | ||
550 | 533 | ||
551 | ret = sysfs_create_group(&p->kobj, &p->gid_group); | 534 | ret = sysfs_create_group(&p->kobj, &p->gid_group); |
552 | if (ret) | 535 | if (ret) |
553 | goto err_free_gid; | 536 | goto err_free_gid; |
554 | 537 | ||
555 | ret = alloc_group(&p->pkey_attr, show_port_pkey, attr.pkey_tbl_len); | ||
556 | if (ret) | ||
557 | goto err_remove_gid; | ||
558 | |||
559 | p->pkey_group.name = "pkeys"; | 538 | p->pkey_group.name = "pkeys"; |
560 | p->pkey_group.attrs = p->pkey_attr; | 539 | p->pkey_group.attrs = alloc_group_attrs(show_port_pkey, |
540 | attr.pkey_tbl_len); | ||
541 | if (!p->pkey_group.attrs) | ||
542 | goto err_remove_gid; | ||
561 | 543 | ||
562 | ret = sysfs_create_group(&p->kobj, &p->pkey_group); | 544 | ret = sysfs_create_group(&p->kobj, &p->pkey_group); |
563 | if (ret) | 545 | if (ret) |
@@ -568,23 +550,19 @@ static int add_port(struct ib_device *device, int port_num) | |||
568 | return 0; | 550 | return 0; |
569 | 551 | ||
570 | err_free_pkey: | 552 | err_free_pkey: |
571 | for (i = 0; i < attr.pkey_tbl_len; ++i) { | 553 | for (i = 0; i < attr.pkey_tbl_len; ++i) |
572 | kfree(p->pkey_attr[i]->name); | 554 | kfree(p->pkey_group.attrs[i]); |
573 | kfree(p->pkey_attr[i]); | ||
574 | } | ||
575 | 555 | ||
576 | kfree(p->pkey_attr); | 556 | kfree(p->pkey_group.attrs); |
577 | 557 | ||
578 | err_remove_gid: | 558 | err_remove_gid: |
579 | sysfs_remove_group(&p->kobj, &p->gid_group); | 559 | sysfs_remove_group(&p->kobj, &p->gid_group); |
580 | 560 | ||
581 | err_free_gid: | 561 | err_free_gid: |
582 | for (i = 0; i < attr.gid_tbl_len; ++i) { | 562 | for (i = 0; i < attr.gid_tbl_len; ++i) |
583 | kfree(p->gid_attr[i]->name); | 563 | kfree(p->gid_group.attrs[i]); |
584 | kfree(p->gid_attr[i]); | ||
585 | } | ||
586 | 564 | ||
587 | kfree(p->gid_attr); | 565 | kfree(p->gid_group.attrs); |
588 | 566 | ||
589 | err_remove_pma: | 567 | err_remove_pma: |
590 | sysfs_remove_group(&p->kobj, &pma_group); | 568 | sysfs_remove_group(&p->kobj, &pma_group); |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 17552a29978b..556264b43425 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -431,9 +431,9 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct | |||
431 | 431 | ||
432 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), | 432 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), |
433 | S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor); | 433 | S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor); |
434 | class_simple_device_add(input_class, | 434 | class_device_create(input_class, |
435 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), | 435 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), |
436 | dev->dev, "event%d", minor); | 436 | dev->dev, "event%d", minor); |
437 | 437 | ||
438 | return &evdev->handle; | 438 | return &evdev->handle; |
439 | } | 439 | } |
@@ -443,7 +443,8 @@ static void evdev_disconnect(struct input_handle *handle) | |||
443 | struct evdev *evdev = handle->private; | 443 | struct evdev *evdev = handle->private; |
444 | struct evdev_list *list; | 444 | struct evdev_list *list; |
445 | 445 | ||
446 | class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); | 446 | class_device_destroy(input_class, |
447 | MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); | ||
447 | devfs_remove("input/event%d", evdev->minor); | 448 | devfs_remove("input/event%d", evdev->minor); |
448 | evdev->exist = 0; | 449 | evdev->exist = 0; |
449 | 450 | ||
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index f20c3f23388b..9b8ff396e6f8 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -453,13 +453,13 @@ static int gameport_thread(void *nothing) | |||
453 | * Gameport port operations | 453 | * Gameport port operations |
454 | */ | 454 | */ |
455 | 455 | ||
456 | static ssize_t gameport_show_description(struct device *dev, char *buf) | 456 | static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) |
457 | { | 457 | { |
458 | struct gameport *gameport = to_gameport_port(dev); | 458 | struct gameport *gameport = to_gameport_port(dev); |
459 | return sprintf(buf, "%s\n", gameport->name); | 459 | return sprintf(buf, "%s\n", gameport->name); |
460 | } | 460 | } |
461 | 461 | ||
462 | static ssize_t gameport_rebind_driver(struct device *dev, const char *buf, size_t count) | 462 | static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
463 | { | 463 | { |
464 | struct gameport *gameport = to_gameport_port(dev); | 464 | struct gameport *gameport = to_gameport_port(dev); |
465 | struct device_driver *drv; | 465 | struct device_driver *drv; |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 3385dd03abfc..83c77c990dda 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -702,13 +702,13 @@ static int __init input_proc_init(void) | |||
702 | static inline int input_proc_init(void) { return 0; } | 702 | static inline int input_proc_init(void) { return 0; } |
703 | #endif | 703 | #endif |
704 | 704 | ||
705 | struct class_simple *input_class; | 705 | struct class *input_class; |
706 | 706 | ||
707 | static int __init input_init(void) | 707 | static int __init input_init(void) |
708 | { | 708 | { |
709 | int retval = -ENOMEM; | 709 | int retval = -ENOMEM; |
710 | 710 | ||
711 | input_class = class_simple_create(THIS_MODULE, "input"); | 711 | input_class = class_create(THIS_MODULE, "input"); |
712 | if (IS_ERR(input_class)) | 712 | if (IS_ERR(input_class)) |
713 | return PTR_ERR(input_class); | 713 | return PTR_ERR(input_class); |
714 | input_proc_init(); | 714 | input_proc_init(); |
@@ -718,7 +718,7 @@ static int __init input_init(void) | |||
718 | remove_proc_entry("devices", proc_bus_input_dir); | 718 | remove_proc_entry("devices", proc_bus_input_dir); |
719 | remove_proc_entry("handlers", proc_bus_input_dir); | 719 | remove_proc_entry("handlers", proc_bus_input_dir); |
720 | remove_proc_entry("input", proc_bus); | 720 | remove_proc_entry("input", proc_bus); |
721 | class_simple_destroy(input_class); | 721 | class_destroy(input_class); |
722 | return retval; | 722 | return retval; |
723 | } | 723 | } |
724 | 724 | ||
@@ -728,7 +728,7 @@ static int __init input_init(void) | |||
728 | remove_proc_entry("handlers", proc_bus_input_dir); | 728 | remove_proc_entry("handlers", proc_bus_input_dir); |
729 | remove_proc_entry("input", proc_bus); | 729 | remove_proc_entry("input", proc_bus); |
730 | unregister_chrdev(INPUT_MAJOR, "input"); | 730 | unregister_chrdev(INPUT_MAJOR, "input"); |
731 | class_simple_destroy(input_class); | 731 | class_destroy(input_class); |
732 | } | 732 | } |
733 | return retval; | 733 | return retval; |
734 | } | 734 | } |
@@ -741,7 +741,7 @@ static void __exit input_exit(void) | |||
741 | 741 | ||
742 | devfs_remove("input"); | 742 | devfs_remove("input"); |
743 | unregister_chrdev(INPUT_MAJOR, "input"); | 743 | unregister_chrdev(INPUT_MAJOR, "input"); |
744 | class_simple_destroy(input_class); | 744 | class_destroy(input_class); |
745 | } | 745 | } |
746 | 746 | ||
747 | subsys_initcall(input_init); | 747 | subsys_initcall(input_init); |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 627d343dfba1..39775fc380c7 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -452,9 +452,9 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct | |||
452 | 452 | ||
453 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), | 453 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), |
454 | S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor); | 454 | S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor); |
455 | class_simple_device_add(input_class, | 455 | class_device_create(input_class, |
456 | MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), | 456 | MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), |
457 | dev->dev, "js%d", minor); | 457 | dev->dev, "js%d", minor); |
458 | 458 | ||
459 | return &joydev->handle; | 459 | return &joydev->handle; |
460 | } | 460 | } |
@@ -464,7 +464,7 @@ static void joydev_disconnect(struct input_handle *handle) | |||
464 | struct joydev *joydev = handle->private; | 464 | struct joydev *joydev = handle->private; |
465 | struct joydev_list *list; | 465 | struct joydev_list *list; |
466 | 466 | ||
467 | class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); | 467 | class_device_destroy(input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); |
468 | devfs_remove("input/js%d", joydev->minor); | 468 | devfs_remove("input/js%d", joydev->minor); |
469 | joydev->exist = 0; | 469 | joydev->exist = 0; |
470 | 470 | ||
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 48fdf1e517cf..82fad9a23ace 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -219,11 +219,11 @@ static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t | |||
219 | #define ATKBD_DEFINE_ATTR(_name) \ | 219 | #define ATKBD_DEFINE_ATTR(_name) \ |
220 | static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ | 220 | static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ |
221 | static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ | 221 | static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ |
222 | static ssize_t atkbd_do_show_##_name(struct device *d, char *b) \ | 222 | static ssize_t atkbd_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ |
223 | { \ | 223 | { \ |
224 | return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ | 224 | return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ |
225 | } \ | 225 | } \ |
226 | static ssize_t atkbd_do_set_##_name(struct device *d, const char *b, size_t s) \ | 226 | static ssize_t atkbd_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s) \ |
227 | { \ | 227 | { \ |
228 | return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ | 228 | return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ |
229 | } \ | 229 | } \ |
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index bda5b065d03c..79e17a0c4664 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -91,11 +91,11 @@ ssize_t psmouse_attr_set_helper(struct device *dev, const char *buf, size_t coun | |||
91 | #define PSMOUSE_DEFINE_ATTR(_name) \ | 91 | #define PSMOUSE_DEFINE_ATTR(_name) \ |
92 | static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \ | 92 | static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \ |
93 | static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\ | 93 | static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\ |
94 | static ssize_t psmouse_do_show_##_name(struct device *d, char *b) \ | 94 | static ssize_t psmouse_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ |
95 | { \ | 95 | { \ |
96 | return psmouse_attr_show_helper(d, b, psmouse_attr_show_##_name); \ | 96 | return psmouse_attr_show_helper(d, b, psmouse_attr_show_##_name); \ |
97 | } \ | 97 | } \ |
98 | static ssize_t psmouse_do_set_##_name(struct device *d, const char *b, size_t s)\ | 98 | static ssize_t psmouse_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s)\ |
99 | { \ | 99 | { \ |
100 | return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \ | 100 | return psmouse_attr_set_helper(d, b, s, psmouse_attr_set_##_name); \ |
101 | } \ | 101 | } \ |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 96fb9870834a..062848ac7e6b 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -647,9 +647,9 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru | |||
647 | 647 | ||
648 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 648 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
649 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); | 649 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor); |
650 | class_simple_device_add(input_class, | 650 | class_device_create(input_class, |
651 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), | 651 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), |
652 | dev->dev, "mouse%d", minor); | 652 | dev->dev, "mouse%d", minor); |
653 | 653 | ||
654 | return &mousedev->handle; | 654 | return &mousedev->handle; |
655 | } | 655 | } |
@@ -659,7 +659,8 @@ static void mousedev_disconnect(struct input_handle *handle) | |||
659 | struct mousedev *mousedev = handle->private; | 659 | struct mousedev *mousedev = handle->private; |
660 | struct mousedev_list *list; | 660 | struct mousedev_list *list; |
661 | 661 | ||
662 | class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | 662 | class_device_destroy(input_class, |
663 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); | ||
663 | devfs_remove("input/mouse%d", mousedev->minor); | 664 | devfs_remove("input/mouse%d", mousedev->minor); |
664 | mousedev->exist = 0; | 665 | mousedev->exist = 0; |
665 | 666 | ||
@@ -735,8 +736,8 @@ static int __init mousedev_init(void) | |||
735 | 736 | ||
736 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), | 737 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), |
737 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); | 738 | S_IFCHR|S_IRUGO|S_IWUSR, "input/mice"); |
738 | class_simple_device_add(input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), | 739 | class_device_create(input_class, |
739 | NULL, "mice"); | 740 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); |
740 | 741 | ||
741 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX | 742 | #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX |
742 | if (!(psaux_registered = !misc_register(&psaux_mouse))) | 743 | if (!(psaux_registered = !misc_register(&psaux_mouse))) |
@@ -755,7 +756,8 @@ static void __exit mousedev_exit(void) | |||
755 | misc_deregister(&psaux_mouse); | 756 | misc_deregister(&psaux_mouse); |
756 | #endif | 757 | #endif |
757 | devfs_remove("input/mice"); | 758 | devfs_remove("input/mice"); |
758 | class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); | 759 | class_device_destroy(input_class, |
760 | MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); | ||
759 | input_unregister_handler(&mousedev_handler); | 761 | input_unregister_handler(&mousedev_handler); |
760 | } | 762 | } |
761 | 763 | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 0beacb77ee18..feab4970406e 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -358,31 +358,31 @@ static int serio_thread(void *nothing) | |||
358 | * Serio port operations | 358 | * Serio port operations |
359 | */ | 359 | */ |
360 | 360 | ||
361 | static ssize_t serio_show_description(struct device *dev, char *buf) | 361 | static ssize_t serio_show_description(struct device *dev, struct device_attribute *attr, char *buf) |
362 | { | 362 | { |
363 | struct serio *serio = to_serio_port(dev); | 363 | struct serio *serio = to_serio_port(dev); |
364 | return sprintf(buf, "%s\n", serio->name); | 364 | return sprintf(buf, "%s\n", serio->name); |
365 | } | 365 | } |
366 | 366 | ||
367 | static ssize_t serio_show_id_type(struct device *dev, char *buf) | 367 | static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) |
368 | { | 368 | { |
369 | struct serio *serio = to_serio_port(dev); | 369 | struct serio *serio = to_serio_port(dev); |
370 | return sprintf(buf, "%02x\n", serio->id.type); | 370 | return sprintf(buf, "%02x\n", serio->id.type); |
371 | } | 371 | } |
372 | 372 | ||
373 | static ssize_t serio_show_id_proto(struct device *dev, char *buf) | 373 | static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf) |
374 | { | 374 | { |
375 | struct serio *serio = to_serio_port(dev); | 375 | struct serio *serio = to_serio_port(dev); |
376 | return sprintf(buf, "%02x\n", serio->id.proto); | 376 | return sprintf(buf, "%02x\n", serio->id.proto); |
377 | } | 377 | } |
378 | 378 | ||
379 | static ssize_t serio_show_id_id(struct device *dev, char *buf) | 379 | static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf) |
380 | { | 380 | { |
381 | struct serio *serio = to_serio_port(dev); | 381 | struct serio *serio = to_serio_port(dev); |
382 | return sprintf(buf, "%02x\n", serio->id.id); | 382 | return sprintf(buf, "%02x\n", serio->id.id); |
383 | } | 383 | } |
384 | 384 | ||
385 | static ssize_t serio_show_id_extra(struct device *dev, char *buf) | 385 | static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf) |
386 | { | 386 | { |
387 | struct serio *serio = to_serio_port(dev); | 387 | struct serio *serio = to_serio_port(dev); |
388 | return sprintf(buf, "%02x\n", serio->id.extra); | 388 | return sprintf(buf, "%02x\n", serio->id.extra); |
@@ -406,7 +406,7 @@ static struct attribute_group serio_id_attr_group = { | |||
406 | .attrs = serio_device_id_attrs, | 406 | .attrs = serio_device_id_attrs, |
407 | }; | 407 | }; |
408 | 408 | ||
409 | static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) | 409 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
410 | { | 410 | { |
411 | struct serio *serio = to_serio_port(dev); | 411 | struct serio *serio = to_serio_port(dev); |
412 | struct device_driver *drv; | 412 | struct device_driver *drv; |
@@ -437,13 +437,13 @@ static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t c | |||
437 | return retval; | 437 | return retval; |
438 | } | 438 | } |
439 | 439 | ||
440 | static ssize_t serio_show_bind_mode(struct device *dev, char *buf) | 440 | static ssize_t serio_show_bind_mode(struct device *dev, struct device_attribute *attr, char *buf) |
441 | { | 441 | { |
442 | struct serio *serio = to_serio_port(dev); | 442 | struct serio *serio = to_serio_port(dev); |
443 | return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto"); | 443 | return sprintf(buf, "%s\n", serio->manual_bind ? "manual" : "auto"); |
444 | } | 444 | } |
445 | 445 | ||
446 | static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t count) | 446 | static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
447 | { | 447 | { |
448 | struct serio *serio = to_serio_port(dev); | 448 | struct serio *serio = to_serio_port(dev); |
449 | int retval; | 449 | int retval; |
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index d0afba85720b..50c63a155156 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c | |||
@@ -414,9 +414,9 @@ static struct input_handle *tsdev_connect(struct input_handler *handler, | |||
414 | S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor); | 414 | S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor); |
415 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2), | 415 | devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2), |
416 | S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor); | 416 | S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor); |
417 | class_simple_device_add(input_class, | 417 | class_device_create(input_class, |
418 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), | 418 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), |
419 | dev->dev, "ts%d", minor); | 419 | dev->dev, "ts%d", minor); |
420 | 420 | ||
421 | return &tsdev->handle; | 421 | return &tsdev->handle; |
422 | } | 422 | } |
@@ -426,7 +426,8 @@ static void tsdev_disconnect(struct input_handle *handle) | |||
426 | struct tsdev *tsdev = handle->private; | 426 | struct tsdev *tsdev = handle->private; |
427 | struct tsdev_list *list; | 427 | struct tsdev_list *list; |
428 | 428 | ||
429 | class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); | 429 | class_device_destroy(input_class, |
430 | MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); | ||
430 | devfs_remove("input/ts%d", tsdev->minor); | 431 | devfs_remove("input/ts%d", tsdev->minor); |
431 | devfs_remove("input/tsraw%d", tsdev->minor); | 432 | devfs_remove("input/tsraw%d", tsdev->minor); |
432 | tsdev->exist = 0; | 433 | tsdev->exist = 0; |
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 12dee8e9fbbe..04fb606b5ddd 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -58,7 +58,7 @@ MODULE_LICENSE("GPL"); | |||
58 | 58 | ||
59 | /* -------- driver information -------------------------------------- */ | 59 | /* -------- driver information -------------------------------------- */ |
60 | 60 | ||
61 | static struct class_simple *capi_class; | 61 | static struct class *capi_class; |
62 | 62 | ||
63 | static int capi_major = 68; /* allocated */ | 63 | static int capi_major = 68; /* allocated */ |
64 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 64 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
@@ -1499,20 +1499,20 @@ static int __init capi_init(void) | |||
1499 | return -EIO; | 1499 | return -EIO; |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | capi_class = class_simple_create(THIS_MODULE, "capi"); | 1502 | capi_class = class_create(THIS_MODULE, "capi"); |
1503 | if (IS_ERR(capi_class)) { | 1503 | if (IS_ERR(capi_class)) { |
1504 | unregister_chrdev(capi_major, "capi20"); | 1504 | unregister_chrdev(capi_major, "capi20"); |
1505 | return PTR_ERR(capi_class); | 1505 | return PTR_ERR(capi_class); |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | class_simple_device_add(capi_class, MKDEV(capi_major, 0), NULL, "capi"); | 1508 | class_device_create(capi_class, MKDEV(capi_major, 0), NULL, "capi"); |
1509 | devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR, | 1509 | devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR, |
1510 | "isdn/capi20"); | 1510 | "isdn/capi20"); |
1511 | 1511 | ||
1512 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 1512 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
1513 | if (capinc_tty_init() < 0) { | 1513 | if (capinc_tty_init() < 0) { |
1514 | class_simple_device_remove(MKDEV(capi_major, 0)); | 1514 | class_device_destroy(capi_class, MKDEV(capi_major, 0)); |
1515 | class_simple_destroy(capi_class); | 1515 | class_destroy(capi_class); |
1516 | unregister_chrdev(capi_major, "capi20"); | 1516 | unregister_chrdev(capi_major, "capi20"); |
1517 | return -ENOMEM; | 1517 | return -ENOMEM; |
1518 | } | 1518 | } |
@@ -1539,8 +1539,8 @@ static void __exit capi_exit(void) | |||
1539 | { | 1539 | { |
1540 | proc_exit(); | 1540 | proc_exit(); |
1541 | 1541 | ||
1542 | class_simple_device_remove(MKDEV(capi_major, 0)); | 1542 | class_device_destroy(capi_class, MKDEV(capi_major, 0)); |
1543 | class_simple_destroy(capi_class); | 1543 | class_destroy(capi_class); |
1544 | unregister_chrdev(capi_major, "capi20"); | 1544 | unregister_chrdev(capi_major, "capi20"); |
1545 | devfs_remove("isdn/capi20"); | 1545 | devfs_remove("isdn/capi20"); |
1546 | 1546 | ||
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 7297c77f99cf..493e2afa191c 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -77,7 +77,7 @@ static struct adb_driver *adb_driver_list[] = { | |||
77 | NULL | 77 | NULL |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static struct class_simple *adb_dev_class; | 80 | static struct class *adb_dev_class; |
81 | 81 | ||
82 | struct adb_driver *adb_controller; | 82 | struct adb_driver *adb_controller; |
83 | struct notifier_block *adb_client_list = NULL; | 83 | struct notifier_block *adb_client_list = NULL; |
@@ -902,9 +902,8 @@ adbdev_init(void) | |||
902 | 902 | ||
903 | devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb"); | 903 | devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb"); |
904 | 904 | ||
905 | adb_dev_class = class_simple_create(THIS_MODULE, "adb"); | 905 | adb_dev_class = class_create(THIS_MODULE, "adb"); |
906 | if (IS_ERR(adb_dev_class)) { | 906 | if (IS_ERR(adb_dev_class)) |
907 | return; | 907 | return; |
908 | } | 908 | class_device_create(adb_dev_class, MKDEV(ADB_MAJOR, 0), NULL, "adb"); |
909 | class_simple_device_add(adb_dev_class, MKDEV(ADB_MAJOR, 0), NULL, "adb"); | ||
910 | } | 909 | } |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index d09308f30960..5ba190ce14a0 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -455,21 +455,22 @@ static int attach_one_thermostat(struct i2c_adapter *adapter, int addr, | |||
455 | * pass around to the attribute functions, so we don't really have | 455 | * pass around to the attribute functions, so we don't really have |
456 | * choice but implement a bunch of them... | 456 | * choice but implement a bunch of them... |
457 | * | 457 | * |
458 | * FIXME, it does now... | ||
458 | */ | 459 | */ |
459 | #define BUILD_SHOW_FUNC_INT(name, data) \ | 460 | #define BUILD_SHOW_FUNC_INT(name, data) \ |
460 | static ssize_t show_##name(struct device *dev, char *buf) \ | 461 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
461 | { \ | 462 | { \ |
462 | return sprintf(buf, "%d\n", data); \ | 463 | return sprintf(buf, "%d\n", data); \ |
463 | } | 464 | } |
464 | 465 | ||
465 | #define BUILD_SHOW_FUNC_STR(name, data) \ | 466 | #define BUILD_SHOW_FUNC_STR(name, data) \ |
466 | static ssize_t show_##name(struct device *dev, char *buf) \ | 467 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
467 | { \ | 468 | { \ |
468 | return sprintf(buf, "%s\n", data); \ | 469 | return sprintf(buf, "%s\n", data); \ |
469 | } | 470 | } |
470 | 471 | ||
471 | #define BUILD_SHOW_FUNC_FAN(name, data) \ | 472 | #define BUILD_SHOW_FUNC_FAN(name, data) \ |
472 | static ssize_t show_##name(struct device *dev, char *buf) \ | 473 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
473 | { \ | 474 | { \ |
474 | return sprintf(buf, "%d (%d rpm)\n", \ | 475 | return sprintf(buf, "%d (%d rpm)\n", \ |
475 | thermostat->last_speed[data], \ | 476 | thermostat->last_speed[data], \ |
@@ -478,7 +479,7 @@ static ssize_t show_##name(struct device *dev, char *buf) \ | |||
478 | } | 479 | } |
479 | 480 | ||
480 | #define BUILD_STORE_FUNC_DEG(name, data) \ | 481 | #define BUILD_STORE_FUNC_DEG(name, data) \ |
481 | static ssize_t store_##name(struct device *dev, const char *buf, size_t n) \ | 482 | static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \ |
482 | { \ | 483 | { \ |
483 | int val; \ | 484 | int val; \ |
484 | int i; \ | 485 | int i; \ |
@@ -491,7 +492,7 @@ static ssize_t store_##name(struct device *dev, const char *buf, size_t n) \ | |||
491 | } | 492 | } |
492 | 493 | ||
493 | #define BUILD_STORE_FUNC_INT(name, data) \ | 494 | #define BUILD_STORE_FUNC_INT(name, data) \ |
494 | static ssize_t store_##name(struct device *dev, const char *buf, size_t n) \ | 495 | static ssize_t store_##name(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) \ |
495 | { \ | 496 | { \ |
496 | u32 val; \ | 497 | u32 val; \ |
497 | val = simple_strtoul(buf, NULL, 10); \ | 498 | val = simple_strtoul(buf, NULL, 10); \ |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 82336a5a5474..feb4e2413858 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -685,7 +685,7 @@ static void fetch_cpu_pumps_minmax(void) | |||
685 | * the input twice... I accept patches :) | 685 | * the input twice... I accept patches :) |
686 | */ | 686 | */ |
687 | #define BUILD_SHOW_FUNC_FIX(name, data) \ | 687 | #define BUILD_SHOW_FUNC_FIX(name, data) \ |
688 | static ssize_t show_##name(struct device *dev, char *buf) \ | 688 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
689 | { \ | 689 | { \ |
690 | ssize_t r; \ | 690 | ssize_t r; \ |
691 | down(&driver_lock); \ | 691 | down(&driver_lock); \ |
@@ -694,7 +694,7 @@ static ssize_t show_##name(struct device *dev, char *buf) \ | |||
694 | return r; \ | 694 | return r; \ |
695 | } | 695 | } |
696 | #define BUILD_SHOW_FUNC_INT(name, data) \ | 696 | #define BUILD_SHOW_FUNC_INT(name, data) \ |
697 | static ssize_t show_##name(struct device *dev, char *buf) \ | 697 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
698 | { \ | 698 | { \ |
699 | return sprintf(buf, "%d", data); \ | 699 | return sprintf(buf, "%d", data); \ |
700 | } | 700 | } |
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index c153699d0f84..0bdb47f08c2a 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -107,13 +107,13 @@ print_temp( const char *s, int temp ) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | static ssize_t | 109 | static ssize_t |
110 | show_cpu_temperature( struct device *dev, char *buf ) | 110 | show_cpu_temperature( struct device *dev, struct device_attribute *attr, char *buf ) |
111 | { | 111 | { |
112 | return sprintf(buf, "%d.%d\n", x.temp>>8, (x.temp & 255)*10/256 ); | 112 | return sprintf(buf, "%d.%d\n", x.temp>>8, (x.temp & 255)*10/256 ); |
113 | } | 113 | } |
114 | 114 | ||
115 | static ssize_t | 115 | static ssize_t |
116 | show_case_temperature( struct device *dev, char *buf ) | 116 | show_case_temperature( struct device *dev, struct device_attribute *attr, char *buf ) |
117 | { | 117 | { |
118 | return sprintf(buf, "%d.%d\n", x.casetemp>>8, (x.casetemp & 255)*10/256 ); | 118 | return sprintf(buf, "%d.%d\n", x.casetemp>>8, (x.casetemp & 255)*10/256 ); |
119 | } | 119 | } |
diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c index ff9be67c2a15..09baa43b2599 100644 --- a/drivers/mca/mca-bus.c +++ b/drivers/mca/mca-bus.c | |||
@@ -69,7 +69,7 @@ struct bus_type mca_bus_type = { | |||
69 | }; | 69 | }; |
70 | EXPORT_SYMBOL (mca_bus_type); | 70 | EXPORT_SYMBOL (mca_bus_type); |
71 | 71 | ||
72 | static ssize_t mca_show_pos_id(struct device *dev, char *buf) | 72 | static ssize_t mca_show_pos_id(struct device *dev, struct device_attribute *attr, char *buf) |
73 | { | 73 | { |
74 | /* four digits, \n and trailing \0 */ | 74 | /* four digits, \n and trailing \0 */ |
75 | struct mca_device *mca_dev = to_mca_device(dev); | 75 | struct mca_device *mca_dev = to_mca_device(dev); |
@@ -81,7 +81,7 @@ static ssize_t mca_show_pos_id(struct device *dev, char *buf) | |||
81 | len = sprintf(buf, "none\n"); | 81 | len = sprintf(buf, "none\n"); |
82 | return len; | 82 | return len; |
83 | } | 83 | } |
84 | static ssize_t mca_show_pos(struct device *dev, char *buf) | 84 | static ssize_t mca_show_pos(struct device *dev, struct device_attribute *attr, char *buf) |
85 | { | 85 | { |
86 | /* enough for 8 two byte hex chars plus space and new line */ | 86 | /* enough for 8 two byte hex chars plus space and new line */ |
87 | int j, len=0; | 87 | int j, len=0; |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 9d9662f4b8e6..4b7adca3e286 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -56,8 +56,7 @@ static const char * const dnames[] = { | |||
56 | #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) | 56 | #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) |
57 | #define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) | 57 | #define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) |
58 | 58 | ||
59 | struct class_simple *dvb_class; | 59 | static struct class *dvb_class; |
60 | EXPORT_SYMBOL(dvb_class); | ||
61 | 60 | ||
62 | static struct dvb_device* dvbdev_find_device (int minor) | 61 | static struct dvb_device* dvbdev_find_device (int minor) |
63 | { | 62 | { |
@@ -236,8 +235,8 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
236 | S_IFCHR | S_IRUSR | S_IWUSR, | 235 | S_IFCHR | S_IRUSR | S_IWUSR, |
237 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); | 236 | "dvb/adapter%d/%s%d", adap->num, dnames[type], id); |
238 | 237 | ||
239 | class_simple_device_add(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), | 238 | class_device_create(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), |
240 | NULL, "dvb%d.%s%d", adap->num, dnames[type], id); | 239 | NULL, "dvb%d.%s%d", adap->num, dnames[type], id); |
241 | 240 | ||
242 | dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", | 241 | dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", |
243 | adap->num, dnames[type], id, nums2minor(adap->num, type, id), | 242 | adap->num, dnames[type], id, nums2minor(adap->num, type, id), |
@@ -256,7 +255,7 @@ void dvb_unregister_device(struct dvb_device *dvbdev) | |||
256 | devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num, | 255 | devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num, |
257 | dnames[dvbdev->type], dvbdev->id); | 256 | dnames[dvbdev->type], dvbdev->id); |
258 | 257 | ||
259 | class_simple_device_remove(MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, | 258 | class_device_destroy(dvb_class, MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, |
260 | dvbdev->type, dvbdev->id))); | 259 | dvbdev->type, dvbdev->id))); |
261 | 260 | ||
262 | list_del (&dvbdev->list_head); | 261 | list_del (&dvbdev->list_head); |
@@ -412,7 +411,7 @@ static int __init init_dvbdev(void) | |||
412 | 411 | ||
413 | devfs_mk_dir("dvb"); | 412 | devfs_mk_dir("dvb"); |
414 | 413 | ||
415 | dvb_class = class_simple_create(THIS_MODULE, "dvb"); | 414 | dvb_class = class_create(THIS_MODULE, "dvb"); |
416 | if (IS_ERR(dvb_class)) { | 415 | if (IS_ERR(dvb_class)) { |
417 | retval = PTR_ERR(dvb_class); | 416 | retval = PTR_ERR(dvb_class); |
418 | goto error; | 417 | goto error; |
@@ -429,7 +428,7 @@ error: | |||
429 | static void __exit exit_dvbdev(void) | 428 | static void __exit exit_dvbdev(void) |
430 | { | 429 | { |
431 | devfs_remove("dvb"); | 430 | devfs_remove("dvb"); |
432 | class_simple_destroy(dvb_class); | 431 | class_destroy(dvb_class); |
433 | cdev_del(&dvb_device_cdev); | 432 | cdev_del(&dvb_device_cdev); |
434 | unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); | 433 | unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); |
435 | } | 434 | } |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 48ff314cdfbf..a0078ae5b9b8 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -2338,7 +2338,7 @@ slave_configure_exit: | |||
2338 | } | 2338 | } |
2339 | 2339 | ||
2340 | ssize_t | 2340 | ssize_t |
2341 | mptscsih_store_queue_depth(struct device *dev, const char *buf, size_t count) | 2341 | mptscsih_store_queue_depth(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2342 | { | 2342 | { |
2343 | int depth; | 2343 | int depth; |
2344 | struct scsi_device *sdev = to_scsi_device(dev); | 2344 | struct scsi_device *sdev = to_scsi_device(dev); |
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index 9f519836effa..d73aec33e16a 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h | |||
@@ -103,5 +103,5 @@ extern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_F | |||
103 | extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); | 103 | extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); |
104 | extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); | 104 | extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); |
105 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); | 105 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); |
106 | extern ssize_t mptscsih_store_queue_depth(struct device *dev, const char *buf, size_t count); | 106 | extern ssize_t mptscsih_store_queue_depth(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); |
107 | extern void mptscsih_timer_expired(unsigned long data); | 107 | extern void mptscsih_timer_expired(unsigned long data); |
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c index 29a56e9cd5b3..5556cd3b5559 100644 --- a/drivers/mmc/mmc_sysfs.c +++ b/drivers/mmc/mmc_sysfs.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #define to_mmc_driver(d) container_of(d, struct mmc_driver, drv) | 22 | #define to_mmc_driver(d) container_of(d, struct mmc_driver, drv) |
23 | 23 | ||
24 | #define MMC_ATTR(name, fmt, args...) \ | 24 | #define MMC_ATTR(name, fmt, args...) \ |
25 | static ssize_t mmc_##name##_show (struct device *dev, char *buf) \ | 25 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
26 | { \ | 26 | { \ |
27 | struct mmc_card *card = dev_to_mmc_card(dev); \ | 27 | struct mmc_card *card = dev_to_mmc_card(dev); \ |
28 | return sprintf(buf, fmt, args); \ | 28 | return sprintf(buf, fmt, args); \ |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index ad4b58af6b76..ab726ab43798 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -273,7 +273,7 @@ static int ppp_connect_channel(struct channel *pch, int unit); | |||
273 | static int ppp_disconnect_channel(struct channel *pch); | 273 | static int ppp_disconnect_channel(struct channel *pch); |
274 | static void ppp_destroy_channel(struct channel *pch); | 274 | static void ppp_destroy_channel(struct channel *pch); |
275 | 275 | ||
276 | static struct class_simple *ppp_class; | 276 | static struct class *ppp_class; |
277 | 277 | ||
278 | /* Translates a PPP protocol number to a NP index (NP == network protocol) */ | 278 | /* Translates a PPP protocol number to a NP index (NP == network protocol) */ |
279 | static inline int proto_to_npindex(int proto) | 279 | static inline int proto_to_npindex(int proto) |
@@ -858,12 +858,12 @@ static int __init ppp_init(void) | |||
858 | printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); | 858 | printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); |
859 | err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); | 859 | err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); |
860 | if (!err) { | 860 | if (!err) { |
861 | ppp_class = class_simple_create(THIS_MODULE, "ppp"); | 861 | ppp_class = class_create(THIS_MODULE, "ppp"); |
862 | if (IS_ERR(ppp_class)) { | 862 | if (IS_ERR(ppp_class)) { |
863 | err = PTR_ERR(ppp_class); | 863 | err = PTR_ERR(ppp_class); |
864 | goto out_chrdev; | 864 | goto out_chrdev; |
865 | } | 865 | } |
866 | class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); | 866 | class_device_create(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); |
867 | err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), | 867 | err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), |
868 | S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); | 868 | S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); |
869 | if (err) | 869 | if (err) |
@@ -876,8 +876,8 @@ out: | |||
876 | return err; | 876 | return err; |
877 | 877 | ||
878 | out_class: | 878 | out_class: |
879 | class_simple_device_remove(MKDEV(PPP_MAJOR,0)); | 879 | class_device_destroy(ppp_class, MKDEV(PPP_MAJOR,0)); |
880 | class_simple_destroy(ppp_class); | 880 | class_destroy(ppp_class); |
881 | out_chrdev: | 881 | out_chrdev: |
882 | unregister_chrdev(PPP_MAJOR, "ppp"); | 882 | unregister_chrdev(PPP_MAJOR, "ppp"); |
883 | goto out; | 883 | goto out; |
@@ -2654,8 +2654,8 @@ static void __exit ppp_cleanup(void) | |||
2654 | if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) | 2654 | if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) |
2655 | printk(KERN_ERR "PPP: failed to unregister PPP device\n"); | 2655 | printk(KERN_ERR "PPP: failed to unregister PPP device\n"); |
2656 | devfs_remove("ppp"); | 2656 | devfs_remove("ppp"); |
2657 | class_simple_device_remove(MKDEV(PPP_MAJOR, 0)); | 2657 | class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); |
2658 | class_simple_destroy(ppp_class); | 2658 | class_destroy(ppp_class); |
2659 | } | 2659 | } |
2660 | 2660 | ||
2661 | /* | 2661 | /* |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 921a573372e9..7ff814fd65d0 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -235,7 +235,7 @@ static int dma[MAX_CARDS+1]; | |||
235 | static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, }; | 235 | static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, }; |
236 | 236 | ||
237 | /* for class stuff*/ | 237 | /* for class stuff*/ |
238 | static struct class_simple *cosa_class; | 238 | static struct class *cosa_class; |
239 | 239 | ||
240 | #ifdef MODULE | 240 | #ifdef MODULE |
241 | module_param_array(io, int, NULL, 0); | 241 | module_param_array(io, int, NULL, 0); |
@@ -394,19 +394,19 @@ static int __init cosa_init(void) | |||
394 | goto out; | 394 | goto out; |
395 | } | 395 | } |
396 | devfs_mk_dir("cosa"); | 396 | devfs_mk_dir("cosa"); |
397 | cosa_class = class_simple_create(THIS_MODULE, "cosa"); | 397 | cosa_class = class_create(THIS_MODULE, "cosa"); |
398 | if (IS_ERR(cosa_class)) { | 398 | if (IS_ERR(cosa_class)) { |
399 | err = PTR_ERR(cosa_class); | 399 | err = PTR_ERR(cosa_class); |
400 | goto out_chrdev; | 400 | goto out_chrdev; |
401 | } | 401 | } |
402 | for (i=0; i<nr_cards; i++) { | 402 | for (i=0; i<nr_cards; i++) { |
403 | class_simple_device_add(cosa_class, MKDEV(cosa_major, i), | 403 | class_device_create(cosa_class, MKDEV(cosa_major, i), |
404 | NULL, "cosa%d", i); | 404 | NULL, "cosa%d", i); |
405 | err = devfs_mk_cdev(MKDEV(cosa_major, i), | 405 | err = devfs_mk_cdev(MKDEV(cosa_major, i), |
406 | S_IFCHR|S_IRUSR|S_IWUSR, | 406 | S_IFCHR|S_IRUSR|S_IWUSR, |
407 | "cosa/%d", i); | 407 | "cosa/%d", i); |
408 | if (err) { | 408 | if (err) { |
409 | class_simple_device_remove(MKDEV(cosa_major, i)); | 409 | class_device_destroy(cosa_class, MKDEV(cosa_major, i)); |
410 | goto out_chrdev; | 410 | goto out_chrdev; |
411 | } | 411 | } |
412 | } | 412 | } |
@@ -427,10 +427,10 @@ static void __exit cosa_exit(void) | |||
427 | printk(KERN_INFO "Unloading the cosa module\n"); | 427 | printk(KERN_INFO "Unloading the cosa module\n"); |
428 | 428 | ||
429 | for (i=0; i<nr_cards; i++) { | 429 | for (i=0; i<nr_cards; i++) { |
430 | class_simple_device_remove(MKDEV(cosa_major, i)); | 430 | class_device_destroy(cosa_class, MKDEV(cosa_major, i)); |
431 | devfs_remove("cosa/%d", i); | 431 | devfs_remove("cosa/%d", i); |
432 | } | 432 | } |
433 | class_simple_destroy(cosa_class); | 433 | class_destroy(cosa_class); |
434 | devfs_remove("cosa"); | 434 | devfs_remove("cosa"); |
435 | for (cosa=cosa_cards; nr_cards--; cosa++) { | 435 | for (cosa=cosa_cards; nr_cards--; cosa++) { |
436 | /* Clean up the per-channel data */ | 436 | /* Clean up the per-channel data */ |
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 41c7971d06c5..4c11048ad51b 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | /* A few routines that create sysfs entries for the hot plug controller */ | 39 | /* A few routines that create sysfs entries for the hot plug controller */ |
40 | 40 | ||
41 | static ssize_t show_ctrl (struct device *dev, char *buf) | 41 | static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) |
42 | { | 42 | { |
43 | struct pci_dev *pci_dev; | 43 | struct pci_dev *pci_dev; |
44 | struct controller *ctrl; | 44 | struct controller *ctrl; |
@@ -82,7 +82,7 @@ static ssize_t show_ctrl (struct device *dev, char *buf) | |||
82 | } | 82 | } |
83 | static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); | 83 | static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); |
84 | 84 | ||
85 | static ssize_t show_dev (struct device *dev, char *buf) | 85 | static ssize_t show_dev (struct device *dev, struct device_attribute *attr, char *buf) |
86 | { | 86 | { |
87 | struct pci_dev *pci_dev; | 87 | struct pci_dev *pci_dev; |
88 | struct controller *ctrl; | 88 | struct controller *ctrl; |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index c802f6270b89..c4282902cb52 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -73,7 +73,7 @@ static ssize_t hotplug_slot_attr_show(struct kobject *kobj, | |||
73 | { | 73 | { |
74 | struct hotplug_slot *slot = to_hotplug_slot(kobj); | 74 | struct hotplug_slot *slot = to_hotplug_slot(kobj); |
75 | struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr); | 75 | struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr); |
76 | return attribute->show ? attribute->show(slot, buf) : 0; | 76 | return attribute->show ? attribute->show(slot, buf) : -EIO; |
77 | } | 77 | } |
78 | 78 | ||
79 | static ssize_t hotplug_slot_attr_store(struct kobject *kobj, | 79 | static ssize_t hotplug_slot_attr_store(struct kobject *kobj, |
@@ -81,7 +81,7 @@ static ssize_t hotplug_slot_attr_store(struct kobject *kobj, | |||
81 | { | 81 | { |
82 | struct hotplug_slot *slot = to_hotplug_slot(kobj); | 82 | struct hotplug_slot *slot = to_hotplug_slot(kobj); |
83 | struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr); | 83 | struct hotplug_slot_attribute *attribute = to_hotplug_attr(attr); |
84 | return attribute->store ? attribute->store(slot, buf, len) : 0; | 84 | return attribute->store ? attribute->store(slot, buf, len) : -EIO; |
85 | } | 85 | } |
86 | 86 | ||
87 | static struct sysfs_ops hotplug_slot_sysfs_ops = { | 87 | static struct sysfs_ops hotplug_slot_sysfs_ops = { |
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c index 3285b822478d..752e6513c447 100644 --- a/drivers/pci/hotplug/rpadlpar_sysfs.c +++ b/drivers/pci/hotplug/rpadlpar_sysfs.c | |||
@@ -48,7 +48,7 @@ dlpar_attr_store(struct kobject * kobj, struct attribute * attr, | |||
48 | struct dlpar_io_attr *dlpar_attr = container_of(attr, | 48 | struct dlpar_io_attr *dlpar_attr = container_of(attr, |
49 | struct dlpar_io_attr, attr); | 49 | struct dlpar_io_attr, attr); |
50 | return dlpar_attr->store ? | 50 | return dlpar_attr->store ? |
51 | dlpar_attr->store(dlpar_attr, buf, nbytes) : 0; | 51 | dlpar_attr->store(dlpar_attr, buf, nbytes) : -EIO; |
52 | } | 52 | } |
53 | 53 | ||
54 | static struct sysfs_ops dlpar_attr_sysfs_ops = { | 54 | static struct sysfs_ops dlpar_attr_sysfs_ops = { |
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index 9a1ee132d12c..c9445ebda5c7 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | /* A few routines that create sysfs entries for the hot plug controller */ | 39 | /* A few routines that create sysfs entries for the hot plug controller */ |
40 | 40 | ||
41 | static ssize_t show_ctrl (struct device *dev, char *buf) | 41 | static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, char *buf) |
42 | { | 42 | { |
43 | struct pci_dev *pci_dev; | 43 | struct pci_dev *pci_dev; |
44 | struct controller *ctrl; | 44 | struct controller *ctrl; |
@@ -82,7 +82,7 @@ static ssize_t show_ctrl (struct device *dev, char *buf) | |||
82 | } | 82 | } |
83 | static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); | 83 | static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); |
84 | 84 | ||
85 | static ssize_t show_dev (struct device *dev, char *buf) | 85 | static ssize_t show_dev (struct device *dev, struct device_attribute *attr, char *buf) |
86 | { | 86 | { |
87 | struct pci_dev *pci_dev; | 87 | struct pci_dev *pci_dev; |
88 | struct controller *ctrl; | 88 | struct controller *ctrl; |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index cf2cff7480f1..e65bf2b395aa 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -335,13 +335,14 @@ pci_driver_attr_show(struct kobject * kobj, struct attribute *attr, char *buf) | |||
335 | { | 335 | { |
336 | struct device_driver *driver = kobj_to_pci_driver(kobj); | 336 | struct device_driver *driver = kobj_to_pci_driver(kobj); |
337 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); | 337 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); |
338 | ssize_t ret = 0; | 338 | ssize_t ret; |
339 | 339 | ||
340 | if (get_driver(driver)) { | 340 | if (!get_driver(driver)) |
341 | if (dattr->show) | 341 | return -ENODEV; |
342 | ret = dattr->show(driver, buf); | 342 | |
343 | put_driver(driver); | 343 | ret = dattr->show ? dattr->show(driver, buf) : -EIO; |
344 | } | 344 | |
345 | put_driver(driver); | ||
345 | return ret; | 346 | return ret; |
346 | } | 347 | } |
347 | 348 | ||
@@ -351,13 +352,14 @@ pci_driver_attr_store(struct kobject * kobj, struct attribute *attr, | |||
351 | { | 352 | { |
352 | struct device_driver *driver = kobj_to_pci_driver(kobj); | 353 | struct device_driver *driver = kobj_to_pci_driver(kobj); |
353 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); | 354 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); |
354 | ssize_t ret = 0; | 355 | ssize_t ret; |
355 | 356 | ||
356 | if (get_driver(driver)) { | 357 | if (!get_driver(driver)) |
357 | if (dattr->store) | 358 | return -ENODEV; |
358 | ret = dattr->store(driver, buf, count); | 359 | |
359 | put_driver(driver); | 360 | ret = dattr->store ? dattr->store(driver, buf, count) : -EIO; |
360 | } | 361 | |
362 | put_driver(driver); | ||
361 | return ret; | 363 | return ret; |
362 | } | 364 | } |
363 | 365 | ||
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 6ca0061137a6..a15f94072a6f 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -29,7 +29,7 @@ static int sysfs_initialized; /* = 0 */ | |||
29 | /* show configuration fields */ | 29 | /* show configuration fields */ |
30 | #define pci_config_attr(field, format_string) \ | 30 | #define pci_config_attr(field, format_string) \ |
31 | static ssize_t \ | 31 | static ssize_t \ |
32 | field##_show(struct device *dev, char *buf) \ | 32 | field##_show(struct device *dev, struct device_attribute *attr, char *buf) \ |
33 | { \ | 33 | { \ |
34 | struct pci_dev *pdev; \ | 34 | struct pci_dev *pdev; \ |
35 | \ | 35 | \ |
@@ -44,7 +44,7 @@ pci_config_attr(subsystem_device, "0x%04x\n"); | |||
44 | pci_config_attr(class, "0x%06x\n"); | 44 | pci_config_attr(class, "0x%06x\n"); |
45 | pci_config_attr(irq, "%u\n"); | 45 | pci_config_attr(irq, "%u\n"); |
46 | 46 | ||
47 | static ssize_t local_cpus_show(struct device *dev, char *buf) | 47 | static ssize_t local_cpus_show(struct device *dev, struct device_attribute *attr, char *buf) |
48 | { | 48 | { |
49 | cpumask_t mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); | 49 | cpumask_t mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); |
50 | int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); | 50 | int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); |
@@ -54,7 +54,7 @@ static ssize_t local_cpus_show(struct device *dev, char *buf) | |||
54 | 54 | ||
55 | /* show resources */ | 55 | /* show resources */ |
56 | static ssize_t | 56 | static ssize_t |
57 | resource_show(struct device * dev, char * buf) | 57 | resource_show(struct device * dev, struct device_attribute *attr, char * buf) |
58 | { | 58 | { |
59 | struct pci_dev * pci_dev = to_pci_dev(dev); | 59 | struct pci_dev * pci_dev = to_pci_dev(dev); |
60 | char * str = buf; | 60 | char * str = buf; |
@@ -73,7 +73,7 @@ resource_show(struct device * dev, char * buf) | |||
73 | return (str - buf); | 73 | return (str - buf); |
74 | } | 74 | } |
75 | 75 | ||
76 | static ssize_t modalias_show(struct device *dev, char *buf) | 76 | static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf) |
77 | { | 77 | { |
78 | struct pci_dev *pci_dev = to_pci_dev(dev); | 78 | struct pci_dev *pci_dev = to_pci_dev(dev); |
79 | 79 | ||
@@ -339,16 +339,17 @@ pci_create_resource_files(struct pci_dev *pdev) | |||
339 | if (!pci_resource_len(pdev, i)) | 339 | if (!pci_resource_len(pdev, i)) |
340 | continue; | 340 | continue; |
341 | 341 | ||
342 | res_attr = kmalloc(sizeof(*res_attr) + 10, GFP_ATOMIC); | 342 | /* allocate attribute structure, piggyback attribute name */ |
343 | res_attr = kcalloc(1, sizeof(*res_attr) + 10, GFP_ATOMIC); | ||
343 | if (res_attr) { | 344 | if (res_attr) { |
344 | memset(res_attr, 0, sizeof(*res_attr) + 10); | 345 | char *res_attr_name = (char *)(res_attr + 1); |
346 | |||
345 | pdev->res_attr[i] = res_attr; | 347 | pdev->res_attr[i] = res_attr; |
346 | /* Allocated above after the res_attr struct */ | 348 | sprintf(res_attr_name, "resource%d", i); |
347 | res_attr->attr.name = (char *)(res_attr + 1); | 349 | res_attr->attr.name = res_attr_name; |
348 | sprintf(res_attr->attr.name, "resource%d", i); | ||
349 | res_attr->size = pci_resource_len(pdev, i); | ||
350 | res_attr->attr.mode = S_IRUSR | S_IWUSR; | 350 | res_attr->attr.mode = S_IRUSR | S_IWUSR; |
351 | res_attr->attr.owner = THIS_MODULE; | 351 | res_attr->attr.owner = THIS_MODULE; |
352 | res_attr->size = pci_resource_len(pdev, i); | ||
352 | res_attr->mmap = pci_mmap_resource; | 353 | res_attr->mmap = pci_mmap_resource; |
353 | res_attr->private = &pdev->resource[i]; | 354 | res_attr->private = &pdev->resource[i]; |
354 | sysfs_create_bin_file(&pdev->dev.kobj, res_attr); | 355 | sysfs_create_bin_file(&pdev->dev.kobj, res_attr); |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 576285765e98..f5c5f10a3d2f 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -232,19 +232,16 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev, | |||
232 | /* Initialize generic device interface */ | 232 | /* Initialize generic device interface */ |
233 | device = &dev->device; | 233 | device = &dev->device; |
234 | memset(device, 0, sizeof(struct device)); | 234 | memset(device, 0, sizeof(struct device)); |
235 | INIT_LIST_HEAD(&device->node); | ||
236 | INIT_LIST_HEAD(&device->children); | ||
237 | INIT_LIST_HEAD(&device->bus_list); | ||
238 | device->bus = &pcie_port_bus_type; | 235 | device->bus = &pcie_port_bus_type; |
239 | device->driver = NULL; | 236 | device->driver = NULL; |
240 | device->driver_data = NULL; | 237 | device->driver_data = NULL; |
241 | device->release = release_pcie_device; /* callback to free pcie dev */ | 238 | device->release = release_pcie_device; /* callback to free pcie dev */ |
242 | sprintf(&device->bus_id[0], "pcie%02x", | 239 | sprintf(&device->bus_id[0], "pcie%02x", |
243 | get_descriptor_id(port_type, service_type)); | 240 | get_descriptor_id(port_type, service_type)); |
244 | device->parent = &parent->dev; | 241 | device->parent = &parent->dev; |
245 | } | 242 | } |
246 | 243 | ||
247 | static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, | 244 | static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, |
248 | int port_type, int service_type, int irq, int irq_mode) | 245 | int port_type, int service_type, int irq, int irq_mode) |
249 | { | 246 | { |
250 | struct pcie_device *device; | 247 | struct pcie_device *device; |
@@ -270,9 +267,9 @@ int pcie_port_device_probe(struct pci_dev *dev) | |||
270 | pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, ®); | 267 | pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, ®); |
271 | type = (reg >> 4) & PORT_TYPE_MASK; | 268 | type = (reg >> 4) & PORT_TYPE_MASK; |
272 | if ( type == PCIE_RC_PORT || type == PCIE_SW_UPSTREAM_PORT || | 269 | if ( type == PCIE_RC_PORT || type == PCIE_SW_UPSTREAM_PORT || |
273 | type == PCIE_SW_DOWNSTREAM_PORT ) | 270 | type == PCIE_SW_DOWNSTREAM_PORT ) |
274 | return 0; | 271 | return 0; |
275 | 272 | ||
276 | return -ENODEV; | 273 | return -ENODEV; |
277 | } | 274 | } |
278 | 275 | ||
@@ -283,8 +280,8 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
283 | u16 reg16; | 280 | u16 reg16; |
284 | 281 | ||
285 | /* Get port type */ | 282 | /* Get port type */ |
286 | pci_read_config_word(dev, | 283 | pci_read_config_word(dev, |
287 | pci_find_capability(dev, PCI_CAP_ID_EXP) + | 284 | pci_find_capability(dev, PCI_CAP_ID_EXP) + |
288 | PCIE_CAPABILITIES_REG, ®16); | 285 | PCIE_CAPABILITIES_REG, ®16); |
289 | type = (reg16 >> 4) & PORT_TYPE_MASK; | 286 | type = (reg16 >> 4) & PORT_TYPE_MASK; |
290 | 287 | ||
@@ -299,11 +296,11 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
299 | if (capabilities & (1 << i)) { | 296 | if (capabilities & (1 << i)) { |
300 | child = alloc_pcie_device( | 297 | child = alloc_pcie_device( |
301 | dev, /* parent */ | 298 | dev, /* parent */ |
302 | type, /* port type */ | 299 | type, /* port type */ |
303 | i, /* service type */ | 300 | i, /* service type */ |
304 | vectors[i], /* irq */ | 301 | vectors[i], /* irq */ |
305 | irq_mode /* interrupt mode */); | 302 | irq_mode /* interrupt mode */); |
306 | if (child) { | 303 | if (child) { |
307 | status = device_register(&child->device); | 304 | status = device_register(&child->device); |
308 | if (status) { | 305 | if (status) { |
309 | kfree(child); | 306 | kfree(child); |
@@ -317,84 +314,78 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
317 | } | 314 | } |
318 | 315 | ||
319 | #ifdef CONFIG_PM | 316 | #ifdef CONFIG_PM |
320 | int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state) | 317 | static int suspend_iter(struct device *dev, void *data) |
321 | { | 318 | { |
322 | struct list_head *head, *tmp; | ||
323 | struct device *parent, *child; | ||
324 | struct device_driver *driver; | ||
325 | struct pcie_port_service_driver *service_driver; | 319 | struct pcie_port_service_driver *service_driver; |
320 | u32 state = (u32)data; | ||
321 | |||
322 | if ((dev->bus == &pcie_port_bus_type) && | ||
323 | (dev->driver)) { | ||
324 | service_driver = to_service_driver(dev->driver); | ||
325 | if (service_driver->suspend) | ||
326 | service_driver->suspend(to_pcie_device(dev), state); | ||
327 | } | ||
328 | return 0; | ||
329 | } | ||
326 | 330 | ||
327 | parent = &dev->dev; | 331 | int pcie_port_device_suspend(struct pci_dev *dev, u32 state) |
328 | head = &parent->children; | 332 | { |
329 | tmp = head->next; | 333 | device_for_each_child(&dev->dev, (void *)state, suspend_iter); |
330 | while (head != tmp) { | 334 | return 0; |
331 | child = container_of(tmp, struct device, node); | ||
332 | tmp = tmp->next; | ||
333 | if (child->bus != &pcie_port_bus_type) | ||
334 | continue; | ||
335 | driver = child->driver; | ||
336 | if (!driver) | ||
337 | continue; | ||
338 | service_driver = to_service_driver(driver); | ||
339 | if (service_driver->suspend) | ||
340 | service_driver->suspend(to_pcie_device(child), state); | ||
341 | } | ||
342 | return 0; | ||
343 | } | 335 | } |
344 | 336 | ||
345 | int pcie_port_device_resume(struct pci_dev *dev) | 337 | static int resume_iter(struct device *dev, void *data) |
346 | { | 338 | { |
347 | struct list_head *head, *tmp; | ||
348 | struct device *parent, *child; | ||
349 | struct device_driver *driver; | ||
350 | struct pcie_port_service_driver *service_driver; | 339 | struct pcie_port_service_driver *service_driver; |
351 | 340 | ||
352 | parent = &dev->dev; | 341 | if ((dev->bus == &pcie_port_bus_type) && |
353 | head = &parent->children; | 342 | (dev->driver)) { |
354 | tmp = head->next; | 343 | service_driver = to_service_driver(dev->driver); |
355 | while (head != tmp) { | 344 | if (service_driver->resume) |
356 | child = container_of(tmp, struct device, node); | 345 | service_driver->resume(to_pcie_device(dev)); |
357 | tmp = tmp->next; | ||
358 | if (child->bus != &pcie_port_bus_type) | ||
359 | continue; | ||
360 | driver = child->driver; | ||
361 | if (!driver) | ||
362 | continue; | ||
363 | service_driver = to_service_driver(driver); | ||
364 | if (service_driver->resume) | ||
365 | service_driver->resume(to_pcie_device(child)); | ||
366 | } | 346 | } |
367 | return 0; | 347 | return 0; |
348 | } | ||
368 | 349 | ||
350 | int pcie_port_device_resume(struct pci_dev *dev) | ||
351 | { | ||
352 | device_for_each_child(&dev->dev, NULL, resume_iter); | ||
353 | return 0; | ||
369 | } | 354 | } |
370 | #endif | 355 | #endif |
371 | 356 | ||
372 | void pcie_port_device_remove(struct pci_dev *dev) | 357 | static int remove_iter(struct device *dev, void *data) |
373 | { | 358 | { |
374 | struct list_head *head, *tmp; | ||
375 | struct device *parent, *child; | ||
376 | struct device_driver *driver; | ||
377 | struct pcie_port_service_driver *service_driver; | 359 | struct pcie_port_service_driver *service_driver; |
378 | int interrupt_mode = PCIE_PORT_INTx_MODE; | ||
379 | 360 | ||
380 | parent = &dev->dev; | 361 | if (dev->bus == &pcie_port_bus_type) { |
381 | head = &parent->children; | 362 | if (dev->driver) { |
382 | tmp = head->next; | 363 | service_driver = to_service_driver(dev->driver); |
383 | while (head != tmp) { | 364 | if (service_driver->remove) |
384 | child = container_of(tmp, struct device, node); | 365 | service_driver->remove(to_pcie_device(dev)); |
385 | tmp = tmp->next; | ||
386 | if (child->bus != &pcie_port_bus_type) | ||
387 | continue; | ||
388 | driver = child->driver; | ||
389 | if (driver) { | ||
390 | service_driver = to_service_driver(driver); | ||
391 | if (service_driver->remove) | ||
392 | service_driver->remove(to_pcie_device(child)); | ||
393 | } | 366 | } |
394 | interrupt_mode = (to_pcie_device(child))->interrupt_mode; | 367 | *(unsigned long*)data = (unsigned long)dev; |
395 | put_device(child); | 368 | return 1; |
396 | device_unregister(child); | ||
397 | } | 369 | } |
370 | return 0; | ||
371 | } | ||
372 | |||
373 | void pcie_port_device_remove(struct pci_dev *dev) | ||
374 | { | ||
375 | struct device *device; | ||
376 | unsigned long device_addr; | ||
377 | int interrupt_mode = PCIE_PORT_INTx_MODE; | ||
378 | int status; | ||
379 | |||
380 | do { | ||
381 | status = device_for_each_child(&dev->dev, &device_addr, remove_iter); | ||
382 | if (status) { | ||
383 | device = (struct device*)device_addr; | ||
384 | interrupt_mode = (to_pcie_device(device))->interrupt_mode; | ||
385 | put_device(device); | ||
386 | device_unregister(device); | ||
387 | } | ||
388 | } while (status); | ||
398 | /* Switch to INTx by default if MSI enabled */ | 389 | /* Switch to INTx by default if MSI enabled */ |
399 | if (interrupt_mode == PCIE_PORT_MSIX_MODE) | 390 | if (interrupt_mode == PCIE_PORT_MSIX_MODE) |
400 | pci_disable_msix(dev); | 391 | pci_disable_msix(dev); |
@@ -423,7 +414,7 @@ int pcie_port_service_register(struct pcie_port_service_driver *new) | |||
423 | new->driver.resume = pcie_port_resume_service; | 414 | new->driver.resume = pcie_port_resume_service; |
424 | 415 | ||
425 | return driver_register(&new->driver); | 416 | return driver_register(&new->driver); |
426 | } | 417 | } |
427 | 418 | ||
428 | void pcie_port_service_unregister(struct pcie_port_service_driver *new) | 419 | void pcie_port_service_unregister(struct pcie_port_service_driver *new) |
429 | { | 420 | { |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index c4ade288c5da..569e55feecfd 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -604,14 +604,14 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | |||
604 | /************************ per-device sysfs output ***************************/ | 604 | /************************ per-device sysfs output ***************************/ |
605 | 605 | ||
606 | #define pcmcia_device_attr(field, test, format) \ | 606 | #define pcmcia_device_attr(field, test, format) \ |
607 | static ssize_t field##_show (struct device *dev, char *buf) \ | 607 | static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
608 | { \ | 608 | { \ |
609 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ | 609 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ |
610 | return p_dev->test ? sprintf (buf, format, p_dev->field) : -ENODEV; \ | 610 | return p_dev->test ? sprintf (buf, format, p_dev->field) : -ENODEV; \ |
611 | } | 611 | } |
612 | 612 | ||
613 | #define pcmcia_device_stringattr(name, field) \ | 613 | #define pcmcia_device_stringattr(name, field) \ |
614 | static ssize_t name##_show (struct device *dev, char *buf) \ | 614 | static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
615 | { \ | 615 | { \ |
616 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ | 616 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ |
617 | return p_dev->field ? sprintf (buf, "%s\n", p_dev->field) : -ENODEV; \ | 617 | return p_dev->field ? sprintf (buf, "%s\n", p_dev->field) : -ENODEV; \ |
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 97eeecfaef1b..3252662958d3 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -140,7 +140,7 @@ static void pnp_release_card(struct device *dmdev) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | static ssize_t pnp_show_card_name(struct device *dmdev, char *buf) | 143 | static ssize_t pnp_show_card_name(struct device *dmdev, struct device_attribute *attr, char *buf) |
144 | { | 144 | { |
145 | char *str = buf; | 145 | char *str = buf; |
146 | struct pnp_card *card = to_pnp_card(dmdev); | 146 | struct pnp_card *card = to_pnp_card(dmdev); |
@@ -150,7 +150,7 @@ static ssize_t pnp_show_card_name(struct device *dmdev, char *buf) | |||
150 | 150 | ||
151 | static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL); | 151 | static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL); |
152 | 152 | ||
153 | static ssize_t pnp_show_card_ids(struct device *dmdev, char *buf) | 153 | static ssize_t pnp_show_card_ids(struct device *dmdev, struct device_attribute *attr, char *buf) |
154 | { | 154 | { |
155 | char *str = buf; | 155 | char *str = buf; |
156 | struct pnp_card *card = to_pnp_card(dmdev); | 156 | struct pnp_card *card = to_pnp_card(dmdev); |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index d64c1ca4fa76..1d037c2a82ac 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -160,10 +160,16 @@ struct bus_type pnp_bus_type = { | |||
160 | }; | 160 | }; |
161 | 161 | ||
162 | 162 | ||
163 | static int count_devices(struct device * dev, void * c) | ||
164 | { | ||
165 | int * count = c; | ||
166 | (*count)++; | ||
167 | return 0; | ||
168 | } | ||
169 | |||
163 | int pnp_register_driver(struct pnp_driver *drv) | 170 | int pnp_register_driver(struct pnp_driver *drv) |
164 | { | 171 | { |
165 | int count; | 172 | int count; |
166 | struct list_head *pos; | ||
167 | 173 | ||
168 | pnp_dbg("the driver '%s' has been registered", drv->name); | 174 | pnp_dbg("the driver '%s' has been registered", drv->name); |
169 | 175 | ||
@@ -177,9 +183,7 @@ int pnp_register_driver(struct pnp_driver *drv) | |||
177 | /* get the number of initial matches */ | 183 | /* get the number of initial matches */ |
178 | if (count >= 0){ | 184 | if (count >= 0){ |
179 | count = 0; | 185 | count = 0; |
180 | list_for_each(pos,&drv->driver.devices){ | 186 | driver_for_each_device(&drv->driver, NULL, &count, count_devices); |
181 | count++; | ||
182 | } | ||
183 | } | 187 | } |
184 | return count; | 188 | return count; |
185 | } | 189 | } |
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index 53fac8ba5d5c..a2d8ce7fef9c 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -205,7 +205,7 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space, | |||
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | static ssize_t pnp_show_options(struct device *dmdev, char *buf) | 208 | static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *attr, char *buf) |
209 | { | 209 | { |
210 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 210 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
211 | struct pnp_option * independent = dev->independent; | 211 | struct pnp_option * independent = dev->independent; |
@@ -236,7 +236,7 @@ static ssize_t pnp_show_options(struct device *dmdev, char *buf) | |||
236 | static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL); | 236 | static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL); |
237 | 237 | ||
238 | 238 | ||
239 | static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf) | 239 | static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf) |
240 | { | 240 | { |
241 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 241 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
242 | int i, ret; | 242 | int i, ret; |
@@ -308,7 +308,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf) | |||
308 | extern struct semaphore pnp_res_mutex; | 308 | extern struct semaphore pnp_res_mutex; |
309 | 309 | ||
310 | static ssize_t | 310 | static ssize_t |
311 | pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count) | 311 | pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, const char * ubuf, size_t count) |
312 | { | 312 | { |
313 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 313 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
314 | char *buf = (void *)ubuf; | 314 | char *buf = (void *)ubuf; |
@@ -444,7 +444,7 @@ pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count | |||
444 | static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR, | 444 | static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR, |
445 | pnp_show_current_resources,pnp_set_current_resources); | 445 | pnp_show_current_resources,pnp_set_current_resources); |
446 | 446 | ||
447 | static ssize_t pnp_show_current_ids(struct device *dmdev, char *buf) | 447 | static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf) |
448 | { | 448 | { |
449 | char *str = buf; | 449 | char *str = buf; |
450 | struct pnp_dev *dev = to_pnp_dev(dmdev); | 450 | struct pnp_dev *dev = to_pnp_dev(dmdev); |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 1aedc48e5f85..d948566bb24a 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -615,7 +615,7 @@ dasd_device_from_cdev(struct ccw_device *cdev) | |||
615 | * readonly controls the readonly status of a dasd | 615 | * readonly controls the readonly status of a dasd |
616 | */ | 616 | */ |
617 | static ssize_t | 617 | static ssize_t |
618 | dasd_ro_show(struct device *dev, char *buf) | 618 | dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) |
619 | { | 619 | { |
620 | struct dasd_devmap *devmap; | 620 | struct dasd_devmap *devmap; |
621 | int ro_flag; | 621 | int ro_flag; |
@@ -629,7 +629,7 @@ dasd_ro_show(struct device *dev, char *buf) | |||
629 | } | 629 | } |
630 | 630 | ||
631 | static ssize_t | 631 | static ssize_t |
632 | dasd_ro_store(struct device *dev, const char *buf, size_t count) | 632 | dasd_ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
633 | { | 633 | { |
634 | struct dasd_devmap *devmap; | 634 | struct dasd_devmap *devmap; |
635 | int ro_flag; | 635 | int ro_flag; |
@@ -656,7 +656,7 @@ static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store); | |||
656 | * to talk to the device | 656 | * to talk to the device |
657 | */ | 657 | */ |
658 | static ssize_t | 658 | static ssize_t |
659 | dasd_use_diag_show(struct device *dev, char *buf) | 659 | dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) |
660 | { | 660 | { |
661 | struct dasd_devmap *devmap; | 661 | struct dasd_devmap *devmap; |
662 | int use_diag; | 662 | int use_diag; |
@@ -670,7 +670,7 @@ dasd_use_diag_show(struct device *dev, char *buf) | |||
670 | } | 670 | } |
671 | 671 | ||
672 | static ssize_t | 672 | static ssize_t |
673 | dasd_use_diag_store(struct device *dev, const char *buf, size_t count) | 673 | dasd_use_diag_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
674 | { | 674 | { |
675 | struct dasd_devmap *devmap; | 675 | struct dasd_devmap *devmap; |
676 | ssize_t rc; | 676 | ssize_t rc; |
@@ -698,7 +698,7 @@ static | |||
698 | DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); | 698 | DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); |
699 | 699 | ||
700 | static ssize_t | 700 | static ssize_t |
701 | dasd_discipline_show(struct device *dev, char *buf) | 701 | dasd_discipline_show(struct device *dev, struct device_attribute *attr, char *buf) |
702 | { | 702 | { |
703 | struct dasd_devmap *devmap; | 703 | struct dasd_devmap *devmap; |
704 | char *dname; | 704 | char *dname; |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index a66b17b65296..16ab8d363ac6 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -45,16 +45,16 @@ static struct block_device_operations dcssblk_devops = { | |||
45 | .release = dcssblk_release, | 45 | .release = dcssblk_release, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static ssize_t dcssblk_add_store(struct device * dev, const char * buf, | 48 | static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf, |
49 | size_t count); | 49 | size_t count); |
50 | static ssize_t dcssblk_remove_store(struct device * dev, const char * buf, | 50 | static ssize_t dcssblk_remove_store(struct device * dev, struct device_attribute *attr, const char * buf, |
51 | size_t count); | 51 | size_t count); |
52 | static ssize_t dcssblk_save_store(struct device * dev, const char * buf, | 52 | static ssize_t dcssblk_save_store(struct device * dev, struct device_attribute *attr, const char * buf, |
53 | size_t count); | 53 | size_t count); |
54 | static ssize_t dcssblk_save_show(struct device *dev, char *buf); | 54 | static ssize_t dcssblk_save_show(struct device *dev, struct device_attribute *attr, char *buf); |
55 | static ssize_t dcssblk_shared_store(struct device * dev, const char * buf, | 55 | static ssize_t dcssblk_shared_store(struct device * dev, struct device_attribute *attr, const char * buf, |
56 | size_t count); | 56 | size_t count); |
57 | static ssize_t dcssblk_shared_show(struct device *dev, char *buf); | 57 | static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf); |
58 | 58 | ||
59 | static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store); | 59 | static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store); |
60 | static DEVICE_ATTR(remove, S_IWUSR, NULL, dcssblk_remove_store); | 60 | static DEVICE_ATTR(remove, S_IWUSR, NULL, dcssblk_remove_store); |
@@ -195,7 +195,7 @@ dcssblk_segment_warn(int rc, char* seg_name) | |||
195 | * operation (show + store) | 195 | * operation (show + store) |
196 | */ | 196 | */ |
197 | static ssize_t | 197 | static ssize_t |
198 | dcssblk_shared_show(struct device *dev, char *buf) | 198 | dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf) |
199 | { | 199 | { |
200 | struct dcssblk_dev_info *dev_info; | 200 | struct dcssblk_dev_info *dev_info; |
201 | 201 | ||
@@ -204,7 +204,7 @@ dcssblk_shared_show(struct device *dev, char *buf) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | static ssize_t | 206 | static ssize_t |
207 | dcssblk_shared_store(struct device *dev, const char *inbuf, size_t count) | 207 | dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count) |
208 | { | 208 | { |
209 | struct dcssblk_dev_info *dev_info; | 209 | struct dcssblk_dev_info *dev_info; |
210 | int rc; | 210 | int rc; |
@@ -288,7 +288,7 @@ out: | |||
288 | * (show + store) | 288 | * (show + store) |
289 | */ | 289 | */ |
290 | static ssize_t | 290 | static ssize_t |
291 | dcssblk_save_show(struct device *dev, char *buf) | 291 | dcssblk_save_show(struct device *dev, struct device_attribute *attr, char *buf) |
292 | { | 292 | { |
293 | struct dcssblk_dev_info *dev_info; | 293 | struct dcssblk_dev_info *dev_info; |
294 | 294 | ||
@@ -297,7 +297,7 @@ dcssblk_save_show(struct device *dev, char *buf) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | static ssize_t | 299 | static ssize_t |
300 | dcssblk_save_store(struct device *dev, const char *inbuf, size_t count) | 300 | dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count) |
301 | { | 301 | { |
302 | struct dcssblk_dev_info *dev_info; | 302 | struct dcssblk_dev_info *dev_info; |
303 | 303 | ||
@@ -343,7 +343,7 @@ dcssblk_save_store(struct device *dev, const char *inbuf, size_t count) | |||
343 | * device attribute for adding devices | 343 | * device attribute for adding devices |
344 | */ | 344 | */ |
345 | static ssize_t | 345 | static ssize_t |
346 | dcssblk_add_store(struct device *dev, const char *buf, size_t count) | 346 | dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
347 | { | 347 | { |
348 | int rc, i; | 348 | int rc, i; |
349 | struct dcssblk_dev_info *dev_info; | 349 | struct dcssblk_dev_info *dev_info; |
@@ -517,7 +517,7 @@ out_nobuf: | |||
517 | * device attribute for removing devices | 517 | * device attribute for removing devices |
518 | */ | 518 | */ |
519 | static ssize_t | 519 | static ssize_t |
520 | dcssblk_remove_store(struct device *dev, const char *buf, size_t count) | 520 | dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
521 | { | 521 | { |
522 | struct dcssblk_dev_info *dev_info; | 522 | struct dcssblk_dev_info *dev_info; |
523 | int rc, i; | 523 | int rc, i; |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 8e16a9716686..d5eefeaba50c 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -1084,7 +1084,7 @@ raw3270_probe (struct ccw_device *cdev) | |||
1084 | * Additional attributes for a 3270 device | 1084 | * Additional attributes for a 3270 device |
1085 | */ | 1085 | */ |
1086 | static ssize_t | 1086 | static ssize_t |
1087 | raw3270_model_show(struct device *dev, char *buf) | 1087 | raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) |
1088 | { | 1088 | { |
1089 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1089 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1090 | ((struct raw3270 *) dev->driver_data)->model); | 1090 | ((struct raw3270 *) dev->driver_data)->model); |
@@ -1092,7 +1092,7 @@ raw3270_model_show(struct device *dev, char *buf) | |||
1092 | static DEVICE_ATTR(model, 0444, raw3270_model_show, 0); | 1092 | static DEVICE_ATTR(model, 0444, raw3270_model_show, 0); |
1093 | 1093 | ||
1094 | static ssize_t | 1094 | static ssize_t |
1095 | raw3270_rows_show(struct device *dev, char *buf) | 1095 | raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) |
1096 | { | 1096 | { |
1097 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1097 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1098 | ((struct raw3270 *) dev->driver_data)->rows); | 1098 | ((struct raw3270 *) dev->driver_data)->rows); |
@@ -1100,7 +1100,7 @@ raw3270_rows_show(struct device *dev, char *buf) | |||
1100 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0); | 1100 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0); |
1101 | 1101 | ||
1102 | static ssize_t | 1102 | static ssize_t |
1103 | raw3270_columns_show(struct device *dev, char *buf) | 1103 | raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) |
1104 | { | 1104 | { |
1105 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1105 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1106 | ((struct raw3270 *) dev->driver_data)->cols); | 1106 | ((struct raw3270 *) dev->driver_data)->cols); |
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index 0f8ffd4167ca..ed0cb1f15b4c 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c | |||
@@ -16,7 +16,7 @@ MODULE_DESCRIPTION( | |||
16 | ); | 16 | ); |
17 | MODULE_LICENSE("GPL"); | 17 | MODULE_LICENSE("GPL"); |
18 | 18 | ||
19 | struct class_simple *tape_class; | 19 | static struct class *tape_class; |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * Register a tape device and return a pointer to the cdev structure. | 22 | * Register a tape device and return a pointer to the cdev structure. |
@@ -70,7 +70,7 @@ struct tape_class_device *register_tape_dev( | |||
70 | if (rc) | 70 | if (rc) |
71 | goto fail_with_cdev; | 71 | goto fail_with_cdev; |
72 | 72 | ||
73 | tcd->class_device = class_simple_device_add( | 73 | tcd->class_device = class_device_create( |
74 | tape_class, | 74 | tape_class, |
75 | tcd->char_device->dev, | 75 | tcd->char_device->dev, |
76 | device, | 76 | device, |
@@ -101,7 +101,7 @@ void unregister_tape_dev(struct tape_class_device *tcd) | |||
101 | &tcd->class_device->dev->kobj, | 101 | &tcd->class_device->dev->kobj, |
102 | tcd->mode_name | 102 | tcd->mode_name |
103 | ); | 103 | ); |
104 | class_simple_device_remove(tcd->char_device->dev); | 104 | class_device_destroy(tape_class, tcd->char_device->dev); |
105 | cdev_del(tcd->char_device); | 105 | cdev_del(tcd->char_device); |
106 | kfree(tcd); | 106 | kfree(tcd); |
107 | } | 107 | } |
@@ -111,14 +111,14 @@ EXPORT_SYMBOL(unregister_tape_dev); | |||
111 | 111 | ||
112 | static int __init tape_init(void) | 112 | static int __init tape_init(void) |
113 | { | 113 | { |
114 | tape_class = class_simple_create(THIS_MODULE, "tape390"); | 114 | tape_class = class_create(THIS_MODULE, "tape390"); |
115 | 115 | ||
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
118 | 118 | ||
119 | static void __exit tape_exit(void) | 119 | static void __exit tape_exit(void) |
120 | { | 120 | { |
121 | class_simple_destroy(tape_class); | 121 | class_destroy(tape_class); |
122 | tape_class = NULL; | 122 | tape_class = NULL; |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index e51046ab8adc..b4df4a515b12 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -107,7 +107,7 @@ busid_to_int(char *bus_id) | |||
107 | * replaced by a link to the cdev tree. | 107 | * replaced by a link to the cdev tree. |
108 | */ | 108 | */ |
109 | static ssize_t | 109 | static ssize_t |
110 | tape_medium_state_show(struct device *dev, char *buf) | 110 | tape_medium_state_show(struct device *dev, struct device_attribute *attr, char *buf) |
111 | { | 111 | { |
112 | struct tape_device *tdev; | 112 | struct tape_device *tdev; |
113 | 113 | ||
@@ -119,7 +119,7 @@ static | |||
119 | DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL); | 119 | DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL); |
120 | 120 | ||
121 | static ssize_t | 121 | static ssize_t |
122 | tape_first_minor_show(struct device *dev, char *buf) | 122 | tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *buf) |
123 | { | 123 | { |
124 | struct tape_device *tdev; | 124 | struct tape_device *tdev; |
125 | 125 | ||
@@ -131,7 +131,7 @@ static | |||
131 | DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL); | 131 | DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL); |
132 | 132 | ||
133 | static ssize_t | 133 | static ssize_t |
134 | tape_state_show(struct device *dev, char *buf) | 134 | tape_state_show(struct device *dev, struct device_attribute *attr, char *buf) |
135 | { | 135 | { |
136 | struct tape_device *tdev; | 136 | struct tape_device *tdev; |
137 | 137 | ||
@@ -144,7 +144,7 @@ static | |||
144 | DEVICE_ATTR(state, 0444, tape_state_show, NULL); | 144 | DEVICE_ATTR(state, 0444, tape_state_show, NULL); |
145 | 145 | ||
146 | static ssize_t | 146 | static ssize_t |
147 | tape_operation_show(struct device *dev, char *buf) | 147 | tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf) |
148 | { | 148 | { |
149 | struct tape_device *tdev; | 149 | struct tape_device *tdev; |
150 | ssize_t rc; | 150 | ssize_t rc; |
@@ -171,7 +171,7 @@ static | |||
171 | DEVICE_ATTR(operation, 0444, tape_operation_show, NULL); | 171 | DEVICE_ATTR(operation, 0444, tape_operation_show, NULL); |
172 | 172 | ||
173 | static ssize_t | 173 | static ssize_t |
174 | tape_blocksize_show(struct device *dev, char *buf) | 174 | tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf) |
175 | { | 175 | { |
176 | struct tape_device *tdev; | 176 | struct tape_device *tdev; |
177 | 177 | ||
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index edf50d2bd10b..f7717327d15e 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -548,7 +548,7 @@ vmlogrdr_read (struct file *filp, char *data, size_t count, loff_t * ppos) | |||
548 | } | 548 | } |
549 | 549 | ||
550 | static ssize_t | 550 | static ssize_t |
551 | vmlogrdr_autopurge_store(struct device * dev, const char * buf, size_t count) { | 551 | vmlogrdr_autopurge_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t count) { |
552 | struct vmlogrdr_priv_t *priv = dev->driver_data; | 552 | struct vmlogrdr_priv_t *priv = dev->driver_data; |
553 | ssize_t ret = count; | 553 | ssize_t ret = count; |
554 | 554 | ||
@@ -567,7 +567,7 @@ vmlogrdr_autopurge_store(struct device * dev, const char * buf, size_t count) { | |||
567 | 567 | ||
568 | 568 | ||
569 | static ssize_t | 569 | static ssize_t |
570 | vmlogrdr_autopurge_show(struct device *dev, char *buf) { | 570 | vmlogrdr_autopurge_show(struct device *dev, struct device_attribute *attr, char *buf) { |
571 | struct vmlogrdr_priv_t *priv = dev->driver_data; | 571 | struct vmlogrdr_priv_t *priv = dev->driver_data; |
572 | return sprintf(buf, "%u\n", priv->autopurge); | 572 | return sprintf(buf, "%u\n", priv->autopurge); |
573 | } | 573 | } |
@@ -578,7 +578,7 @@ static DEVICE_ATTR(autopurge, 0644, vmlogrdr_autopurge_show, | |||
578 | 578 | ||
579 | 579 | ||
580 | static ssize_t | 580 | static ssize_t |
581 | vmlogrdr_purge_store(struct device * dev, const char * buf, size_t count) { | 581 | vmlogrdr_purge_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t count) { |
582 | 582 | ||
583 | char cp_command[80]; | 583 | char cp_command[80]; |
584 | char cp_response[80]; | 584 | char cp_response[80]; |
@@ -619,7 +619,7 @@ static DEVICE_ATTR(purge, 0200, NULL, vmlogrdr_purge_store); | |||
619 | 619 | ||
620 | 620 | ||
621 | static ssize_t | 621 | static ssize_t |
622 | vmlogrdr_autorecording_store(struct device *dev, const char *buf, | 622 | vmlogrdr_autorecording_store(struct device *dev, struct device_attribute *attr, const char *buf, |
623 | size_t count) { | 623 | size_t count) { |
624 | struct vmlogrdr_priv_t *priv = dev->driver_data; | 624 | struct vmlogrdr_priv_t *priv = dev->driver_data; |
625 | ssize_t ret = count; | 625 | ssize_t ret = count; |
@@ -639,7 +639,7 @@ vmlogrdr_autorecording_store(struct device *dev, const char *buf, | |||
639 | 639 | ||
640 | 640 | ||
641 | static ssize_t | 641 | static ssize_t |
642 | vmlogrdr_autorecording_show(struct device *dev, char *buf) { | 642 | vmlogrdr_autorecording_show(struct device *dev, struct device_attribute *attr, char *buf) { |
643 | struct vmlogrdr_priv_t *priv = dev->driver_data; | 643 | struct vmlogrdr_priv_t *priv = dev->driver_data; |
644 | return sprintf(buf, "%u\n", priv->autorecording); | 644 | return sprintf(buf, "%u\n", priv->autorecording); |
645 | } | 645 | } |
@@ -650,7 +650,7 @@ static DEVICE_ATTR(autorecording, 0644, vmlogrdr_autorecording_show, | |||
650 | 650 | ||
651 | 651 | ||
652 | static ssize_t | 652 | static ssize_t |
653 | vmlogrdr_recording_store(struct device * dev, const char * buf, size_t count) { | 653 | vmlogrdr_recording_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t count) { |
654 | 654 | ||
655 | struct vmlogrdr_priv_t *priv = dev->driver_data; | 655 | struct vmlogrdr_priv_t *priv = dev->driver_data; |
656 | ssize_t ret; | 656 | ssize_t ret; |
@@ -703,7 +703,7 @@ static struct attribute_group vmlogrdr_attr_group = { | |||
703 | .attrs = vmlogrdr_attrs, | 703 | .attrs = vmlogrdr_attrs, |
704 | }; | 704 | }; |
705 | 705 | ||
706 | static struct class_simple *vmlogrdr_class; | 706 | static struct class *vmlogrdr_class; |
707 | static struct device_driver vmlogrdr_driver = { | 707 | static struct device_driver vmlogrdr_driver = { |
708 | .name = "vmlogrdr", | 708 | .name = "vmlogrdr", |
709 | .bus = &iucv_bus, | 709 | .bus = &iucv_bus, |
@@ -727,7 +727,7 @@ vmlogrdr_register_driver(void) { | |||
727 | goto unregdriver; | 727 | goto unregdriver; |
728 | } | 728 | } |
729 | 729 | ||
730 | vmlogrdr_class = class_simple_create(THIS_MODULE, "vmlogrdr"); | 730 | vmlogrdr_class = class_create(THIS_MODULE, "vmlogrdr"); |
731 | if (IS_ERR(vmlogrdr_class)) { | 731 | if (IS_ERR(vmlogrdr_class)) { |
732 | printk(KERN_ERR "vmlogrdr: failed to create class.\n"); | 732 | printk(KERN_ERR "vmlogrdr: failed to create class.\n"); |
733 | ret=PTR_ERR(vmlogrdr_class); | 733 | ret=PTR_ERR(vmlogrdr_class); |
@@ -746,7 +746,7 @@ unregdriver: | |||
746 | 746 | ||
747 | static void | 747 | static void |
748 | vmlogrdr_unregister_driver(void) { | 748 | vmlogrdr_unregister_driver(void) { |
749 | class_simple_destroy(vmlogrdr_class); | 749 | class_destroy(vmlogrdr_class); |
750 | vmlogrdr_class = NULL; | 750 | vmlogrdr_class = NULL; |
751 | driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status); | 751 | driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status); |
752 | driver_unregister(&vmlogrdr_driver); | 752 | driver_unregister(&vmlogrdr_driver); |
@@ -786,7 +786,7 @@ vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) { | |||
786 | device_unregister(dev); | 786 | device_unregister(dev); |
787 | return ret; | 787 | return ret; |
788 | } | 788 | } |
789 | priv->class_device = class_simple_device_add( | 789 | priv->class_device = class_device_create( |
790 | vmlogrdr_class, | 790 | vmlogrdr_class, |
791 | MKDEV(vmlogrdr_major, priv->minor_num), | 791 | MKDEV(vmlogrdr_major, priv->minor_num), |
792 | dev, | 792 | dev, |
@@ -806,7 +806,7 @@ vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) { | |||
806 | 806 | ||
807 | static int | 807 | static int |
808 | vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv ) { | 808 | vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv ) { |
809 | class_simple_device_remove(MKDEV(vmlogrdr_major, priv->minor_num)); | 809 | class_device_destroy(vmlogrdr_class, MKDEV(vmlogrdr_major, priv->minor_num)); |
810 | if (priv->device != NULL) { | 810 | if (priv->device != NULL) { |
811 | sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group); | 811 | sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group); |
812 | device_unregister(priv->device); | 812 | device_unregister(priv->device); |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 21a75ee28b80..306525acb9f8 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -77,7 +77,7 @@ __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) | |||
77 | * longer needed or accidentially created. Saves memory :) | 77 | * longer needed or accidentially created. Saves memory :) |
78 | */ | 78 | */ |
79 | static ssize_t | 79 | static ssize_t |
80 | ccwgroup_ungroup_store(struct device *dev, const char *buf, size_t count) | 80 | ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
81 | { | 81 | { |
82 | struct ccwgroup_device *gdev; | 82 | struct ccwgroup_device *gdev; |
83 | 83 | ||
@@ -310,7 +310,7 @@ ccwgroup_set_offline(struct ccwgroup_device *gdev) | |||
310 | } | 310 | } |
311 | 311 | ||
312 | static ssize_t | 312 | static ssize_t |
313 | ccwgroup_online_store (struct device *dev, const char *buf, size_t count) | 313 | ccwgroup_online_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
314 | { | 314 | { |
315 | struct ccwgroup_device *gdev; | 315 | struct ccwgroup_device *gdev; |
316 | struct ccwgroup_driver *gdrv; | 316 | struct ccwgroup_driver *gdrv; |
@@ -338,7 +338,7 @@ ccwgroup_online_store (struct device *dev, const char *buf, size_t count) | |||
338 | } | 338 | } |
339 | 339 | ||
340 | static ssize_t | 340 | static ssize_t |
341 | ccwgroup_online_show (struct device *dev, char *buf) | 341 | ccwgroup_online_show (struct device *dev, struct device_attribute *attr, char *buf) |
342 | { | 342 | { |
343 | int online; | 343 | int online; |
344 | 344 | ||
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index b35fe12e6bfc..b86f94ecd874 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -852,7 +852,7 @@ out: | |||
852 | * Files for the channel path entries. | 852 | * Files for the channel path entries. |
853 | */ | 853 | */ |
854 | static ssize_t | 854 | static ssize_t |
855 | chp_status_show(struct device *dev, char *buf) | 855 | chp_status_show(struct device *dev, struct device_attribute *attr, char *buf) |
856 | { | 856 | { |
857 | struct channel_path *chp = container_of(dev, struct channel_path, dev); | 857 | struct channel_path *chp = container_of(dev, struct channel_path, dev); |
858 | 858 | ||
@@ -863,7 +863,7 @@ chp_status_show(struct device *dev, char *buf) | |||
863 | } | 863 | } |
864 | 864 | ||
865 | static ssize_t | 865 | static ssize_t |
866 | chp_status_write(struct device *dev, const char *buf, size_t count) | 866 | chp_status_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
867 | { | 867 | { |
868 | struct channel_path *cp = container_of(dev, struct channel_path, dev); | 868 | struct channel_path *cp = container_of(dev, struct channel_path, dev); |
869 | char cmd[10]; | 869 | char cmd[10]; |
@@ -888,7 +888,7 @@ chp_status_write(struct device *dev, const char *buf, size_t count) | |||
888 | static DEVICE_ATTR(status, 0644, chp_status_show, chp_status_write); | 888 | static DEVICE_ATTR(status, 0644, chp_status_show, chp_status_write); |
889 | 889 | ||
890 | static ssize_t | 890 | static ssize_t |
891 | chp_type_show(struct device *dev, char *buf) | 891 | chp_type_show(struct device *dev, struct device_attribute *attr, char *buf) |
892 | { | 892 | { |
893 | struct channel_path *chp = container_of(dev, struct channel_path, dev); | 893 | struct channel_path *chp = container_of(dev, struct channel_path, dev); |
894 | 894 | ||
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 49def26ba383..8cc4f1a940dc 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c | |||
@@ -796,7 +796,7 @@ cmb_show_attr(struct device *dev, char *buf, enum cmb_index idx) | |||
796 | } | 796 | } |
797 | 797 | ||
798 | static ssize_t | 798 | static ssize_t |
799 | cmb_show_avg_sample_interval(struct device *dev, char *buf) | 799 | cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr, char *buf) |
800 | { | 800 | { |
801 | struct ccw_device *cdev; | 801 | struct ccw_device *cdev; |
802 | long interval; | 802 | long interval; |
@@ -813,7 +813,7 @@ cmb_show_avg_sample_interval(struct device *dev, char *buf) | |||
813 | } | 813 | } |
814 | 814 | ||
815 | static ssize_t | 815 | static ssize_t |
816 | cmb_show_avg_utilization(struct device *dev, char *buf) | 816 | cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char *buf) |
817 | { | 817 | { |
818 | struct cmbdata data; | 818 | struct cmbdata data; |
819 | u64 utilization; | 819 | u64 utilization; |
@@ -842,12 +842,12 @@ cmb_show_avg_utilization(struct device *dev, char *buf) | |||
842 | } | 842 | } |
843 | 843 | ||
844 | #define cmf_attr(name) \ | 844 | #define cmf_attr(name) \ |
845 | static ssize_t show_ ## name (struct device * dev, char * buf) \ | 845 | static ssize_t show_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ |
846 | { return cmb_show_attr((dev), buf, cmb_ ## name); } \ | 846 | { return cmb_show_attr((dev), buf, cmb_ ## name); } \ |
847 | static DEVICE_ATTR(name, 0444, show_ ## name, NULL); | 847 | static DEVICE_ATTR(name, 0444, show_ ## name, NULL); |
848 | 848 | ||
849 | #define cmf_attr_avg(name) \ | 849 | #define cmf_attr_avg(name) \ |
850 | static ssize_t show_avg_ ## name (struct device * dev, char * buf) \ | 850 | static ssize_t show_avg_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ |
851 | { return cmb_show_attr((dev), buf, cmb_ ## name); } \ | 851 | { return cmb_show_attr((dev), buf, cmb_ ## name); } \ |
852 | static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL); | 852 | static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL); |
853 | 853 | ||
@@ -902,12 +902,12 @@ static struct attribute_group cmf_attr_group_ext = { | |||
902 | .attrs = cmf_attributes_ext, | 902 | .attrs = cmf_attributes_ext, |
903 | }; | 903 | }; |
904 | 904 | ||
905 | static ssize_t cmb_enable_show(struct device *dev, char *buf) | 905 | static ssize_t cmb_enable_show(struct device *dev, struct device_attribute *attr, char *buf) |
906 | { | 906 | { |
907 | return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0); | 907 | return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0); |
908 | } | 908 | } |
909 | 909 | ||
910 | static ssize_t cmb_enable_store(struct device *dev, const char *buf, size_t c) | 910 | static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t c) |
911 | { | 911 | { |
912 | struct ccw_device *cdev; | 912 | struct ccw_device *cdev; |
913 | int ret; | 913 | int ret; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index df0325505e4e..809e1108a06e 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -204,7 +204,7 @@ module_exit(cleanup_ccw_bus_type); | |||
204 | * TODO: Split chpids and pimpampom up? Where is "in use" in the tree? | 204 | * TODO: Split chpids and pimpampom up? Where is "in use" in the tree? |
205 | */ | 205 | */ |
206 | static ssize_t | 206 | static ssize_t |
207 | chpids_show (struct device * dev, char * buf) | 207 | chpids_show (struct device * dev, struct device_attribute *attr, char * buf) |
208 | { | 208 | { |
209 | struct subchannel *sch = to_subchannel(dev); | 209 | struct subchannel *sch = to_subchannel(dev); |
210 | struct ssd_info *ssd = &sch->ssd_info; | 210 | struct ssd_info *ssd = &sch->ssd_info; |
@@ -219,7 +219,7 @@ chpids_show (struct device * dev, char * buf) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | static ssize_t | 221 | static ssize_t |
222 | pimpampom_show (struct device * dev, char * buf) | 222 | pimpampom_show (struct device * dev, struct device_attribute *attr, char * buf) |
223 | { | 223 | { |
224 | struct subchannel *sch = to_subchannel(dev); | 224 | struct subchannel *sch = to_subchannel(dev); |
225 | struct pmcw *pmcw = &sch->schib.pmcw; | 225 | struct pmcw *pmcw = &sch->schib.pmcw; |
@@ -229,7 +229,7 @@ pimpampom_show (struct device * dev, char * buf) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | static ssize_t | 231 | static ssize_t |
232 | devtype_show (struct device *dev, char *buf) | 232 | devtype_show (struct device *dev, struct device_attribute *attr, char *buf) |
233 | { | 233 | { |
234 | struct ccw_device *cdev = to_ccwdev(dev); | 234 | struct ccw_device *cdev = to_ccwdev(dev); |
235 | struct ccw_device_id *id = &(cdev->id); | 235 | struct ccw_device_id *id = &(cdev->id); |
@@ -242,7 +242,7 @@ devtype_show (struct device *dev, char *buf) | |||
242 | } | 242 | } |
243 | 243 | ||
244 | static ssize_t | 244 | static ssize_t |
245 | cutype_show (struct device *dev, char *buf) | 245 | cutype_show (struct device *dev, struct device_attribute *attr, char *buf) |
246 | { | 246 | { |
247 | struct ccw_device *cdev = to_ccwdev(dev); | 247 | struct ccw_device *cdev = to_ccwdev(dev); |
248 | struct ccw_device_id *id = &(cdev->id); | 248 | struct ccw_device_id *id = &(cdev->id); |
@@ -252,7 +252,7 @@ cutype_show (struct device *dev, char *buf) | |||
252 | } | 252 | } |
253 | 253 | ||
254 | static ssize_t | 254 | static ssize_t |
255 | online_show (struct device *dev, char *buf) | 255 | online_show (struct device *dev, struct device_attribute *attr, char *buf) |
256 | { | 256 | { |
257 | struct ccw_device *cdev = to_ccwdev(dev); | 257 | struct ccw_device *cdev = to_ccwdev(dev); |
258 | 258 | ||
@@ -350,7 +350,7 @@ ccw_device_set_online(struct ccw_device *cdev) | |||
350 | } | 350 | } |
351 | 351 | ||
352 | static ssize_t | 352 | static ssize_t |
353 | online_store (struct device *dev, const char *buf, size_t count) | 353 | online_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
354 | { | 354 | { |
355 | struct ccw_device *cdev = to_ccwdev(dev); | 355 | struct ccw_device *cdev = to_ccwdev(dev); |
356 | int i, force, ret; | 356 | int i, force, ret; |
@@ -422,7 +422,7 @@ online_store (struct device *dev, const char *buf, size_t count) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | static ssize_t | 424 | static ssize_t |
425 | available_show (struct device *dev, char *buf) | 425 | available_show (struct device *dev, struct device_attribute *attr, char *buf) |
426 | { | 426 | { |
427 | struct ccw_device *cdev = to_ccwdev(dev); | 427 | struct ccw_device *cdev = to_ccwdev(dev); |
428 | struct subchannel *sch; | 428 | struct subchannel *sch; |
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index 06804d39a9c6..a99927d54ebb 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -241,20 +241,20 @@ static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr); | |||
241 | static void dumpit (char *buf, int len); | 241 | static void dumpit (char *buf, int len); |
242 | #endif | 242 | #endif |
243 | /* sysfs Functions */ | 243 | /* sysfs Functions */ |
244 | static ssize_t claw_hname_show(struct device *dev, char *buf); | 244 | static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf); |
245 | static ssize_t claw_hname_write(struct device *dev, | 245 | static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr, |
246 | const char *buf, size_t count); | 246 | const char *buf, size_t count); |
247 | static ssize_t claw_adname_show(struct device *dev, char *buf); | 247 | static ssize_t claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf); |
248 | static ssize_t claw_adname_write(struct device *dev, | 248 | static ssize_t claw_adname_write(struct device *dev, struct device_attribute *attr, |
249 | const char *buf, size_t count); | 249 | const char *buf, size_t count); |
250 | static ssize_t claw_apname_show(struct device *dev, char *buf); | 250 | static ssize_t claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf); |
251 | static ssize_t claw_apname_write(struct device *dev, | 251 | static ssize_t claw_apname_write(struct device *dev, struct device_attribute *attr, |
252 | const char *buf, size_t count); | 252 | const char *buf, size_t count); |
253 | static ssize_t claw_wbuff_show(struct device *dev, char *buf); | 253 | static ssize_t claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf); |
254 | static ssize_t claw_wbuff_write(struct device *dev, | 254 | static ssize_t claw_wbuff_write(struct device *dev, struct device_attribute *attr, |
255 | const char *buf, size_t count); | 255 | const char *buf, size_t count); |
256 | static ssize_t claw_rbuff_show(struct device *dev, char *buf); | 256 | static ssize_t claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf); |
257 | static ssize_t claw_rbuff_write(struct device *dev, | 257 | static ssize_t claw_rbuff_write(struct device *dev, struct device_attribute *attr, |
258 | const char *buf, size_t count); | 258 | const char *buf, size_t count); |
259 | static int claw_add_files(struct device *dev); | 259 | static int claw_add_files(struct device *dev); |
260 | static void claw_remove_files(struct device *dev); | 260 | static void claw_remove_files(struct device *dev); |
@@ -4149,7 +4149,7 @@ claw_remove_device(struct ccwgroup_device *cgdev) | |||
4149 | * sysfs attributes | 4149 | * sysfs attributes |
4150 | */ | 4150 | */ |
4151 | static ssize_t | 4151 | static ssize_t |
4152 | claw_hname_show(struct device *dev, char *buf) | 4152 | claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf) |
4153 | { | 4153 | { |
4154 | struct claw_privbk *priv; | 4154 | struct claw_privbk *priv; |
4155 | struct claw_env * p_env; | 4155 | struct claw_env * p_env; |
@@ -4162,7 +4162,7 @@ claw_hname_show(struct device *dev, char *buf) | |||
4162 | } | 4162 | } |
4163 | 4163 | ||
4164 | static ssize_t | 4164 | static ssize_t |
4165 | claw_hname_write(struct device *dev, const char *buf, size_t count) | 4165 | claw_hname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
4166 | { | 4166 | { |
4167 | struct claw_privbk *priv; | 4167 | struct claw_privbk *priv; |
4168 | struct claw_env * p_env; | 4168 | struct claw_env * p_env; |
@@ -4186,7 +4186,7 @@ claw_hname_write(struct device *dev, const char *buf, size_t count) | |||
4186 | static DEVICE_ATTR(host_name, 0644, claw_hname_show, claw_hname_write); | 4186 | static DEVICE_ATTR(host_name, 0644, claw_hname_show, claw_hname_write); |
4187 | 4187 | ||
4188 | static ssize_t | 4188 | static ssize_t |
4189 | claw_adname_show(struct device *dev, char *buf) | 4189 | claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf) |
4190 | { | 4190 | { |
4191 | struct claw_privbk *priv; | 4191 | struct claw_privbk *priv; |
4192 | struct claw_env * p_env; | 4192 | struct claw_env * p_env; |
@@ -4199,7 +4199,7 @@ claw_adname_show(struct device *dev, char *buf) | |||
4199 | } | 4199 | } |
4200 | 4200 | ||
4201 | static ssize_t | 4201 | static ssize_t |
4202 | claw_adname_write(struct device *dev, const char *buf, size_t count) | 4202 | claw_adname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
4203 | { | 4203 | { |
4204 | struct claw_privbk *priv; | 4204 | struct claw_privbk *priv; |
4205 | struct claw_env * p_env; | 4205 | struct claw_env * p_env; |
@@ -4223,7 +4223,7 @@ claw_adname_write(struct device *dev, const char *buf, size_t count) | |||
4223 | static DEVICE_ATTR(adapter_name, 0644, claw_adname_show, claw_adname_write); | 4223 | static DEVICE_ATTR(adapter_name, 0644, claw_adname_show, claw_adname_write); |
4224 | 4224 | ||
4225 | static ssize_t | 4225 | static ssize_t |
4226 | claw_apname_show(struct device *dev, char *buf) | 4226 | claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf) |
4227 | { | 4227 | { |
4228 | struct claw_privbk *priv; | 4228 | struct claw_privbk *priv; |
4229 | struct claw_env * p_env; | 4229 | struct claw_env * p_env; |
@@ -4237,7 +4237,7 @@ claw_apname_show(struct device *dev, char *buf) | |||
4237 | } | 4237 | } |
4238 | 4238 | ||
4239 | static ssize_t | 4239 | static ssize_t |
4240 | claw_apname_write(struct device *dev, const char *buf, size_t count) | 4240 | claw_apname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
4241 | { | 4241 | { |
4242 | struct claw_privbk *priv; | 4242 | struct claw_privbk *priv; |
4243 | struct claw_env * p_env; | 4243 | struct claw_env * p_env; |
@@ -4271,7 +4271,7 @@ claw_apname_write(struct device *dev, const char *buf, size_t count) | |||
4271 | static DEVICE_ATTR(api_type, 0644, claw_apname_show, claw_apname_write); | 4271 | static DEVICE_ATTR(api_type, 0644, claw_apname_show, claw_apname_write); |
4272 | 4272 | ||
4273 | static ssize_t | 4273 | static ssize_t |
4274 | claw_wbuff_show(struct device *dev, char *buf) | 4274 | claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf) |
4275 | { | 4275 | { |
4276 | struct claw_privbk *priv; | 4276 | struct claw_privbk *priv; |
4277 | struct claw_env * p_env; | 4277 | struct claw_env * p_env; |
@@ -4284,7 +4284,7 @@ claw_wbuff_show(struct device *dev, char *buf) | |||
4284 | } | 4284 | } |
4285 | 4285 | ||
4286 | static ssize_t | 4286 | static ssize_t |
4287 | claw_wbuff_write(struct device *dev, const char *buf, size_t count) | 4287 | claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
4288 | { | 4288 | { |
4289 | struct claw_privbk *priv; | 4289 | struct claw_privbk *priv; |
4290 | struct claw_env * p_env; | 4290 | struct claw_env * p_env; |
@@ -4312,7 +4312,7 @@ claw_wbuff_write(struct device *dev, const char *buf, size_t count) | |||
4312 | static DEVICE_ATTR(write_buffer, 0644, claw_wbuff_show, claw_wbuff_write); | 4312 | static DEVICE_ATTR(write_buffer, 0644, claw_wbuff_show, claw_wbuff_write); |
4313 | 4313 | ||
4314 | static ssize_t | 4314 | static ssize_t |
4315 | claw_rbuff_show(struct device *dev, char *buf) | 4315 | claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf) |
4316 | { | 4316 | { |
4317 | struct claw_privbk *priv; | 4317 | struct claw_privbk *priv; |
4318 | struct claw_env * p_env; | 4318 | struct claw_env * p_env; |
@@ -4325,7 +4325,7 @@ claw_rbuff_show(struct device *dev, char *buf) | |||
4325 | } | 4325 | } |
4326 | 4326 | ||
4327 | static ssize_t | 4327 | static ssize_t |
4328 | claw_rbuff_write(struct device *dev, const char *buf, size_t count) | 4328 | claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
4329 | { | 4329 | { |
4330 | struct claw_privbk *priv; | 4330 | struct claw_privbk *priv; |
4331 | struct claw_env *p_env; | 4331 | struct claw_env *p_env; |
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c index ff3e95e07e89..96ca863eaff2 100644 --- a/drivers/s390/net/ctcmain.c +++ b/drivers/s390/net/ctcmain.c | |||
@@ -2469,7 +2469,7 @@ ctc_stats(struct net_device * dev) | |||
2469 | */ | 2469 | */ |
2470 | 2470 | ||
2471 | static ssize_t | 2471 | static ssize_t |
2472 | buffer_show(struct device *dev, char *buf) | 2472 | buffer_show(struct device *dev, struct device_attribute *attr, char *buf) |
2473 | { | 2473 | { |
2474 | struct ctc_priv *priv; | 2474 | struct ctc_priv *priv; |
2475 | 2475 | ||
@@ -2481,7 +2481,7 @@ buffer_show(struct device *dev, char *buf) | |||
2481 | } | 2481 | } |
2482 | 2482 | ||
2483 | static ssize_t | 2483 | static ssize_t |
2484 | buffer_write(struct device *dev, const char *buf, size_t count) | 2484 | buffer_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2485 | { | 2485 | { |
2486 | struct ctc_priv *priv; | 2486 | struct ctc_priv *priv; |
2487 | struct net_device *ndev; | 2487 | struct net_device *ndev; |
@@ -2530,13 +2530,13 @@ einval: | |||
2530 | } | 2530 | } |
2531 | 2531 | ||
2532 | static ssize_t | 2532 | static ssize_t |
2533 | loglevel_show(struct device *dev, char *buf) | 2533 | loglevel_show(struct device *dev, struct device_attribute *attr, char *buf) |
2534 | { | 2534 | { |
2535 | return sprintf(buf, "%d\n", loglevel); | 2535 | return sprintf(buf, "%d\n", loglevel); |
2536 | } | 2536 | } |
2537 | 2537 | ||
2538 | static ssize_t | 2538 | static ssize_t |
2539 | loglevel_write(struct device *dev, const char *buf, size_t count) | 2539 | loglevel_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2540 | { | 2540 | { |
2541 | int ll1; | 2541 | int ll1; |
2542 | 2542 | ||
@@ -2589,7 +2589,7 @@ ctc_print_statistics(struct ctc_priv *priv) | |||
2589 | } | 2589 | } |
2590 | 2590 | ||
2591 | static ssize_t | 2591 | static ssize_t |
2592 | stats_show(struct device *dev, char *buf) | 2592 | stats_show(struct device *dev, struct device_attribute *attr, char *buf) |
2593 | { | 2593 | { |
2594 | struct ctc_priv *priv = dev->driver_data; | 2594 | struct ctc_priv *priv = dev->driver_data; |
2595 | if (!priv) | 2595 | if (!priv) |
@@ -2599,7 +2599,7 @@ stats_show(struct device *dev, char *buf) | |||
2599 | } | 2599 | } |
2600 | 2600 | ||
2601 | static ssize_t | 2601 | static ssize_t |
2602 | stats_write(struct device *dev, const char *buf, size_t count) | 2602 | stats_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2603 | { | 2603 | { |
2604 | struct ctc_priv *priv = dev->driver_data; | 2604 | struct ctc_priv *priv = dev->driver_data; |
2605 | if (!priv) | 2605 | if (!priv) |
@@ -2654,7 +2654,7 @@ ctc_free_netdevice(struct net_device * dev, int free_dev) | |||
2654 | } | 2654 | } |
2655 | 2655 | ||
2656 | static ssize_t | 2656 | static ssize_t |
2657 | ctc_proto_show(struct device *dev, char *buf) | 2657 | ctc_proto_show(struct device *dev, struct device_attribute *attr, char *buf) |
2658 | { | 2658 | { |
2659 | struct ctc_priv *priv; | 2659 | struct ctc_priv *priv; |
2660 | 2660 | ||
@@ -2666,7 +2666,7 @@ ctc_proto_show(struct device *dev, char *buf) | |||
2666 | } | 2666 | } |
2667 | 2667 | ||
2668 | static ssize_t | 2668 | static ssize_t |
2669 | ctc_proto_store(struct device *dev, const char *buf, size_t count) | 2669 | ctc_proto_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2670 | { | 2670 | { |
2671 | struct ctc_priv *priv; | 2671 | struct ctc_priv *priv; |
2672 | int value; | 2672 | int value; |
@@ -2687,7 +2687,7 @@ ctc_proto_store(struct device *dev, const char *buf, size_t count) | |||
2687 | 2687 | ||
2688 | 2688 | ||
2689 | static ssize_t | 2689 | static ssize_t |
2690 | ctc_type_show(struct device *dev, char *buf) | 2690 | ctc_type_show(struct device *dev, struct device_attribute *attr, char *buf) |
2691 | { | 2691 | { |
2692 | struct ccwgroup_device *cgdev; | 2692 | struct ccwgroup_device *cgdev; |
2693 | 2693 | ||
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index cccfed248e70..ab086242d305 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -1984,7 +1984,7 @@ lcs_open_device(struct net_device *dev) | |||
1984 | * show function for portno called by cat or similar things | 1984 | * show function for portno called by cat or similar things |
1985 | */ | 1985 | */ |
1986 | static ssize_t | 1986 | static ssize_t |
1987 | lcs_portno_show (struct device *dev, char *buf) | 1987 | lcs_portno_show (struct device *dev, struct device_attribute *attr, char *buf) |
1988 | { | 1988 | { |
1989 | struct lcs_card *card; | 1989 | struct lcs_card *card; |
1990 | 1990 | ||
@@ -2000,7 +2000,7 @@ lcs_portno_show (struct device *dev, char *buf) | |||
2000 | * store the value which is piped to file portno | 2000 | * store the value which is piped to file portno |
2001 | */ | 2001 | */ |
2002 | static ssize_t | 2002 | static ssize_t |
2003 | lcs_portno_store (struct device *dev, const char *buf, size_t count) | 2003 | lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2004 | { | 2004 | { |
2005 | struct lcs_card *card; | 2005 | struct lcs_card *card; |
2006 | int value; | 2006 | int value; |
@@ -2021,7 +2021,7 @@ lcs_portno_store (struct device *dev, const char *buf, size_t count) | |||
2021 | static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store); | 2021 | static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store); |
2022 | 2022 | ||
2023 | static ssize_t | 2023 | static ssize_t |
2024 | lcs_type_show(struct device *dev, char *buf) | 2024 | lcs_type_show(struct device *dev, struct device_attribute *attr, char *buf) |
2025 | { | 2025 | { |
2026 | struct ccwgroup_device *cgdev; | 2026 | struct ccwgroup_device *cgdev; |
2027 | 2027 | ||
@@ -2035,7 +2035,7 @@ lcs_type_show(struct device *dev, char *buf) | |||
2035 | static DEVICE_ATTR(type, 0444, lcs_type_show, NULL); | 2035 | static DEVICE_ATTR(type, 0444, lcs_type_show, NULL); |
2036 | 2036 | ||
2037 | static ssize_t | 2037 | static ssize_t |
2038 | lcs_timeout_show(struct device *dev, char *buf) | 2038 | lcs_timeout_show(struct device *dev, struct device_attribute *attr, char *buf) |
2039 | { | 2039 | { |
2040 | struct lcs_card *card; | 2040 | struct lcs_card *card; |
2041 | 2041 | ||
@@ -2045,7 +2045,7 @@ lcs_timeout_show(struct device *dev, char *buf) | |||
2045 | } | 2045 | } |
2046 | 2046 | ||
2047 | static ssize_t | 2047 | static ssize_t |
2048 | lcs_timeout_store (struct device *dev, const char *buf, size_t count) | 2048 | lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
2049 | { | 2049 | { |
2050 | struct lcs_card *card; | 2050 | struct lcs_card *card; |
2051 | int value; | 2051 | int value; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 16e8e69afb10..3fd4fb754b2d 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -1356,7 +1356,7 @@ netiucv_change_mtu (struct net_device * dev, int new_mtu) | |||
1356 | *****************************************************************************/ | 1356 | *****************************************************************************/ |
1357 | 1357 | ||
1358 | static ssize_t | 1358 | static ssize_t |
1359 | user_show (struct device *dev, char *buf) | 1359 | user_show (struct device *dev, struct device_attribute *attr, char *buf) |
1360 | { | 1360 | { |
1361 | struct netiucv_priv *priv = dev->driver_data; | 1361 | struct netiucv_priv *priv = dev->driver_data; |
1362 | 1362 | ||
@@ -1365,7 +1365,7 @@ user_show (struct device *dev, char *buf) | |||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | static ssize_t | 1367 | static ssize_t |
1368 | user_write (struct device *dev, const char *buf, size_t count) | 1368 | user_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1369 | { | 1369 | { |
1370 | struct netiucv_priv *priv = dev->driver_data; | 1370 | struct netiucv_priv *priv = dev->driver_data; |
1371 | struct net_device *ndev = priv->conn->netdev; | 1371 | struct net_device *ndev = priv->conn->netdev; |
@@ -1422,7 +1422,7 @@ user_write (struct device *dev, const char *buf, size_t count) | |||
1422 | static DEVICE_ATTR(user, 0644, user_show, user_write); | 1422 | static DEVICE_ATTR(user, 0644, user_show, user_write); |
1423 | 1423 | ||
1424 | static ssize_t | 1424 | static ssize_t |
1425 | buffer_show (struct device *dev, char *buf) | 1425 | buffer_show (struct device *dev, struct device_attribute *attr, char *buf) |
1426 | { | 1426 | { |
1427 | struct netiucv_priv *priv = dev->driver_data; | 1427 | struct netiucv_priv *priv = dev->driver_data; |
1428 | 1428 | ||
@@ -1431,7 +1431,7 @@ buffer_show (struct device *dev, char *buf) | |||
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | static ssize_t | 1433 | static ssize_t |
1434 | buffer_write (struct device *dev, const char *buf, size_t count) | 1434 | buffer_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1435 | { | 1435 | { |
1436 | struct netiucv_priv *priv = dev->driver_data; | 1436 | struct netiucv_priv *priv = dev->driver_data; |
1437 | struct net_device *ndev = priv->conn->netdev; | 1437 | struct net_device *ndev = priv->conn->netdev; |
@@ -1486,7 +1486,7 @@ buffer_write (struct device *dev, const char *buf, size_t count) | |||
1486 | static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write); | 1486 | static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write); |
1487 | 1487 | ||
1488 | static ssize_t | 1488 | static ssize_t |
1489 | dev_fsm_show (struct device *dev, char *buf) | 1489 | dev_fsm_show (struct device *dev, struct device_attribute *attr, char *buf) |
1490 | { | 1490 | { |
1491 | struct netiucv_priv *priv = dev->driver_data; | 1491 | struct netiucv_priv *priv = dev->driver_data; |
1492 | 1492 | ||
@@ -1497,7 +1497,7 @@ dev_fsm_show (struct device *dev, char *buf) | |||
1497 | static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL); | 1497 | static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL); |
1498 | 1498 | ||
1499 | static ssize_t | 1499 | static ssize_t |
1500 | conn_fsm_show (struct device *dev, char *buf) | 1500 | conn_fsm_show (struct device *dev, struct device_attribute *attr, char *buf) |
1501 | { | 1501 | { |
1502 | struct netiucv_priv *priv = dev->driver_data; | 1502 | struct netiucv_priv *priv = dev->driver_data; |
1503 | 1503 | ||
@@ -1508,7 +1508,7 @@ conn_fsm_show (struct device *dev, char *buf) | |||
1508 | static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL); | 1508 | static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL); |
1509 | 1509 | ||
1510 | static ssize_t | 1510 | static ssize_t |
1511 | maxmulti_show (struct device *dev, char *buf) | 1511 | maxmulti_show (struct device *dev, struct device_attribute *attr, char *buf) |
1512 | { | 1512 | { |
1513 | struct netiucv_priv *priv = dev->driver_data; | 1513 | struct netiucv_priv *priv = dev->driver_data; |
1514 | 1514 | ||
@@ -1517,7 +1517,7 @@ maxmulti_show (struct device *dev, char *buf) | |||
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | static ssize_t | 1519 | static ssize_t |
1520 | maxmulti_write (struct device *dev, const char *buf, size_t count) | 1520 | maxmulti_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1521 | { | 1521 | { |
1522 | struct netiucv_priv *priv = dev->driver_data; | 1522 | struct netiucv_priv *priv = dev->driver_data; |
1523 | 1523 | ||
@@ -1529,7 +1529,7 @@ maxmulti_write (struct device *dev, const char *buf, size_t count) | |||
1529 | static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write); | 1529 | static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write); |
1530 | 1530 | ||
1531 | static ssize_t | 1531 | static ssize_t |
1532 | maxcq_show (struct device *dev, char *buf) | 1532 | maxcq_show (struct device *dev, struct device_attribute *attr, char *buf) |
1533 | { | 1533 | { |
1534 | struct netiucv_priv *priv = dev->driver_data; | 1534 | struct netiucv_priv *priv = dev->driver_data; |
1535 | 1535 | ||
@@ -1538,7 +1538,7 @@ maxcq_show (struct device *dev, char *buf) | |||
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | static ssize_t | 1540 | static ssize_t |
1541 | maxcq_write (struct device *dev, const char *buf, size_t count) | 1541 | maxcq_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1542 | { | 1542 | { |
1543 | struct netiucv_priv *priv = dev->driver_data; | 1543 | struct netiucv_priv *priv = dev->driver_data; |
1544 | 1544 | ||
@@ -1550,7 +1550,7 @@ maxcq_write (struct device *dev, const char *buf, size_t count) | |||
1550 | static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write); | 1550 | static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write); |
1551 | 1551 | ||
1552 | static ssize_t | 1552 | static ssize_t |
1553 | sdoio_show (struct device *dev, char *buf) | 1553 | sdoio_show (struct device *dev, struct device_attribute *attr, char *buf) |
1554 | { | 1554 | { |
1555 | struct netiucv_priv *priv = dev->driver_data; | 1555 | struct netiucv_priv *priv = dev->driver_data; |
1556 | 1556 | ||
@@ -1559,7 +1559,7 @@ sdoio_show (struct device *dev, char *buf) | |||
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | static ssize_t | 1561 | static ssize_t |
1562 | sdoio_write (struct device *dev, const char *buf, size_t count) | 1562 | sdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1563 | { | 1563 | { |
1564 | struct netiucv_priv *priv = dev->driver_data; | 1564 | struct netiucv_priv *priv = dev->driver_data; |
1565 | 1565 | ||
@@ -1571,7 +1571,7 @@ sdoio_write (struct device *dev, const char *buf, size_t count) | |||
1571 | static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write); | 1571 | static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write); |
1572 | 1572 | ||
1573 | static ssize_t | 1573 | static ssize_t |
1574 | mdoio_show (struct device *dev, char *buf) | 1574 | mdoio_show (struct device *dev, struct device_attribute *attr, char *buf) |
1575 | { | 1575 | { |
1576 | struct netiucv_priv *priv = dev->driver_data; | 1576 | struct netiucv_priv *priv = dev->driver_data; |
1577 | 1577 | ||
@@ -1580,7 +1580,7 @@ mdoio_show (struct device *dev, char *buf) | |||
1580 | } | 1580 | } |
1581 | 1581 | ||
1582 | static ssize_t | 1582 | static ssize_t |
1583 | mdoio_write (struct device *dev, const char *buf, size_t count) | 1583 | mdoio_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1584 | { | 1584 | { |
1585 | struct netiucv_priv *priv = dev->driver_data; | 1585 | struct netiucv_priv *priv = dev->driver_data; |
1586 | 1586 | ||
@@ -1592,7 +1592,7 @@ mdoio_write (struct device *dev, const char *buf, size_t count) | |||
1592 | static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write); | 1592 | static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write); |
1593 | 1593 | ||
1594 | static ssize_t | 1594 | static ssize_t |
1595 | txlen_show (struct device *dev, char *buf) | 1595 | txlen_show (struct device *dev, struct device_attribute *attr, char *buf) |
1596 | { | 1596 | { |
1597 | struct netiucv_priv *priv = dev->driver_data; | 1597 | struct netiucv_priv *priv = dev->driver_data; |
1598 | 1598 | ||
@@ -1601,7 +1601,7 @@ txlen_show (struct device *dev, char *buf) | |||
1601 | } | 1601 | } |
1602 | 1602 | ||
1603 | static ssize_t | 1603 | static ssize_t |
1604 | txlen_write (struct device *dev, const char *buf, size_t count) | 1604 | txlen_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1605 | { | 1605 | { |
1606 | struct netiucv_priv *priv = dev->driver_data; | 1606 | struct netiucv_priv *priv = dev->driver_data; |
1607 | 1607 | ||
@@ -1613,7 +1613,7 @@ txlen_write (struct device *dev, const char *buf, size_t count) | |||
1613 | static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write); | 1613 | static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write); |
1614 | 1614 | ||
1615 | static ssize_t | 1615 | static ssize_t |
1616 | txtime_show (struct device *dev, char *buf) | 1616 | txtime_show (struct device *dev, struct device_attribute *attr, char *buf) |
1617 | { | 1617 | { |
1618 | struct netiucv_priv *priv = dev->driver_data; | 1618 | struct netiucv_priv *priv = dev->driver_data; |
1619 | 1619 | ||
@@ -1622,7 +1622,7 @@ txtime_show (struct device *dev, char *buf) | |||
1622 | } | 1622 | } |
1623 | 1623 | ||
1624 | static ssize_t | 1624 | static ssize_t |
1625 | txtime_write (struct device *dev, const char *buf, size_t count) | 1625 | txtime_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1626 | { | 1626 | { |
1627 | struct netiucv_priv *priv = dev->driver_data; | 1627 | struct netiucv_priv *priv = dev->driver_data; |
1628 | 1628 | ||
@@ -1634,7 +1634,7 @@ txtime_write (struct device *dev, const char *buf, size_t count) | |||
1634 | static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write); | 1634 | static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write); |
1635 | 1635 | ||
1636 | static ssize_t | 1636 | static ssize_t |
1637 | txpend_show (struct device *dev, char *buf) | 1637 | txpend_show (struct device *dev, struct device_attribute *attr, char *buf) |
1638 | { | 1638 | { |
1639 | struct netiucv_priv *priv = dev->driver_data; | 1639 | struct netiucv_priv *priv = dev->driver_data; |
1640 | 1640 | ||
@@ -1643,7 +1643,7 @@ txpend_show (struct device *dev, char *buf) | |||
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | static ssize_t | 1645 | static ssize_t |
1646 | txpend_write (struct device *dev, const char *buf, size_t count) | 1646 | txpend_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1647 | { | 1647 | { |
1648 | struct netiucv_priv *priv = dev->driver_data; | 1648 | struct netiucv_priv *priv = dev->driver_data; |
1649 | 1649 | ||
@@ -1655,7 +1655,7 @@ txpend_write (struct device *dev, const char *buf, size_t count) | |||
1655 | static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write); | 1655 | static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write); |
1656 | 1656 | ||
1657 | static ssize_t | 1657 | static ssize_t |
1658 | txmpnd_show (struct device *dev, char *buf) | 1658 | txmpnd_show (struct device *dev, struct device_attribute *attr, char *buf) |
1659 | { | 1659 | { |
1660 | struct netiucv_priv *priv = dev->driver_data; | 1660 | struct netiucv_priv *priv = dev->driver_data; |
1661 | 1661 | ||
@@ -1664,7 +1664,7 @@ txmpnd_show (struct device *dev, char *buf) | |||
1664 | } | 1664 | } |
1665 | 1665 | ||
1666 | static ssize_t | 1666 | static ssize_t |
1667 | txmpnd_write (struct device *dev, const char *buf, size_t count) | 1667 | txmpnd_write (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1668 | { | 1668 | { |
1669 | struct netiucv_priv *priv = dev->driver_data; | 1669 | struct netiucv_priv *priv = dev->driver_data; |
1670 | 1670 | ||
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 240348398211..98bedb0cb387 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -30,7 +30,7 @@ const char *VERSION_QETH_SYS_C = "$Revision: 1.51 $"; | |||
30 | //low/high watermark | 30 | //low/high watermark |
31 | 31 | ||
32 | static ssize_t | 32 | static ssize_t |
33 | qeth_dev_state_show(struct device *dev, char *buf) | 33 | qeth_dev_state_show(struct device *dev, struct device_attribute *attr, char *buf) |
34 | { | 34 | { |
35 | struct qeth_card *card = dev->driver_data; | 35 | struct qeth_card *card = dev->driver_data; |
36 | if (!card) | 36 | if (!card) |
@@ -58,7 +58,7 @@ qeth_dev_state_show(struct device *dev, char *buf) | |||
58 | static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL); | 58 | static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL); |
59 | 59 | ||
60 | static ssize_t | 60 | static ssize_t |
61 | qeth_dev_chpid_show(struct device *dev, char *buf) | 61 | qeth_dev_chpid_show(struct device *dev, struct device_attribute *attr, char *buf) |
62 | { | 62 | { |
63 | struct qeth_card *card = dev->driver_data; | 63 | struct qeth_card *card = dev->driver_data; |
64 | if (!card) | 64 | if (!card) |
@@ -70,7 +70,7 @@ qeth_dev_chpid_show(struct device *dev, char *buf) | |||
70 | static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL); | 70 | static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL); |
71 | 71 | ||
72 | static ssize_t | 72 | static ssize_t |
73 | qeth_dev_if_name_show(struct device *dev, char *buf) | 73 | qeth_dev_if_name_show(struct device *dev, struct device_attribute *attr, char *buf) |
74 | { | 74 | { |
75 | struct qeth_card *card = dev->driver_data; | 75 | struct qeth_card *card = dev->driver_data; |
76 | if (!card) | 76 | if (!card) |
@@ -81,7 +81,7 @@ qeth_dev_if_name_show(struct device *dev, char *buf) | |||
81 | static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL); | 81 | static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL); |
82 | 82 | ||
83 | static ssize_t | 83 | static ssize_t |
84 | qeth_dev_card_type_show(struct device *dev, char *buf) | 84 | qeth_dev_card_type_show(struct device *dev, struct device_attribute *attr, char *buf) |
85 | { | 85 | { |
86 | struct qeth_card *card = dev->driver_data; | 86 | struct qeth_card *card = dev->driver_data; |
87 | if (!card) | 87 | if (!card) |
@@ -93,7 +93,7 @@ qeth_dev_card_type_show(struct device *dev, char *buf) | |||
93 | static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL); | 93 | static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL); |
94 | 94 | ||
95 | static ssize_t | 95 | static ssize_t |
96 | qeth_dev_portno_show(struct device *dev, char *buf) | 96 | qeth_dev_portno_show(struct device *dev, struct device_attribute *attr, char *buf) |
97 | { | 97 | { |
98 | struct qeth_card *card = dev->driver_data; | 98 | struct qeth_card *card = dev->driver_data; |
99 | if (!card) | 99 | if (!card) |
@@ -103,7 +103,7 @@ qeth_dev_portno_show(struct device *dev, char *buf) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | static ssize_t | 105 | static ssize_t |
106 | qeth_dev_portno_store(struct device *dev, const char *buf, size_t count) | 106 | qeth_dev_portno_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
107 | { | 107 | { |
108 | struct qeth_card *card = dev->driver_data; | 108 | struct qeth_card *card = dev->driver_data; |
109 | char *tmp; | 109 | char *tmp; |
@@ -129,7 +129,7 @@ qeth_dev_portno_store(struct device *dev, const char *buf, size_t count) | |||
129 | static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store); | 129 | static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store); |
130 | 130 | ||
131 | static ssize_t | 131 | static ssize_t |
132 | qeth_dev_portname_show(struct device *dev, char *buf) | 132 | qeth_dev_portname_show(struct device *dev, struct device_attribute *attr, char *buf) |
133 | { | 133 | { |
134 | struct qeth_card *card = dev->driver_data; | 134 | struct qeth_card *card = dev->driver_data; |
135 | char portname[9] = {0, }; | 135 | char portname[9] = {0, }; |
@@ -146,7 +146,7 @@ qeth_dev_portname_show(struct device *dev, char *buf) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static ssize_t | 148 | static ssize_t |
149 | qeth_dev_portname_store(struct device *dev, const char *buf, size_t count) | 149 | qeth_dev_portname_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
150 | { | 150 | { |
151 | struct qeth_card *card = dev->driver_data; | 151 | struct qeth_card *card = dev->driver_data; |
152 | char *tmp; | 152 | char *tmp; |
@@ -177,7 +177,7 @@ static DEVICE_ATTR(portname, 0644, qeth_dev_portname_show, | |||
177 | qeth_dev_portname_store); | 177 | qeth_dev_portname_store); |
178 | 178 | ||
179 | static ssize_t | 179 | static ssize_t |
180 | qeth_dev_checksum_show(struct device *dev, char *buf) | 180 | qeth_dev_checksum_show(struct device *dev, struct device_attribute *attr, char *buf) |
181 | { | 181 | { |
182 | struct qeth_card *card = dev->driver_data; | 182 | struct qeth_card *card = dev->driver_data; |
183 | 183 | ||
@@ -188,7 +188,7 @@ qeth_dev_checksum_show(struct device *dev, char *buf) | |||
188 | } | 188 | } |
189 | 189 | ||
190 | static ssize_t | 190 | static ssize_t |
191 | qeth_dev_checksum_store(struct device *dev, const char *buf, size_t count) | 191 | qeth_dev_checksum_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
192 | { | 192 | { |
193 | struct qeth_card *card = dev->driver_data; | 193 | struct qeth_card *card = dev->driver_data; |
194 | char *tmp; | 194 | char *tmp; |
@@ -218,7 +218,7 @@ static DEVICE_ATTR(checksumming, 0644, qeth_dev_checksum_show, | |||
218 | qeth_dev_checksum_store); | 218 | qeth_dev_checksum_store); |
219 | 219 | ||
220 | static ssize_t | 220 | static ssize_t |
221 | qeth_dev_prioqing_show(struct device *dev, char *buf) | 221 | qeth_dev_prioqing_show(struct device *dev, struct device_attribute *attr, char *buf) |
222 | { | 222 | { |
223 | struct qeth_card *card = dev->driver_data; | 223 | struct qeth_card *card = dev->driver_data; |
224 | 224 | ||
@@ -237,7 +237,7 @@ qeth_dev_prioqing_show(struct device *dev, char *buf) | |||
237 | } | 237 | } |
238 | 238 | ||
239 | static ssize_t | 239 | static ssize_t |
240 | qeth_dev_prioqing_store(struct device *dev, const char *buf, size_t count) | 240 | qeth_dev_prioqing_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
241 | { | 241 | { |
242 | struct qeth_card *card = dev->driver_data; | 242 | struct qeth_card *card = dev->driver_data; |
243 | char *tmp; | 243 | char *tmp; |
@@ -290,7 +290,7 @@ static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show, | |||
290 | qeth_dev_prioqing_store); | 290 | qeth_dev_prioqing_store); |
291 | 291 | ||
292 | static ssize_t | 292 | static ssize_t |
293 | qeth_dev_bufcnt_show(struct device *dev, char *buf) | 293 | qeth_dev_bufcnt_show(struct device *dev, struct device_attribute *attr, char *buf) |
294 | { | 294 | { |
295 | struct qeth_card *card = dev->driver_data; | 295 | struct qeth_card *card = dev->driver_data; |
296 | 296 | ||
@@ -301,7 +301,7 @@ qeth_dev_bufcnt_show(struct device *dev, char *buf) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | static ssize_t | 303 | static ssize_t |
304 | qeth_dev_bufcnt_store(struct device *dev, const char *buf, size_t count) | 304 | qeth_dev_bufcnt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
305 | { | 305 | { |
306 | struct qeth_card *card = dev->driver_data; | 306 | struct qeth_card *card = dev->driver_data; |
307 | char *tmp; | 307 | char *tmp; |
@@ -360,7 +360,7 @@ qeth_dev_route_show(struct qeth_card *card, struct qeth_routing_info *route, | |||
360 | } | 360 | } |
361 | 361 | ||
362 | static ssize_t | 362 | static ssize_t |
363 | qeth_dev_route4_show(struct device *dev, char *buf) | 363 | qeth_dev_route4_show(struct device *dev, struct device_attribute *attr, char *buf) |
364 | { | 364 | { |
365 | struct qeth_card *card = dev->driver_data; | 365 | struct qeth_card *card = dev->driver_data; |
366 | 366 | ||
@@ -410,7 +410,7 @@ qeth_dev_route_store(struct qeth_card *card, struct qeth_routing_info *route, | |||
410 | } | 410 | } |
411 | 411 | ||
412 | static ssize_t | 412 | static ssize_t |
413 | qeth_dev_route4_store(struct device *dev, const char *buf, size_t count) | 413 | qeth_dev_route4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
414 | { | 414 | { |
415 | struct qeth_card *card = dev->driver_data; | 415 | struct qeth_card *card = dev->driver_data; |
416 | 416 | ||
@@ -425,7 +425,7 @@ static DEVICE_ATTR(route4, 0644, qeth_dev_route4_show, qeth_dev_route4_store); | |||
425 | 425 | ||
426 | #ifdef CONFIG_QETH_IPV6 | 426 | #ifdef CONFIG_QETH_IPV6 |
427 | static ssize_t | 427 | static ssize_t |
428 | qeth_dev_route6_show(struct device *dev, char *buf) | 428 | qeth_dev_route6_show(struct device *dev, struct device_attribute *attr, char *buf) |
429 | { | 429 | { |
430 | struct qeth_card *card = dev->driver_data; | 430 | struct qeth_card *card = dev->driver_data; |
431 | 431 | ||
@@ -439,7 +439,7 @@ qeth_dev_route6_show(struct device *dev, char *buf) | |||
439 | } | 439 | } |
440 | 440 | ||
441 | static ssize_t | 441 | static ssize_t |
442 | qeth_dev_route6_store(struct device *dev, const char *buf, size_t count) | 442 | qeth_dev_route6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
443 | { | 443 | { |
444 | struct qeth_card *card = dev->driver_data; | 444 | struct qeth_card *card = dev->driver_data; |
445 | 445 | ||
@@ -461,7 +461,7 @@ static DEVICE_ATTR(route6, 0644, qeth_dev_route6_show, qeth_dev_route6_store); | |||
461 | #endif | 461 | #endif |
462 | 462 | ||
463 | static ssize_t | 463 | static ssize_t |
464 | qeth_dev_add_hhlen_show(struct device *dev, char *buf) | 464 | qeth_dev_add_hhlen_show(struct device *dev, struct device_attribute *attr, char *buf) |
465 | { | 465 | { |
466 | struct qeth_card *card = dev->driver_data; | 466 | struct qeth_card *card = dev->driver_data; |
467 | 467 | ||
@@ -472,7 +472,7 @@ qeth_dev_add_hhlen_show(struct device *dev, char *buf) | |||
472 | } | 472 | } |
473 | 473 | ||
474 | static ssize_t | 474 | static ssize_t |
475 | qeth_dev_add_hhlen_store(struct device *dev, const char *buf, size_t count) | 475 | qeth_dev_add_hhlen_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
476 | { | 476 | { |
477 | struct qeth_card *card = dev->driver_data; | 477 | struct qeth_card *card = dev->driver_data; |
478 | char *tmp; | 478 | char *tmp; |
@@ -499,7 +499,7 @@ static DEVICE_ATTR(add_hhlen, 0644, qeth_dev_add_hhlen_show, | |||
499 | qeth_dev_add_hhlen_store); | 499 | qeth_dev_add_hhlen_store); |
500 | 500 | ||
501 | static ssize_t | 501 | static ssize_t |
502 | qeth_dev_fake_ll_show(struct device *dev, char *buf) | 502 | qeth_dev_fake_ll_show(struct device *dev, struct device_attribute *attr, char *buf) |
503 | { | 503 | { |
504 | struct qeth_card *card = dev->driver_data; | 504 | struct qeth_card *card = dev->driver_data; |
505 | 505 | ||
@@ -510,7 +510,7 @@ qeth_dev_fake_ll_show(struct device *dev, char *buf) | |||
510 | } | 510 | } |
511 | 511 | ||
512 | static ssize_t | 512 | static ssize_t |
513 | qeth_dev_fake_ll_store(struct device *dev, const char *buf, size_t count) | 513 | qeth_dev_fake_ll_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
514 | { | 514 | { |
515 | struct qeth_card *card = dev->driver_data; | 515 | struct qeth_card *card = dev->driver_data; |
516 | char *tmp; | 516 | char *tmp; |
@@ -536,7 +536,7 @@ static DEVICE_ATTR(fake_ll, 0644, qeth_dev_fake_ll_show, | |||
536 | qeth_dev_fake_ll_store); | 536 | qeth_dev_fake_ll_store); |
537 | 537 | ||
538 | static ssize_t | 538 | static ssize_t |
539 | qeth_dev_fake_broadcast_show(struct device *dev, char *buf) | 539 | qeth_dev_fake_broadcast_show(struct device *dev, struct device_attribute *attr, char *buf) |
540 | { | 540 | { |
541 | struct qeth_card *card = dev->driver_data; | 541 | struct qeth_card *card = dev->driver_data; |
542 | 542 | ||
@@ -547,7 +547,7 @@ qeth_dev_fake_broadcast_show(struct device *dev, char *buf) | |||
547 | } | 547 | } |
548 | 548 | ||
549 | static ssize_t | 549 | static ssize_t |
550 | qeth_dev_fake_broadcast_store(struct device *dev, const char *buf, size_t count) | 550 | qeth_dev_fake_broadcast_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
551 | { | 551 | { |
552 | struct qeth_card *card = dev->driver_data; | 552 | struct qeth_card *card = dev->driver_data; |
553 | char *tmp; | 553 | char *tmp; |
@@ -574,7 +574,7 @@ static DEVICE_ATTR(fake_broadcast, 0644, qeth_dev_fake_broadcast_show, | |||
574 | qeth_dev_fake_broadcast_store); | 574 | qeth_dev_fake_broadcast_store); |
575 | 575 | ||
576 | static ssize_t | 576 | static ssize_t |
577 | qeth_dev_recover_store(struct device *dev, const char *buf, size_t count) | 577 | qeth_dev_recover_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
578 | { | 578 | { |
579 | struct qeth_card *card = dev->driver_data; | 579 | struct qeth_card *card = dev->driver_data; |
580 | char *tmp; | 580 | char *tmp; |
@@ -596,7 +596,7 @@ qeth_dev_recover_store(struct device *dev, const char *buf, size_t count) | |||
596 | static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store); | 596 | static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store); |
597 | 597 | ||
598 | static ssize_t | 598 | static ssize_t |
599 | qeth_dev_broadcast_mode_show(struct device *dev, char *buf) | 599 | qeth_dev_broadcast_mode_show(struct device *dev, struct device_attribute *attr, char *buf) |
600 | { | 600 | { |
601 | struct qeth_card *card = dev->driver_data; | 601 | struct qeth_card *card = dev->driver_data; |
602 | 602 | ||
@@ -613,7 +613,7 @@ qeth_dev_broadcast_mode_show(struct device *dev, char *buf) | |||
613 | } | 613 | } |
614 | 614 | ||
615 | static ssize_t | 615 | static ssize_t |
616 | qeth_dev_broadcast_mode_store(struct device *dev, const char *buf, size_t count) | 616 | qeth_dev_broadcast_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
617 | { | 617 | { |
618 | struct qeth_card *card = dev->driver_data; | 618 | struct qeth_card *card = dev->driver_data; |
619 | char *tmp; | 619 | char *tmp; |
@@ -651,7 +651,7 @@ static DEVICE_ATTR(broadcast_mode, 0644, qeth_dev_broadcast_mode_show, | |||
651 | qeth_dev_broadcast_mode_store); | 651 | qeth_dev_broadcast_mode_store); |
652 | 652 | ||
653 | static ssize_t | 653 | static ssize_t |
654 | qeth_dev_canonical_macaddr_show(struct device *dev, char *buf) | 654 | qeth_dev_canonical_macaddr_show(struct device *dev, struct device_attribute *attr, char *buf) |
655 | { | 655 | { |
656 | struct qeth_card *card = dev->driver_data; | 656 | struct qeth_card *card = dev->driver_data; |
657 | 657 | ||
@@ -667,7 +667,7 @@ qeth_dev_canonical_macaddr_show(struct device *dev, char *buf) | |||
667 | } | 667 | } |
668 | 668 | ||
669 | static ssize_t | 669 | static ssize_t |
670 | qeth_dev_canonical_macaddr_store(struct device *dev, const char *buf, | 670 | qeth_dev_canonical_macaddr_store(struct device *dev, struct device_attribute *attr, const char *buf, |
671 | size_t count) | 671 | size_t count) |
672 | { | 672 | { |
673 | struct qeth_card *card = dev->driver_data; | 673 | struct qeth_card *card = dev->driver_data; |
@@ -703,7 +703,7 @@ static DEVICE_ATTR(canonical_macaddr, 0644, qeth_dev_canonical_macaddr_show, | |||
703 | qeth_dev_canonical_macaddr_store); | 703 | qeth_dev_canonical_macaddr_store); |
704 | 704 | ||
705 | static ssize_t | 705 | static ssize_t |
706 | qeth_dev_layer2_show(struct device *dev, char *buf) | 706 | qeth_dev_layer2_show(struct device *dev, struct device_attribute *attr, char *buf) |
707 | { | 707 | { |
708 | struct qeth_card *card = dev->driver_data; | 708 | struct qeth_card *card = dev->driver_data; |
709 | 709 | ||
@@ -714,7 +714,7 @@ qeth_dev_layer2_show(struct device *dev, char *buf) | |||
714 | } | 714 | } |
715 | 715 | ||
716 | static ssize_t | 716 | static ssize_t |
717 | qeth_dev_layer2_store(struct device *dev, const char *buf, size_t count) | 717 | qeth_dev_layer2_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
718 | { | 718 | { |
719 | struct qeth_card *card = dev->driver_data; | 719 | struct qeth_card *card = dev->driver_data; |
720 | char *tmp; | 720 | char *tmp; |
@@ -742,7 +742,7 @@ static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show, | |||
742 | qeth_dev_layer2_store); | 742 | qeth_dev_layer2_store); |
743 | 743 | ||
744 | static ssize_t | 744 | static ssize_t |
745 | qeth_dev_large_send_show(struct device *dev, char *buf) | 745 | qeth_dev_large_send_show(struct device *dev, struct device_attribute *attr, char *buf) |
746 | { | 746 | { |
747 | struct qeth_card *card = dev->driver_data; | 747 | struct qeth_card *card = dev->driver_data; |
748 | 748 | ||
@@ -762,7 +762,7 @@ qeth_dev_large_send_show(struct device *dev, char *buf) | |||
762 | } | 762 | } |
763 | 763 | ||
764 | static ssize_t | 764 | static ssize_t |
765 | qeth_dev_large_send_store(struct device *dev, const char *buf, size_t count) | 765 | qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
766 | { | 766 | { |
767 | struct qeth_card *card = dev->driver_data; | 767 | struct qeth_card *card = dev->driver_data; |
768 | enum qeth_large_send_types type; | 768 | enum qeth_large_send_types type; |
@@ -832,7 +832,7 @@ qeth_dev_blkt_store(struct qeth_card *card, const char *buf, size_t count, | |||
832 | } | 832 | } |
833 | 833 | ||
834 | static ssize_t | 834 | static ssize_t |
835 | qeth_dev_blkt_total_show(struct device *dev, char *buf) | 835 | qeth_dev_blkt_total_show(struct device *dev, struct device_attribute *attr, char *buf) |
836 | { | 836 | { |
837 | struct qeth_card *card = dev->driver_data; | 837 | struct qeth_card *card = dev->driver_data; |
838 | 838 | ||
@@ -841,7 +841,7 @@ qeth_dev_blkt_total_show(struct device *dev, char *buf) | |||
841 | 841 | ||
842 | 842 | ||
843 | static ssize_t | 843 | static ssize_t |
844 | qeth_dev_blkt_total_store(struct device *dev, const char *buf, size_t count) | 844 | qeth_dev_blkt_total_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
845 | { | 845 | { |
846 | struct qeth_card *card = dev->driver_data; | 846 | struct qeth_card *card = dev->driver_data; |
847 | 847 | ||
@@ -855,7 +855,7 @@ static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show, | |||
855 | qeth_dev_blkt_total_store); | 855 | qeth_dev_blkt_total_store); |
856 | 856 | ||
857 | static ssize_t | 857 | static ssize_t |
858 | qeth_dev_blkt_inter_show(struct device *dev, char *buf) | 858 | qeth_dev_blkt_inter_show(struct device *dev, struct device_attribute *attr, char *buf) |
859 | { | 859 | { |
860 | struct qeth_card *card = dev->driver_data; | 860 | struct qeth_card *card = dev->driver_data; |
861 | 861 | ||
@@ -864,7 +864,7 @@ qeth_dev_blkt_inter_show(struct device *dev, char *buf) | |||
864 | 864 | ||
865 | 865 | ||
866 | static ssize_t | 866 | static ssize_t |
867 | qeth_dev_blkt_inter_store(struct device *dev, const char *buf, size_t count) | 867 | qeth_dev_blkt_inter_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
868 | { | 868 | { |
869 | struct qeth_card *card = dev->driver_data; | 869 | struct qeth_card *card = dev->driver_data; |
870 | 870 | ||
@@ -876,7 +876,7 @@ static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show, | |||
876 | qeth_dev_blkt_inter_store); | 876 | qeth_dev_blkt_inter_store); |
877 | 877 | ||
878 | static ssize_t | 878 | static ssize_t |
879 | qeth_dev_blkt_inter_jumbo_show(struct device *dev, char *buf) | 879 | qeth_dev_blkt_inter_jumbo_show(struct device *dev, struct device_attribute *attr, char *buf) |
880 | { | 880 | { |
881 | struct qeth_card *card = dev->driver_data; | 881 | struct qeth_card *card = dev->driver_data; |
882 | 882 | ||
@@ -886,7 +886,7 @@ qeth_dev_blkt_inter_jumbo_show(struct device *dev, char *buf) | |||
886 | 886 | ||
887 | 887 | ||
888 | static ssize_t | 888 | static ssize_t |
889 | qeth_dev_blkt_inter_jumbo_store(struct device *dev, const char *buf, size_t count) | 889 | qeth_dev_blkt_inter_jumbo_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
890 | { | 890 | { |
891 | struct qeth_card *card = dev->driver_data; | 891 | struct qeth_card *card = dev->driver_data; |
892 | 892 | ||
@@ -956,7 +956,7 @@ qeth_check_layer2(struct qeth_card *card) | |||
956 | 956 | ||
957 | 957 | ||
958 | static ssize_t | 958 | static ssize_t |
959 | qeth_dev_ipato_enable_show(struct device *dev, char *buf) | 959 | qeth_dev_ipato_enable_show(struct device *dev, struct device_attribute *attr, char *buf) |
960 | { | 960 | { |
961 | struct qeth_card *card = dev->driver_data; | 961 | struct qeth_card *card = dev->driver_data; |
962 | 962 | ||
@@ -969,7 +969,7 @@ qeth_dev_ipato_enable_show(struct device *dev, char *buf) | |||
969 | } | 969 | } |
970 | 970 | ||
971 | static ssize_t | 971 | static ssize_t |
972 | qeth_dev_ipato_enable_store(struct device *dev, const char *buf, size_t count) | 972 | qeth_dev_ipato_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
973 | { | 973 | { |
974 | struct qeth_card *card = dev->driver_data; | 974 | struct qeth_card *card = dev->driver_data; |
975 | char *tmp; | 975 | char *tmp; |
@@ -1004,7 +1004,7 @@ static QETH_DEVICE_ATTR(ipato_enable, enable, 0644, | |||
1004 | qeth_dev_ipato_enable_store); | 1004 | qeth_dev_ipato_enable_store); |
1005 | 1005 | ||
1006 | static ssize_t | 1006 | static ssize_t |
1007 | qeth_dev_ipato_invert4_show(struct device *dev, char *buf) | 1007 | qeth_dev_ipato_invert4_show(struct device *dev, struct device_attribute *attr, char *buf) |
1008 | { | 1008 | { |
1009 | struct qeth_card *card = dev->driver_data; | 1009 | struct qeth_card *card = dev->driver_data; |
1010 | 1010 | ||
@@ -1018,7 +1018,7 @@ qeth_dev_ipato_invert4_show(struct device *dev, char *buf) | |||
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | static ssize_t | 1020 | static ssize_t |
1021 | qeth_dev_ipato_invert4_store(struct device *dev, const char *buf, size_t count) | 1021 | qeth_dev_ipato_invert4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1022 | { | 1022 | { |
1023 | struct qeth_card *card = dev->driver_data; | 1023 | struct qeth_card *card = dev->driver_data; |
1024 | char *tmp; | 1024 | char *tmp; |
@@ -1084,7 +1084,7 @@ qeth_dev_ipato_add_show(char *buf, struct qeth_card *card, | |||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | static ssize_t | 1086 | static ssize_t |
1087 | qeth_dev_ipato_add4_show(struct device *dev, char *buf) | 1087 | qeth_dev_ipato_add4_show(struct device *dev, struct device_attribute *attr, char *buf) |
1088 | { | 1088 | { |
1089 | struct qeth_card *card = dev->driver_data; | 1089 | struct qeth_card *card = dev->driver_data; |
1090 | 1090 | ||
@@ -1153,7 +1153,7 @@ qeth_dev_ipato_add_store(const char *buf, size_t count, | |||
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | static ssize_t | 1155 | static ssize_t |
1156 | qeth_dev_ipato_add4_store(struct device *dev, const char *buf, size_t count) | 1156 | qeth_dev_ipato_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1157 | { | 1157 | { |
1158 | struct qeth_card *card = dev->driver_data; | 1158 | struct qeth_card *card = dev->driver_data; |
1159 | 1159 | ||
@@ -1186,7 +1186,7 @@ qeth_dev_ipato_del_store(const char *buf, size_t count, | |||
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | static ssize_t | 1188 | static ssize_t |
1189 | qeth_dev_ipato_del4_store(struct device *dev, const char *buf, size_t count) | 1189 | qeth_dev_ipato_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1190 | { | 1190 | { |
1191 | struct qeth_card *card = dev->driver_data; | 1191 | struct qeth_card *card = dev->driver_data; |
1192 | 1192 | ||
@@ -1201,7 +1201,7 @@ static QETH_DEVICE_ATTR(ipato_del4, del4, 0200, NULL, | |||
1201 | 1201 | ||
1202 | #ifdef CONFIG_QETH_IPV6 | 1202 | #ifdef CONFIG_QETH_IPV6 |
1203 | static ssize_t | 1203 | static ssize_t |
1204 | qeth_dev_ipato_invert6_show(struct device *dev, char *buf) | 1204 | qeth_dev_ipato_invert6_show(struct device *dev, struct device_attribute *attr, char *buf) |
1205 | { | 1205 | { |
1206 | struct qeth_card *card = dev->driver_data; | 1206 | struct qeth_card *card = dev->driver_data; |
1207 | 1207 | ||
@@ -1215,7 +1215,7 @@ qeth_dev_ipato_invert6_show(struct device *dev, char *buf) | |||
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | static ssize_t | 1217 | static ssize_t |
1218 | qeth_dev_ipato_invert6_store(struct device *dev, const char *buf, size_t count) | 1218 | qeth_dev_ipato_invert6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1219 | { | 1219 | { |
1220 | struct qeth_card *card = dev->driver_data; | 1220 | struct qeth_card *card = dev->driver_data; |
1221 | char *tmp; | 1221 | char *tmp; |
@@ -1247,7 +1247,7 @@ static QETH_DEVICE_ATTR(ipato_invert6, invert6, 0644, | |||
1247 | 1247 | ||
1248 | 1248 | ||
1249 | static ssize_t | 1249 | static ssize_t |
1250 | qeth_dev_ipato_add6_show(struct device *dev, char *buf) | 1250 | qeth_dev_ipato_add6_show(struct device *dev, struct device_attribute *attr, char *buf) |
1251 | { | 1251 | { |
1252 | struct qeth_card *card = dev->driver_data; | 1252 | struct qeth_card *card = dev->driver_data; |
1253 | 1253 | ||
@@ -1258,7 +1258,7 @@ qeth_dev_ipato_add6_show(struct device *dev, char *buf) | |||
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | static ssize_t | 1260 | static ssize_t |
1261 | qeth_dev_ipato_add6_store(struct device *dev, const char *buf, size_t count) | 1261 | qeth_dev_ipato_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1262 | { | 1262 | { |
1263 | struct qeth_card *card = dev->driver_data; | 1263 | struct qeth_card *card = dev->driver_data; |
1264 | 1264 | ||
@@ -1273,7 +1273,7 @@ static QETH_DEVICE_ATTR(ipato_add6, add6, 0644, | |||
1273 | qeth_dev_ipato_add6_store); | 1273 | qeth_dev_ipato_add6_store); |
1274 | 1274 | ||
1275 | static ssize_t | 1275 | static ssize_t |
1276 | qeth_dev_ipato_del6_store(struct device *dev, const char *buf, size_t count) | 1276 | qeth_dev_ipato_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1277 | { | 1277 | { |
1278 | struct qeth_card *card = dev->driver_data; | 1278 | struct qeth_card *card = dev->driver_data; |
1279 | 1279 | ||
@@ -1341,7 +1341,7 @@ qeth_dev_vipa_add_show(char *buf, struct qeth_card *card, | |||
1341 | } | 1341 | } |
1342 | 1342 | ||
1343 | static ssize_t | 1343 | static ssize_t |
1344 | qeth_dev_vipa_add4_show(struct device *dev, char *buf) | 1344 | qeth_dev_vipa_add4_show(struct device *dev, struct device_attribute *attr, char *buf) |
1345 | { | 1345 | { |
1346 | struct qeth_card *card = dev->driver_data; | 1346 | struct qeth_card *card = dev->driver_data; |
1347 | 1347 | ||
@@ -1381,7 +1381,7 @@ qeth_dev_vipa_add_store(const char *buf, size_t count, | |||
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | static ssize_t | 1383 | static ssize_t |
1384 | qeth_dev_vipa_add4_store(struct device *dev, const char *buf, size_t count) | 1384 | qeth_dev_vipa_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1385 | { | 1385 | { |
1386 | struct qeth_card *card = dev->driver_data; | 1386 | struct qeth_card *card = dev->driver_data; |
1387 | 1387 | ||
@@ -1413,7 +1413,7 @@ qeth_dev_vipa_del_store(const char *buf, size_t count, | |||
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | static ssize_t | 1415 | static ssize_t |
1416 | qeth_dev_vipa_del4_store(struct device *dev, const char *buf, size_t count) | 1416 | qeth_dev_vipa_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1417 | { | 1417 | { |
1418 | struct qeth_card *card = dev->driver_data; | 1418 | struct qeth_card *card = dev->driver_data; |
1419 | 1419 | ||
@@ -1428,7 +1428,7 @@ static QETH_DEVICE_ATTR(vipa_del4, del4, 0200, NULL, | |||
1428 | 1428 | ||
1429 | #ifdef CONFIG_QETH_IPV6 | 1429 | #ifdef CONFIG_QETH_IPV6 |
1430 | static ssize_t | 1430 | static ssize_t |
1431 | qeth_dev_vipa_add6_show(struct device *dev, char *buf) | 1431 | qeth_dev_vipa_add6_show(struct device *dev, struct device_attribute *attr, char *buf) |
1432 | { | 1432 | { |
1433 | struct qeth_card *card = dev->driver_data; | 1433 | struct qeth_card *card = dev->driver_data; |
1434 | 1434 | ||
@@ -1439,7 +1439,7 @@ qeth_dev_vipa_add6_show(struct device *dev, char *buf) | |||
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | static ssize_t | 1441 | static ssize_t |
1442 | qeth_dev_vipa_add6_store(struct device *dev, const char *buf, size_t count) | 1442 | qeth_dev_vipa_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1443 | { | 1443 | { |
1444 | struct qeth_card *card = dev->driver_data; | 1444 | struct qeth_card *card = dev->driver_data; |
1445 | 1445 | ||
@@ -1454,7 +1454,7 @@ static QETH_DEVICE_ATTR(vipa_add6, add6, 0644, | |||
1454 | qeth_dev_vipa_add6_store); | 1454 | qeth_dev_vipa_add6_store); |
1455 | 1455 | ||
1456 | static ssize_t | 1456 | static ssize_t |
1457 | qeth_dev_vipa_del6_store(struct device *dev, const char *buf, size_t count) | 1457 | qeth_dev_vipa_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1458 | { | 1458 | { |
1459 | struct qeth_card *card = dev->driver_data; | 1459 | struct qeth_card *card = dev->driver_data; |
1460 | 1460 | ||
@@ -1522,7 +1522,7 @@ qeth_dev_rxip_add_show(char *buf, struct qeth_card *card, | |||
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | static ssize_t | 1524 | static ssize_t |
1525 | qeth_dev_rxip_add4_show(struct device *dev, char *buf) | 1525 | qeth_dev_rxip_add4_show(struct device *dev, struct device_attribute *attr, char *buf) |
1526 | { | 1526 | { |
1527 | struct qeth_card *card = dev->driver_data; | 1527 | struct qeth_card *card = dev->driver_data; |
1528 | 1528 | ||
@@ -1562,7 +1562,7 @@ qeth_dev_rxip_add_store(const char *buf, size_t count, | |||
1562 | } | 1562 | } |
1563 | 1563 | ||
1564 | static ssize_t | 1564 | static ssize_t |
1565 | qeth_dev_rxip_add4_store(struct device *dev, const char *buf, size_t count) | 1565 | qeth_dev_rxip_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1566 | { | 1566 | { |
1567 | struct qeth_card *card = dev->driver_data; | 1567 | struct qeth_card *card = dev->driver_data; |
1568 | 1568 | ||
@@ -1594,7 +1594,7 @@ qeth_dev_rxip_del_store(const char *buf, size_t count, | |||
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | static ssize_t | 1596 | static ssize_t |
1597 | qeth_dev_rxip_del4_store(struct device *dev, const char *buf, size_t count) | 1597 | qeth_dev_rxip_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1598 | { | 1598 | { |
1599 | struct qeth_card *card = dev->driver_data; | 1599 | struct qeth_card *card = dev->driver_data; |
1600 | 1600 | ||
@@ -1609,7 +1609,7 @@ static QETH_DEVICE_ATTR(rxip_del4, del4, 0200, NULL, | |||
1609 | 1609 | ||
1610 | #ifdef CONFIG_QETH_IPV6 | 1610 | #ifdef CONFIG_QETH_IPV6 |
1611 | static ssize_t | 1611 | static ssize_t |
1612 | qeth_dev_rxip_add6_show(struct device *dev, char *buf) | 1612 | qeth_dev_rxip_add6_show(struct device *dev, struct device_attribute *attr, char *buf) |
1613 | { | 1613 | { |
1614 | struct qeth_card *card = dev->driver_data; | 1614 | struct qeth_card *card = dev->driver_data; |
1615 | 1615 | ||
@@ -1620,7 +1620,7 @@ qeth_dev_rxip_add6_show(struct device *dev, char *buf) | |||
1620 | } | 1620 | } |
1621 | 1621 | ||
1622 | static ssize_t | 1622 | static ssize_t |
1623 | qeth_dev_rxip_add6_store(struct device *dev, const char *buf, size_t count) | 1623 | qeth_dev_rxip_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1624 | { | 1624 | { |
1625 | struct qeth_card *card = dev->driver_data; | 1625 | struct qeth_card *card = dev->driver_data; |
1626 | 1626 | ||
@@ -1635,7 +1635,7 @@ static QETH_DEVICE_ATTR(rxip_add6, add6, 0644, | |||
1635 | qeth_dev_rxip_add6_store); | 1635 | qeth_dev_rxip_add6_store); |
1636 | 1636 | ||
1637 | static ssize_t | 1637 | static ssize_t |
1638 | qeth_dev_rxip_del6_store(struct device *dev, const char *buf, size_t count) | 1638 | qeth_dev_rxip_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1639 | { | 1639 | { |
1640 | struct qeth_card *card = dev->driver_data; | 1640 | struct qeth_card *card = dev->driver_data; |
1641 | 1641 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 6965992ddbbf..b61d309352c3 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -924,7 +924,7 @@ struct fc_function_template zfcp_transport_functions = { | |||
924 | * Generates attribute for a unit. | 924 | * Generates attribute for a unit. |
925 | */ | 925 | */ |
926 | #define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value) \ | 926 | #define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value) \ |
927 | static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \ | 927 | static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, struct device_attribute *attr, \ |
928 | char *buf) \ | 928 | char *buf) \ |
929 | { \ | 929 | { \ |
930 | struct scsi_device *sdev; \ | 930 | struct scsi_device *sdev; \ |
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c index 23e2dca55bb8..e7345a74800a 100644 --- a/drivers/s390/scsi/zfcp_sysfs_adapter.c +++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c | |||
@@ -50,7 +50,7 @@ static const char fc_topologies[5][25] = { | |||
50 | * Generates attributes for an adapter. | 50 | * Generates attributes for an adapter. |
51 | */ | 51 | */ |
52 | #define ZFCP_DEFINE_ADAPTER_ATTR(_name, _format, _value) \ | 52 | #define ZFCP_DEFINE_ADAPTER_ATTR(_name, _format, _value) \ |
53 | static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \ | 53 | static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, struct device_attribute *attr, \ |
54 | char *buf) \ | 54 | char *buf) \ |
55 | { \ | 55 | { \ |
56 | struct zfcp_adapter *adapter; \ | 56 | struct zfcp_adapter *adapter; \ |
@@ -90,7 +90,7 @@ ZFCP_DEFINE_ADAPTER_ATTR(in_recovery, "%d\n", atomic_test_mask | |||
90 | * Store function of the "port_add" attribute of an adapter. | 90 | * Store function of the "port_add" attribute of an adapter. |
91 | */ | 91 | */ |
92 | static ssize_t | 92 | static ssize_t |
93 | zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count) | 93 | zfcp_sysfs_port_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
94 | { | 94 | { |
95 | wwn_t wwpn; | 95 | wwn_t wwpn; |
96 | char *endp; | 96 | char *endp; |
@@ -135,7 +135,7 @@ static DEVICE_ATTR(port_add, S_IWUSR, NULL, zfcp_sysfs_port_add_store); | |||
135 | * Store function of the "port_remove" attribute of an adapter. | 135 | * Store function of the "port_remove" attribute of an adapter. |
136 | */ | 136 | */ |
137 | static ssize_t | 137 | static ssize_t |
138 | zfcp_sysfs_port_remove_store(struct device *dev, const char *buf, size_t count) | 138 | zfcp_sysfs_port_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
139 | { | 139 | { |
140 | struct zfcp_adapter *adapter; | 140 | struct zfcp_adapter *adapter; |
141 | struct zfcp_port *port; | 141 | struct zfcp_port *port; |
@@ -196,7 +196,7 @@ static DEVICE_ATTR(port_remove, S_IWUSR, NULL, zfcp_sysfs_port_remove_store); | |||
196 | * started for the belonging adapter. | 196 | * started for the belonging adapter. |
197 | */ | 197 | */ |
198 | static ssize_t | 198 | static ssize_t |
199 | zfcp_sysfs_adapter_failed_store(struct device *dev, | 199 | zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *attr, |
200 | const char *buf, size_t count) | 200 | const char *buf, size_t count) |
201 | { | 201 | { |
202 | struct zfcp_adapter *adapter; | 202 | struct zfcp_adapter *adapter; |
@@ -236,7 +236,7 @@ zfcp_sysfs_adapter_failed_store(struct device *dev, | |||
236 | * "0" if adapter is working, otherwise "1". | 236 | * "0" if adapter is working, otherwise "1". |
237 | */ | 237 | */ |
238 | static ssize_t | 238 | static ssize_t |
239 | zfcp_sysfs_adapter_failed_show(struct device *dev, char *buf) | 239 | zfcp_sysfs_adapter_failed_show(struct device *dev, struct device_attribute *attr, char *buf) |
240 | { | 240 | { |
241 | struct zfcp_adapter *adapter; | 241 | struct zfcp_adapter *adapter; |
242 | 242 | ||
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c index 6aafb2abb4b5..7a84c7d474d9 100644 --- a/drivers/s390/scsi/zfcp_sysfs_port.c +++ b/drivers/s390/scsi/zfcp_sysfs_port.c | |||
@@ -53,7 +53,7 @@ zfcp_sysfs_port_release(struct device *dev) | |||
53 | * Generates attributes for a port. | 53 | * Generates attributes for a port. |
54 | */ | 54 | */ |
55 | #define ZFCP_DEFINE_PORT_ATTR(_name, _format, _value) \ | 55 | #define ZFCP_DEFINE_PORT_ATTR(_name, _format, _value) \ |
56 | static ssize_t zfcp_sysfs_port_##_name##_show(struct device *dev, \ | 56 | static ssize_t zfcp_sysfs_port_##_name##_show(struct device *dev, struct device_attribute *attr, \ |
57 | char *buf) \ | 57 | char *buf) \ |
58 | { \ | 58 | { \ |
59 | struct zfcp_port *port; \ | 59 | struct zfcp_port *port; \ |
@@ -82,7 +82,7 @@ ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask | |||
82 | * Store function of the "unit_add" attribute of a port. | 82 | * Store function of the "unit_add" attribute of a port. |
83 | */ | 83 | */ |
84 | static ssize_t | 84 | static ssize_t |
85 | zfcp_sysfs_unit_add_store(struct device *dev, const char *buf, size_t count) | 85 | zfcp_sysfs_unit_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
86 | { | 86 | { |
87 | fcp_lun_t fcp_lun; | 87 | fcp_lun_t fcp_lun; |
88 | char *endp; | 88 | char *endp; |
@@ -125,7 +125,7 @@ static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store); | |||
125 | * @count: number of bytes in buffer | 125 | * @count: number of bytes in buffer |
126 | */ | 126 | */ |
127 | static ssize_t | 127 | static ssize_t |
128 | zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count) | 128 | zfcp_sysfs_unit_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
129 | { | 129 | { |
130 | struct zfcp_port *port; | 130 | struct zfcp_port *port; |
131 | struct zfcp_unit *unit; | 131 | struct zfcp_unit *unit; |
@@ -186,7 +186,7 @@ static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); | |||
186 | * started for the belonging port. | 186 | * started for the belonging port. |
187 | */ | 187 | */ |
188 | static ssize_t | 188 | static ssize_t |
189 | zfcp_sysfs_port_failed_store(struct device *dev, const char *buf, size_t count) | 189 | zfcp_sysfs_port_failed_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
190 | { | 190 | { |
191 | struct zfcp_port *port; | 191 | struct zfcp_port *port; |
192 | unsigned int val; | 192 | unsigned int val; |
@@ -224,7 +224,7 @@ zfcp_sysfs_port_failed_store(struct device *dev, const char *buf, size_t count) | |||
224 | * "0" if port is working, otherwise "1". | 224 | * "0" if port is working, otherwise "1". |
225 | */ | 225 | */ |
226 | static ssize_t | 226 | static ssize_t |
227 | zfcp_sysfs_port_failed_show(struct device *dev, char *buf) | 227 | zfcp_sysfs_port_failed_show(struct device *dev, struct device_attribute *attr, char *buf) |
228 | { | 228 | { |
229 | struct zfcp_port *port; | 229 | struct zfcp_port *port; |
230 | 230 | ||
diff --git a/drivers/s390/scsi/zfcp_sysfs_unit.c b/drivers/s390/scsi/zfcp_sysfs_unit.c index 87c0b461831f..0556642c9e1d 100644 --- a/drivers/s390/scsi/zfcp_sysfs_unit.c +++ b/drivers/s390/scsi/zfcp_sysfs_unit.c | |||
@@ -53,7 +53,7 @@ zfcp_sysfs_unit_release(struct device *dev) | |||
53 | * Generates attribute for a unit. | 53 | * Generates attribute for a unit. |
54 | */ | 54 | */ |
55 | #define ZFCP_DEFINE_UNIT_ATTR(_name, _format, _value) \ | 55 | #define ZFCP_DEFINE_UNIT_ATTR(_name, _format, _value) \ |
56 | static ssize_t zfcp_sysfs_unit_##_name##_show(struct device *dev, \ | 56 | static ssize_t zfcp_sysfs_unit_##_name##_show(struct device *dev, struct device_attribute *attr, \ |
57 | char *buf) \ | 57 | char *buf) \ |
58 | { \ | 58 | { \ |
59 | struct zfcp_unit *unit; \ | 59 | struct zfcp_unit *unit; \ |
@@ -86,7 +86,7 @@ ZFCP_DEFINE_UNIT_ATTR(access_readonly, "%d\n", atomic_test_mask | |||
86 | * started for the belonging unit. | 86 | * started for the belonging unit. |
87 | */ | 87 | */ |
88 | static ssize_t | 88 | static ssize_t |
89 | zfcp_sysfs_unit_failed_store(struct device *dev, const char *buf, size_t count) | 89 | zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
90 | { | 90 | { |
91 | struct zfcp_unit *unit; | 91 | struct zfcp_unit *unit; |
92 | unsigned int val; | 92 | unsigned int val; |
@@ -123,7 +123,7 @@ zfcp_sysfs_unit_failed_store(struct device *dev, const char *buf, size_t count) | |||
123 | * "0" if unit is working, otherwise "1". | 123 | * "0" if unit is working, otherwise "1". |
124 | */ | 124 | */ |
125 | static ssize_t | 125 | static ssize_t |
126 | zfcp_sysfs_unit_failed_show(struct device *dev, char *buf) | 126 | zfcp_sysfs_unit_failed_show(struct device *dev, struct device_attribute *attr, char *buf) |
127 | { | 127 | { |
128 | struct zfcp_unit *unit; | 128 | struct zfcp_unit *unit; |
129 | 129 | ||
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index d151af9a6f15..a7620fc368e7 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -2125,7 +2125,7 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type) | |||
2125 | } | 2125 | } |
2126 | 2126 | ||
2127 | static ssize_t | 2127 | static ssize_t |
2128 | NCR_700_show_active_tags(struct device *dev, char *buf) | 2128 | NCR_700_show_active_tags(struct device *dev, struct device_attribute *attr, char *buf) |
2129 | { | 2129 | { |
2130 | struct scsi_device *SDp = to_scsi_device(dev); | 2130 | struct scsi_device *SDp = to_scsi_device(dev); |
2131 | 2131 | ||
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 78b7e543471b..ce711f166cfb 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -466,7 +466,7 @@ int eesoxscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_ | |||
466 | return pos; | 466 | return pos; |
467 | } | 467 | } |
468 | 468 | ||
469 | static ssize_t eesoxscsi_show_term(struct device *dev, char *buf) | 469 | static ssize_t eesoxscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
470 | { | 470 | { |
471 | struct expansion_card *ec = ECARD_DEV(dev); | 471 | struct expansion_card *ec = ECARD_DEV(dev); |
472 | struct Scsi_Host *host = ecard_get_drvdata(ec); | 472 | struct Scsi_Host *host = ecard_get_drvdata(ec); |
@@ -475,7 +475,7 @@ static ssize_t eesoxscsi_show_term(struct device *dev, char *buf) | |||
475 | return sprintf(buf, "%d\n", info->control & EESOX_TERM_ENABLE ? 1 : 0); | 475 | return sprintf(buf, "%d\n", info->control & EESOX_TERM_ENABLE ? 1 : 0); |
476 | } | 476 | } |
477 | 477 | ||
478 | static ssize_t eesoxscsi_store_term(struct device *dev, const char *buf, size_t len) | 478 | static ssize_t eesoxscsi_store_term(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) |
479 | { | 479 | { |
480 | struct expansion_card *ec = ECARD_DEV(dev); | 480 | struct expansion_card *ec = ECARD_DEV(dev); |
481 | struct Scsi_Host *host = ecard_get_drvdata(ec); | 481 | struct Scsi_Host *host = ecard_get_drvdata(ec); |
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 54f23be6460f..abda216113f1 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c | |||
@@ -269,7 +269,7 @@ int powertecscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, o | |||
269 | return pos; | 269 | return pos; |
270 | } | 270 | } |
271 | 271 | ||
272 | static ssize_t powertecscsi_show_term(struct device *dev, char *buf) | 272 | static ssize_t powertecscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
273 | { | 273 | { |
274 | struct expansion_card *ec = ECARD_DEV(dev); | 274 | struct expansion_card *ec = ECARD_DEV(dev); |
275 | struct Scsi_Host *host = ecard_get_drvdata(ec); | 275 | struct Scsi_Host *host = ecard_get_drvdata(ec); |
@@ -279,7 +279,7 @@ static ssize_t powertecscsi_show_term(struct device *dev, char *buf) | |||
279 | } | 279 | } |
280 | 280 | ||
281 | static ssize_t | 281 | static ssize_t |
282 | powertecscsi_store_term(struct device *dev, const char *buf, size_t len) | 282 | powertecscsi_store_term(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) |
283 | { | 283 | { |
284 | struct expansion_card *ec = ECARD_DEV(dev); | 284 | struct expansion_card *ec = ECARD_DEV(dev); |
285 | struct Scsi_Host *host = ecard_get_drvdata(ec); | 285 | struct Scsi_Host *host = ecard_get_drvdata(ec); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 17b106b79f72..80d022625c82 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2716,7 +2716,7 @@ static int ipr_change_queue_type(struct scsi_device *sdev, int tag_type) | |||
2716 | * Return value: | 2716 | * Return value: |
2717 | * number of bytes printed to buffer | 2717 | * number of bytes printed to buffer |
2718 | **/ | 2718 | **/ |
2719 | static ssize_t ipr_show_adapter_handle(struct device *dev, char *buf) | 2719 | static ssize_t ipr_show_adapter_handle(struct device *dev, struct device_attribute *attr, char *buf) |
2720 | { | 2720 | { |
2721 | struct scsi_device *sdev = to_scsi_device(dev); | 2721 | struct scsi_device *sdev = to_scsi_device(dev); |
2722 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; | 2722 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 057ed45b54b2..cbe430246276 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -124,7 +124,7 @@ static irqreturn_t megaraid_isr(int, void *, struct pt_regs *); | |||
124 | static void megaraid_mbox_dpc(unsigned long); | 124 | static void megaraid_mbox_dpc(unsigned long); |
125 | 125 | ||
126 | static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); | 126 | static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); |
127 | static ssize_t megaraid_sysfs_show_ldnum(struct device *, char *); | 127 | static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *); |
128 | 128 | ||
129 | static int megaraid_cmm_register(adapter_t *); | 129 | static int megaraid_cmm_register(adapter_t *); |
130 | static int megaraid_cmm_unregister(adapter_t *); | 130 | static int megaraid_cmm_unregister(adapter_t *); |
@@ -4145,7 +4145,7 @@ megaraid_sysfs_show_app_hndl(struct class_device *cdev, char *buf) | |||
4145 | * @param buf : buffer to send data to | 4145 | * @param buf : buffer to send data to |
4146 | */ | 4146 | */ |
4147 | static ssize_t | 4147 | static ssize_t |
4148 | megaraid_sysfs_show_ldnum(struct device *dev, char *buf) | 4148 | megaraid_sysfs_show_ldnum(struct device *dev, struct device_attribute *attr, char *buf) |
4149 | { | 4149 | { |
4150 | struct scsi_device *sdev = to_scsi_device(dev); | 4150 | struct scsi_device *sdev = to_scsi_device(dev); |
4151 | adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host); | 4151 | adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host); |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index c585c7bef247..89a4a0615c22 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5608,13 +5608,13 @@ static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf) | |||
5608 | 5608 | ||
5609 | CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); | 5609 | CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); |
5610 | 5610 | ||
5611 | static struct class_simple * osst_sysfs_class; | 5611 | static struct class *osst_sysfs_class; |
5612 | 5612 | ||
5613 | static int osst_sysfs_valid = 0; | 5613 | static int osst_sysfs_valid = 0; |
5614 | 5614 | ||
5615 | static void osst_sysfs_init(void) | 5615 | static void osst_sysfs_init(void) |
5616 | { | 5616 | { |
5617 | osst_sysfs_class = class_simple_create(THIS_MODULE, "onstream_tape"); | 5617 | osst_sysfs_class = class_create(THIS_MODULE, "onstream_tape"); |
5618 | if ( IS_ERR(osst_sysfs_class) ) | 5618 | if ( IS_ERR(osst_sysfs_class) ) |
5619 | printk(KERN_WARNING "osst :W: Unable to register sysfs class\n"); | 5619 | printk(KERN_WARNING "osst :W: Unable to register sysfs class\n"); |
5620 | else | 5620 | else |
@@ -5627,7 +5627,7 @@ static void osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * | |||
5627 | 5627 | ||
5628 | if (!osst_sysfs_valid) return; | 5628 | if (!osst_sysfs_valid) return; |
5629 | 5629 | ||
5630 | osst_class_member = class_simple_device_add(osst_sysfs_class, dev, device, "%s", name); | 5630 | osst_class_member = class_device_create(osst_sysfs_class, dev, device, "%s", name); |
5631 | if (IS_ERR(osst_class_member)) { | 5631 | if (IS_ERR(osst_class_member)) { |
5632 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5632 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5633 | return; | 5633 | return; |
@@ -5645,13 +5645,13 @@ static void osst_sysfs_destroy(dev_t dev) | |||
5645 | { | 5645 | { |
5646 | if (!osst_sysfs_valid) return; | 5646 | if (!osst_sysfs_valid) return; |
5647 | 5647 | ||
5648 | class_simple_device_remove(dev); | 5648 | class_device_destroy(osst_sysfs_class, dev); |
5649 | } | 5649 | } |
5650 | 5650 | ||
5651 | static void osst_sysfs_cleanup(void) | 5651 | static void osst_sysfs_cleanup(void) |
5652 | { | 5652 | { |
5653 | if (osst_sysfs_valid) { | 5653 | if (osst_sysfs_valid) { |
5654 | class_simple_destroy(osst_sysfs_class); | 5654 | class_destroy(osst_sysfs_class); |
5655 | osst_sysfs_valid = 0; | 5655 | osst_sysfs_valid = 0; |
5656 | } | 5656 | } |
5657 | } | 5657 | } |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index e75ee4671ee3..93b41100a6d8 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -230,7 +230,7 @@ void scsi_sysfs_unregister(void) | |||
230 | */ | 230 | */ |
231 | #define sdev_show_function(field, format_string) \ | 231 | #define sdev_show_function(field, format_string) \ |
232 | static ssize_t \ | 232 | static ssize_t \ |
233 | sdev_show_##field (struct device *dev, char *buf) \ | 233 | sdev_show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
234 | { \ | 234 | { \ |
235 | struct scsi_device *sdev; \ | 235 | struct scsi_device *sdev; \ |
236 | sdev = to_scsi_device(dev); \ | 236 | sdev = to_scsi_device(dev); \ |
@@ -254,7 +254,7 @@ static DEVICE_ATTR(field, S_IRUGO, sdev_show_##field, NULL); | |||
254 | sdev_show_function(field, format_string) \ | 254 | sdev_show_function(field, format_string) \ |
255 | \ | 255 | \ |
256 | static ssize_t \ | 256 | static ssize_t \ |
257 | sdev_store_##field (struct device *dev, const char *buf, size_t count) \ | 257 | sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
258 | { \ | 258 | { \ |
259 | struct scsi_device *sdev; \ | 259 | struct scsi_device *sdev; \ |
260 | sdev = to_scsi_device(dev); \ | 260 | sdev = to_scsi_device(dev); \ |
@@ -274,7 +274,7 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##fie | |||
274 | sdev_show_function(field, "%d\n") \ | 274 | sdev_show_function(field, "%d\n") \ |
275 | \ | 275 | \ |
276 | static ssize_t \ | 276 | static ssize_t \ |
277 | sdev_store_##field (struct device *dev, const char *buf, size_t count) \ | 277 | sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
278 | { \ | 278 | { \ |
279 | int ret; \ | 279 | int ret; \ |
280 | struct scsi_device *sdev; \ | 280 | struct scsi_device *sdev; \ |
@@ -317,7 +317,7 @@ sdev_rd_attr (model, "%.16s\n"); | |||
317 | sdev_rd_attr (rev, "%.4s\n"); | 317 | sdev_rd_attr (rev, "%.4s\n"); |
318 | 318 | ||
319 | static ssize_t | 319 | static ssize_t |
320 | sdev_show_timeout (struct device *dev, char *buf) | 320 | sdev_show_timeout (struct device *dev, struct device_attribute *attr, char *buf) |
321 | { | 321 | { |
322 | struct scsi_device *sdev; | 322 | struct scsi_device *sdev; |
323 | sdev = to_scsi_device(dev); | 323 | sdev = to_scsi_device(dev); |
@@ -325,7 +325,7 @@ sdev_show_timeout (struct device *dev, char *buf) | |||
325 | } | 325 | } |
326 | 326 | ||
327 | static ssize_t | 327 | static ssize_t |
328 | sdev_store_timeout (struct device *dev, const char *buf, size_t count) | 328 | sdev_store_timeout (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
329 | { | 329 | { |
330 | struct scsi_device *sdev; | 330 | struct scsi_device *sdev; |
331 | int timeout; | 331 | int timeout; |
@@ -337,14 +337,14 @@ sdev_store_timeout (struct device *dev, const char *buf, size_t count) | |||
337 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); | 337 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); |
338 | 338 | ||
339 | static ssize_t | 339 | static ssize_t |
340 | store_rescan_field (struct device *dev, const char *buf, size_t count) | 340 | store_rescan_field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
341 | { | 341 | { |
342 | scsi_rescan_device(dev); | 342 | scsi_rescan_device(dev); |
343 | return count; | 343 | return count; |
344 | } | 344 | } |
345 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); | 345 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); |
346 | 346 | ||
347 | static ssize_t sdev_store_delete(struct device *dev, const char *buf, | 347 | static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, |
348 | size_t count) | 348 | size_t count) |
349 | { | 349 | { |
350 | scsi_remove_device(to_scsi_device(dev)); | 350 | scsi_remove_device(to_scsi_device(dev)); |
@@ -353,7 +353,7 @@ static ssize_t sdev_store_delete(struct device *dev, const char *buf, | |||
353 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); | 353 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); |
354 | 354 | ||
355 | static ssize_t | 355 | static ssize_t |
356 | store_state_field(struct device *dev, const char *buf, size_t count) | 356 | store_state_field(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
357 | { | 357 | { |
358 | int i; | 358 | int i; |
359 | struct scsi_device *sdev = to_scsi_device(dev); | 359 | struct scsi_device *sdev = to_scsi_device(dev); |
@@ -376,7 +376,7 @@ store_state_field(struct device *dev, const char *buf, size_t count) | |||
376 | } | 376 | } |
377 | 377 | ||
378 | static ssize_t | 378 | static ssize_t |
379 | show_state_field(struct device *dev, char *buf) | 379 | show_state_field(struct device *dev, struct device_attribute *attr, char *buf) |
380 | { | 380 | { |
381 | struct scsi_device *sdev = to_scsi_device(dev); | 381 | struct scsi_device *sdev = to_scsi_device(dev); |
382 | const char *name = scsi_device_state_name(sdev->sdev_state); | 382 | const char *name = scsi_device_state_name(sdev->sdev_state); |
@@ -390,7 +390,7 @@ show_state_field(struct device *dev, char *buf) | |||
390 | static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); | 390 | static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); |
391 | 391 | ||
392 | static ssize_t | 392 | static ssize_t |
393 | show_queue_type_field(struct device *dev, char *buf) | 393 | show_queue_type_field(struct device *dev, struct device_attribute *attr, char *buf) |
394 | { | 394 | { |
395 | struct scsi_device *sdev = to_scsi_device(dev); | 395 | struct scsi_device *sdev = to_scsi_device(dev); |
396 | const char *name = "none"; | 396 | const char *name = "none"; |
@@ -406,7 +406,7 @@ show_queue_type_field(struct device *dev, char *buf) | |||
406 | static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); | 406 | static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); |
407 | 407 | ||
408 | static ssize_t | 408 | static ssize_t |
409 | show_iostat_counterbits(struct device *dev, char *buf) | 409 | show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) |
410 | { | 410 | { |
411 | return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); | 411 | return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); |
412 | } | 412 | } |
@@ -415,7 +415,7 @@ static DEVICE_ATTR(iocounterbits, S_IRUGO, show_iostat_counterbits, NULL); | |||
415 | 415 | ||
416 | #define show_sdev_iostat(field) \ | 416 | #define show_sdev_iostat(field) \ |
417 | static ssize_t \ | 417 | static ssize_t \ |
418 | show_iostat_##field(struct device *dev, char *buf) \ | 418 | show_iostat_##field(struct device *dev, struct device_attribute *attr, char *buf) \ |
419 | { \ | 419 | { \ |
420 | struct scsi_device *sdev = to_scsi_device(dev); \ | 420 | struct scsi_device *sdev = to_scsi_device(dev); \ |
421 | unsigned long long count = atomic_read(&sdev->field); \ | 421 | unsigned long long count = atomic_read(&sdev->field); \ |
@@ -449,7 +449,7 @@ static struct device_attribute *scsi_sysfs_sdev_attrs[] = { | |||
449 | NULL | 449 | NULL |
450 | }; | 450 | }; |
451 | 451 | ||
452 | static ssize_t sdev_store_queue_depth_rw(struct device *dev, const char *buf, | 452 | static ssize_t sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, const char *buf, |
453 | size_t count) | 453 | size_t count) |
454 | { | 454 | { |
455 | int depth, retval; | 455 | int depth, retval; |
@@ -475,7 +475,7 @@ static struct device_attribute sdev_attr_queue_depth_rw = | |||
475 | __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, | 475 | __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, |
476 | sdev_store_queue_depth_rw); | 476 | sdev_store_queue_depth_rw); |
477 | 477 | ||
478 | static ssize_t sdev_store_queue_type_rw(struct device *dev, const char *buf, | 478 | static ssize_t sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, const char *buf, |
479 | size_t count) | 479 | size_t count) |
480 | { | 480 | { |
481 | struct scsi_device *sdev = to_scsi_device(dev); | 481 | struct scsi_device *sdev = to_scsi_device(dev); |
@@ -669,6 +669,13 @@ void __scsi_remove_target(struct scsi_target *starget) | |||
669 | scsi_target_reap(starget); | 669 | scsi_target_reap(starget); |
670 | } | 670 | } |
671 | 671 | ||
672 | static int __remove_child (struct device * dev, void * data) | ||
673 | { | ||
674 | if (scsi_is_target_device(dev)) | ||
675 | __scsi_remove_target(to_scsi_target(dev)); | ||
676 | return 0; | ||
677 | } | ||
678 | |||
672 | /** | 679 | /** |
673 | * scsi_remove_target - try to remove a target and all its devices | 680 | * scsi_remove_target - try to remove a target and all its devices |
674 | * @dev: generic starget or parent of generic stargets to be removed | 681 | * @dev: generic starget or parent of generic stargets to be removed |
@@ -679,7 +686,7 @@ void __scsi_remove_target(struct scsi_target *starget) | |||
679 | */ | 686 | */ |
680 | void scsi_remove_target(struct device *dev) | 687 | void scsi_remove_target(struct device *dev) |
681 | { | 688 | { |
682 | struct device *rdev, *idev, *next; | 689 | struct device *rdev; |
683 | 690 | ||
684 | if (scsi_is_target_device(dev)) { | 691 | if (scsi_is_target_device(dev)) { |
685 | __scsi_remove_target(to_scsi_target(dev)); | 692 | __scsi_remove_target(to_scsi_target(dev)); |
@@ -687,10 +694,7 @@ void scsi_remove_target(struct device *dev) | |||
687 | } | 694 | } |
688 | 695 | ||
689 | rdev = get_device(dev); | 696 | rdev = get_device(dev); |
690 | list_for_each_entry_safe(idev, next, &dev->children, node) { | 697 | device_for_each_child(dev, NULL, __remove_child); |
691 | if (scsi_is_target_device(idev)) | ||
692 | __scsi_remove_target(to_scsi_target(idev)); | ||
693 | } | ||
694 | put_device(rdev); | 698 | put_device(rdev); |
695 | } | 699 | } |
696 | EXPORT_SYMBOL(scsi_remove_target); | 700 | EXPORT_SYMBOL(scsi_remove_target); |
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index c87ae469d707..2918b9600db7 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -348,17 +348,21 @@ spi_transport_rd_attr(rd_strm, "%d\n"); | |||
348 | spi_transport_rd_attr(rti, "%d\n"); | 348 | spi_transport_rd_attr(rti, "%d\n"); |
349 | spi_transport_rd_attr(pcomp_en, "%d\n"); | 349 | spi_transport_rd_attr(pcomp_en, "%d\n"); |
350 | 350 | ||
351 | /* we only care about the first child device so we return 1 */ | ||
352 | static int child_iter(struct device *dev, void *data) | ||
353 | { | ||
354 | struct scsi_device *sdev = to_scsi_device(dev); | ||
355 | |||
356 | spi_dv_device(sdev); | ||
357 | return 1; | ||
358 | } | ||
359 | |||
351 | static ssize_t | 360 | static ssize_t |
352 | store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) | 361 | store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) |
353 | { | 362 | { |
354 | struct scsi_target *starget = transport_class_to_starget(cdev); | 363 | struct scsi_target *starget = transport_class_to_starget(cdev); |
355 | 364 | ||
356 | /* FIXME: we're relying on an awful lot of device internals | 365 | device_for_each_child(&starget->dev, NULL, child_iter); |
357 | * here. We really need a function to get the first available | ||
358 | * child */ | ||
359 | struct device *dev = container_of(starget->dev.children.next, struct device, node); | ||
360 | struct scsi_device *sdev = to_scsi_device(dev); | ||
361 | spi_dv_device(sdev); | ||
362 | return count; | 366 | return count; |
363 | } | 367 | } |
364 | static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); | 368 | static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3d1d7bff38ed..51292f269ce5 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1430,7 +1430,7 @@ static struct file_operations sg_fops = { | |||
1430 | .fasync = sg_fasync, | 1430 | .fasync = sg_fasync, |
1431 | }; | 1431 | }; |
1432 | 1432 | ||
1433 | static struct class_simple * sg_sysfs_class; | 1433 | static struct class *sg_sysfs_class; |
1434 | 1434 | ||
1435 | static int sg_sysfs_valid = 0; | 1435 | static int sg_sysfs_valid = 0; |
1436 | 1436 | ||
@@ -1551,13 +1551,13 @@ sg_add(struct class_device *cl_dev) | |||
1551 | if (sg_sysfs_valid) { | 1551 | if (sg_sysfs_valid) { |
1552 | struct class_device * sg_class_member; | 1552 | struct class_device * sg_class_member; |
1553 | 1553 | ||
1554 | sg_class_member = class_simple_device_add(sg_sysfs_class, | 1554 | sg_class_member = class_device_create(sg_sysfs_class, |
1555 | MKDEV(SCSI_GENERIC_MAJOR, k), | 1555 | MKDEV(SCSI_GENERIC_MAJOR, k), |
1556 | cl_dev->dev, "%s", | 1556 | cl_dev->dev, "%s", |
1557 | disk->disk_name); | 1557 | disk->disk_name); |
1558 | if (IS_ERR(sg_class_member)) | 1558 | if (IS_ERR(sg_class_member)) |
1559 | printk(KERN_WARNING "sg_add: " | 1559 | printk(KERN_WARNING "sg_add: " |
1560 | "class_simple_device_add failed\n"); | 1560 | "class_device_create failed\n"); |
1561 | class_set_devdata(sg_class_member, sdp); | 1561 | class_set_devdata(sg_class_member, sdp); |
1562 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1562 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1563 | &sg_class_member->kobj, "generic"); | 1563 | &sg_class_member->kobj, "generic"); |
@@ -1636,7 +1636,7 @@ sg_remove(struct class_device *cl_dev) | |||
1636 | 1636 | ||
1637 | if (sdp) { | 1637 | if (sdp) { |
1638 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); | 1638 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); |
1639 | class_simple_device_remove(MKDEV(SCSI_GENERIC_MAJOR, k)); | 1639 | class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, k)); |
1640 | cdev_del(sdp->cdev); | 1640 | cdev_del(sdp->cdev); |
1641 | sdp->cdev = NULL; | 1641 | sdp->cdev = NULL; |
1642 | devfs_remove("%s/generic", scsidp->devfs_name); | 1642 | devfs_remove("%s/generic", scsidp->devfs_name); |
@@ -1677,7 +1677,7 @@ init_sg(void) | |||
1677 | SG_MAX_DEVS, "sg"); | 1677 | SG_MAX_DEVS, "sg"); |
1678 | if (rc) | 1678 | if (rc) |
1679 | return rc; | 1679 | return rc; |
1680 | sg_sysfs_class = class_simple_create(THIS_MODULE, "scsi_generic"); | 1680 | sg_sysfs_class = class_create(THIS_MODULE, "scsi_generic"); |
1681 | if ( IS_ERR(sg_sysfs_class) ) { | 1681 | if ( IS_ERR(sg_sysfs_class) ) { |
1682 | rc = PTR_ERR(sg_sysfs_class); | 1682 | rc = PTR_ERR(sg_sysfs_class); |
1683 | goto err_out; | 1683 | goto err_out; |
@@ -1690,7 +1690,7 @@ init_sg(void) | |||
1690 | #endif /* CONFIG_SCSI_PROC_FS */ | 1690 | #endif /* CONFIG_SCSI_PROC_FS */ |
1691 | return 0; | 1691 | return 0; |
1692 | } | 1692 | } |
1693 | class_simple_destroy(sg_sysfs_class); | 1693 | class_destroy(sg_sysfs_class); |
1694 | err_out: | 1694 | err_out: |
1695 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); | 1695 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), SG_MAX_DEVS); |
1696 | return rc; | 1696 | return rc; |
@@ -1703,7 +1703,7 @@ exit_sg(void) | |||
1703 | sg_proc_cleanup(); | 1703 | sg_proc_cleanup(); |
1704 | #endif /* CONFIG_SCSI_PROC_FS */ | 1704 | #endif /* CONFIG_SCSI_PROC_FS */ |
1705 | scsi_unregister_interface(&sg_interface); | 1705 | scsi_unregister_interface(&sg_interface); |
1706 | class_simple_destroy(sg_sysfs_class); | 1706 | class_destroy(sg_sysfs_class); |
1707 | sg_sysfs_valid = 0; | 1707 | sg_sysfs_valid = 0; |
1708 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), | 1708 | unregister_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), |
1709 | SG_MAX_DEVS); | 1709 | SG_MAX_DEVS); |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 03b902c20e09..0291a8fb654d 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -84,7 +84,7 @@ static int try_wdio = 1; | |||
84 | static int st_dev_max; | 84 | static int st_dev_max; |
85 | static int st_nr_dev; | 85 | static int st_nr_dev; |
86 | 86 | ||
87 | static struct class_simple *st_sysfs_class; | 87 | static struct class *st_sysfs_class; |
88 | 88 | ||
89 | MODULE_AUTHOR("Kai Makisara"); | 89 | MODULE_AUTHOR("Kai Makisara"); |
90 | MODULE_DESCRIPTION("SCSI Tape Driver"); | 90 | MODULE_DESCRIPTION("SCSI Tape Driver"); |
@@ -4024,8 +4024,9 @@ out_free_tape: | |||
4024 | if (STm->cdevs[j]) { | 4024 | if (STm->cdevs[j]) { |
4025 | if (cdev == STm->cdevs[j]) | 4025 | if (cdev == STm->cdevs[j]) |
4026 | cdev = NULL; | 4026 | cdev = NULL; |
4027 | class_simple_device_remove(MKDEV(SCSI_TAPE_MAJOR, | 4027 | class_device_destroy(st_sysfs_class, |
4028 | TAPE_MINOR(i, mode, j))); | 4028 | MKDEV(SCSI_TAPE_MAJOR, |
4029 | TAPE_MINOR(i, mode, j))); | ||
4029 | cdev_del(STm->cdevs[j]); | 4030 | cdev_del(STm->cdevs[j]); |
4030 | } | 4031 | } |
4031 | } | 4032 | } |
@@ -4068,8 +4069,9 @@ static int st_remove(struct device *dev) | |||
4068 | devfs_remove("%s/mt%s", SDp->devfs_name, st_formats[j]); | 4069 | devfs_remove("%s/mt%s", SDp->devfs_name, st_formats[j]); |
4069 | devfs_remove("%s/mt%sn", SDp->devfs_name, st_formats[j]); | 4070 | devfs_remove("%s/mt%sn", SDp->devfs_name, st_formats[j]); |
4070 | for (j=0; j < 2; j++) { | 4071 | for (j=0; j < 2; j++) { |
4071 | class_simple_device_remove(MKDEV(SCSI_TAPE_MAJOR, | 4072 | class_device_destroy(st_sysfs_class, |
4072 | TAPE_MINOR(i, mode, j))); | 4073 | MKDEV(SCSI_TAPE_MAJOR, |
4074 | TAPE_MINOR(i, mode, j))); | ||
4073 | cdev_del(tpnt->modes[mode].cdevs[j]); | 4075 | cdev_del(tpnt->modes[mode].cdevs[j]); |
4074 | tpnt->modes[mode].cdevs[j] = NULL; | 4076 | tpnt->modes[mode].cdevs[j] = NULL; |
4075 | } | 4077 | } |
@@ -4134,7 +4136,7 @@ static int __init init_st(void) | |||
4134 | "st: Version %s, fixed bufsize %d, s/g segs %d\n", | 4136 | "st: Version %s, fixed bufsize %d, s/g segs %d\n", |
4135 | verstr, st_fixed_buffer_size, st_max_sg_segs); | 4137 | verstr, st_fixed_buffer_size, st_max_sg_segs); |
4136 | 4138 | ||
4137 | st_sysfs_class = class_simple_create(THIS_MODULE, "scsi_tape"); | 4139 | st_sysfs_class = class_create(THIS_MODULE, "scsi_tape"); |
4138 | if (IS_ERR(st_sysfs_class)) { | 4140 | if (IS_ERR(st_sysfs_class)) { |
4139 | st_sysfs_class = NULL; | 4141 | st_sysfs_class = NULL; |
4140 | printk(KERN_ERR "Unable create sysfs class for SCSI tapes\n"); | 4142 | printk(KERN_ERR "Unable create sysfs class for SCSI tapes\n"); |
@@ -4148,7 +4150,7 @@ static int __init init_st(void) | |||
4148 | return 0; | 4150 | return 0; |
4149 | } | 4151 | } |
4150 | if (st_sysfs_class) | 4152 | if (st_sysfs_class) |
4151 | class_simple_destroy(st_sysfs_class); | 4153 | class_destroy(st_sysfs_class); |
4152 | unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), | 4154 | unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0), |
4153 | 4155 | ||
4154 | ST_MAX_TAPE_ENTRIES); | 4156 | ST_MAX_TAPE_ENTRIES); |
@@ -4161,7 +4163,7 @@ static int __init init_st(void) | |||
4161 | static void __exit exit_st(void) | 4163 | static void __exit exit_st(void) |
4162 | { | 4164 | { |
4163 | if (st_sysfs_class) | 4165 | if (st_sysfs_class) |
4164 | class_simple_destroy(st_sysfs_class); | 4166 | class_destroy(st_sysfs_class); |
4165 | st_sysfs_class = NULL; | 4167 | st_sysfs_class = NULL; |
4166 | do_remove_driverfs_files(); | 4168 | do_remove_driverfs_files(); |
4167 | scsi_unregister_driver(&st_template.gendrv); | 4169 | scsi_unregister_driver(&st_template.gendrv); |
@@ -4284,12 +4286,12 @@ static void do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4284 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4286 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4285 | STp->disk->disk_name, st_formats[i]); | 4287 | STp->disk->disk_name, st_formats[i]); |
4286 | st_class_member = | 4288 | st_class_member = |
4287 | class_simple_device_add(st_sysfs_class, | 4289 | class_device_create(st_sysfs_class, |
4288 | MKDEV(SCSI_TAPE_MAJOR, | 4290 | MKDEV(SCSI_TAPE_MAJOR, |
4289 | TAPE_MINOR(dev_num, mode, rew)), | 4291 | TAPE_MINOR(dev_num, mode, rew)), |
4290 | &STp->device->sdev_gendev, "%s", name); | 4292 | &STp->device->sdev_gendev, "%s", name); |
4291 | if (IS_ERR(st_class_member)) { | 4293 | if (IS_ERR(st_class_member)) { |
4292 | printk(KERN_WARNING "st%d: class_simple_device_add failed\n", | 4294 | printk(KERN_WARNING "st%d: class_device_create failed\n", |
4293 | dev_num); | 4295 | dev_num); |
4294 | goto out; | 4296 | goto out; |
4295 | } | 4297 | } |
diff --git a/drivers/sh/superhyway/superhyway-sysfs.c b/drivers/sh/superhyway/superhyway-sysfs.c index 39ab6a12da76..dc119ce68e3e 100644 --- a/drivers/sh/superhyway/superhyway-sysfs.c +++ b/drivers/sh/superhyway/superhyway-sysfs.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/superhyway.h> | 15 | #include <linux/superhyway.h> |
16 | 16 | ||
17 | #define superhyway_ro_attr(name, fmt, field) \ | 17 | #define superhyway_ro_attr(name, fmt, field) \ |
18 | static ssize_t name##_show(struct device *dev, char *buf) \ | 18 | static ssize_t name##_show(struct device *dev, struct device_attribute *attr, char *buf) \ |
19 | { \ | 19 | { \ |
20 | struct superhyway_device *s = to_superhyway_device(dev); \ | 20 | struct superhyway_device *s = to_superhyway_device(dev); \ |
21 | return sprintf(buf, fmt, s->field); \ | 21 | return sprintf(buf, fmt, s->field); \ |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index ef0b35731ff0..83e815d3cd52 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -239,7 +239,7 @@ static char *usb_dump_interface_descriptor(char *start, char *end, | |||
239 | int setno) | 239 | int setno) |
240 | { | 240 | { |
241 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; | 241 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; |
242 | char *driver_name = ""; | 242 | const char *driver_name = ""; |
243 | 243 | ||
244 | if (start > end) | 244 | if (start > end) |
245 | return start; | 245 | return start; |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 38ed2220c9fc..65ca131cc44c 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -68,7 +68,7 @@ static struct file_operations usb_fops = { | |||
68 | .open = usb_open, | 68 | .open = usb_open, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static struct class_simple *usb_class; | 71 | static struct class *usb_class; |
72 | 72 | ||
73 | int usb_major_init(void) | 73 | int usb_major_init(void) |
74 | { | 74 | { |
@@ -80,9 +80,10 @@ int usb_major_init(void) | |||
80 | goto out; | 80 | goto out; |
81 | } | 81 | } |
82 | 82 | ||
83 | usb_class = class_simple_create(THIS_MODULE, "usb"); | 83 | usb_class = class_create(THIS_MODULE, "usb"); |
84 | if (IS_ERR(usb_class)) { | 84 | if (IS_ERR(usb_class)) { |
85 | err("class_simple_create failed for usb devices"); | 85 | error = PTR_ERR(usb_class); |
86 | err("class_create failed for usb devices"); | ||
86 | unregister_chrdev(USB_MAJOR, "usb"); | 87 | unregister_chrdev(USB_MAJOR, "usb"); |
87 | goto out; | 88 | goto out; |
88 | } | 89 | } |
@@ -95,7 +96,7 @@ out: | |||
95 | 96 | ||
96 | void usb_major_cleanup(void) | 97 | void usb_major_cleanup(void) |
97 | { | 98 | { |
98 | class_simple_destroy(usb_class); | 99 | class_destroy(usb_class); |
99 | devfs_remove("usb"); | 100 | devfs_remove("usb"); |
100 | unregister_chrdev(USB_MAJOR, "usb"); | 101 | unregister_chrdev(USB_MAJOR, "usb"); |
101 | } | 102 | } |
@@ -171,7 +172,7 @@ int usb_register_dev(struct usb_interface *intf, | |||
171 | ++temp; | 172 | ++temp; |
172 | else | 173 | else |
173 | temp = name; | 174 | temp = name; |
174 | intf->class_dev = class_simple_device_add(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp); | 175 | intf->class_dev = class_device_create(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp); |
175 | if (IS_ERR(intf->class_dev)) { | 176 | if (IS_ERR(intf->class_dev)) { |
176 | spin_lock (&minor_lock); | 177 | spin_lock (&minor_lock); |
177 | usb_minors[intf->minor] = NULL; | 178 | usb_minors[intf->minor] = NULL; |
@@ -220,7 +221,7 @@ void usb_deregister_dev(struct usb_interface *intf, | |||
220 | 221 | ||
221 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); | 222 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); |
222 | devfs_remove (name); | 223 | devfs_remove (name); |
223 | class_simple_device_remove(MKDEV(USB_MAJOR, intf->minor)); | 224 | class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor)); |
224 | intf->class_dev = NULL; | 225 | intf->class_dev = NULL; |
225 | intf->minor = -1; | 226 | intf->minor = -1; |
226 | } | 227 | } |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 266e9e06a9f5..d041782e0c8b 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -651,50 +651,45 @@ static int usb_rh_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) | |||
651 | /*-------------------------------------------------------------------------*/ | 651 | /*-------------------------------------------------------------------------*/ |
652 | 652 | ||
653 | /* exported only within usbcore */ | 653 | /* exported only within usbcore */ |
654 | struct usb_bus *usb_bus_get (struct usb_bus *bus) | 654 | struct usb_bus *usb_bus_get(struct usb_bus *bus) |
655 | { | 655 | { |
656 | struct class_device *tmp; | 656 | if (bus) |
657 | kref_get(&bus->kref); | ||
658 | return bus; | ||
659 | } | ||
657 | 660 | ||
658 | if (!bus) | 661 | static void usb_host_release(struct kref *kref) |
659 | return NULL; | 662 | { |
663 | struct usb_bus *bus = container_of(kref, struct usb_bus, kref); | ||
660 | 664 | ||
661 | tmp = class_device_get(&bus->class_dev); | 665 | if (bus->release) |
662 | if (tmp) | 666 | bus->release(bus); |
663 | return to_usb_bus(tmp); | ||
664 | else | ||
665 | return NULL; | ||
666 | } | 667 | } |
667 | 668 | ||
668 | /* exported only within usbcore */ | 669 | /* exported only within usbcore */ |
669 | void usb_bus_put (struct usb_bus *bus) | 670 | void usb_bus_put(struct usb_bus *bus) |
670 | { | 671 | { |
671 | if (bus) | 672 | if (bus) |
672 | class_device_put(&bus->class_dev); | 673 | kref_put(&bus->kref, usb_host_release); |
673 | } | 674 | } |
674 | 675 | ||
675 | /*-------------------------------------------------------------------------*/ | 676 | /*-------------------------------------------------------------------------*/ |
676 | 677 | ||
677 | static void usb_host_release(struct class_device *class_dev) | 678 | static struct class *usb_host_class; |
678 | { | ||
679 | struct usb_bus *bus = to_usb_bus(class_dev); | ||
680 | |||
681 | if (bus->release) | ||
682 | bus->release(bus); | ||
683 | } | ||
684 | |||
685 | static struct class usb_host_class = { | ||
686 | .name = "usb_host", | ||
687 | .release = &usb_host_release, | ||
688 | }; | ||
689 | 679 | ||
690 | int usb_host_init(void) | 680 | int usb_host_init(void) |
691 | { | 681 | { |
692 | return class_register(&usb_host_class); | 682 | int retval = 0; |
683 | |||
684 | usb_host_class = class_create(THIS_MODULE, "usb_host"); | ||
685 | if (IS_ERR(usb_host_class)) | ||
686 | retval = PTR_ERR(usb_host_class); | ||
687 | return retval; | ||
693 | } | 688 | } |
694 | 689 | ||
695 | void usb_host_cleanup(void) | 690 | void usb_host_cleanup(void) |
696 | { | 691 | { |
697 | class_unregister(&usb_host_class); | 692 | class_destroy(usb_host_class); |
698 | } | 693 | } |
699 | 694 | ||
700 | /** | 695 | /** |
@@ -719,8 +714,7 @@ static void usb_bus_init (struct usb_bus *bus) | |||
719 | 714 | ||
720 | INIT_LIST_HEAD (&bus->bus_list); | 715 | INIT_LIST_HEAD (&bus->bus_list); |
721 | 716 | ||
722 | class_device_initialize(&bus->class_dev); | 717 | kref_init(&bus->kref); |
723 | bus->class_dev.class = &usb_host_class; | ||
724 | } | 718 | } |
725 | 719 | ||
726 | /** | 720 | /** |
@@ -761,7 +755,6 @@ struct usb_bus *usb_alloc_bus (struct usb_operations *op) | |||
761 | static int usb_register_bus(struct usb_bus *bus) | 755 | static int usb_register_bus(struct usb_bus *bus) |
762 | { | 756 | { |
763 | int busnum; | 757 | int busnum; |
764 | int retval; | ||
765 | 758 | ||
766 | down (&usb_bus_list_lock); | 759 | down (&usb_bus_list_lock); |
767 | busnum = find_next_zero_bit (busmap.busmap, USB_MAXBUS, 1); | 760 | busnum = find_next_zero_bit (busmap.busmap, USB_MAXBUS, 1); |
@@ -774,15 +767,15 @@ static int usb_register_bus(struct usb_bus *bus) | |||
774 | return -E2BIG; | 767 | return -E2BIG; |
775 | } | 768 | } |
776 | 769 | ||
777 | snprintf(bus->class_dev.class_id, BUS_ID_SIZE, "usb%d", busnum); | 770 | bus->class_dev = class_device_create(usb_host_class, MKDEV(0,0), bus->controller, "usb%d", busnum); |
778 | bus->class_dev.dev = bus->controller; | 771 | if (IS_ERR(bus->class_dev)) { |
779 | retval = class_device_add(&bus->class_dev); | ||
780 | if (retval) { | ||
781 | clear_bit(busnum, busmap.busmap); | 772 | clear_bit(busnum, busmap.busmap); |
782 | up(&usb_bus_list_lock); | 773 | up(&usb_bus_list_lock); |
783 | return retval; | 774 | return PTR_ERR(bus->class_dev); |
784 | } | 775 | } |
785 | 776 | ||
777 | class_set_devdata(bus->class_dev, bus); | ||
778 | |||
786 | /* Add it to the local list of buses */ | 779 | /* Add it to the local list of buses */ |
787 | list_add (&bus->bus_list, &usb_bus_list); | 780 | list_add (&bus->bus_list, &usb_bus_list); |
788 | up (&usb_bus_list_lock); | 781 | up (&usb_bus_list_lock); |
@@ -820,7 +813,7 @@ static void usb_deregister_bus (struct usb_bus *bus) | |||
820 | 813 | ||
821 | clear_bit (bus->busnum, busmap.busmap); | 814 | clear_bit (bus->busnum, busmap.busmap); |
822 | 815 | ||
823 | class_device_del(&bus->class_dev); | 816 | class_device_unregister(bus->class_dev); |
824 | } | 817 | } |
825 | 818 | ||
826 | /** | 819 | /** |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 4d0c9e65cd03..740cb4c668df 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | /* Active configuration fields */ | 25 | /* Active configuration fields */ |
26 | #define usb_actconfig_show(field, multiplier, format_string) \ | 26 | #define usb_actconfig_show(field, multiplier, format_string) \ |
27 | static ssize_t show_##field (struct device *dev, char *buf) \ | 27 | static ssize_t show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
28 | { \ | 28 | { \ |
29 | struct usb_device *udev; \ | 29 | struct usb_device *udev; \ |
30 | struct usb_host_config *actconfig; \ | 30 | struct usb_host_config *actconfig; \ |
@@ -46,7 +46,7 @@ usb_actconfig_attr (bNumInterfaces, 1, "%2d\n") | |||
46 | usb_actconfig_attr (bmAttributes, 1, "%2x\n") | 46 | usb_actconfig_attr (bmAttributes, 1, "%2x\n") |
47 | usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") | 47 | usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") |
48 | 48 | ||
49 | static ssize_t show_configuration_string(struct device *dev, char *buf) | 49 | static ssize_t show_configuration_string(struct device *dev, struct device_attribute *attr, char *buf) |
50 | { | 50 | { |
51 | struct usb_device *udev; | 51 | struct usb_device *udev; |
52 | struct usb_host_config *actconfig; | 52 | struct usb_host_config *actconfig; |
@@ -69,7 +69,7 @@ static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL); | |||
69 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); | 69 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); |
70 | 70 | ||
71 | static ssize_t | 71 | static ssize_t |
72 | set_bConfigurationValue (struct device *dev, const char *buf, size_t count) | 72 | set_bConfigurationValue (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
73 | { | 73 | { |
74 | struct usb_device *udev = udev = to_usb_device (dev); | 74 | struct usb_device *udev = udev = to_usb_device (dev); |
75 | int config, value; | 75 | int config, value; |
@@ -87,7 +87,7 @@ static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, | |||
87 | 87 | ||
88 | /* String fields */ | 88 | /* String fields */ |
89 | #define usb_string_attr(name) \ | 89 | #define usb_string_attr(name) \ |
90 | static ssize_t show_##name(struct device *dev, char *buf) \ | 90 | static ssize_t show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
91 | { \ | 91 | { \ |
92 | struct usb_device *udev; \ | 92 | struct usb_device *udev; \ |
93 | int len; \ | 93 | int len; \ |
@@ -107,7 +107,7 @@ usb_string_attr(manufacturer); | |||
107 | usb_string_attr(serial); | 107 | usb_string_attr(serial); |
108 | 108 | ||
109 | static ssize_t | 109 | static ssize_t |
110 | show_speed (struct device *dev, char *buf) | 110 | show_speed (struct device *dev, struct device_attribute *attr, char *buf) |
111 | { | 111 | { |
112 | struct usb_device *udev; | 112 | struct usb_device *udev; |
113 | char *speed; | 113 | char *speed; |
@@ -133,7 +133,7 @@ show_speed (struct device *dev, char *buf) | |||
133 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); | 133 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); |
134 | 134 | ||
135 | static ssize_t | 135 | static ssize_t |
136 | show_devnum (struct device *dev, char *buf) | 136 | show_devnum (struct device *dev, struct device_attribute *attr, char *buf) |
137 | { | 137 | { |
138 | struct usb_device *udev; | 138 | struct usb_device *udev; |
139 | 139 | ||
@@ -143,7 +143,7 @@ show_devnum (struct device *dev, char *buf) | |||
143 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); | 143 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); |
144 | 144 | ||
145 | static ssize_t | 145 | static ssize_t |
146 | show_version (struct device *dev, char *buf) | 146 | show_version (struct device *dev, struct device_attribute *attr, char *buf) |
147 | { | 147 | { |
148 | struct usb_device *udev; | 148 | struct usb_device *udev; |
149 | u16 bcdUSB; | 149 | u16 bcdUSB; |
@@ -155,7 +155,7 @@ show_version (struct device *dev, char *buf) | |||
155 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 155 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
156 | 156 | ||
157 | static ssize_t | 157 | static ssize_t |
158 | show_maxchild (struct device *dev, char *buf) | 158 | show_maxchild (struct device *dev, struct device_attribute *attr, char *buf) |
159 | { | 159 | { |
160 | struct usb_device *udev; | 160 | struct usb_device *udev; |
161 | 161 | ||
@@ -167,7 +167,7 @@ static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL); | |||
167 | /* Descriptor fields */ | 167 | /* Descriptor fields */ |
168 | #define usb_descriptor_attr_le16(field, format_string) \ | 168 | #define usb_descriptor_attr_le16(field, format_string) \ |
169 | static ssize_t \ | 169 | static ssize_t \ |
170 | show_##field (struct device *dev, char *buf) \ | 170 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
171 | { \ | 171 | { \ |
172 | struct usb_device *udev; \ | 172 | struct usb_device *udev; \ |
173 | \ | 173 | \ |
@@ -183,7 +183,7 @@ usb_descriptor_attr_le16(bcdDevice, "%04x\n") | |||
183 | 183 | ||
184 | #define usb_descriptor_attr(field, format_string) \ | 184 | #define usb_descriptor_attr(field, format_string) \ |
185 | static ssize_t \ | 185 | static ssize_t \ |
186 | show_##field (struct device *dev, char *buf) \ | 186 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
187 | { \ | 187 | { \ |
188 | struct usb_device *udev; \ | 188 | struct usb_device *udev; \ |
189 | \ | 189 | \ |
@@ -254,7 +254,7 @@ void usb_remove_sysfs_dev_files (struct usb_device *udev) | |||
254 | /* Interface fields */ | 254 | /* Interface fields */ |
255 | #define usb_intf_attr(field, format_string) \ | 255 | #define usb_intf_attr(field, format_string) \ |
256 | static ssize_t \ | 256 | static ssize_t \ |
257 | show_##field (struct device *dev, char *buf) \ | 257 | show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ |
258 | { \ | 258 | { \ |
259 | struct usb_interface *intf = to_usb_interface (dev); \ | 259 | struct usb_interface *intf = to_usb_interface (dev); \ |
260 | \ | 260 | \ |
@@ -269,7 +269,7 @@ usb_intf_attr (bInterfaceClass, "%02x\n") | |||
269 | usb_intf_attr (bInterfaceSubClass, "%02x\n") | 269 | usb_intf_attr (bInterfaceSubClass, "%02x\n") |
270 | usb_intf_attr (bInterfaceProtocol, "%02x\n") | 270 | usb_intf_attr (bInterfaceProtocol, "%02x\n") |
271 | 271 | ||
272 | static ssize_t show_interface_string(struct device *dev, char *buf) | 272 | static ssize_t show_interface_string(struct device *dev, struct device_attribute *attr, char *buf) |
273 | { | 273 | { |
274 | struct usb_interface *intf; | 274 | struct usb_interface *intf; |
275 | struct usb_device *udev; | 275 | struct usb_device *udev; |
@@ -286,7 +286,7 @@ static ssize_t show_interface_string(struct device *dev, char *buf) | |||
286 | } | 286 | } |
287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); | 287 | static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); |
288 | 288 | ||
289 | static ssize_t show_modalias(struct device *dev, char *buf) | 289 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) |
290 | { | 290 | { |
291 | struct usb_interface *intf; | 291 | struct usb_interface *intf; |
292 | struct usb_device *udev; | 292 | struct usb_device *udev; |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 25cf7e9eccfa..a3c42203213a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -293,7 +293,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, | |||
293 | /* if interface was already added, bind now; else let | 293 | /* if interface was already added, bind now; else let |
294 | * the future device_add() bind it, bypassing probe() | 294 | * the future device_add() bind it, bypassing probe() |
295 | */ | 295 | */ |
296 | if (!list_empty (&dev->bus_list)) | 296 | if (klist_node_attached(&dev->knode_bus)) |
297 | device_bind_driver(dev); | 297 | device_bind_driver(dev); |
298 | 298 | ||
299 | return 0; | 299 | return 0; |
@@ -322,9 +322,15 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
322 | if (!dev->driver || dev->driver != &driver->driver) | 322 | if (!dev->driver || dev->driver != &driver->driver) |
323 | return; | 323 | return; |
324 | 324 | ||
325 | /* don't disconnect from disconnect(), or before dev_add() */ | 325 | /* don't release from within disconnect() */ |
326 | if (!list_empty (&dev->driver_list) && !list_empty (&dev->bus_list)) | 326 | if (iface->condition != USB_INTERFACE_BOUND) |
327 | return; | ||
328 | |||
329 | /* release only after device_add() */ | ||
330 | if (klist_node_attached(&dev->knode_bus)) { | ||
331 | iface->condition = USB_INTERFACE_UNBINDING; | ||
327 | device_release_driver(dev); | 332 | device_release_driver(dev); |
333 | } | ||
328 | 334 | ||
329 | dev->driver = NULL; | 335 | dev->driver = NULL; |
330 | usb_set_intfdata(iface, NULL); | 336 | usb_set_intfdata(iface, NULL); |
@@ -462,6 +468,25 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) | |||
462 | return NULL; | 468 | return NULL; |
463 | } | 469 | } |
464 | 470 | ||
471 | |||
472 | static int __find_interface(struct device * dev, void * data) | ||
473 | { | ||
474 | struct usb_interface ** ret = (struct usb_interface **)data; | ||
475 | struct usb_interface * intf = *ret; | ||
476 | int *minor = (int *)data; | ||
477 | |||
478 | /* can't look at usb devices, only interfaces */ | ||
479 | if (dev->driver == &usb_generic_driver) | ||
480 | return 0; | ||
481 | |||
482 | intf = to_usb_interface(dev); | ||
483 | if (intf->minor != -1 && intf->minor == *minor) { | ||
484 | *ret = intf; | ||
485 | return 1; | ||
486 | } | ||
487 | return 0; | ||
488 | } | ||
489 | |||
465 | /** | 490 | /** |
466 | * usb_find_interface - find usb_interface pointer for driver and device | 491 | * usb_find_interface - find usb_interface pointer for driver and device |
467 | * @drv: the driver whose current configuration is considered | 492 | * @drv: the driver whose current configuration is considered |
@@ -473,26 +498,12 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) | |||
473 | */ | 498 | */ |
474 | struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) | 499 | struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) |
475 | { | 500 | { |
476 | struct list_head *entry; | 501 | struct usb_interface *intf = (struct usb_interface *)(long)minor; |
477 | struct device *dev; | 502 | int ret; |
478 | struct usb_interface *intf; | ||
479 | 503 | ||
480 | list_for_each(entry, &drv->driver.devices) { | 504 | ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface); |
481 | dev = container_of(entry, struct device, driver_list); | ||
482 | |||
483 | /* can't look at usb devices, only interfaces */ | ||
484 | if (dev->driver == &usb_generic_driver) | ||
485 | continue; | ||
486 | |||
487 | intf = to_usb_interface(dev); | ||
488 | if (intf->minor == -1) | ||
489 | continue; | ||
490 | if (intf->minor == minor) | ||
491 | return intf; | ||
492 | } | ||
493 | 505 | ||
494 | /* no device found that matches */ | 506 | return ret ? intf : NULL; |
495 | return NULL; | ||
496 | } | 507 | } |
497 | 508 | ||
498 | static int usb_device_match (struct device *dev, struct device_driver *drv) | 509 | static int usb_device_match (struct device *dev, struct device_driver *drv) |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 8ef8a9cd9ac4..c039d2fbe7ab 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -633,7 +633,7 @@ static const struct usb_gadget_ops dummy_ops = { | |||
633 | 633 | ||
634 | /* "function" sysfs attribute */ | 634 | /* "function" sysfs attribute */ |
635 | static ssize_t | 635 | static ssize_t |
636 | show_function (struct device *dev, char *buf) | 636 | show_function (struct device *dev, struct device_attribute *attr, char *buf) |
637 | { | 637 | { |
638 | struct dummy *dum = gadget_dev_to_dummy (dev); | 638 | struct dummy *dum = gadget_dev_to_dummy (dev); |
639 | 639 | ||
@@ -1600,7 +1600,7 @@ show_urb (char *buf, size_t size, struct urb *urb) | |||
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | static ssize_t | 1602 | static ssize_t |
1603 | show_urbs (struct device *dev, char *buf) | 1603 | show_urbs (struct device *dev, struct device_attribute *attr, char *buf) |
1604 | { | 1604 | { |
1605 | struct usb_hcd *hcd = dev_get_drvdata (dev); | 1605 | struct usb_hcd *hcd = dev_get_drvdata (dev); |
1606 | struct dummy *dum = hcd_to_dummy (hcd); | 1606 | struct dummy *dum = hcd_to_dummy (hcd); |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 4857f0e4ef44..037a7f163822 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3554,14 +3554,14 @@ static void close_all_backing_files(struct fsg_dev *fsg) | |||
3554 | } | 3554 | } |
3555 | 3555 | ||
3556 | 3556 | ||
3557 | static ssize_t show_ro(struct device *dev, char *buf) | 3557 | static ssize_t show_ro(struct device *dev, struct device_attribute *attr, char *buf) |
3558 | { | 3558 | { |
3559 | struct lun *curlun = dev_to_lun(dev); | 3559 | struct lun *curlun = dev_to_lun(dev); |
3560 | 3560 | ||
3561 | return sprintf(buf, "%d\n", curlun->ro); | 3561 | return sprintf(buf, "%d\n", curlun->ro); |
3562 | } | 3562 | } |
3563 | 3563 | ||
3564 | static ssize_t show_file(struct device *dev, char *buf) | 3564 | static ssize_t show_file(struct device *dev, struct device_attribute *attr, char *buf) |
3565 | { | 3565 | { |
3566 | struct lun *curlun = dev_to_lun(dev); | 3566 | struct lun *curlun = dev_to_lun(dev); |
3567 | struct fsg_dev *fsg = (struct fsg_dev *) dev_get_drvdata(dev); | 3567 | struct fsg_dev *fsg = (struct fsg_dev *) dev_get_drvdata(dev); |
@@ -3589,7 +3589,7 @@ static ssize_t show_file(struct device *dev, char *buf) | |||
3589 | } | 3589 | } |
3590 | 3590 | ||
3591 | 3591 | ||
3592 | static ssize_t store_ro(struct device *dev, const char *buf, size_t count) | 3592 | static ssize_t store_ro(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
3593 | { | 3593 | { |
3594 | ssize_t rc = count; | 3594 | ssize_t rc = count; |
3595 | struct lun *curlun = dev_to_lun(dev); | 3595 | struct lun *curlun = dev_to_lun(dev); |
@@ -3613,7 +3613,7 @@ static ssize_t store_ro(struct device *dev, const char *buf, size_t count) | |||
3613 | return rc; | 3613 | return rc; |
3614 | } | 3614 | } |
3615 | 3615 | ||
3616 | static ssize_t store_file(struct device *dev, const char *buf, size_t count) | 3616 | static ssize_t store_file(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
3617 | { | 3617 | { |
3618 | struct lun *curlun = dev_to_lun(dev); | 3618 | struct lun *curlun = dev_to_lun(dev); |
3619 | struct fsg_dev *fsg = (struct fsg_dev *) dev_get_drvdata(dev); | 3619 | struct fsg_dev *fsg = (struct fsg_dev *) dev_get_drvdata(dev); |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index e5457f2026cc..e47e398daeb5 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -1469,7 +1469,7 @@ static const struct usb_gadget_ops net2280_ops = { | |||
1469 | 1469 | ||
1470 | /* "function" sysfs attribute */ | 1470 | /* "function" sysfs attribute */ |
1471 | static ssize_t | 1471 | static ssize_t |
1472 | show_function (struct device *_dev, char *buf) | 1472 | show_function (struct device *_dev, struct device_attribute *attr, char *buf) |
1473 | { | 1473 | { |
1474 | struct net2280 *dev = dev_get_drvdata (_dev); | 1474 | struct net2280 *dev = dev_get_drvdata (_dev); |
1475 | 1475 | ||
@@ -1482,7 +1482,7 @@ show_function (struct device *_dev, char *buf) | |||
1482 | static DEVICE_ATTR (function, S_IRUGO, show_function, NULL); | 1482 | static DEVICE_ATTR (function, S_IRUGO, show_function, NULL); |
1483 | 1483 | ||
1484 | static ssize_t | 1484 | static ssize_t |
1485 | show_registers (struct device *_dev, char *buf) | 1485 | show_registers (struct device *_dev, struct device_attribute *attr, char *buf) |
1486 | { | 1486 | { |
1487 | struct net2280 *dev; | 1487 | struct net2280 *dev; |
1488 | char *next; | 1488 | char *next; |
@@ -1637,7 +1637,7 @@ show_registers (struct device *_dev, char *buf) | |||
1637 | static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); | 1637 | static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); |
1638 | 1638 | ||
1639 | static ssize_t | 1639 | static ssize_t |
1640 | show_queues (struct device *_dev, char *buf) | 1640 | show_queues (struct device *_dev, struct device_attribute *attr, char *buf) |
1641 | { | 1641 | { |
1642 | struct net2280 *dev; | 1642 | struct net2280 *dev; |
1643 | char *next; | 1643 | char *next; |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 6390c5726d81..b8b4524ed746 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -1429,7 +1429,7 @@ done: | |||
1429 | 1429 | ||
1430 | /* "function" sysfs attribute */ | 1430 | /* "function" sysfs attribute */ |
1431 | static ssize_t | 1431 | static ssize_t |
1432 | show_function (struct device *_dev, char *buf) | 1432 | show_function (struct device *_dev, struct device_attribute *attr, char *buf) |
1433 | { | 1433 | { |
1434 | struct pxa2xx_udc *dev = dev_get_drvdata (_dev); | 1434 | struct pxa2xx_udc *dev = dev_get_drvdata (_dev); |
1435 | 1435 | ||
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 9b347d765383..2ff11d53567b 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -450,7 +450,7 @@ show_async (struct class_device *class_dev, char *buf) | |||
450 | 450 | ||
451 | *buf = 0; | 451 | *buf = 0; |
452 | 452 | ||
453 | bus = to_usb_bus(class_dev); | 453 | bus = class_get_devdata(class_dev); |
454 | hcd = bus->hcpriv; | 454 | hcd = bus->hcpriv; |
455 | ehci = hcd_to_ehci (hcd); | 455 | ehci = hcd_to_ehci (hcd); |
456 | next = buf; | 456 | next = buf; |
@@ -496,7 +496,7 @@ show_periodic (struct class_device *class_dev, char *buf) | |||
496 | return 0; | 496 | return 0; |
497 | seen_count = 0; | 497 | seen_count = 0; |
498 | 498 | ||
499 | bus = to_usb_bus(class_dev); | 499 | bus = class_get_devdata(class_dev); |
500 | hcd = bus->hcpriv; | 500 | hcd = bus->hcpriv; |
501 | ehci = hcd_to_ehci (hcd); | 501 | ehci = hcd_to_ehci (hcd); |
502 | next = buf; | 502 | next = buf; |
@@ -633,7 +633,7 @@ show_registers (struct class_device *class_dev, char *buf) | |||
633 | static char fmt [] = "%*s\n"; | 633 | static char fmt [] = "%*s\n"; |
634 | static char label [] = ""; | 634 | static char label [] = ""; |
635 | 635 | ||
636 | bus = to_usb_bus(class_dev); | 636 | bus = class_get_devdata(class_dev); |
637 | hcd = bus->hcpriv; | 637 | hcd = bus->hcpriv; |
638 | ehci = hcd_to_ehci (hcd); | 638 | ehci = hcd_to_ehci (hcd); |
639 | next = buf; | 639 | next = buf; |
@@ -735,7 +735,7 @@ static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); | |||
735 | 735 | ||
736 | static inline void create_debug_files (struct ehci_hcd *ehci) | 736 | static inline void create_debug_files (struct ehci_hcd *ehci) |
737 | { | 737 | { |
738 | struct class_device *cldev = &ehci_to_hcd(ehci)->self.class_dev; | 738 | struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev; |
739 | 739 | ||
740 | class_device_create_file(cldev, &class_device_attr_async); | 740 | class_device_create_file(cldev, &class_device_attr_async); |
741 | class_device_create_file(cldev, &class_device_attr_periodic); | 741 | class_device_create_file(cldev, &class_device_attr_periodic); |
@@ -744,7 +744,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
744 | 744 | ||
745 | static inline void remove_debug_files (struct ehci_hcd *ehci) | 745 | static inline void remove_debug_files (struct ehci_hcd *ehci) |
746 | { | 746 | { |
747 | struct class_device *cldev = &ehci_to_hcd(ehci)->self.class_dev; | 747 | struct class_device *cldev = ehci_to_hcd(ehci)->self.class_dev; |
748 | 748 | ||
749 | class_device_remove_file(cldev, &class_device_attr_async); | 749 | class_device_remove_file(cldev, &class_device_attr_async); |
750 | class_device_remove_file(cldev, &class_device_attr_periodic); | 750 | class_device_remove_file(cldev, &class_device_attr_periodic); |
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 62f53a213808..c58408c95c3d 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -481,7 +481,7 @@ show_async (struct class_device *class_dev, char *buf) | |||
481 | size_t temp; | 481 | size_t temp; |
482 | unsigned long flags; | 482 | unsigned long flags; |
483 | 483 | ||
484 | bus = to_usb_bus(class_dev); | 484 | bus = class_get_devdata(class_dev); |
485 | hcd = bus->hcpriv; | 485 | hcd = bus->hcpriv; |
486 | ohci = hcd_to_ohci(hcd); | 486 | ohci = hcd_to_ohci(hcd); |
487 | 487 | ||
@@ -514,7 +514,7 @@ show_periodic (struct class_device *class_dev, char *buf) | |||
514 | return 0; | 514 | return 0; |
515 | seen_count = 0; | 515 | seen_count = 0; |
516 | 516 | ||
517 | bus = to_usb_bus(class_dev); | 517 | bus = class_get_devdata(class_dev); |
518 | hcd = bus->hcpriv; | 518 | hcd = bus->hcpriv; |
519 | ohci = hcd_to_ohci(hcd); | 519 | ohci = hcd_to_ohci(hcd); |
520 | next = buf; | 520 | next = buf; |
@@ -611,7 +611,7 @@ show_registers (struct class_device *class_dev, char *buf) | |||
611 | char *next; | 611 | char *next; |
612 | u32 rdata; | 612 | u32 rdata; |
613 | 613 | ||
614 | bus = to_usb_bus(class_dev); | 614 | bus = class_get_devdata(class_dev); |
615 | hcd = bus->hcpriv; | 615 | hcd = bus->hcpriv; |
616 | ohci = hcd_to_ohci(hcd); | 616 | ohci = hcd_to_ohci(hcd); |
617 | regs = ohci->regs; | 617 | regs = ohci->regs; |
@@ -684,7 +684,7 @@ static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); | |||
684 | 684 | ||
685 | static inline void create_debug_files (struct ohci_hcd *ohci) | 685 | static inline void create_debug_files (struct ohci_hcd *ohci) |
686 | { | 686 | { |
687 | struct class_device *cldev = &ohci_to_hcd(ohci)->self.class_dev; | 687 | struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev; |
688 | 688 | ||
689 | class_device_create_file(cldev, &class_device_attr_async); | 689 | class_device_create_file(cldev, &class_device_attr_async); |
690 | class_device_create_file(cldev, &class_device_attr_periodic); | 690 | class_device_create_file(cldev, &class_device_attr_periodic); |
@@ -694,7 +694,7 @@ static inline void create_debug_files (struct ohci_hcd *ohci) | |||
694 | 694 | ||
695 | static inline void remove_debug_files (struct ohci_hcd *ohci) | 695 | static inline void remove_debug_files (struct ohci_hcd *ohci) |
696 | { | 696 | { |
697 | struct class_device *cldev = &ohci_to_hcd(ohci)->self.class_dev; | 697 | struct class_device *cldev = ohci_to_hcd(ohci)->self.class_dev; |
698 | 698 | ||
699 | class_device_remove_file(cldev, &class_device_attr_async); | 699 | class_device_remove_file(cldev, &class_device_attr_async); |
700 | class_device_remove_file(cldev, &class_device_attr_periodic); | 700 | class_device_remove_file(cldev, &class_device_attr_periodic); |
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 94ce2a9ad50f..e991f7ed7330 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -1025,7 +1025,7 @@ static int aiptek_program_tablet(struct aiptek *aiptek) | |||
1025 | /*********************************************************************** | 1025 | /*********************************************************************** |
1026 | * support the 'size' file -- display support | 1026 | * support the 'size' file -- display support |
1027 | */ | 1027 | */ |
1028 | static ssize_t show_tabletSize(struct device *dev, char *buf) | 1028 | static ssize_t show_tabletSize(struct device *dev, struct device_attribute *attr, char *buf) |
1029 | { | 1029 | { |
1030 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1030 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1031 | 1031 | ||
@@ -1048,7 +1048,7 @@ static DEVICE_ATTR(size, S_IRUGO, show_tabletSize, NULL); | |||
1048 | /*********************************************************************** | 1048 | /*********************************************************************** |
1049 | * support routines for the 'product_id' file | 1049 | * support routines for the 'product_id' file |
1050 | */ | 1050 | */ |
1051 | static ssize_t show_tabletProductId(struct device *dev, char *buf) | 1051 | static ssize_t show_tabletProductId(struct device *dev, struct device_attribute *attr, char *buf) |
1052 | { | 1052 | { |
1053 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1053 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1054 | 1054 | ||
@@ -1064,7 +1064,7 @@ static DEVICE_ATTR(product_id, S_IRUGO, show_tabletProductId, NULL); | |||
1064 | /*********************************************************************** | 1064 | /*********************************************************************** |
1065 | * support routines for the 'vendor_id' file | 1065 | * support routines for the 'vendor_id' file |
1066 | */ | 1066 | */ |
1067 | static ssize_t show_tabletVendorId(struct device *dev, char *buf) | 1067 | static ssize_t show_tabletVendorId(struct device *dev, struct device_attribute *attr, char *buf) |
1068 | { | 1068 | { |
1069 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1069 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1070 | 1070 | ||
@@ -1079,7 +1079,7 @@ static DEVICE_ATTR(vendor_id, S_IRUGO, show_tabletVendorId, NULL); | |||
1079 | /*********************************************************************** | 1079 | /*********************************************************************** |
1080 | * support routines for the 'vendor' file | 1080 | * support routines for the 'vendor' file |
1081 | */ | 1081 | */ |
1082 | static ssize_t show_tabletManufacturer(struct device *dev, char *buf) | 1082 | static ssize_t show_tabletManufacturer(struct device *dev, struct device_attribute *attr, char *buf) |
1083 | { | 1083 | { |
1084 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1084 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1085 | int retval; | 1085 | int retval; |
@@ -1096,7 +1096,7 @@ static DEVICE_ATTR(vendor, S_IRUGO, show_tabletManufacturer, NULL); | |||
1096 | /*********************************************************************** | 1096 | /*********************************************************************** |
1097 | * support routines for the 'product' file | 1097 | * support routines for the 'product' file |
1098 | */ | 1098 | */ |
1099 | static ssize_t show_tabletProduct(struct device *dev, char *buf) | 1099 | static ssize_t show_tabletProduct(struct device *dev, struct device_attribute *attr, char *buf) |
1100 | { | 1100 | { |
1101 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1101 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1102 | int retval; | 1102 | int retval; |
@@ -1114,7 +1114,7 @@ static DEVICE_ATTR(product, S_IRUGO, show_tabletProduct, NULL); | |||
1114 | * support routines for the 'pointer_mode' file. Note that this file | 1114 | * support routines for the 'pointer_mode' file. Note that this file |
1115 | * both displays current setting and allows reprogramming. | 1115 | * both displays current setting and allows reprogramming. |
1116 | */ | 1116 | */ |
1117 | static ssize_t show_tabletPointerMode(struct device *dev, char *buf) | 1117 | static ssize_t show_tabletPointerMode(struct device *dev, struct device_attribute *attr, char *buf) |
1118 | { | 1118 | { |
1119 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1119 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1120 | char *s; | 1120 | char *s; |
@@ -1143,7 +1143,7 @@ static ssize_t show_tabletPointerMode(struct device *dev, char *buf) | |||
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | static ssize_t | 1145 | static ssize_t |
1146 | store_tabletPointerMode(struct device *dev, const char *buf, size_t count) | 1146 | store_tabletPointerMode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1147 | { | 1147 | { |
1148 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1148 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1149 | if (aiptek == NULL) | 1149 | if (aiptek == NULL) |
@@ -1168,7 +1168,7 @@ static DEVICE_ATTR(pointer_mode, | |||
1168 | * support routines for the 'coordinate_mode' file. Note that this file | 1168 | * support routines for the 'coordinate_mode' file. Note that this file |
1169 | * both displays current setting and allows reprogramming. | 1169 | * both displays current setting and allows reprogramming. |
1170 | */ | 1170 | */ |
1171 | static ssize_t show_tabletCoordinateMode(struct device *dev, char *buf) | 1171 | static ssize_t show_tabletCoordinateMode(struct device *dev, struct device_attribute *attr, char *buf) |
1172 | { | 1172 | { |
1173 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1173 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1174 | char *s; | 1174 | char *s; |
@@ -1193,7 +1193,7 @@ static ssize_t show_tabletCoordinateMode(struct device *dev, char *buf) | |||
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | static ssize_t | 1195 | static ssize_t |
1196 | store_tabletCoordinateMode(struct device *dev, const char *buf, size_t count) | 1196 | store_tabletCoordinateMode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1197 | { | 1197 | { |
1198 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1198 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1199 | if (aiptek == NULL) | 1199 | if (aiptek == NULL) |
@@ -1217,7 +1217,7 @@ static DEVICE_ATTR(coordinate_mode, | |||
1217 | * support routines for the 'tool_mode' file. Note that this file | 1217 | * support routines for the 'tool_mode' file. Note that this file |
1218 | * both displays current setting and allows reprogramming. | 1218 | * both displays current setting and allows reprogramming. |
1219 | */ | 1219 | */ |
1220 | static ssize_t show_tabletToolMode(struct device *dev, char *buf) | 1220 | static ssize_t show_tabletToolMode(struct device *dev, struct device_attribute *attr, char *buf) |
1221 | { | 1221 | { |
1222 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1222 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1223 | char *s; | 1223 | char *s; |
@@ -1262,7 +1262,7 @@ static ssize_t show_tabletToolMode(struct device *dev, char *buf) | |||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | static ssize_t | 1264 | static ssize_t |
1265 | store_tabletToolMode(struct device *dev, const char *buf, size_t count) | 1265 | store_tabletToolMode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1266 | { | 1266 | { |
1267 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1267 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1268 | if (aiptek == NULL) | 1268 | if (aiptek == NULL) |
@@ -1295,7 +1295,7 @@ static DEVICE_ATTR(tool_mode, | |||
1295 | * support routines for the 'xtilt' file. Note that this file | 1295 | * support routines for the 'xtilt' file. Note that this file |
1296 | * both displays current setting and allows reprogramming. | 1296 | * both displays current setting and allows reprogramming. |
1297 | */ | 1297 | */ |
1298 | static ssize_t show_tabletXtilt(struct device *dev, char *buf) | 1298 | static ssize_t show_tabletXtilt(struct device *dev, struct device_attribute *attr, char *buf) |
1299 | { | 1299 | { |
1300 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1300 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1301 | 1301 | ||
@@ -1311,7 +1311,7 @@ static ssize_t show_tabletXtilt(struct device *dev, char *buf) | |||
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static ssize_t | 1313 | static ssize_t |
1314 | store_tabletXtilt(struct device *dev, const char *buf, size_t count) | 1314 | store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1315 | { | 1315 | { |
1316 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1316 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1317 | int x; | 1317 | int x; |
@@ -1337,7 +1337,7 @@ static DEVICE_ATTR(xtilt, | |||
1337 | * support routines for the 'ytilt' file. Note that this file | 1337 | * support routines for the 'ytilt' file. Note that this file |
1338 | * both displays current setting and allows reprogramming. | 1338 | * both displays current setting and allows reprogramming. |
1339 | */ | 1339 | */ |
1340 | static ssize_t show_tabletYtilt(struct device *dev, char *buf) | 1340 | static ssize_t show_tabletYtilt(struct device *dev, struct device_attribute *attr, char *buf) |
1341 | { | 1341 | { |
1342 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1342 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1343 | 1343 | ||
@@ -1353,7 +1353,7 @@ static ssize_t show_tabletYtilt(struct device *dev, char *buf) | |||
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static ssize_t | 1355 | static ssize_t |
1356 | store_tabletYtilt(struct device *dev, const char *buf, size_t count) | 1356 | store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1357 | { | 1357 | { |
1358 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1358 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1359 | int y; | 1359 | int y; |
@@ -1379,7 +1379,7 @@ static DEVICE_ATTR(ytilt, | |||
1379 | * support routines for the 'jitter' file. Note that this file | 1379 | * support routines for the 'jitter' file. Note that this file |
1380 | * both displays current setting and allows reprogramming. | 1380 | * both displays current setting and allows reprogramming. |
1381 | */ | 1381 | */ |
1382 | static ssize_t show_tabletJitterDelay(struct device *dev, char *buf) | 1382 | static ssize_t show_tabletJitterDelay(struct device *dev, struct device_attribute *attr, char *buf) |
1383 | { | 1383 | { |
1384 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1384 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1385 | 1385 | ||
@@ -1390,7 +1390,7 @@ static ssize_t show_tabletJitterDelay(struct device *dev, char *buf) | |||
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | static ssize_t | 1392 | static ssize_t |
1393 | store_tabletJitterDelay(struct device *dev, const char *buf, size_t count) | 1393 | store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1394 | { | 1394 | { |
1395 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1395 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1396 | 1396 | ||
@@ -1409,7 +1409,7 @@ static DEVICE_ATTR(jitter, | |||
1409 | * support routines for the 'delay' file. Note that this file | 1409 | * support routines for the 'delay' file. Note that this file |
1410 | * both displays current setting and allows reprogramming. | 1410 | * both displays current setting and allows reprogramming. |
1411 | */ | 1411 | */ |
1412 | static ssize_t show_tabletProgrammableDelay(struct device *dev, char *buf) | 1412 | static ssize_t show_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, char *buf) |
1413 | { | 1413 | { |
1414 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1414 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1415 | 1415 | ||
@@ -1421,7 +1421,7 @@ static ssize_t show_tabletProgrammableDelay(struct device *dev, char *buf) | |||
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | static ssize_t | 1423 | static ssize_t |
1424 | store_tabletProgrammableDelay(struct device *dev, const char *buf, size_t count) | 1424 | store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1425 | { | 1425 | { |
1426 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1426 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1427 | 1427 | ||
@@ -1440,7 +1440,7 @@ static DEVICE_ATTR(delay, | |||
1440 | * support routines for the 'input_path' file. Note that this file | 1440 | * support routines for the 'input_path' file. Note that this file |
1441 | * only displays current setting. | 1441 | * only displays current setting. |
1442 | */ | 1442 | */ |
1443 | static ssize_t show_tabletInputDevice(struct device *dev, char *buf) | 1443 | static ssize_t show_tabletInputDevice(struct device *dev, struct device_attribute *attr, char *buf) |
1444 | { | 1444 | { |
1445 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1445 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1446 | 1446 | ||
@@ -1457,7 +1457,7 @@ static DEVICE_ATTR(input_path, S_IRUGO, show_tabletInputDevice, NULL); | |||
1457 | * support routines for the 'event_count' file. Note that this file | 1457 | * support routines for the 'event_count' file. Note that this file |
1458 | * only displays current setting. | 1458 | * only displays current setting. |
1459 | */ | 1459 | */ |
1460 | static ssize_t show_tabletEventsReceived(struct device *dev, char *buf) | 1460 | static ssize_t show_tabletEventsReceived(struct device *dev, struct device_attribute *attr, char *buf) |
1461 | { | 1461 | { |
1462 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1462 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1463 | 1463 | ||
@@ -1473,7 +1473,7 @@ static DEVICE_ATTR(event_count, S_IRUGO, show_tabletEventsReceived, NULL); | |||
1473 | * support routines for the 'diagnostic' file. Note that this file | 1473 | * support routines for the 'diagnostic' file. Note that this file |
1474 | * only displays current setting. | 1474 | * only displays current setting. |
1475 | */ | 1475 | */ |
1476 | static ssize_t show_tabletDiagnosticMessage(struct device *dev, char *buf) | 1476 | static ssize_t show_tabletDiagnosticMessage(struct device *dev, struct device_attribute *attr, char *buf) |
1477 | { | 1477 | { |
1478 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1478 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1479 | char *retMsg; | 1479 | char *retMsg; |
@@ -1515,7 +1515,7 @@ static DEVICE_ATTR(diagnostic, S_IRUGO, show_tabletDiagnosticMessage, NULL); | |||
1515 | * support routines for the 'stylus_upper' file. Note that this file | 1515 | * support routines for the 'stylus_upper' file. Note that this file |
1516 | * both displays current setting and allows for setting changing. | 1516 | * both displays current setting and allows for setting changing. |
1517 | */ | 1517 | */ |
1518 | static ssize_t show_tabletStylusUpper(struct device *dev, char *buf) | 1518 | static ssize_t show_tabletStylusUpper(struct device *dev, struct device_attribute *attr, char *buf) |
1519 | { | 1519 | { |
1520 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1520 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1521 | char *s; | 1521 | char *s; |
@@ -1540,7 +1540,7 @@ static ssize_t show_tabletStylusUpper(struct device *dev, char *buf) | |||
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | static ssize_t | 1542 | static ssize_t |
1543 | store_tabletStylusUpper(struct device *dev, const char *buf, size_t count) | 1543 | store_tabletStylusUpper(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1544 | { | 1544 | { |
1545 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1545 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1546 | 1546 | ||
@@ -1565,7 +1565,7 @@ static DEVICE_ATTR(stylus_upper, | |||
1565 | * support routines for the 'stylus_lower' file. Note that this file | 1565 | * support routines for the 'stylus_lower' file. Note that this file |
1566 | * both displays current setting and allows for setting changing. | 1566 | * both displays current setting and allows for setting changing. |
1567 | */ | 1567 | */ |
1568 | static ssize_t show_tabletStylusLower(struct device *dev, char *buf) | 1568 | static ssize_t show_tabletStylusLower(struct device *dev, struct device_attribute *attr, char *buf) |
1569 | { | 1569 | { |
1570 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1570 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1571 | char *s; | 1571 | char *s; |
@@ -1590,7 +1590,7 @@ static ssize_t show_tabletStylusLower(struct device *dev, char *buf) | |||
1590 | } | 1590 | } |
1591 | 1591 | ||
1592 | static ssize_t | 1592 | static ssize_t |
1593 | store_tabletStylusLower(struct device *dev, const char *buf, size_t count) | 1593 | store_tabletStylusLower(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1594 | { | 1594 | { |
1595 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1595 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1596 | 1596 | ||
@@ -1615,7 +1615,7 @@ static DEVICE_ATTR(stylus_lower, | |||
1615 | * support routines for the 'mouse_left' file. Note that this file | 1615 | * support routines for the 'mouse_left' file. Note that this file |
1616 | * both displays current setting and allows for setting changing. | 1616 | * both displays current setting and allows for setting changing. |
1617 | */ | 1617 | */ |
1618 | static ssize_t show_tabletMouseLeft(struct device *dev, char *buf) | 1618 | static ssize_t show_tabletMouseLeft(struct device *dev, struct device_attribute *attr, char *buf) |
1619 | { | 1619 | { |
1620 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1620 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1621 | char *s; | 1621 | char *s; |
@@ -1644,7 +1644,7 @@ static ssize_t show_tabletMouseLeft(struct device *dev, char *buf) | |||
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | static ssize_t | 1646 | static ssize_t |
1647 | store_tabletMouseLeft(struct device *dev, const char *buf, size_t count) | 1647 | store_tabletMouseLeft(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1648 | { | 1648 | { |
1649 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1649 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1650 | 1650 | ||
@@ -1669,7 +1669,7 @@ static DEVICE_ATTR(mouse_left, | |||
1669 | * support routines for the 'mouse_middle' file. Note that this file | 1669 | * support routines for the 'mouse_middle' file. Note that this file |
1670 | * both displays current setting and allows for setting changing. | 1670 | * both displays current setting and allows for setting changing. |
1671 | */ | 1671 | */ |
1672 | static ssize_t show_tabletMouseMiddle(struct device *dev, char *buf) | 1672 | static ssize_t show_tabletMouseMiddle(struct device *dev, struct device_attribute *attr, char *buf) |
1673 | { | 1673 | { |
1674 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1674 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1675 | char *s; | 1675 | char *s; |
@@ -1698,7 +1698,7 @@ static ssize_t show_tabletMouseMiddle(struct device *dev, char *buf) | |||
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | static ssize_t | 1700 | static ssize_t |
1701 | store_tabletMouseMiddle(struct device *dev, const char *buf, size_t count) | 1701 | store_tabletMouseMiddle(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1702 | { | 1702 | { |
1703 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1703 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1704 | 1704 | ||
@@ -1725,7 +1725,7 @@ static DEVICE_ATTR(mouse_middle, | |||
1725 | * support routines for the 'mouse_right' file. Note that this file | 1725 | * support routines for the 'mouse_right' file. Note that this file |
1726 | * both displays current setting and allows for setting changing. | 1726 | * both displays current setting and allows for setting changing. |
1727 | */ | 1727 | */ |
1728 | static ssize_t show_tabletMouseRight(struct device *dev, char *buf) | 1728 | static ssize_t show_tabletMouseRight(struct device *dev, struct device_attribute *attr, char *buf) |
1729 | { | 1729 | { |
1730 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1730 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1731 | char *s; | 1731 | char *s; |
@@ -1754,7 +1754,7 @@ static ssize_t show_tabletMouseRight(struct device *dev, char *buf) | |||
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | static ssize_t | 1756 | static ssize_t |
1757 | store_tabletMouseRight(struct device *dev, const char *buf, size_t count) | 1757 | store_tabletMouseRight(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1758 | { | 1758 | { |
1759 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1759 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1760 | 1760 | ||
@@ -1780,7 +1780,7 @@ static DEVICE_ATTR(mouse_right, | |||
1780 | * support routines for the 'wheel' file. Note that this file | 1780 | * support routines for the 'wheel' file. Note that this file |
1781 | * both displays current setting and allows for setting changing. | 1781 | * both displays current setting and allows for setting changing. |
1782 | */ | 1782 | */ |
1783 | static ssize_t show_tabletWheel(struct device *dev, char *buf) | 1783 | static ssize_t show_tabletWheel(struct device *dev, struct device_attribute *attr, char *buf) |
1784 | { | 1784 | { |
1785 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1785 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1786 | 1786 | ||
@@ -1796,7 +1796,7 @@ static ssize_t show_tabletWheel(struct device *dev, char *buf) | |||
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | static ssize_t | 1798 | static ssize_t |
1799 | store_tabletWheel(struct device *dev, const char *buf, size_t count) | 1799 | store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1800 | { | 1800 | { |
1801 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1801 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1802 | 1802 | ||
@@ -1814,7 +1814,7 @@ static DEVICE_ATTR(wheel, | |||
1814 | * support routines for the 'execute' file. Note that this file | 1814 | * support routines for the 'execute' file. Note that this file |
1815 | * both displays current setting and allows for setting changing. | 1815 | * both displays current setting and allows for setting changing. |
1816 | */ | 1816 | */ |
1817 | static ssize_t show_tabletExecute(struct device *dev, char *buf) | 1817 | static ssize_t show_tabletExecute(struct device *dev, struct device_attribute *attr, char *buf) |
1818 | { | 1818 | { |
1819 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1819 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1820 | 1820 | ||
@@ -1829,7 +1829,7 @@ static ssize_t show_tabletExecute(struct device *dev, char *buf) | |||
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | static ssize_t | 1831 | static ssize_t |
1832 | store_tabletExecute(struct device *dev, const char *buf, size_t count) | 1832 | store_tabletExecute(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1833 | { | 1833 | { |
1834 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1834 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1835 | 1835 | ||
@@ -1855,7 +1855,7 @@ static DEVICE_ATTR(execute, | |||
1855 | * support routines for the 'odm_code' file. Note that this file | 1855 | * support routines for the 'odm_code' file. Note that this file |
1856 | * only displays current setting. | 1856 | * only displays current setting. |
1857 | */ | 1857 | */ |
1858 | static ssize_t show_tabletODMCode(struct device *dev, char *buf) | 1858 | static ssize_t show_tabletODMCode(struct device *dev, struct device_attribute *attr, char *buf) |
1859 | { | 1859 | { |
1860 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1860 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1861 | 1861 | ||
@@ -1871,7 +1871,7 @@ static DEVICE_ATTR(odm_code, S_IRUGO, show_tabletODMCode, NULL); | |||
1871 | * support routines for the 'model_code' file. Note that this file | 1871 | * support routines for the 'model_code' file. Note that this file |
1872 | * only displays current setting. | 1872 | * only displays current setting. |
1873 | */ | 1873 | */ |
1874 | static ssize_t show_tabletModelCode(struct device *dev, char *buf) | 1874 | static ssize_t show_tabletModelCode(struct device *dev, struct device_attribute *attr, char *buf) |
1875 | { | 1875 | { |
1876 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1876 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1877 | 1877 | ||
@@ -1887,7 +1887,7 @@ static DEVICE_ATTR(model_code, S_IRUGO, show_tabletModelCode, NULL); | |||
1887 | * support routines for the 'firmware_code' file. Note that this file | 1887 | * support routines for the 'firmware_code' file. Note that this file |
1888 | * only displays current setting. | 1888 | * only displays current setting. |
1889 | */ | 1889 | */ |
1890 | static ssize_t show_firmwareCode(struct device *dev, char *buf) | 1890 | static ssize_t show_firmwareCode(struct device *dev, struct device_attribute *attr, char *buf) |
1891 | { | 1891 | { |
1892 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1892 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1893 | 1893 | ||
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 626e2b05f719..b33044d56a1e 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c | |||
@@ -85,7 +85,7 @@ static int vendor_command(struct usb_device *dev, unsigned char request, | |||
85 | #define BRIGHTNESS 0x2c /* RAM location for brightness value */ | 85 | #define BRIGHTNESS 0x2c /* RAM location for brightness value */ |
86 | #define BRIGHTNESS_SEM 0x2b /* RAM location for brightness semaphore */ | 86 | #define BRIGHTNESS_SEM 0x2b /* RAM location for brightness semaphore */ |
87 | 87 | ||
88 | static ssize_t show_brightness(struct device *dev, char *buf) | 88 | static ssize_t show_brightness(struct device *dev, struct device_attribute *attr, char *buf) |
89 | { | 89 | { |
90 | struct usb_interface *intf = to_usb_interface(dev); | 90 | struct usb_interface *intf = to_usb_interface(dev); |
91 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); | 91 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); |
@@ -93,7 +93,7 @@ static ssize_t show_brightness(struct device *dev, char *buf) | |||
93 | return sprintf(buf, "%i", cytherm->brightness); | 93 | return sprintf(buf, "%i", cytherm->brightness); |
94 | } | 94 | } |
95 | 95 | ||
96 | static ssize_t set_brightness(struct device *dev, const char *buf, | 96 | static ssize_t set_brightness(struct device *dev, struct device_attribute *attr, const char *buf, |
97 | size_t count) | 97 | size_t count) |
98 | { | 98 | { |
99 | struct usb_interface *intf = to_usb_interface(dev); | 99 | struct usb_interface *intf = to_usb_interface(dev); |
@@ -138,7 +138,7 @@ static DEVICE_ATTR(brightness, S_IRUGO | S_IWUSR | S_IWGRP, | |||
138 | #define TEMP 0x33 /* RAM location for temperature */ | 138 | #define TEMP 0x33 /* RAM location for temperature */ |
139 | #define SIGN 0x34 /* RAM location for temperature sign */ | 139 | #define SIGN 0x34 /* RAM location for temperature sign */ |
140 | 140 | ||
141 | static ssize_t show_temp(struct device *dev, char *buf) | 141 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) |
142 | { | 142 | { |
143 | 143 | ||
144 | struct usb_interface *intf = to_usb_interface(dev); | 144 | struct usb_interface *intf = to_usb_interface(dev); |
@@ -174,7 +174,7 @@ static ssize_t show_temp(struct device *dev, char *buf) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | static ssize_t set_temp(struct device *dev, const char *buf, size_t count) | 177 | static ssize_t set_temp(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
178 | { | 178 | { |
179 | return count; | 179 | return count; |
180 | } | 180 | } |
@@ -184,7 +184,7 @@ static DEVICE_ATTR(temp, S_IRUGO, show_temp, set_temp); | |||
184 | 184 | ||
185 | #define BUTTON 0x7a | 185 | #define BUTTON 0x7a |
186 | 186 | ||
187 | static ssize_t show_button(struct device *dev, char *buf) | 187 | static ssize_t show_button(struct device *dev, struct device_attribute *attr, char *buf) |
188 | { | 188 | { |
189 | 189 | ||
190 | struct usb_interface *intf = to_usb_interface(dev); | 190 | struct usb_interface *intf = to_usb_interface(dev); |
@@ -215,7 +215,7 @@ static ssize_t show_button(struct device *dev, char *buf) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | static ssize_t set_button(struct device *dev, const char *buf, size_t count) | 218 | static ssize_t set_button(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
219 | { | 219 | { |
220 | return count; | 220 | return count; |
221 | } | 221 | } |
@@ -223,7 +223,7 @@ static ssize_t set_button(struct device *dev, const char *buf, size_t count) | |||
223 | static DEVICE_ATTR(button, S_IRUGO, show_button, set_button); | 223 | static DEVICE_ATTR(button, S_IRUGO, show_button, set_button); |
224 | 224 | ||
225 | 225 | ||
226 | static ssize_t show_port0(struct device *dev, char *buf) | 226 | static ssize_t show_port0(struct device *dev, struct device_attribute *attr, char *buf) |
227 | { | 227 | { |
228 | struct usb_interface *intf = to_usb_interface(dev); | 228 | struct usb_interface *intf = to_usb_interface(dev); |
229 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); | 229 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); |
@@ -249,7 +249,7 @@ static ssize_t show_port0(struct device *dev, char *buf) | |||
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | static ssize_t set_port0(struct device *dev, const char *buf, size_t count) | 252 | static ssize_t set_port0(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
253 | { | 253 | { |
254 | struct usb_interface *intf = to_usb_interface(dev); | 254 | struct usb_interface *intf = to_usb_interface(dev); |
255 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); | 255 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); |
@@ -283,7 +283,7 @@ static ssize_t set_port0(struct device *dev, const char *buf, size_t count) | |||
283 | 283 | ||
284 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR | S_IWGRP, show_port0, set_port0); | 284 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR | S_IWGRP, show_port0, set_port0); |
285 | 285 | ||
286 | static ssize_t show_port1(struct device *dev, char *buf) | 286 | static ssize_t show_port1(struct device *dev, struct device_attribute *attr, char *buf) |
287 | { | 287 | { |
288 | struct usb_interface *intf = to_usb_interface(dev); | 288 | struct usb_interface *intf = to_usb_interface(dev); |
289 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); | 289 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); |
@@ -309,7 +309,7 @@ static ssize_t show_port1(struct device *dev, char *buf) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
312 | static ssize_t set_port1(struct device *dev, const char *buf, size_t count) | 312 | static ssize_t set_port1(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
313 | { | 313 | { |
314 | struct usb_interface *intf = to_usb_interface(dev); | 314 | struct usb_interface *intf = to_usb_interface(dev); |
315 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); | 315 | struct usb_cytherm *cytherm = usb_get_intfdata(intf); |
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index ddbf8e992368..067a81486921 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -173,7 +173,7 @@ exit: | |||
173 | } | 173 | } |
174 | 174 | ||
175 | #define set_lcd_line(number) \ | 175 | #define set_lcd_line(number) \ |
176 | static ssize_t lcd_line_##number(struct device *dev, const char *buf, size_t count) \ | 176 | static ssize_t lcd_line_##number(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
177 | { \ | 177 | { \ |
178 | struct usb_interface *intf = to_usb_interface(dev); \ | 178 | struct usb_interface *intf = to_usb_interface(dev); \ |
179 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ | 179 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ |
@@ -184,7 +184,7 @@ static DEVICE_ATTR(lcd_line_##number, S_IWUGO, NULL, lcd_line_##number); | |||
184 | set_lcd_line(1); | 184 | set_lcd_line(1); |
185 | set_lcd_line(2); | 185 | set_lcd_line(2); |
186 | 186 | ||
187 | static ssize_t set_backlight(struct device *dev, const char *buf, size_t count) | 187 | static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
188 | { | 188 | { |
189 | struct usb_interface *intf = to_usb_interface(dev); | 189 | struct usb_interface *intf = to_usb_interface(dev); |
190 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); | 190 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); |
@@ -232,7 +232,7 @@ static void remove_lcd_files(struct phidget_interfacekit *kit) | |||
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | static ssize_t enable_lcd_files(struct device *dev, const char *buf, size_t count) | 235 | static ssize_t enable_lcd_files(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
236 | { | 236 | { |
237 | struct usb_interface *intf = to_usb_interface(dev); | 237 | struct usb_interface *intf = to_usb_interface(dev); |
238 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); | 238 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); |
@@ -307,7 +307,7 @@ resubmit: | |||
307 | } | 307 | } |
308 | 308 | ||
309 | #define show_set_output(value) \ | 309 | #define show_set_output(value) \ |
310 | static ssize_t set_output##value(struct device *dev, const char *buf, \ | 310 | static ssize_t set_output##value(struct device *dev, struct device_attribute *attr, const char *buf, \ |
311 | size_t count) \ | 311 | size_t count) \ |
312 | { \ | 312 | { \ |
313 | struct usb_interface *intf = to_usb_interface(dev); \ | 313 | struct usb_interface *intf = to_usb_interface(dev); \ |
@@ -324,7 +324,7 @@ static ssize_t set_output##value(struct device *dev, const char *buf, \ | |||
324 | return retval ? retval : count; \ | 324 | return retval ? retval : count; \ |
325 | } \ | 325 | } \ |
326 | \ | 326 | \ |
327 | static ssize_t show_output##value(struct device *dev, char *buf) \ | 327 | static ssize_t show_output##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
328 | { \ | 328 | { \ |
329 | struct usb_interface *intf = to_usb_interface(dev); \ | 329 | struct usb_interface *intf = to_usb_interface(dev); \ |
330 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ | 330 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ |
@@ -343,7 +343,7 @@ show_set_output(7); | |||
343 | show_set_output(8); /* should be MAX_INTERFACES - 1 */ | 343 | show_set_output(8); /* should be MAX_INTERFACES - 1 */ |
344 | 344 | ||
345 | #define show_input(value) \ | 345 | #define show_input(value) \ |
346 | static ssize_t show_input##value(struct device *dev, char *buf) \ | 346 | static ssize_t show_input##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
347 | { \ | 347 | { \ |
348 | struct usb_interface *intf = to_usb_interface(dev); \ | 348 | struct usb_interface *intf = to_usb_interface(dev); \ |
349 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ | 349 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ |
@@ -362,7 +362,7 @@ show_input(7); | |||
362 | show_input(8); /* should be MAX_INTERFACES - 1 */ | 362 | show_input(8); /* should be MAX_INTERFACES - 1 */ |
363 | 363 | ||
364 | #define show_sensor(value) \ | 364 | #define show_sensor(value) \ |
365 | static ssize_t show_sensor##value(struct device *dev, char *buf) \ | 365 | static ssize_t show_sensor##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
366 | { \ | 366 | { \ |
367 | struct usb_interface *intf = to_usb_interface(dev); \ | 367 | struct usb_interface *intf = to_usb_interface(dev); \ |
368 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ | 368 | struct phidget_interfacekit *kit = usb_get_intfdata(intf); \ |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 4bd291502a3c..b84eda631ab5 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -207,7 +207,7 @@ change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, | |||
207 | } | 207 | } |
208 | 208 | ||
209 | #define show_set(value) \ | 209 | #define show_set(value) \ |
210 | static ssize_t set_servo##value (struct device *dev, \ | 210 | static ssize_t set_servo##value (struct device *dev, struct device_attribute *attr, \ |
211 | const char *buf, size_t count) \ | 211 | const char *buf, size_t count) \ |
212 | { \ | 212 | { \ |
213 | int degrees, minutes, retval; \ | 213 | int degrees, minutes, retval; \ |
@@ -233,7 +233,7 @@ static ssize_t set_servo##value (struct device *dev, \ | |||
233 | return retval < 0 ? retval : count; \ | 233 | return retval < 0 ? retval : count; \ |
234 | } \ | 234 | } \ |
235 | \ | 235 | \ |
236 | static ssize_t show_servo##value (struct device *dev, char *buf) \ | 236 | static ssize_t show_servo##value (struct device *dev, struct device_attribute *attr, char *buf) \ |
237 | { \ | 237 | { \ |
238 | struct usb_interface *intf = to_usb_interface (dev); \ | 238 | struct usb_interface *intf = to_usb_interface (dev); \ |
239 | struct phidget_servo *servo = usb_get_intfdata (intf); \ | 239 | struct phidget_servo *servo = usb_get_intfdata (intf); \ |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index ee329d5e1c5e..f6ba4c788dbc 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -81,14 +81,14 @@ static void change_color(struct usb_led *led) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | #define show_set(value) \ | 83 | #define show_set(value) \ |
84 | static ssize_t show_##value(struct device *dev, char *buf) \ | 84 | static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \ |
85 | { \ | 85 | { \ |
86 | struct usb_interface *intf = to_usb_interface(dev); \ | 86 | struct usb_interface *intf = to_usb_interface(dev); \ |
87 | struct usb_led *led = usb_get_intfdata(intf); \ | 87 | struct usb_led *led = usb_get_intfdata(intf); \ |
88 | \ | 88 | \ |
89 | return sprintf(buf, "%d\n", led->value); \ | 89 | return sprintf(buf, "%d\n", led->value); \ |
90 | } \ | 90 | } \ |
91 | static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ | 91 | static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ |
92 | { \ | 92 | { \ |
93 | struct usb_interface *intf = to_usb_interface(dev); \ | 93 | struct usb_interface *intf = to_usb_interface(dev); \ |
94 | struct usb_led *led = usb_get_intfdata(intf); \ | 94 | struct usb_led *led = usb_get_intfdata(intf); \ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 3bfcc7b9f861..d882fa3ad19a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1218,7 +1218,7 @@ check_and_exit: | |||
1218 | * *************************************************************************** | 1218 | * *************************************************************************** |
1219 | */ | 1219 | */ |
1220 | 1220 | ||
1221 | static ssize_t show_latency_timer(struct device *dev, char *buf) | 1221 | static ssize_t show_latency_timer(struct device *dev, struct device_attribute *attr, char *buf) |
1222 | { | 1222 | { |
1223 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1223 | struct usb_serial_port *port = to_usb_serial_port(dev); |
1224 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1224 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
@@ -1245,7 +1245,7 @@ static ssize_t show_latency_timer(struct device *dev, char *buf) | |||
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | /* Write a new value of the latency timer, in units of milliseconds. */ | 1247 | /* Write a new value of the latency timer, in units of milliseconds. */ |
1248 | static ssize_t store_latency_timer(struct device *dev, const char *valbuf, | 1248 | static ssize_t store_latency_timer(struct device *dev, struct device_attribute *attr, const char *valbuf, |
1249 | size_t count) | 1249 | size_t count) |
1250 | { | 1250 | { |
1251 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1251 | struct usb_serial_port *port = to_usb_serial_port(dev); |
@@ -1276,7 +1276,7 @@ static ssize_t store_latency_timer(struct device *dev, const char *valbuf, | |||
1276 | 1276 | ||
1277 | /* Write an event character directly to the FTDI register. The ASCII | 1277 | /* Write an event character directly to the FTDI register. The ASCII |
1278 | value is in the low 8 bits, with the enable bit in the 9th bit. */ | 1278 | value is in the low 8 bits, with the enable bit in the 9th bit. */ |
1279 | static ssize_t store_event_char(struct device *dev, const char *valbuf, | 1279 | static ssize_t store_event_char(struct device *dev, struct device_attribute *attr, const char *valbuf, |
1280 | size_t count) | 1280 | size_t count) |
1281 | { | 1281 | { |
1282 | struct usb_serial_port *port = to_usb_serial_port(dev); | 1282 | struct usb_serial_port *port = to_usb_serial_port(dev); |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 1035b248eff4..e43eddc3d44b 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -398,7 +398,7 @@ US_DO_ALL_FLAGS | |||
398 | ***********************************************************************/ | 398 | ***********************************************************************/ |
399 | 399 | ||
400 | /* Output routine for the sysfs max_sectors file */ | 400 | /* Output routine for the sysfs max_sectors file */ |
401 | static ssize_t show_max_sectors(struct device *dev, char *buf) | 401 | static ssize_t show_max_sectors(struct device *dev, struct device_attribute *attr, char *buf) |
402 | { | 402 | { |
403 | struct scsi_device *sdev = to_scsi_device(dev); | 403 | struct scsi_device *sdev = to_scsi_device(dev); |
404 | 404 | ||
@@ -406,7 +406,7 @@ static ssize_t show_max_sectors(struct device *dev, char *buf) | |||
406 | } | 406 | } |
407 | 407 | ||
408 | /* Input routine for the sysfs max_sectors file */ | 408 | /* Input routine for the sysfs max_sectors file */ |
409 | static ssize_t store_max_sectors(struct device *dev, const char *buf, | 409 | static ssize_t store_max_sectors(struct device *dev, struct device_attribute *attr, const char *buf, |
410 | size_t count) | 410 | size_t count) |
411 | { | 411 | { |
412 | struct scsi_device *sdev = to_scsi_device(dev); | 412 | struct scsi_device *sdev = to_scsi_device(dev); |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 7705070191d9..8cef020d1801 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1040,7 +1040,7 @@ static struct file_operations fb_fops = { | |||
1040 | #endif | 1040 | #endif |
1041 | }; | 1041 | }; |
1042 | 1042 | ||
1043 | static struct class_simple *fb_class; | 1043 | static struct class *fb_class; |
1044 | 1044 | ||
1045 | /** | 1045 | /** |
1046 | * register_framebuffer - registers a frame buffer device | 1046 | * register_framebuffer - registers a frame buffer device |
@@ -1066,7 +1066,7 @@ register_framebuffer(struct fb_info *fb_info) | |||
1066 | break; | 1066 | break; |
1067 | fb_info->node = i; | 1067 | fb_info->node = i; |
1068 | 1068 | ||
1069 | fb_info->class_device = class_simple_device_add(fb_class, MKDEV(FB_MAJOR, i), | 1069 | fb_info->class_device = class_device_create(fb_class, MKDEV(FB_MAJOR, i), |
1070 | fb_info->device, "fb%d", i); | 1070 | fb_info->device, "fb%d", i); |
1071 | if (IS_ERR(fb_info->class_device)) { | 1071 | if (IS_ERR(fb_info->class_device)) { |
1072 | /* Not fatal */ | 1072 | /* Not fatal */ |
@@ -1134,7 +1134,7 @@ unregister_framebuffer(struct fb_info *fb_info) | |||
1134 | registered_fb[i]=NULL; | 1134 | registered_fb[i]=NULL; |
1135 | num_registered_fb--; | 1135 | num_registered_fb--; |
1136 | fb_cleanup_class_device(fb_info); | 1136 | fb_cleanup_class_device(fb_info); |
1137 | class_simple_device_remove(MKDEV(FB_MAJOR, i)); | 1137 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
1138 | return 0; | 1138 | return 0; |
1139 | } | 1139 | } |
1140 | 1140 | ||
@@ -1197,7 +1197,7 @@ fbmem_init(void) | |||
1197 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) | 1197 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) |
1198 | printk("unable to get major %d for fb devs\n", FB_MAJOR); | 1198 | printk("unable to get major %d for fb devs\n", FB_MAJOR); |
1199 | 1199 | ||
1200 | fb_class = class_simple_create(THIS_MODULE, "graphics"); | 1200 | fb_class = class_create(THIS_MODULE, "graphics"); |
1201 | if (IS_ERR(fb_class)) { | 1201 | if (IS_ERR(fb_class)) { |
1202 | printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class)); | 1202 | printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class)); |
1203 | fb_class = NULL; | 1203 | fb_class = NULL; |
@@ -1210,7 +1210,7 @@ module_init(fbmem_init); | |||
1210 | static void __exit | 1210 | static void __exit |
1211 | fbmem_exit(void) | 1211 | fbmem_exit(void) |
1212 | { | 1212 | { |
1213 | class_simple_destroy(fb_class); | 1213 | class_destroy(fb_class); |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | module_exit(fbmem_exit); | 1216 | module_exit(fbmem_exit); |
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 2a023282d7a3..d3c1922cb13a 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c | |||
@@ -1045,14 +1045,14 @@ static struct fb_ops gbefb_ops = { | |||
1045 | * sysfs | 1045 | * sysfs |
1046 | */ | 1046 | */ |
1047 | 1047 | ||
1048 | static ssize_t gbefb_show_memsize(struct device *dev, char *buf) | 1048 | static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf) |
1049 | { | 1049 | { |
1050 | return snprintf(buf, PAGE_SIZE, "%d\n", gbe_mem_size); | 1050 | return snprintf(buf, PAGE_SIZE, "%d\n", gbe_mem_size); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL); | 1053 | static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL); |
1054 | 1054 | ||
1055 | static ssize_t gbefb_show_rev(struct device *device, char *buf) | 1055 | static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *attr, char *buf) |
1056 | { | 1056 | { |
1057 | return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision); | 1057 | return snprintf(buf, PAGE_SIZE, "%d\n", gbe_revision); |
1058 | } | 1058 | } |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 58cd2ad84afb..adcda697ea60 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -101,7 +101,7 @@ static void(*w100fb_ssp_send)(u8 adrs, u8 data); | |||
101 | * Sysfs functions | 101 | * Sysfs functions |
102 | */ | 102 | */ |
103 | 103 | ||
104 | static ssize_t rotation_show(struct device *dev, char *buf) | 104 | static ssize_t rotation_show(struct device *dev, struct device_attribute *attr, char *buf) |
105 | { | 105 | { |
106 | struct fb_info *info = dev_get_drvdata(dev); | 106 | struct fb_info *info = dev_get_drvdata(dev); |
107 | struct w100fb_par *par=info->par; | 107 | struct w100fb_par *par=info->par; |
@@ -109,7 +109,7 @@ static ssize_t rotation_show(struct device *dev, char *buf) | |||
109 | return sprintf(buf, "%d\n",par->rotation_flag); | 109 | return sprintf(buf, "%d\n",par->rotation_flag); |
110 | } | 110 | } |
111 | 111 | ||
112 | static ssize_t rotation_store(struct device *dev, const char *buf, size_t count) | 112 | static ssize_t rotation_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
113 | { | 113 | { |
114 | unsigned int rotate; | 114 | unsigned int rotate; |
115 | struct fb_info *info = dev_get_drvdata(dev); | 115 | struct fb_info *info = dev_get_drvdata(dev); |
@@ -134,7 +134,7 @@ static ssize_t rotation_store(struct device *dev, const char *buf, size_t count) | |||
134 | 134 | ||
135 | static DEVICE_ATTR(rotation, 0644, rotation_show, rotation_store); | 135 | static DEVICE_ATTR(rotation, 0644, rotation_show, rotation_store); |
136 | 136 | ||
137 | static ssize_t w100fb_reg_read(struct device *dev, const char *buf, size_t count) | 137 | static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
138 | { | 138 | { |
139 | unsigned long param; | 139 | unsigned long param; |
140 | unsigned long regs; | 140 | unsigned long regs; |
@@ -146,7 +146,7 @@ static ssize_t w100fb_reg_read(struct device *dev, const char *buf, size_t count | |||
146 | 146 | ||
147 | static DEVICE_ATTR(reg_read, 0200, NULL, w100fb_reg_read); | 147 | static DEVICE_ATTR(reg_read, 0200, NULL, w100fb_reg_read); |
148 | 148 | ||
149 | static ssize_t w100fb_reg_write(struct device *dev, const char *buf, size_t count) | 149 | static ssize_t w100fb_reg_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
150 | { | 150 | { |
151 | unsigned long regs; | 151 | unsigned long regs; |
152 | unsigned long param; | 152 | unsigned long param; |
@@ -163,7 +163,7 @@ static ssize_t w100fb_reg_write(struct device *dev, const char *buf, size_t coun | |||
163 | static DEVICE_ATTR(reg_write, 0200, NULL, w100fb_reg_write); | 163 | static DEVICE_ATTR(reg_write, 0200, NULL, w100fb_reg_write); |
164 | 164 | ||
165 | 165 | ||
166 | static ssize_t fastsysclk_show(struct device *dev, char *buf) | 166 | static ssize_t fastsysclk_show(struct device *dev, struct device_attribute *attr, char *buf) |
167 | { | 167 | { |
168 | struct fb_info *info = dev_get_drvdata(dev); | 168 | struct fb_info *info = dev_get_drvdata(dev); |
169 | struct w100fb_par *par=info->par; | 169 | struct w100fb_par *par=info->par; |
@@ -171,7 +171,7 @@ static ssize_t fastsysclk_show(struct device *dev, char *buf) | |||
171 | return sprintf(buf, "%d\n",par->fastsysclk_mode); | 171 | return sprintf(buf, "%d\n",par->fastsysclk_mode); |
172 | } | 172 | } |
173 | 173 | ||
174 | static ssize_t fastsysclk_store(struct device *dev, const char *buf, size_t count) | 174 | static ssize_t fastsysclk_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
175 | { | 175 | { |
176 | int param; | 176 | int param; |
177 | struct fb_info *info = dev_get_drvdata(dev); | 177 | struct fb_info *info = dev_get_drvdata(dev); |
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 8d7821899cc1..24a192e3b8b4 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c | |||
@@ -88,7 +88,7 @@ static void w1_slave_release(struct device *dev) | |||
88 | complete(&sl->dev_released); | 88 | complete(&sl->dev_released); |
89 | } | 89 | } |
90 | 90 | ||
91 | static ssize_t w1_default_read_name(struct device *dev, char *buf) | 91 | static ssize_t w1_default_read_name(struct device *dev, struct device_attribute *attr, char *buf) |
92 | { | 92 | { |
93 | return sprintf(buf, "No family registered.\n"); | 93 | return sprintf(buf, "No family registered.\n"); |
94 | } | 94 | } |
@@ -137,7 +137,7 @@ static struct device_attribute w1_slave_attribute_val = { | |||
137 | .show = &w1_default_read_name, | 137 | .show = &w1_default_read_name, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static ssize_t w1_master_attribute_show_name(struct device *dev, char *buf) | 140 | static ssize_t w1_master_attribute_show_name(struct device *dev, struct device_attribute *attr, char *buf) |
141 | { | 141 | { |
142 | struct w1_master *md = container_of (dev, struct w1_master, dev); | 142 | struct w1_master *md = container_of (dev, struct w1_master, dev); |
143 | ssize_t count; | 143 | ssize_t count; |
@@ -152,7 +152,7 @@ static ssize_t w1_master_attribute_show_name(struct device *dev, char *buf) | |||
152 | return count; | 152 | return count; |
153 | } | 153 | } |
154 | 154 | ||
155 | static ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf) | 155 | static ssize_t w1_master_attribute_show_pointer(struct device *dev, struct device_attribute *attr, char *buf) |
156 | { | 156 | { |
157 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 157 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
158 | ssize_t count; | 158 | ssize_t count; |
@@ -166,14 +166,14 @@ static ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf) | |||
166 | return count; | 166 | return count; |
167 | } | 167 | } |
168 | 168 | ||
169 | static ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf) | 169 | static ssize_t w1_master_attribute_show_timeout(struct device *dev, struct device_attribute *attr, char *buf) |
170 | { | 170 | { |
171 | ssize_t count; | 171 | ssize_t count; |
172 | count = sprintf(buf, "%d\n", w1_timeout); | 172 | count = sprintf(buf, "%d\n", w1_timeout); |
173 | return count; | 173 | return count; |
174 | } | 174 | } |
175 | 175 | ||
176 | static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf) | 176 | static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, struct device_attribute *attr, char *buf) |
177 | { | 177 | { |
178 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 178 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
179 | ssize_t count; | 179 | ssize_t count; |
@@ -187,7 +187,7 @@ static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char | |||
187 | return count; | 187 | return count; |
188 | } | 188 | } |
189 | 189 | ||
190 | static ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf) | 190 | static ssize_t w1_master_attribute_show_attempts(struct device *dev, struct device_attribute *attr, char *buf) |
191 | { | 191 | { |
192 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 192 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
193 | ssize_t count; | 193 | ssize_t count; |
@@ -201,7 +201,7 @@ static ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf) | |||
201 | return count; | 201 | return count; |
202 | } | 202 | } |
203 | 203 | ||
204 | static ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf) | 204 | static ssize_t w1_master_attribute_show_slave_count(struct device *dev, struct device_attribute *attr, char *buf) |
205 | { | 205 | { |
206 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 206 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
207 | ssize_t count; | 207 | ssize_t count; |
@@ -215,7 +215,7 @@ static ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *bu | |||
215 | return count; | 215 | return count; |
216 | } | 216 | } |
217 | 217 | ||
218 | static ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf) | 218 | static ssize_t w1_master_attribute_show_slaves(struct device *dev, struct device_attribute *attr, char *buf) |
219 | 219 | ||
220 | { | 220 | { |
221 | struct w1_master *md = container_of(dev, struct w1_master, dev); | 221 | struct w1_master *md = container_of(dev, struct w1_master, dev); |
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h index 03a2de7a601f..07fa49412a90 100644 --- a/drivers/w1/w1_family.h +++ b/drivers/w1/w1_family.h | |||
@@ -34,10 +34,10 @@ | |||
34 | 34 | ||
35 | struct w1_family_ops | 35 | struct w1_family_ops |
36 | { | 36 | { |
37 | ssize_t (* rname)(struct device *, char *); | 37 | ssize_t (* rname)(struct device *, struct device_attribute *, char *); |
38 | ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t); | 38 | ssize_t (* rbin)(struct kobject *, char *, loff_t, size_t); |
39 | 39 | ||
40 | ssize_t (* rval)(struct device *, char *); | 40 | ssize_t (* rval)(struct device *, struct device_attribute *, char *); |
41 | unsigned char rvalname[MAXNAMELEN]; | 41 | unsigned char rvalname[MAXNAMELEN]; |
42 | }; | 42 | }; |
43 | 43 | ||
diff --git a/drivers/w1/w1_smem.c b/drivers/w1/w1_smem.c index a54e425217a0..674eb75a9bad 100644 --- a/drivers/w1/w1_smem.c +++ b/drivers/w1/w1_smem.c | |||
@@ -36,8 +36,8 @@ MODULE_LICENSE("GPL"); | |||
36 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); | 36 | MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); |
37 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); | 37 | MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); |
38 | 38 | ||
39 | static ssize_t w1_smem_read_name(struct device *, char *); | 39 | static ssize_t w1_smem_read_name(struct device *, struct device_attribute *attr, char *); |
40 | static ssize_t w1_smem_read_val(struct device *, char *); | 40 | static ssize_t w1_smem_read_val(struct device *, struct device_attribute *attr, char *); |
41 | static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t); | 41 | static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t); |
42 | 42 | ||
43 | static struct w1_family_ops w1_smem_fops = { | 43 | static struct w1_family_ops w1_smem_fops = { |
@@ -47,14 +47,14 @@ static struct w1_family_ops w1_smem_fops = { | |||
47 | .rvalname = "id", | 47 | .rvalname = "id", |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static ssize_t w1_smem_read_name(struct device *dev, char *buf) | 50 | static ssize_t w1_smem_read_name(struct device *dev, struct device_attribute *attr, char *buf) |
51 | { | 51 | { |
52 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 52 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
53 | 53 | ||
54 | return sprintf(buf, "%s\n", sl->name); | 54 | return sprintf(buf, "%s\n", sl->name); |
55 | } | 55 | } |
56 | 56 | ||
57 | static ssize_t w1_smem_read_val(struct device *dev, char *buf) | 57 | static ssize_t w1_smem_read_val(struct device *dev, struct device_attribute *attr, char *buf) |
58 | { | 58 | { |
59 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 59 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
60 | int i; | 60 | int i; |
diff --git a/drivers/w1/w1_therm.c b/drivers/w1/w1_therm.c index 0b1817890503..70310f7a722e 100644 --- a/drivers/w1/w1_therm.c +++ b/drivers/w1/w1_therm.c | |||
@@ -42,8 +42,8 @@ static u8 bad_roms[][9] = { | |||
42 | {} | 42 | {} |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static ssize_t w1_therm_read_name(struct device *, char *); | 45 | static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *); |
46 | static ssize_t w1_therm_read_temp(struct device *, char *); | 46 | static ssize_t w1_therm_read_temp(struct device *, struct device_attribute *attr, char *); |
47 | static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); | 47 | static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); |
48 | 48 | ||
49 | static struct w1_family_ops w1_therm_fops = { | 49 | static struct w1_family_ops w1_therm_fops = { |
@@ -53,7 +53,7 @@ static struct w1_family_ops w1_therm_fops = { | |||
53 | .rvalname = "temp1_input", | 53 | .rvalname = "temp1_input", |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static ssize_t w1_therm_read_name(struct device *dev, char *buf) | 56 | static ssize_t w1_therm_read_name(struct device *dev, struct device_attribute *attr, char *buf) |
57 | { | 57 | { |
58 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 58 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
59 | 59 | ||
@@ -77,7 +77,7 @@ static inline int w1_convert_temp(u8 rom[9]) | |||
77 | return t; | 77 | return t; |
78 | } | 78 | } |
79 | 79 | ||
80 | static ssize_t w1_therm_read_temp(struct device *dev, char *buf) | 80 | static ssize_t w1_therm_read_temp(struct device *dev, struct device_attribute *attr, char *buf) |
81 | { | 81 | { |
82 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | 82 | struct w1_slave *sl = container_of(dev, struct w1_slave, dev); |
83 | 83 | ||
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index dad03fc33a44..04ca8840acf1 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /* show configuration fields */ | 21 | /* show configuration fields */ |
22 | #define zorro_config_attr(name, field, format_string) \ | 22 | #define zorro_config_attr(name, field, format_string) \ |
23 | static ssize_t \ | 23 | static ssize_t \ |
24 | show_##name(struct device *dev, char *buf) \ | 24 | show_##name(struct device *dev, struct device_attribute *attr, char *buf) \ |
25 | { \ | 25 | { \ |
26 | struct zorro_dev *z; \ | 26 | struct zorro_dev *z; \ |
27 | \ | 27 | \ |
@@ -36,7 +36,7 @@ zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n"); | |||
36 | zorro_config_attr(slotaddr, slotaddr, "0x%04x\n"); | 36 | zorro_config_attr(slotaddr, slotaddr, "0x%04x\n"); |
37 | zorro_config_attr(slotsize, slotsize, "0x%04x\n"); | 37 | zorro_config_attr(slotsize, slotsize, "0x%04x\n"); |
38 | 38 | ||
39 | static ssize_t zorro_show_resource(struct device *dev, char *buf) | 39 | static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf) |
40 | { | 40 | { |
41 | struct zorro_dev *z = to_zorro_dev(dev); | 41 | struct zorro_dev *z = to_zorro_dev(dev); |
42 | 42 | ||
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index ef001a9313e6..3d1cce3653b8 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -61,7 +61,7 @@ unsigned long coda_timeout = 30; /* .. secs, then signals will dequeue */ | |||
61 | 61 | ||
62 | 62 | ||
63 | struct venus_comm coda_comms[MAX_CODADEVS]; | 63 | struct venus_comm coda_comms[MAX_CODADEVS]; |
64 | static struct class_simple *coda_psdev_class; | 64 | static struct class *coda_psdev_class; |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Device operations | 67 | * Device operations |
@@ -363,14 +363,14 @@ static int init_coda_psdev(void) | |||
363 | CODA_PSDEV_MAJOR); | 363 | CODA_PSDEV_MAJOR); |
364 | return -EIO; | 364 | return -EIO; |
365 | } | 365 | } |
366 | coda_psdev_class = class_simple_create(THIS_MODULE, "coda"); | 366 | coda_psdev_class = class_create(THIS_MODULE, "coda"); |
367 | if (IS_ERR(coda_psdev_class)) { | 367 | if (IS_ERR(coda_psdev_class)) { |
368 | err = PTR_ERR(coda_psdev_class); | 368 | err = PTR_ERR(coda_psdev_class); |
369 | goto out_chrdev; | 369 | goto out_chrdev; |
370 | } | 370 | } |
371 | devfs_mk_dir ("coda"); | 371 | devfs_mk_dir ("coda"); |
372 | for (i = 0; i < MAX_CODADEVS; i++) { | 372 | for (i = 0; i < MAX_CODADEVS; i++) { |
373 | class_simple_device_add(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), | 373 | class_device_create(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), |
374 | NULL, "cfs%d", i); | 374 | NULL, "cfs%d", i); |
375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), | 375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), |
376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); | 376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); |
@@ -382,8 +382,8 @@ static int init_coda_psdev(void) | |||
382 | 382 | ||
383 | out_class: | 383 | out_class: |
384 | for (i = 0; i < MAX_CODADEVS; i++) | 384 | for (i = 0; i < MAX_CODADEVS; i++) |
385 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 385 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
386 | class_simple_destroy(coda_psdev_class); | 386 | class_destroy(coda_psdev_class); |
387 | out_chrdev: | 387 | out_chrdev: |
388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
389 | out: | 389 | out: |
@@ -425,10 +425,10 @@ static int __init init_coda(void) | |||
425 | return 0; | 425 | return 0; |
426 | out: | 426 | out: |
427 | for (i = 0; i < MAX_CODADEVS; i++) { | 427 | for (i = 0; i < MAX_CODADEVS; i++) { |
428 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 428 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
429 | devfs_remove("coda/%d", i); | 429 | devfs_remove("coda/%d", i); |
430 | } | 430 | } |
431 | class_simple_destroy(coda_psdev_class); | 431 | class_destroy(coda_psdev_class); |
432 | devfs_remove("coda"); | 432 | devfs_remove("coda"); |
433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
434 | coda_sysctl_clean(); | 434 | coda_sysctl_clean(); |
@@ -447,10 +447,10 @@ static void __exit exit_coda(void) | |||
447 | printk("coda: failed to unregister filesystem\n"); | 447 | printk("coda: failed to unregister filesystem\n"); |
448 | } | 448 | } |
449 | for (i = 0; i < MAX_CODADEVS; i++) { | 449 | for (i = 0; i < MAX_CODADEVS; i++) { |
450 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 450 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
451 | devfs_remove("coda/%d", i); | 451 | devfs_remove("coda/%d", i); |
452 | } | 452 | } |
453 | class_simple_destroy(coda_psdev_class); | 453 | class_destroy(coda_psdev_class); |
454 | devfs_remove("coda"); | 454 | devfs_remove("coda"); |
455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
456 | coda_sysctl_clean(); | 456 | coda_sysctl_clean(); |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 548556ff2506..efc97d9b7860 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -45,44 +45,15 @@ struct file_operations debugfs_file_operations = { | |||
45 | .open = default_open, | 45 | .open = default_open, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define simple_type(type, format, temptype, strtolfn) \ | 48 | static void debugfs_u8_set(void *data, u64 val) |
49 | static ssize_t read_file_##type(struct file *file, char __user *user_buf, \ | 49 | { |
50 | size_t count, loff_t *ppos) \ | 50 | *(u8 *)data = val; |
51 | { \ | 51 | } |
52 | char buf[32]; \ | 52 | static u64 debugfs_u8_get(void *data) |
53 | type *val = file->private_data; \ | 53 | { |
54 | \ | 54 | return *(u8 *)data; |
55 | snprintf(buf, sizeof(buf), format "\n", *val); \ | 55 | } |
56 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));\ | 56 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); |
57 | } \ | ||
58 | static ssize_t write_file_##type(struct file *file, const char __user *user_buf,\ | ||
59 | size_t count, loff_t *ppos) \ | ||
60 | { \ | ||
61 | char *endp; \ | ||
62 | char buf[32]; \ | ||
63 | int buf_size; \ | ||
64 | type *val = file->private_data; \ | ||
65 | temptype tmp; \ | ||
66 | \ | ||
67 | memset(buf, 0x00, sizeof(buf)); \ | ||
68 | buf_size = min(count, (sizeof(buf)-1)); \ | ||
69 | if (copy_from_user(buf, user_buf, buf_size)) \ | ||
70 | return -EFAULT; \ | ||
71 | \ | ||
72 | tmp = strtolfn(buf, &endp, 0); \ | ||
73 | if ((endp == buf) || ((type)tmp != tmp)) \ | ||
74 | return -EINVAL; \ | ||
75 | *val = tmp; \ | ||
76 | return count; \ | ||
77 | } \ | ||
78 | static struct file_operations fops_##type = { \ | ||
79 | .read = read_file_##type, \ | ||
80 | .write = write_file_##type, \ | ||
81 | .open = default_open, \ | ||
82 | }; | ||
83 | simple_type(u8, "%c", unsigned long, simple_strtoul); | ||
84 | simple_type(u16, "%hi", unsigned long, simple_strtoul); | ||
85 | simple_type(u32, "%i", unsigned long, simple_strtoul); | ||
86 | 57 | ||
87 | /** | 58 | /** |
88 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 59 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
@@ -116,6 +87,16 @@ struct dentry *debugfs_create_u8(const char *name, mode_t mode, | |||
116 | } | 87 | } |
117 | EXPORT_SYMBOL_GPL(debugfs_create_u8); | 88 | EXPORT_SYMBOL_GPL(debugfs_create_u8); |
118 | 89 | ||
90 | static void debugfs_u16_set(void *data, u64 val) | ||
91 | { | ||
92 | *(u16 *)data = val; | ||
93 | } | ||
94 | static u64 debugfs_u16_get(void *data) | ||
95 | { | ||
96 | return *(u16 *)data; | ||
97 | } | ||
98 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); | ||
99 | |||
119 | /** | 100 | /** |
120 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 101 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
121 | * | 102 | * |
@@ -148,6 +129,16 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode, | |||
148 | } | 129 | } |
149 | EXPORT_SYMBOL_GPL(debugfs_create_u16); | 130 | EXPORT_SYMBOL_GPL(debugfs_create_u16); |
150 | 131 | ||
132 | static void debugfs_u32_set(void *data, u64 val) | ||
133 | { | ||
134 | *(u32 *)data = val; | ||
135 | } | ||
136 | static u64 debugfs_u32_get(void *data) | ||
137 | { | ||
138 | return *(u32 *)data; | ||
139 | } | ||
140 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); | ||
141 | |||
151 | /** | 142 | /** |
152 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 143 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
153 | * | 144 | * |
diff --git a/fs/libfs.c b/fs/libfs.c index f90b29595927..5025563e7379 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -519,6 +519,102 @@ int simple_transaction_release(struct inode *inode, struct file *file) | |||
519 | return 0; | 519 | return 0; |
520 | } | 520 | } |
521 | 521 | ||
522 | /* Simple attribute files */ | ||
523 | |||
524 | struct simple_attr { | ||
525 | u64 (*get)(void *); | ||
526 | void (*set)(void *, u64); | ||
527 | char get_buf[24]; /* enough to store a u64 and "\n\0" */ | ||
528 | char set_buf[24]; | ||
529 | void *data; | ||
530 | const char *fmt; /* format for read operation */ | ||
531 | struct semaphore sem; /* protects access to these buffers */ | ||
532 | }; | ||
533 | |||
534 | /* simple_attr_open is called by an actual attribute open file operation | ||
535 | * to set the attribute specific access operations. */ | ||
536 | int simple_attr_open(struct inode *inode, struct file *file, | ||
537 | u64 (*get)(void *), void (*set)(void *, u64), | ||
538 | const char *fmt) | ||
539 | { | ||
540 | struct simple_attr *attr; | ||
541 | |||
542 | attr = kmalloc(sizeof(*attr), GFP_KERNEL); | ||
543 | if (!attr) | ||
544 | return -ENOMEM; | ||
545 | |||
546 | attr->get = get; | ||
547 | attr->set = set; | ||
548 | attr->data = inode->u.generic_ip; | ||
549 | attr->fmt = fmt; | ||
550 | init_MUTEX(&attr->sem); | ||
551 | |||
552 | file->private_data = attr; | ||
553 | |||
554 | return nonseekable_open(inode, file); | ||
555 | } | ||
556 | |||
557 | int simple_attr_close(struct inode *inode, struct file *file) | ||
558 | { | ||
559 | kfree(file->private_data); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | /* read from the buffer that is filled with the get function */ | ||
564 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
565 | size_t len, loff_t *ppos) | ||
566 | { | ||
567 | struct simple_attr *attr; | ||
568 | size_t size; | ||
569 | ssize_t ret; | ||
570 | |||
571 | attr = file->private_data; | ||
572 | |||
573 | if (!attr->get) | ||
574 | return -EACCES; | ||
575 | |||
576 | down(&attr->sem); | ||
577 | if (*ppos) /* continued read */ | ||
578 | size = strlen(attr->get_buf); | ||
579 | else /* first read */ | ||
580 | size = scnprintf(attr->get_buf, sizeof(attr->get_buf), | ||
581 | attr->fmt, | ||
582 | (unsigned long long)attr->get(attr->data)); | ||
583 | |||
584 | ret = simple_read_from_buffer(buf, len, ppos, attr->get_buf, size); | ||
585 | up(&attr->sem); | ||
586 | return ret; | ||
587 | } | ||
588 | |||
589 | /* interpret the buffer as a number to call the set function with */ | ||
590 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
591 | size_t len, loff_t *ppos) | ||
592 | { | ||
593 | struct simple_attr *attr; | ||
594 | u64 val; | ||
595 | size_t size; | ||
596 | ssize_t ret; | ||
597 | |||
598 | attr = file->private_data; | ||
599 | |||
600 | if (!attr->set) | ||
601 | return -EACCES; | ||
602 | |||
603 | down(&attr->sem); | ||
604 | ret = -EFAULT; | ||
605 | size = min(sizeof(attr->set_buf) - 1, len); | ||
606 | if (copy_from_user(attr->set_buf, buf, size)) | ||
607 | goto out; | ||
608 | |||
609 | ret = len; /* claim we got the whole input */ | ||
610 | attr->set_buf[size] = '\0'; | ||
611 | val = simple_strtol(attr->set_buf, NULL, 0); | ||
612 | attr->set(attr->data, val); | ||
613 | out: | ||
614 | up(&attr->sem); | ||
615 | return ret; | ||
616 | } | ||
617 | |||
522 | EXPORT_SYMBOL(dcache_dir_close); | 618 | EXPORT_SYMBOL(dcache_dir_close); |
523 | EXPORT_SYMBOL(dcache_dir_lseek); | 619 | EXPORT_SYMBOL(dcache_dir_lseek); |
524 | EXPORT_SYMBOL(dcache_dir_open); | 620 | EXPORT_SYMBOL(dcache_dir_open); |
@@ -547,3 +643,7 @@ EXPORT_SYMBOL(simple_read_from_buffer); | |||
547 | EXPORT_SYMBOL(simple_transaction_get); | 643 | EXPORT_SYMBOL(simple_transaction_get); |
548 | EXPORT_SYMBOL(simple_transaction_read); | 644 | EXPORT_SYMBOL(simple_transaction_read); |
549 | EXPORT_SYMBOL(simple_transaction_release); | 645 | EXPORT_SYMBOL(simple_transaction_release); |
646 | EXPORT_SYMBOL_GPL(simple_attr_open); | ||
647 | EXPORT_SYMBOL_GPL(simple_attr_close); | ||
648 | EXPORT_SYMBOL_GPL(simple_attr_read); | ||
649 | EXPORT_SYMBOL_GPL(simple_attr_write); | ||
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index d4aaa88d0214..78899eeab974 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -25,7 +25,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | |||
25 | struct kobject * kobj = to_kobj(dentry->d_parent); | 25 | struct kobject * kobj = to_kobj(dentry->d_parent); |
26 | 26 | ||
27 | if (!attr->read) | 27 | if (!attr->read) |
28 | return -EINVAL; | 28 | return -EIO; |
29 | 29 | ||
30 | return attr->read(kobj, buffer, off, count); | 30 | return attr->read(kobj, buffer, off, count); |
31 | } | 31 | } |
@@ -71,7 +71,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | |||
71 | struct kobject *kobj = to_kobj(dentry->d_parent); | 71 | struct kobject *kobj = to_kobj(dentry->d_parent); |
72 | 72 | ||
73 | if (!attr->write) | 73 | if (!attr->write) |
74 | return -EINVAL; | 74 | return -EIO; |
75 | 75 | ||
76 | return attr->write(kobj, buffer, offset, count); | 76 | return attr->write(kobj, buffer, offset, count); |
77 | } | 77 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index fe198210bc2d..37d7a6875d86 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -101,18 +101,19 @@ static int create_dir(struct kobject * k, struct dentry * p, | |||
101 | down(&p->d_inode->i_sem); | 101 | down(&p->d_inode->i_sem); |
102 | *d = sysfs_get_dentry(p,n); | 102 | *d = sysfs_get_dentry(p,n); |
103 | if (!IS_ERR(*d)) { | 103 | if (!IS_ERR(*d)) { |
104 | error = sysfs_create(*d, mode, init_dir); | 104 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, SYSFS_DIR); |
105 | if (!error) { | 105 | if (!error) { |
106 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, | 106 | error = sysfs_create(*d, mode, init_dir); |
107 | SYSFS_DIR); | ||
108 | if (!error) { | 107 | if (!error) { |
109 | p->d_inode->i_nlink++; | 108 | p->d_inode->i_nlink++; |
110 | (*d)->d_op = &sysfs_dentry_ops; | 109 | (*d)->d_op = &sysfs_dentry_ops; |
111 | d_rehash(*d); | 110 | d_rehash(*d); |
112 | } | 111 | } |
113 | } | 112 | } |
114 | if (error && (error != -EEXIST)) | 113 | if (error && (error != -EEXIST)) { |
114 | sysfs_put((*d)->d_fsdata); | ||
115 | d_drop(*d); | 115 | d_drop(*d); |
116 | } | ||
116 | dput(*d); | 117 | dput(*d); |
117 | } else | 118 | } else |
118 | error = PTR_ERR(*d); | 119 | error = PTR_ERR(*d); |
@@ -171,17 +172,19 @@ static int sysfs_attach_attr(struct sysfs_dirent * sd, struct dentry * dentry) | |||
171 | init = init_file; | 172 | init = init_file; |
172 | } | 173 | } |
173 | 174 | ||
175 | dentry->d_fsdata = sysfs_get(sd); | ||
176 | sd->s_dentry = dentry; | ||
174 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); | 177 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); |
175 | if (error) | 178 | if (error) { |
179 | sysfs_put(sd); | ||
176 | return error; | 180 | return error; |
181 | } | ||
177 | 182 | ||
178 | if (bin_attr) { | 183 | if (bin_attr) { |
179 | dentry->d_inode->i_size = bin_attr->size; | 184 | dentry->d_inode->i_size = bin_attr->size; |
180 | dentry->d_inode->i_fop = &bin_fops; | 185 | dentry->d_inode->i_fop = &bin_fops; |
181 | } | 186 | } |
182 | dentry->d_op = &sysfs_dentry_ops; | 187 | dentry->d_op = &sysfs_dentry_ops; |
183 | dentry->d_fsdata = sysfs_get(sd); | ||
184 | sd->s_dentry = dentry; | ||
185 | d_rehash(dentry); | 188 | d_rehash(dentry); |
186 | 189 | ||
187 | return 0; | 190 | return 0; |
@@ -191,13 +194,15 @@ static int sysfs_attach_link(struct sysfs_dirent * sd, struct dentry * dentry) | |||
191 | { | 194 | { |
192 | int err = 0; | 195 | int err = 0; |
193 | 196 | ||
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
194 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); | 199 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); |
195 | if (!err) { | 200 | if (!err) { |
196 | dentry->d_op = &sysfs_dentry_ops; | 201 | dentry->d_op = &sysfs_dentry_ops; |
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
199 | d_rehash(dentry); | 202 | d_rehash(dentry); |
200 | } | 203 | } else |
204 | sysfs_put(sd); | ||
205 | |||
201 | return err; | 206 | return err; |
202 | } | 207 | } |
203 | 208 | ||
@@ -228,6 +233,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
228 | 233 | ||
229 | struct inode_operations sysfs_dir_inode_operations = { | 234 | struct inode_operations sysfs_dir_inode_operations = { |
230 | .lookup = sysfs_lookup, | 235 | .lookup = sysfs_lookup, |
236 | .setattr = sysfs_setattr, | ||
231 | }; | 237 | }; |
232 | 238 | ||
233 | static void remove_dir(struct dentry * d) | 239 | static void remove_dir(struct dentry * d) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 364208071e17..849aac115460 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -23,7 +23,7 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) | |||
23 | { | 23 | { |
24 | struct subsystem * s = to_subsys(kobj); | 24 | struct subsystem * s = to_subsys(kobj); |
25 | struct subsys_attribute * sattr = to_sattr(attr); | 25 | struct subsys_attribute * sattr = to_sattr(attr); |
26 | ssize_t ret = 0; | 26 | ssize_t ret = -EIO; |
27 | 27 | ||
28 | if (sattr->show) | 28 | if (sattr->show) |
29 | ret = sattr->show(s,page); | 29 | ret = sattr->show(s,page); |
@@ -36,7 +36,7 @@ subsys_attr_store(struct kobject * kobj, struct attribute * attr, | |||
36 | { | 36 | { |
37 | struct subsystem * s = to_subsys(kobj); | 37 | struct subsystem * s = to_subsys(kobj); |
38 | struct subsys_attribute * sattr = to_sattr(attr); | 38 | struct subsys_attribute * sattr = to_sattr(attr); |
39 | ssize_t ret = 0; | 39 | ssize_t ret = -EIO; |
40 | 40 | ||
41 | if (sattr->store) | 41 | if (sattr->store) |
42 | ret = sattr->store(s,page,count); | 42 | ret = sattr->store(s,page,count); |
@@ -182,7 +182,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t | |||
182 | return -ENOMEM; | 182 | return -ENOMEM; |
183 | 183 | ||
184 | if (count >= PAGE_SIZE) | 184 | if (count >= PAGE_SIZE) |
185 | count = PAGE_SIZE - 1; | 185 | count = PAGE_SIZE; |
186 | error = copy_from_user(buffer->page,buf,count); | 186 | error = copy_from_user(buffer->page,buf,count); |
187 | buffer->needs_read_fill = 1; | 187 | buffer->needs_read_fill = 1; |
188 | return error ? -EFAULT : count; | 188 | return error ? -EFAULT : count; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index aff7b2dfa8ee..565cac1d4200 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -26,18 +26,107 @@ static struct backing_dev_info sysfs_backing_dev_info = { | |||
26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, | 26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | struct inode * sysfs_new_inode(mode_t mode) | 29 | static struct inode_operations sysfs_inode_operations ={ |
30 | .setattr = sysfs_setattr, | ||
31 | }; | ||
32 | |||
33 | int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | ||
34 | { | ||
35 | struct inode * inode = dentry->d_inode; | ||
36 | struct sysfs_dirent * sd = dentry->d_fsdata; | ||
37 | struct iattr * sd_iattr; | ||
38 | unsigned int ia_valid = iattr->ia_valid; | ||
39 | int error; | ||
40 | |||
41 | if (!sd) | ||
42 | return -EINVAL; | ||
43 | |||
44 | sd_iattr = sd->s_iattr; | ||
45 | |||
46 | error = inode_change_ok(inode, iattr); | ||
47 | if (error) | ||
48 | return error; | ||
49 | |||
50 | error = inode_setattr(inode, iattr); | ||
51 | if (error) | ||
52 | return error; | ||
53 | |||
54 | if (!sd_iattr) { | ||
55 | /* setting attributes for the first time, allocate now */ | ||
56 | sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); | ||
57 | if (!sd_iattr) | ||
58 | return -ENOMEM; | ||
59 | /* assign default attributes */ | ||
60 | memset(sd_iattr, 0, sizeof(struct iattr)); | ||
61 | sd_iattr->ia_mode = sd->s_mode; | ||
62 | sd_iattr->ia_uid = 0; | ||
63 | sd_iattr->ia_gid = 0; | ||
64 | sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME; | ||
65 | sd->s_iattr = sd_iattr; | ||
66 | } | ||
67 | |||
68 | /* attributes were changed atleast once in past */ | ||
69 | |||
70 | if (ia_valid & ATTR_UID) | ||
71 | sd_iattr->ia_uid = iattr->ia_uid; | ||
72 | if (ia_valid & ATTR_GID) | ||
73 | sd_iattr->ia_gid = iattr->ia_gid; | ||
74 | if (ia_valid & ATTR_ATIME) | ||
75 | sd_iattr->ia_atime = timespec_trunc(iattr->ia_atime, | ||
76 | inode->i_sb->s_time_gran); | ||
77 | if (ia_valid & ATTR_MTIME) | ||
78 | sd_iattr->ia_mtime = timespec_trunc(iattr->ia_mtime, | ||
79 | inode->i_sb->s_time_gran); | ||
80 | if (ia_valid & ATTR_CTIME) | ||
81 | sd_iattr->ia_ctime = timespec_trunc(iattr->ia_ctime, | ||
82 | inode->i_sb->s_time_gran); | ||
83 | if (ia_valid & ATTR_MODE) { | ||
84 | umode_t mode = iattr->ia_mode; | ||
85 | |||
86 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) | ||
87 | mode &= ~S_ISGID; | ||
88 | sd_iattr->ia_mode = mode; | ||
89 | } | ||
90 | |||
91 | return error; | ||
92 | } | ||
93 | |||
94 | static inline void set_default_inode_attr(struct inode * inode, mode_t mode) | ||
95 | { | ||
96 | inode->i_mode = mode; | ||
97 | inode->i_uid = 0; | ||
98 | inode->i_gid = 0; | ||
99 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
100 | } | ||
101 | |||
102 | static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) | ||
103 | { | ||
104 | inode->i_mode = iattr->ia_mode; | ||
105 | inode->i_uid = iattr->ia_uid; | ||
106 | inode->i_gid = iattr->ia_gid; | ||
107 | inode->i_atime = iattr->ia_atime; | ||
108 | inode->i_mtime = iattr->ia_mtime; | ||
109 | inode->i_ctime = iattr->ia_ctime; | ||
110 | } | ||
111 | |||
112 | struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd) | ||
30 | { | 113 | { |
31 | struct inode * inode = new_inode(sysfs_sb); | 114 | struct inode * inode = new_inode(sysfs_sb); |
32 | if (inode) { | 115 | if (inode) { |
33 | inode->i_mode = mode; | ||
34 | inode->i_uid = 0; | ||
35 | inode->i_gid = 0; | ||
36 | inode->i_blksize = PAGE_CACHE_SIZE; | 116 | inode->i_blksize = PAGE_CACHE_SIZE; |
37 | inode->i_blocks = 0; | 117 | inode->i_blocks = 0; |
38 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
39 | inode->i_mapping->a_ops = &sysfs_aops; | 118 | inode->i_mapping->a_ops = &sysfs_aops; |
40 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; | 119 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; |
120 | inode->i_op = &sysfs_inode_operations; | ||
121 | |||
122 | if (sd->s_iattr) { | ||
123 | /* sysfs_dirent has non-default attributes | ||
124 | * get them for the new inode from persistent copy | ||
125 | * in sysfs_dirent | ||
126 | */ | ||
127 | set_inode_attr(inode, sd->s_iattr); | ||
128 | } else | ||
129 | set_default_inode_attr(inode, mode); | ||
41 | } | 130 | } |
42 | return inode; | 131 | return inode; |
43 | } | 132 | } |
@@ -48,7 +137,8 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) | |||
48 | struct inode * inode = NULL; | 137 | struct inode * inode = NULL; |
49 | if (dentry) { | 138 | if (dentry) { |
50 | if (!dentry->d_inode) { | 139 | if (!dentry->d_inode) { |
51 | if ((inode = sysfs_new_inode(mode))) { | 140 | struct sysfs_dirent * sd = dentry->d_fsdata; |
141 | if ((inode = sysfs_new_inode(mode, sd))) { | ||
52 | if (dentry->d_parent && dentry->d_parent->d_inode) { | 142 | if (dentry->d_parent && dentry->d_parent->d_inode) { |
53 | struct inode *p_inode = dentry->d_parent->d_inode; | 143 | struct inode *p_inode = dentry->d_parent->d_inode; |
54 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; | 144 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 5c805bb1a4b7..f1117e885bd6 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -28,6 +28,7 @@ static struct sysfs_dirent sysfs_root = { | |||
28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), | 28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), |
29 | .s_element = NULL, | 29 | .s_element = NULL, |
30 | .s_type = SYSFS_ROOT, | 30 | .s_type = SYSFS_ROOT, |
31 | .s_iattr = NULL, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | 34 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -42,7 +43,8 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
42 | sb->s_time_gran = 1; | 43 | sb->s_time_gran = 1; |
43 | sysfs_sb = sb; | 44 | sysfs_sb = sb; |
44 | 45 | ||
45 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); | 46 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, |
47 | &sysfs_root); | ||
46 | if (inode) { | 48 | if (inode) { |
47 | inode->i_op = &sysfs_dir_inode_operations; | 49 | inode->i_op = &sysfs_dir_inode_operations; |
48 | inode->i_fop = &sysfs_dir_operations; | 50 | inode->i_fop = &sysfs_dir_operations; |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index dfdf70174354..fae57c83a722 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -43,7 +43,7 @@ static void fill_object_path(struct kobject * kobj, char * buffer, int length) | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | static int sysfs_add_link(struct dentry * parent, char * name, struct kobject * target) | 46 | static int sysfs_add_link(struct dentry * parent, const char * name, struct kobject * target) |
47 | { | 47 | { |
48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; | 48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; |
49 | struct sysfs_symlink * sl; | 49 | struct sysfs_symlink * sl; |
@@ -79,7 +79,7 @@ exit1: | |||
79 | * @target: object we're pointing to. | 79 | * @target: object we're pointing to. |
80 | * @name: name of the symlink. | 80 | * @name: name of the symlink. |
81 | */ | 81 | */ |
82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name) | 82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) |
83 | { | 83 | { |
84 | struct dentry * dentry = kobj->dentry; | 84 | struct dentry * dentry = kobj->dentry; |
85 | int error = 0; | 85 | int error = 0; |
@@ -99,13 +99,13 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * nam | |||
99 | * @name: name of the symlink to remove. | 99 | * @name: name of the symlink to remove. |
100 | */ | 100 | */ |
101 | 101 | ||
102 | void sysfs_remove_link(struct kobject * kobj, char * name) | 102 | void sysfs_remove_link(struct kobject * kobj, const char * name) |
103 | { | 103 | { |
104 | sysfs_hash_and_remove(kobj->dentry,name); | 104 | sysfs_hash_and_remove(kobj->dentry,name); |
105 | } | 105 | } |
106 | 106 | ||
107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, | 107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, |
108 | char *path) | 108 | char *path) |
109 | { | 109 | { |
110 | char * s; | 110 | char * s; |
111 | int depth, size; | 111 | int depth, size; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index a8a24a0c0b3b..29da6f5f07c8 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -2,7 +2,7 @@ | |||
2 | extern struct vfsmount * sysfs_mount; | 2 | extern struct vfsmount * sysfs_mount; |
3 | extern kmem_cache_t *sysfs_dir_cachep; | 3 | extern kmem_cache_t *sysfs_dir_cachep; |
4 | 4 | ||
5 | extern struct inode * sysfs_new_inode(mode_t mode); | 5 | extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *); |
6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); | 6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); |
7 | 7 | ||
8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, | 8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, |
@@ -17,6 +17,7 @@ extern void sysfs_remove_subdir(struct dentry *); | |||
17 | 17 | ||
18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); | 18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); |
19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); | 19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); |
20 | extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | ||
20 | 21 | ||
21 | extern struct rw_semaphore sysfs_rename_sem; | 22 | extern struct rw_semaphore sysfs_rename_sem; |
22 | extern struct super_block * sysfs_sb; | 23 | extern struct super_block * sysfs_sb; |
@@ -75,6 +76,7 @@ static inline void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
75 | kobject_put(sl->target_kobj); | 76 | kobject_put(sl->target_kobj); |
76 | kfree(sl); | 77 | kfree(sl); |
77 | } | 78 | } |
79 | kfree(sd->s_iattr); | ||
78 | kmem_cache_free(sysfs_dir_cachep, sd); | 80 | kmem_cache_free(sysfs_dir_cachep, sd); |
79 | } | 81 | } |
80 | 82 | ||
diff --git a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h index b98db3cdae83..c726f1845190 100644 --- a/include/asm-ppc/ocp.h +++ b/include/asm-ppc/ocp.h | |||
@@ -189,7 +189,7 @@ extern void ocp_for_each_device(void(*callback)(struct ocp_device *, void *arg), | |||
189 | /* Sysfs support */ | 189 | /* Sysfs support */ |
190 | #define OCP_SYSFS_ADDTL(type, format, name, field) \ | 190 | #define OCP_SYSFS_ADDTL(type, format, name, field) \ |
191 | static ssize_t \ | 191 | static ssize_t \ |
192 | show_##name##_##field(struct device *dev, char *buf) \ | 192 | show_##name##_##field(struct device *dev, struct device_attribute *attr, char *buf) \ |
193 | { \ | 193 | { \ |
194 | struct ocp_device *odev = to_ocp_dev(dev); \ | 194 | struct ocp_device *odev = to_ocp_dev(dev); \ |
195 | type *add = odev->def->additions; \ | 195 | type *add = odev->def->additions; \ |
diff --git a/include/linux/device.h b/include/linux/device.h index df94c0de53f2..7b781a72b293 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/config.h> | 14 | #include <linux/config.h> |
15 | #include <linux/ioport.h> | 15 | #include <linux/ioport.h> |
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/klist.h> | ||
17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
@@ -44,14 +45,15 @@ struct device; | |||
44 | struct device_driver; | 45 | struct device_driver; |
45 | struct class; | 46 | struct class; |
46 | struct class_device; | 47 | struct class_device; |
47 | struct class_simple; | ||
48 | 48 | ||
49 | struct bus_type { | 49 | struct bus_type { |
50 | char * name; | 50 | const char * name; |
51 | 51 | ||
52 | struct subsystem subsys; | 52 | struct subsystem subsys; |
53 | struct kset drivers; | 53 | struct kset drivers; |
54 | struct kset devices; | 54 | struct kset devices; |
55 | struct klist klist_devices; | ||
56 | struct klist klist_drivers; | ||
55 | 57 | ||
56 | struct bus_attribute * bus_attrs; | 58 | struct bus_attribute * bus_attrs; |
57 | struct device_attribute * dev_attrs; | 59 | struct device_attribute * dev_attrs; |
@@ -98,17 +100,18 @@ extern int bus_create_file(struct bus_type *, struct bus_attribute *); | |||
98 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | 100 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); |
99 | 101 | ||
100 | struct device_driver { | 102 | struct device_driver { |
101 | char * name; | 103 | const char * name; |
102 | struct bus_type * bus; | 104 | struct bus_type * bus; |
103 | 105 | ||
104 | struct completion unloaded; | 106 | struct completion unloaded; |
105 | struct kobject kobj; | 107 | struct kobject kobj; |
106 | struct list_head devices; | 108 | struct klist klist_devices; |
109 | struct klist_node knode_bus; | ||
107 | 110 | ||
108 | struct module * owner; | 111 | struct module * owner; |
109 | 112 | ||
110 | int (*probe) (struct device * dev); | 113 | int (*probe) (struct device * dev); |
111 | int (*remove) (struct device * dev); | 114 | int (*remove) (struct device * dev); |
112 | void (*shutdown) (struct device * dev); | 115 | void (*shutdown) (struct device * dev); |
113 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); | 116 | int (*suspend) (struct device * dev, pm_message_t state, u32 level); |
114 | int (*resume) (struct device * dev, u32 level); | 117 | int (*resume) (struct device * dev, u32 level); |
@@ -137,12 +140,16 @@ struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) | |||
137 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); | 140 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); |
138 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 141 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); |
139 | 142 | ||
143 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, | ||
144 | void * data, int (*fn)(struct device *, void *)); | ||
145 | |||
140 | 146 | ||
141 | /* | 147 | /* |
142 | * device classes | 148 | * device classes |
143 | */ | 149 | */ |
144 | struct class { | 150 | struct class { |
145 | char * name; | 151 | const char * name; |
152 | struct module * owner; | ||
146 | 153 | ||
147 | struct subsystem subsys; | 154 | struct subsystem subsys; |
148 | struct list_head children; | 155 | struct list_head children; |
@@ -185,6 +192,7 @@ struct class_device { | |||
185 | struct kobject kobj; | 192 | struct kobject kobj; |
186 | struct class * class; /* required */ | 193 | struct class * class; /* required */ |
187 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 194 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
195 | struct class_device_attribute *devt_attr; | ||
188 | struct device * dev; /* not necessary, but nice to have */ | 196 | struct device * dev; /* not necessary, but nice to have */ |
189 | void * class_data; /* class-specific data */ | 197 | void * class_data; /* class-specific data */ |
190 | 198 | ||
@@ -245,26 +253,28 @@ struct class_interface { | |||
245 | extern int class_interface_register(struct class_interface *); | 253 | extern int class_interface_register(struct class_interface *); |
246 | extern void class_interface_unregister(struct class_interface *); | 254 | extern void class_interface_unregister(struct class_interface *); |
247 | 255 | ||
248 | /* interface for class simple stuff */ | 256 | extern struct class *class_create(struct module *owner, char *name); |
249 | extern struct class_simple *class_simple_create(struct module *owner, char *name); | 257 | extern void class_destroy(struct class *cls); |
250 | extern void class_simple_destroy(struct class_simple *cs); | 258 | extern struct class_device *class_device_create(struct class *cls, dev_t devt, |
251 | extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...) | 259 | struct device *device, char *fmt, ...) |
252 | __attribute__((format(printf,4,5))); | 260 | __attribute__((format(printf,4,5))); |
253 | extern int class_simple_set_hotplug(struct class_simple *, | 261 | extern void class_device_destroy(struct class *cls, dev_t devt); |
254 | int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size)); | ||
255 | extern void class_simple_device_remove(dev_t dev); | ||
256 | 262 | ||
257 | 263 | ||
258 | struct device { | 264 | struct device { |
259 | struct list_head node; /* node in sibling list */ | 265 | struct klist klist_children; |
260 | struct list_head bus_list; /* node in bus's list */ | 266 | struct klist_node knode_parent; /* node in sibling list */ |
261 | struct list_head driver_list; | 267 | struct klist_node knode_driver; |
262 | struct list_head children; | 268 | struct klist_node knode_bus; |
263 | struct device * parent; | 269 | struct device * parent; |
264 | 270 | ||
265 | struct kobject kobj; | 271 | struct kobject kobj; |
266 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 272 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
267 | 273 | ||
274 | struct semaphore sem; /* semaphore to synchronize calls to | ||
275 | * its driver. | ||
276 | */ | ||
277 | |||
268 | struct bus_type * bus; /* type of bus device is on */ | 278 | struct bus_type * bus; /* type of bus device is on */ |
269 | struct device_driver *driver; /* which driver has allocated this | 279 | struct device_driver *driver; /* which driver has allocated this |
270 | device */ | 280 | device */ |
@@ -288,12 +298,6 @@ struct device { | |||
288 | void (*release)(struct device * dev); | 298 | void (*release)(struct device * dev); |
289 | }; | 299 | }; |
290 | 300 | ||
291 | static inline struct device * | ||
292 | list_to_dev(struct list_head *node) | ||
293 | { | ||
294 | return list_entry(node, struct device, node); | ||
295 | } | ||
296 | |||
297 | static inline void * | 301 | static inline void * |
298 | dev_get_drvdata (struct device *dev) | 302 | dev_get_drvdata (struct device *dev) |
299 | { | 303 | { |
@@ -321,7 +325,6 @@ extern int device_for_each_child(struct device *, void *, | |||
321 | * Manual binding of a device to driver. See drivers/base/bus.c | 325 | * Manual binding of a device to driver. See drivers/base/bus.c |
322 | * for information on use. | 326 | * for information on use. |
323 | */ | 327 | */ |
324 | extern int driver_probe_device(struct device_driver * drv, struct device * dev); | ||
325 | extern void device_bind_driver(struct device * dev); | 328 | extern void device_bind_driver(struct device * dev); |
326 | extern void device_release_driver(struct device * dev); | 329 | extern void device_release_driver(struct device * dev); |
327 | extern int device_attach(struct device * dev); | 330 | extern int device_attach(struct device * dev); |
@@ -332,8 +335,10 @@ extern void driver_attach(struct device_driver * drv); | |||
332 | 335 | ||
333 | struct device_attribute { | 336 | struct device_attribute { |
334 | struct attribute attr; | 337 | struct attribute attr; |
335 | ssize_t (*show)(struct device * dev, char * buf); | 338 | ssize_t (*show)(struct device *dev, struct device_attribute *attr, |
336 | ssize_t (*store)(struct device * dev, const char * buf, size_t count); | 339 | char *buf); |
340 | ssize_t (*store)(struct device *dev, struct device_attribute *attr, | ||
341 | const char *buf, size_t count); | ||
337 | }; | 342 | }; |
338 | 343 | ||
339 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | 344 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ |
@@ -360,13 +365,12 @@ extern int (*platform_notify_remove)(struct device * dev); | |||
360 | */ | 365 | */ |
361 | extern struct device * get_device(struct device * dev); | 366 | extern struct device * get_device(struct device * dev); |
362 | extern void put_device(struct device * dev); | 367 | extern void put_device(struct device * dev); |
363 | extern struct device *device_find(const char *name, struct bus_type *bus); | ||
364 | 368 | ||
365 | 369 | ||
366 | /* drivers/base/platform.c */ | 370 | /* drivers/base/platform.c */ |
367 | 371 | ||
368 | struct platform_device { | 372 | struct platform_device { |
369 | char * name; | 373 | const char * name; |
370 | u32 id; | 374 | u32 id; |
371 | struct device dev; | 375 | struct device dev; |
372 | u32 num_resources; | 376 | u32 num_resources; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 0180102dace1..9b8b696d4f15 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1657,6 +1657,52 @@ static inline void simple_transaction_set(struct file *file, size_t n) | |||
1657 | ar->size = n; | 1657 | ar->size = n; |
1658 | } | 1658 | } |
1659 | 1659 | ||
1660 | /* | ||
1661 | * simple attribute files | ||
1662 | * | ||
1663 | * These attributes behave similar to those in sysfs: | ||
1664 | * | ||
1665 | * Writing to an attribute immediately sets a value, an open file can be | ||
1666 | * written to multiple times. | ||
1667 | * | ||
1668 | * Reading from an attribute creates a buffer from the value that might get | ||
1669 | * read with multiple read calls. When the attribute has been read | ||
1670 | * completely, no further read calls are possible until the file is opened | ||
1671 | * again. | ||
1672 | * | ||
1673 | * All attributes contain a text representation of a numeric value | ||
1674 | * that are accessed with the get() and set() functions. | ||
1675 | */ | ||
1676 | #define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) \ | ||
1677 | static int __fops ## _open(struct inode *inode, struct file *file) \ | ||
1678 | { \ | ||
1679 | __simple_attr_check_format(__fmt, 0ull); \ | ||
1680 | return simple_attr_open(inode, file, __get, __set, __fmt); \ | ||
1681 | } \ | ||
1682 | static struct file_operations __fops = { \ | ||
1683 | .owner = THIS_MODULE, \ | ||
1684 | .open = __fops ## _open, \ | ||
1685 | .release = simple_attr_close, \ | ||
1686 | .read = simple_attr_read, \ | ||
1687 | .write = simple_attr_write, \ | ||
1688 | }; | ||
1689 | |||
1690 | static inline void __attribute__((format(printf, 1, 2))) | ||
1691 | __simple_attr_check_format(const char *fmt, ...) | ||
1692 | { | ||
1693 | /* don't do anything, just let the compiler check the arguments; */ | ||
1694 | } | ||
1695 | |||
1696 | int simple_attr_open(struct inode *inode, struct file *file, | ||
1697 | u64 (*get)(void *), void (*set)(void *, u64), | ||
1698 | const char *fmt); | ||
1699 | int simple_attr_close(struct inode *inode, struct file *file); | ||
1700 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
1701 | size_t len, loff_t *ppos); | ||
1702 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
1703 | size_t len, loff_t *ppos); | ||
1704 | |||
1705 | |||
1660 | #ifdef CONFIG_SECURITY | 1706 | #ifdef CONFIG_SECURITY |
1661 | static inline char *alloc_secdata(void) | 1707 | static inline char *alloc_secdata(void) |
1662 | { | 1708 | { |
diff --git a/include/linux/i2c-sysfs.h b/include/linux/i2c-sysfs.h new file mode 100644 index 000000000000..d7bf6ce11679 --- /dev/null +++ b/include/linux/i2c-sysfs.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * i2c-sysfs.h - i2c chip driver sysfs defines | ||
3 | * | ||
4 | * Copyright (C) 2005 Yani Ioannou <yani.ioannou@gmail.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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | #ifndef _LINUX_I2C_SYSFS_H | ||
21 | #define _LINUX_I2C_SYSFS_H | ||
22 | |||
23 | struct sensor_device_attribute{ | ||
24 | struct device_attribute dev_attr; | ||
25 | int index; | ||
26 | }; | ||
27 | #define to_sensor_dev_attr(_dev_attr) \ | ||
28 | container_of(_dev_attr, struct sensor_device_attribute, dev_attr) | ||
29 | |||
30 | #define SENSOR_DEVICE_ATTR(_name,_mode,_show,_store,_index) \ | ||
31 | struct sensor_device_attribute sensor_dev_attr_##_name = { \ | ||
32 | .dev_attr = __ATTR(_name,_mode,_show,_store), \ | ||
33 | .index = _index, \ | ||
34 | } | ||
35 | |||
36 | #endif /* _LINUX_I2C_SYSFS_H */ | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 72731d7d189e..9d9598ed760d 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -1015,7 +1015,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
1015 | dev->absbit[LONG(axis)] |= BIT(axis); | 1015 | dev->absbit[LONG(axis)] |= BIT(axis); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | extern struct class_simple *input_class; | 1018 | extern struct class *input_class; |
1019 | 1019 | ||
1020 | #endif | 1020 | #endif |
1021 | #endif | 1021 | #endif |
diff --git a/include/linux/klist.h b/include/linux/klist.h new file mode 100644 index 000000000000..eebf5e5696ec --- /dev/null +++ b/include/linux/klist.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * klist.h - Some generic list helpers, extending struct list_head a bit. | ||
3 | * | ||
4 | * Implementations are found in lib/klist.c | ||
5 | * | ||
6 | * | ||
7 | * Copyright (C) 2005 Patrick Mochel | ||
8 | * | ||
9 | * This file is rleased under the GPL v2. | ||
10 | */ | ||
11 | |||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/completion.h> | ||
14 | #include <linux/kref.h> | ||
15 | #include <linux/list.h> | ||
16 | |||
17 | |||
18 | struct klist { | ||
19 | spinlock_t k_lock; | ||
20 | struct list_head k_list; | ||
21 | }; | ||
22 | |||
23 | |||
24 | extern void klist_init(struct klist * k); | ||
25 | |||
26 | |||
27 | struct klist_node { | ||
28 | struct klist * n_klist; | ||
29 | struct list_head n_node; | ||
30 | struct kref n_ref; | ||
31 | struct completion n_removed; | ||
32 | }; | ||
33 | |||
34 | extern void klist_add_tail(struct klist * k, struct klist_node * n); | ||
35 | extern void klist_add_head(struct klist * k, struct klist_node * n); | ||
36 | |||
37 | extern void klist_del(struct klist_node * n); | ||
38 | extern void klist_remove(struct klist_node * n); | ||
39 | |||
40 | extern int klist_node_attached(struct klist_node * n); | ||
41 | |||
42 | |||
43 | struct klist_iter { | ||
44 | struct klist * i_klist; | ||
45 | struct list_head * i_head; | ||
46 | struct klist_node * i_cur; | ||
47 | }; | ||
48 | |||
49 | |||
50 | extern void klist_iter_init(struct klist * k, struct klist_iter * i); | ||
51 | extern void klist_iter_init_node(struct klist * k, struct klist_iter * i, | ||
52 | struct klist_node * n); | ||
53 | extern void klist_iter_exit(struct klist_iter * i); | ||
54 | extern struct klist_node * klist_next(struct klist_iter * i); | ||
55 | |||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 765d660d3bea..3b22304f12fd 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -33,7 +33,7 @@ | |||
33 | extern u64 hotplug_seqnum; | 33 | extern u64 hotplug_seqnum; |
34 | 34 | ||
35 | struct kobject { | 35 | struct kobject { |
36 | char * k_name; | 36 | const char * k_name; |
37 | char name[KOBJ_NAME_LEN]; | 37 | char name[KOBJ_NAME_LEN]; |
38 | struct kref kref; | 38 | struct kref kref; |
39 | struct list_head entry; | 39 | struct list_head entry; |
@@ -46,7 +46,7 @@ struct kobject { | |||
46 | extern int kobject_set_name(struct kobject *, const char *, ...) | 46 | extern int kobject_set_name(struct kobject *, const char *, ...) |
47 | __attribute__((format(printf,2,3))); | 47 | __attribute__((format(printf,2,3))); |
48 | 48 | ||
49 | static inline char * kobject_name(struct kobject * kobj) | 49 | static inline const char * kobject_name(const struct kobject * kobj) |
50 | { | 50 | { |
51 | return kobj->k_name; | 51 | return kobj->k_name; |
52 | } | 52 | } |
@@ -57,7 +57,7 @@ extern void kobject_cleanup(struct kobject *); | |||
57 | extern int kobject_add(struct kobject *); | 57 | extern int kobject_add(struct kobject *); |
58 | extern void kobject_del(struct kobject *); | 58 | extern void kobject_del(struct kobject *); |
59 | 59 | ||
60 | extern int kobject_rename(struct kobject *, char *new_name); | 60 | extern int kobject_rename(struct kobject *, const char *new_name); |
61 | 61 | ||
62 | extern int kobject_register(struct kobject *); | 62 | extern int kobject_register(struct kobject *); |
63 | extern void kobject_unregister(struct kobject *); | 63 | extern void kobject_unregister(struct kobject *); |
@@ -94,7 +94,7 @@ struct kobj_type { | |||
94 | */ | 94 | */ |
95 | struct kset_hotplug_ops { | 95 | struct kset_hotplug_ops { |
96 | int (*filter)(struct kset *kset, struct kobject *kobj); | 96 | int (*filter)(struct kset *kset, struct kobject *kobj); |
97 | char *(*name)(struct kset *kset, struct kobject *kobj); | 97 | const char *(*name)(struct kset *kset, struct kobject *kobj); |
98 | int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, | 98 | int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, |
99 | int num_envp, char *buffer, int buffer_size); | 99 | int num_envp, char *buffer, int buffer_size); |
100 | }; | 100 | }; |
diff --git a/include/linux/node.h b/include/linux/node.h index 6e0a697e594e..254dc3de650b 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
@@ -27,6 +27,7 @@ struct node { | |||
27 | }; | 27 | }; |
28 | 28 | ||
29 | extern int register_node(struct node *, int, struct node *); | 29 | extern int register_node(struct node *, int, struct node *); |
30 | extern void unregister_node(struct node *node); | ||
30 | 31 | ||
31 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 32 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) |
32 | 33 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 38b58b30814a..392da5a6dacb 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -16,13 +16,13 @@ struct kobject; | |||
16 | struct module; | 16 | struct module; |
17 | 17 | ||
18 | struct attribute { | 18 | struct attribute { |
19 | char * name; | 19 | const char * name; |
20 | struct module * owner; | 20 | struct module * owner; |
21 | mode_t mode; | 21 | mode_t mode; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | struct attribute_group { | 24 | struct attribute_group { |
25 | char * name; | 25 | const char * name; |
26 | struct attribute ** attrs; | 26 | struct attribute ** attrs; |
27 | }; | 27 | }; |
28 | 28 | ||
@@ -73,6 +73,7 @@ struct sysfs_dirent { | |||
73 | int s_type; | 73 | int s_type; |
74 | umode_t s_mode; | 74 | umode_t s_mode; |
75 | struct dentry * s_dentry; | 75 | struct dentry * s_dentry; |
76 | struct iattr * s_iattr; | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | #define SYSFS_ROOT 0x0001 | 79 | #define SYSFS_ROOT 0x0001 |
@@ -105,11 +106,11 @@ sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | |||
105 | extern void | 106 | extern void |
106 | sysfs_remove_file(struct kobject *, const struct attribute *); | 107 | sysfs_remove_file(struct kobject *, const struct attribute *); |
107 | 108 | ||
108 | extern int | 109 | extern int |
109 | sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); | 110 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); |
110 | 111 | ||
111 | extern void | 112 | extern void |
112 | sysfs_remove_link(struct kobject *, char * name); | 113 | sysfs_remove_link(struct kobject *, const char * name); |
113 | 114 | ||
114 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 115 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); |
115 | int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 116 | int sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr); |
@@ -153,12 +154,12 @@ static inline void sysfs_remove_file(struct kobject * k, const struct attribute | |||
153 | ; | 154 | ; |
154 | } | 155 | } |
155 | 156 | ||
156 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, char * n) | 157 | static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) |
157 | { | 158 | { |
158 | return 0; | 159 | return 0; |
159 | } | 160 | } |
160 | 161 | ||
161 | static inline void sysfs_remove_link(struct kobject * k, char * name) | 162 | static inline void sysfs_remove_link(struct kobject * k, const char * name) |
162 | { | 163 | { |
163 | ; | 164 | ; |
164 | } | 165 | } |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 2d1ac5058534..3d508bf08402 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -287,15 +287,14 @@ struct usb_bus { | |||
287 | 287 | ||
288 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ | 288 | struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ |
289 | 289 | ||
290 | struct class_device class_dev; /* class device for this bus */ | 290 | struct class_device *class_dev; /* class device for this bus */ |
291 | struct kref kref; /* handles reference counting this bus */ | ||
291 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ | 292 | void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ |
292 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | 293 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) |
293 | struct mon_bus *mon_bus; /* non-null when associated */ | 294 | struct mon_bus *mon_bus; /* non-null when associated */ |
294 | int monitored; /* non-zero when monitored */ | 295 | int monitored; /* non-zero when monitored */ |
295 | #endif | 296 | #endif |
296 | }; | 297 | }; |
297 | #define to_usb_bus(d) container_of(d, struct usb_bus, class_dev) | ||
298 | |||
299 | 298 | ||
300 | /* -------------------------------------------------------------------------- */ | 299 | /* -------------------------------------------------------------------------- */ |
301 | 300 | ||
diff --git a/kernel/params.c b/kernel/params.c index 5513844bec13..d586c35ef8fc 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -629,7 +629,7 @@ static ssize_t module_attr_show(struct kobject *kobj, | |||
629 | mk = to_module_kobject(kobj); | 629 | mk = to_module_kobject(kobj); |
630 | 630 | ||
631 | if (!attribute->show) | 631 | if (!attribute->show) |
632 | return -EPERM; | 632 | return -EIO; |
633 | 633 | ||
634 | if (!try_module_get(mk->mod)) | 634 | if (!try_module_get(mk->mod)) |
635 | return -ENODEV; | 635 | return -ENODEV; |
@@ -653,7 +653,7 @@ static ssize_t module_attr_store(struct kobject *kobj, | |||
653 | mk = to_module_kobject(kobj); | 653 | mk = to_module_kobject(kobj); |
654 | 654 | ||
655 | if (!attribute->store) | 655 | if (!attribute->store) |
656 | return -EPERM; | 656 | return -EIO; |
657 | 657 | ||
658 | if (!try_module_get(mk->mod)) | 658 | if (!try_module_get(mk->mod)) |
659 | return -ENODEV; | 659 | return -ENODEV; |
diff --git a/lib/Makefile b/lib/Makefile index 7c70db79c0e0..9eccea9429a7 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -4,9 +4,10 @@ | |||
4 | 4 | ||
5 | lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ | 5 | lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ |
6 | bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ | 6 | bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ |
7 | kobject.o kref.o idr.o div64.o int_sqrt.o \ | 7 | idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ |
8 | bitmap.o extable.o kobject_uevent.o prio_tree.o sha1.o \ | 8 | sha1.o halfmd4.o |
9 | halfmd4.o | 9 | |
10 | lib-y += kobject.o kref.o kobject_uevent.o klist.o | ||
10 | 11 | ||
11 | obj-y += sort.o parser.o | 12 | obj-y += sort.o parser.o |
12 | 13 | ||
diff --git a/lib/klist.c b/lib/klist.c new file mode 100644 index 000000000000..738ab810160a --- /dev/null +++ b/lib/klist.c | |||
@@ -0,0 +1,265 @@ | |||
1 | /* | ||
2 | * klist.c - Routines for manipulating klists. | ||
3 | * | ||
4 | * | ||
5 | * This klist interface provides a couple of structures that wrap around | ||
6 | * struct list_head to provide explicit list "head" (struct klist) and | ||
7 | * list "node" (struct klist_node) objects. For struct klist, a spinlock | ||
8 | * is included that protects access to the actual list itself. struct | ||
9 | * klist_node provides a pointer to the klist that owns it and a kref | ||
10 | * reference count that indicates the number of current users of that node | ||
11 | * in the list. | ||
12 | * | ||
13 | * The entire point is to provide an interface for iterating over a list | ||
14 | * that is safe and allows for modification of the list during the | ||
15 | * iteration (e.g. insertion and removal), including modification of the | ||
16 | * current node on the list. | ||
17 | * | ||
18 | * It works using a 3rd object type - struct klist_iter - that is declared | ||
19 | * and initialized before an iteration. klist_next() is used to acquire the | ||
20 | * next element in the list. It returns NULL if there are no more items. | ||
21 | * Internally, that routine takes the klist's lock, decrements the reference | ||
22 | * count of the previous klist_node and increments the count of the next | ||
23 | * klist_node. It then drops the lock and returns. | ||
24 | * | ||
25 | * There are primitives for adding and removing nodes to/from a klist. | ||
26 | * When deleting, klist_del() will simply decrement the reference count. | ||
27 | * Only when the count goes to 0 is the node removed from the list. | ||
28 | * klist_remove() will try to delete the node from the list and block | ||
29 | * until it is actually removed. This is useful for objects (like devices) | ||
30 | * that have been removed from the system and must be freed (but must wait | ||
31 | * until all accessors have finished). | ||
32 | * | ||
33 | * Copyright (C) 2005 Patrick Mochel | ||
34 | * | ||
35 | * This file is released under the GPL v2. | ||
36 | */ | ||
37 | |||
38 | #include <linux/klist.h> | ||
39 | #include <linux/module.h> | ||
40 | |||
41 | |||
42 | /** | ||
43 | * klist_init - Initialize a klist structure. | ||
44 | * @k: The klist we're initializing. | ||
45 | */ | ||
46 | |||
47 | void klist_init(struct klist * k) | ||
48 | { | ||
49 | INIT_LIST_HEAD(&k->k_list); | ||
50 | spin_lock_init(&k->k_lock); | ||
51 | } | ||
52 | |||
53 | EXPORT_SYMBOL_GPL(klist_init); | ||
54 | |||
55 | |||
56 | static void add_head(struct klist * k, struct klist_node * n) | ||
57 | { | ||
58 | spin_lock(&k->k_lock); | ||
59 | list_add(&n->n_node, &k->k_list); | ||
60 | spin_unlock(&k->k_lock); | ||
61 | } | ||
62 | |||
63 | static void add_tail(struct klist * k, struct klist_node * n) | ||
64 | { | ||
65 | spin_lock(&k->k_lock); | ||
66 | list_add_tail(&n->n_node, &k->k_list); | ||
67 | spin_unlock(&k->k_lock); | ||
68 | } | ||
69 | |||
70 | |||
71 | static void klist_node_init(struct klist * k, struct klist_node * n) | ||
72 | { | ||
73 | INIT_LIST_HEAD(&n->n_node); | ||
74 | init_completion(&n->n_removed); | ||
75 | kref_init(&n->n_ref); | ||
76 | n->n_klist = k; | ||
77 | } | ||
78 | |||
79 | |||
80 | /** | ||
81 | * klist_add_head - Initialize a klist_node and add it to front. | ||
82 | * @k: klist it's going on. | ||
83 | * @n: node we're adding. | ||
84 | */ | ||
85 | |||
86 | void klist_add_head(struct klist * k, struct klist_node * n) | ||
87 | { | ||
88 | klist_node_init(k, n); | ||
89 | add_head(k, n); | ||
90 | } | ||
91 | |||
92 | EXPORT_SYMBOL_GPL(klist_add_head); | ||
93 | |||
94 | |||
95 | /** | ||
96 | * klist_add_tail - Initialize a klist_node and add it to back. | ||
97 | * @k: klist it's going on. | ||
98 | * @n: node we're adding. | ||
99 | */ | ||
100 | |||
101 | void klist_add_tail(struct klist * k, struct klist_node * n) | ||
102 | { | ||
103 | klist_node_init(k, n); | ||
104 | add_tail(k, n); | ||
105 | } | ||
106 | |||
107 | EXPORT_SYMBOL_GPL(klist_add_tail); | ||
108 | |||
109 | |||
110 | static void klist_release(struct kref * kref) | ||
111 | { | ||
112 | struct klist_node * n = container_of(kref, struct klist_node, n_ref); | ||
113 | list_del(&n->n_node); | ||
114 | complete(&n->n_removed); | ||
115 | n->n_klist = NULL; | ||
116 | } | ||
117 | |||
118 | static int klist_dec_and_del(struct klist_node * n) | ||
119 | { | ||
120 | return kref_put(&n->n_ref, klist_release); | ||
121 | } | ||
122 | |||
123 | |||
124 | /** | ||
125 | * klist_del - Decrement the reference count of node and try to remove. | ||
126 | * @n: node we're deleting. | ||
127 | */ | ||
128 | |||
129 | void klist_del(struct klist_node * n) | ||
130 | { | ||
131 | struct klist * k = n->n_klist; | ||
132 | |||
133 | spin_lock(&k->k_lock); | ||
134 | klist_dec_and_del(n); | ||
135 | spin_unlock(&k->k_lock); | ||
136 | } | ||
137 | |||
138 | EXPORT_SYMBOL_GPL(klist_del); | ||
139 | |||
140 | |||
141 | /** | ||
142 | * klist_remove - Decrement the refcount of node and wait for it to go away. | ||
143 | * @n: node we're removing. | ||
144 | */ | ||
145 | |||
146 | void klist_remove(struct klist_node * n) | ||
147 | { | ||
148 | struct klist * k = n->n_klist; | ||
149 | spin_lock(&k->k_lock); | ||
150 | klist_dec_and_del(n); | ||
151 | spin_unlock(&k->k_lock); | ||
152 | wait_for_completion(&n->n_removed); | ||
153 | } | ||
154 | |||
155 | EXPORT_SYMBOL_GPL(klist_remove); | ||
156 | |||
157 | |||
158 | /** | ||
159 | * klist_node_attached - Say whether a node is bound to a list or not. | ||
160 | * @n: Node that we're testing. | ||
161 | */ | ||
162 | |||
163 | int klist_node_attached(struct klist_node * n) | ||
164 | { | ||
165 | return (n->n_klist != NULL); | ||
166 | } | ||
167 | |||
168 | EXPORT_SYMBOL_GPL(klist_node_attached); | ||
169 | |||
170 | |||
171 | /** | ||
172 | * klist_iter_init_node - Initialize a klist_iter structure. | ||
173 | * @k: klist we're iterating. | ||
174 | * @i: klist_iter we're filling. | ||
175 | * @n: node to start with. | ||
176 | * | ||
177 | * Similar to klist_iter_init(), but starts the action off with @n, | ||
178 | * instead of with the list head. | ||
179 | */ | ||
180 | |||
181 | void klist_iter_init_node(struct klist * k, struct klist_iter * i, struct klist_node * n) | ||
182 | { | ||
183 | i->i_klist = k; | ||
184 | i->i_head = &k->k_list; | ||
185 | i->i_cur = n; | ||
186 | } | ||
187 | |||
188 | EXPORT_SYMBOL_GPL(klist_iter_init_node); | ||
189 | |||
190 | |||
191 | /** | ||
192 | * klist_iter_init - Iniitalize a klist_iter structure. | ||
193 | * @k: klist we're iterating. | ||
194 | * @i: klist_iter structure we're filling. | ||
195 | * | ||
196 | * Similar to klist_iter_init_node(), but start with the list head. | ||
197 | */ | ||
198 | |||
199 | void klist_iter_init(struct klist * k, struct klist_iter * i) | ||
200 | { | ||
201 | klist_iter_init_node(k, i, NULL); | ||
202 | } | ||
203 | |||
204 | EXPORT_SYMBOL_GPL(klist_iter_init); | ||
205 | |||
206 | |||
207 | /** | ||
208 | * klist_iter_exit - Finish a list iteration. | ||
209 | * @i: Iterator structure. | ||
210 | * | ||
211 | * Must be called when done iterating over list, as it decrements the | ||
212 | * refcount of the current node. Necessary in case iteration exited before | ||
213 | * the end of the list was reached, and always good form. | ||
214 | */ | ||
215 | |||
216 | void klist_iter_exit(struct klist_iter * i) | ||
217 | { | ||
218 | if (i->i_cur) { | ||
219 | klist_del(i->i_cur); | ||
220 | i->i_cur = NULL; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | EXPORT_SYMBOL_GPL(klist_iter_exit); | ||
225 | |||
226 | |||
227 | static struct klist_node * to_klist_node(struct list_head * n) | ||
228 | { | ||
229 | return container_of(n, struct klist_node, n_node); | ||
230 | } | ||
231 | |||
232 | |||
233 | /** | ||
234 | * klist_next - Ante up next node in list. | ||
235 | * @i: Iterator structure. | ||
236 | * | ||
237 | * First grab list lock. Decrement the reference count of the previous | ||
238 | * node, if there was one. Grab the next node, increment its reference | ||
239 | * count, drop the lock, and return that next node. | ||
240 | */ | ||
241 | |||
242 | struct klist_node * klist_next(struct klist_iter * i) | ||
243 | { | ||
244 | struct list_head * next; | ||
245 | struct klist_node * knode = NULL; | ||
246 | |||
247 | spin_lock(&i->i_klist->k_lock); | ||
248 | if (i->i_cur) { | ||
249 | next = i->i_cur->n_node.next; | ||
250 | klist_dec_and_del(i->i_cur); | ||
251 | } else | ||
252 | next = i->i_head->next; | ||
253 | |||
254 | if (next != i->i_head) { | ||
255 | knode = to_klist_node(next); | ||
256 | kref_get(&knode->n_ref); | ||
257 | } | ||
258 | i->i_cur = knode; | ||
259 | spin_unlock(&i->i_klist->k_lock); | ||
260 | return knode; | ||
261 | } | ||
262 | |||
263 | EXPORT_SYMBOL_GPL(klist_next); | ||
264 | |||
265 | |||
diff --git a/lib/kobject.c b/lib/kobject.c index 94048826624c..dd0917dd9fa9 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -279,7 +279,7 @@ EXPORT_SYMBOL(kobject_set_name); | |||
279 | * @new_name: object's new name | 279 | * @new_name: object's new name |
280 | */ | 280 | */ |
281 | 281 | ||
282 | int kobject_rename(struct kobject * kobj, char *new_name) | 282 | int kobject_rename(struct kobject * kobj, const char *new_name) |
283 | { | 283 | { |
284 | int error = 0; | 284 | int error = 0; |
285 | 285 | ||
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 2a4e7671eaf4..8e49d21057e4 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -197,7 +197,7 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) | |||
197 | int i = 0; | 197 | int i = 0; |
198 | int retval; | 198 | int retval; |
199 | char *kobj_path = NULL; | 199 | char *kobj_path = NULL; |
200 | char *name = NULL; | 200 | const char *name = NULL; |
201 | char *action_string; | 201 | char *action_string; |
202 | u64 seq; | 202 | u64 seq; |
203 | struct kobject *top_kobj = kobj; | 203 | struct kobject *top_kobj = kobj; |
@@ -246,10 +246,10 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) | |||
246 | if (hotplug_ops->name) | 246 | if (hotplug_ops->name) |
247 | name = hotplug_ops->name(kset, kobj); | 247 | name = hotplug_ops->name(kset, kobj); |
248 | if (name == NULL) | 248 | if (name == NULL) |
249 | name = kset->kobj.name; | 249 | name = kobject_name(&kset->kobj); |
250 | 250 | ||
251 | argv [0] = hotplug_path; | 251 | argv [0] = hotplug_path; |
252 | argv [1] = name; | 252 | argv [1] = (char *)name; /* won't be changed but 'const' has to go */ |
253 | argv [2] = NULL; | 253 | argv [2] = NULL; |
254 | 254 | ||
255 | /* minimal command environment */ | 255 | /* minimal command environment */ |
diff --git a/security/seclvl.c b/security/seclvl.c index 8a0ab0d7949e..c8e87b22c9bd 100644 --- a/security/seclvl.c +++ b/security/seclvl.c | |||
@@ -155,7 +155,7 @@ seclvl_attr_store(struct kobject *kobj, | |||
155 | struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj); | 155 | struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj); |
156 | struct seclvl_attribute *attribute = | 156 | struct seclvl_attribute *attribute = |
157 | container_of(attr, struct seclvl_attribute, attr); | 157 | container_of(attr, struct seclvl_attribute, attr); |
158 | return (attribute->store ? attribute->store(obj, buf, len) : 0); | 158 | return attribute->store ? attribute->store(obj, buf, len) : -EIO; |
159 | } | 159 | } |
160 | 160 | ||
161 | static ssize_t | 161 | static ssize_t |
@@ -164,7 +164,7 @@ seclvl_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) | |||
164 | struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj); | 164 | struct seclvl_obj *obj = container_of(kobj, struct seclvl_obj, kobj); |
165 | struct seclvl_attribute *attribute = | 165 | struct seclvl_attribute *attribute = |
166 | container_of(attr, struct seclvl_attribute, attr); | 166 | container_of(attr, struct seclvl_attribute, attr); |
167 | return (attribute->show ? attribute->show(obj, buf) : 0); | 167 | return attribute->show ? attribute->show(obj, buf) : -EIO; |
168 | } | 168 | } |
169 | 169 | ||
170 | /** | 170 | /** |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 88e052079f85..33eaa5e5d284 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -64,7 +64,7 @@ static struct list_head snd_minors_hash[SNDRV_CARDS]; | |||
64 | 64 | ||
65 | static DECLARE_MUTEX(sound_mutex); | 65 | static DECLARE_MUTEX(sound_mutex); |
66 | 66 | ||
67 | extern struct class_simple *sound_class; | 67 | extern struct class *sound_class; |
68 | 68 | ||
69 | 69 | ||
70 | #ifdef CONFIG_KMOD | 70 | #ifdef CONFIG_KMOD |
@@ -231,7 +231,7 @@ int snd_register_device(int type, snd_card_t * card, int dev, snd_minor_t * reg, | |||
231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); | 231 | devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name); |
232 | if (card) | 232 | if (card) |
233 | device = card->dev; | 233 | device = card->dev; |
234 | class_simple_device_add(sound_class, MKDEV(major, minor), device, name); | 234 | class_device_create(sound_class, MKDEV(major, minor), device, "%s", name); |
235 | 235 | ||
236 | up(&sound_mutex); | 236 | up(&sound_mutex); |
237 | return 0; | 237 | return 0; |
@@ -263,7 +263,7 @@ int snd_unregister_device(int type, snd_card_t * card, int dev) | |||
263 | 263 | ||
264 | if (strncmp(mptr->name, "controlC", 8) || card->number >= cards_limit) /* created in sound.c */ | 264 | if (strncmp(mptr->name, "controlC", 8) || card->number >= cards_limit) /* created in sound.c */ |
265 | devfs_remove("snd/%s", mptr->name); | 265 | devfs_remove("snd/%s", mptr->name); |
266 | class_simple_device_remove(MKDEV(major, minor)); | 266 | class_device_destroy(sound_class, MKDEV(major, minor)); |
267 | 267 | ||
268 | list_del(&mptr->list); | 268 | list_del(&mptr->list); |
269 | up(&sound_mutex); | 269 | up(&sound_mutex); |
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index de91c90a0112..a686be936aff 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -73,7 +73,7 @@ static char dma_alloc_map[MAX_DMA_CHANNELS]; | |||
73 | 73 | ||
74 | 74 | ||
75 | unsigned long seq_time = 0; /* Time for /dev/sequencer */ | 75 | unsigned long seq_time = 0; /* Time for /dev/sequencer */ |
76 | extern struct class_simple *sound_class; | 76 | extern struct class *sound_class; |
77 | 77 | ||
78 | /* | 78 | /* |
79 | * Table for configurable mixer volume handling | 79 | * Table for configurable mixer volume handling |
@@ -567,9 +567,9 @@ static int __init oss_init(void) | |||
567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), | 567 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor), |
568 | S_IFCHR | dev_list[i].mode, | 568 | S_IFCHR | dev_list[i].mode, |
569 | "sound/%s", dev_list[i].name); | 569 | "sound/%s", dev_list[i].name); |
570 | class_simple_device_add(sound_class, | 570 | class_device_create(sound_class, |
571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 571 | MKDEV(SOUND_MAJOR, dev_list[i].minor), |
572 | NULL, "%s", dev_list[i].name); | 572 | NULL, "%s", dev_list[i].name); |
573 | 573 | ||
574 | if (!dev_list[i].num) | 574 | if (!dev_list[i].num) |
575 | continue; | 575 | continue; |
@@ -579,10 +579,9 @@ static int __init oss_init(void) | |||
579 | dev_list[i].minor + (j*0x10)), | 579 | dev_list[i].minor + (j*0x10)), |
580 | S_IFCHR | dev_list[i].mode, | 580 | S_IFCHR | dev_list[i].mode, |
581 | "sound/%s%d", dev_list[i].name, j); | 581 | "sound/%s%d", dev_list[i].name, j); |
582 | class_simple_device_add(sound_class, | 582 | class_device_create(sound_class, |
583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), | 583 | MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), |
584 | NULL, | 584 | NULL, "%s%d", dev_list[i].name, j); |
585 | "%s%d", dev_list[i].name, j); | ||
586 | } | 585 | } |
587 | } | 586 | } |
588 | 587 | ||
@@ -598,12 +597,12 @@ static void __exit oss_cleanup(void) | |||
598 | 597 | ||
599 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { | 598 | for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { |
600 | devfs_remove("sound/%s", dev_list[i].name); | 599 | devfs_remove("sound/%s", dev_list[i].name); |
601 | class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor)); | 600 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); |
602 | if (!dev_list[i].num) | 601 | if (!dev_list[i].num) |
603 | continue; | 602 | continue; |
604 | for (j = 1; j < *dev_list[i].num; j++) { | 603 | for (j = 1; j < *dev_list[i].num; j++) { |
605 | devfs_remove("sound/%s%d", dev_list[i].name, j); | 604 | devfs_remove("sound/%s%d", dev_list[i].name, j); |
606 | class_simple_device_remove(MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); | 605 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); |
607 | } | 606 | } |
608 | } | 607 | } |
609 | 608 | ||
diff --git a/sound/sound_core.c b/sound/sound_core.c index 30f75c9288cb..21a69e096225 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -65,7 +65,7 @@ extern int msnd_classic_init(void); | |||
65 | extern int msnd_pinnacle_init(void); | 65 | extern int msnd_pinnacle_init(void); |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | struct class_simple *sound_class; | 68 | struct class *sound_class; |
69 | EXPORT_SYMBOL(sound_class); | 69 | EXPORT_SYMBOL(sound_class); |
70 | 70 | ||
71 | /* | 71 | /* |
@@ -174,7 +174,7 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f | |||
174 | 174 | ||
175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), | 175 | devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor), |
176 | S_IFCHR | mode, s->name); | 176 | S_IFCHR | mode, s->name); |
177 | class_simple_device_add(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), | 177 | class_device_create(sound_class, MKDEV(SOUND_MAJOR, s->unit_minor), |
178 | NULL, s->name+6); | 178 | NULL, s->name+6); |
179 | return r; | 179 | return r; |
180 | 180 | ||
@@ -198,7 +198,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit) | |||
198 | spin_unlock(&sound_loader_lock); | 198 | spin_unlock(&sound_loader_lock); |
199 | if (p) { | 199 | if (p) { |
200 | devfs_remove(p->name); | 200 | devfs_remove(p->name); |
201 | class_simple_device_remove(MKDEV(SOUND_MAJOR, p->unit_minor)); | 201 | class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); |
202 | kfree(p); | 202 | kfree(p); |
203 | } | 203 | } |
204 | } | 204 | } |
@@ -562,7 +562,7 @@ static void __exit cleanup_soundcore(void) | |||
562 | empty */ | 562 | empty */ |
563 | unregister_chrdev(SOUND_MAJOR, "sound"); | 563 | unregister_chrdev(SOUND_MAJOR, "sound"); |
564 | devfs_remove("sound"); | 564 | devfs_remove("sound"); |
565 | class_simple_destroy(sound_class); | 565 | class_destroy(sound_class); |
566 | } | 566 | } |
567 | 567 | ||
568 | static int __init init_soundcore(void) | 568 | static int __init init_soundcore(void) |
@@ -572,7 +572,7 @@ static int __init init_soundcore(void) | |||
572 | return -EBUSY; | 572 | return -EBUSY; |
573 | } | 573 | } |
574 | devfs_mk_dir ("sound"); | 574 | devfs_mk_dir ("sound"); |
575 | sound_class = class_simple_create(THIS_MODULE, "sound"); | 575 | sound_class = class_create(THIS_MODULE, "sound"); |
576 | if (IS_ERR(sound_class)) | 576 | if (IS_ERR(sound_class)) |
577 | return PTR_ERR(sound_class); | 577 | return PTR_ERR(sound_class); |
578 | 578 | ||