aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/scan.c4
-rw-r--r--drivers/base/Makefile4
-rw-r--r--drivers/base/base.h2
-rw-r--r--drivers/base/bus.c299
-rw-r--r--drivers/base/class.c194
-rw-r--r--drivers/base/class_simple.c199
-rw-r--r--drivers/base/core.c62
-rw-r--r--drivers/base/dd.c248
-rw-r--r--drivers/base/dmapool.c2
-rw-r--r--drivers/base/driver.c39
-rw-r--r--drivers/base/node.c20
-rw-r--r--drivers/base/power/resume.c8
-rw-r--r--drivers/base/power/suspend.c16
-rw-r--r--drivers/base/power/sysfs.c4
-rw-r--r--drivers/base/sys.c4
-rw-r--r--drivers/block/aoe/aoechr.c10
-rw-r--r--drivers/block/as-iosched.c4
-rw-r--r--drivers/block/cfq-iosched.c4
-rw-r--r--drivers/block/deadline-iosched.c4
-rw-r--r--drivers/block/genhd.c2
-rw-r--r--drivers/block/ll_rw_blk.c4
-rw-r--r--drivers/block/paride/pg.c14
-rw-r--r--drivers/block/paride/pt.c20
-rw-r--r--drivers/block/ub.c2
-rw-r--r--drivers/char/dsp56k.c14
-rw-r--r--drivers/char/ftape/zftape/zftape-init.c30
-rw-r--r--drivers/char/hvcs.c14
-rw-r--r--drivers/char/ip2main.c24
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c14
-rw-r--r--drivers/char/istallion.c10
-rw-r--r--drivers/char/lp.c12
-rw-r--r--drivers/char/mbcs.c4
-rw-r--r--drivers/char/mem.c7
-rw-r--r--drivers/char/misc.c16
-rw-r--r--drivers/char/mwave/mwavedd.c2
-rw-r--r--drivers/char/ppdev.c12
-rw-r--r--drivers/char/raw.c18
-rw-r--r--drivers/char/snsc.c7
-rw-r--r--drivers/char/stallion.c10
-rw-r--r--drivers/char/tipar.c14
-rw-r--r--drivers/char/tpm/tpm.c6
-rw-r--r--drivers/char/tty_io.c16
-rw-r--r--drivers/char/vc_screen.c16
-rw-r--r--drivers/char/viotape.c16
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/dio/dio-sysfs.c10
-rw-r--r--drivers/eisa/eisa-bus.c4
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/firmware/efivars.c4
-rw-r--r--drivers/i2c/chips/adm1021.c6
-rw-r--r--drivers/i2c/chips/adm1025.c28
-rw-r--r--drivers/i2c/chips/adm1026.c572
-rw-r--r--drivers/i2c/chips/adm1031.c44
-rw-r--r--drivers/i2c/chips/asb100.c46
-rw-r--r--drivers/i2c/chips/ds1621.c6
-rw-r--r--drivers/i2c/chips/fscher.c8
-rw-r--r--drivers/i2c/chips/fscpos.c16
-rw-r--r--drivers/i2c/chips/gl518sm.c12
-rw-r--r--drivers/i2c/chips/gl520sm.c8
-rw-r--r--drivers/i2c/chips/it87.c50
-rw-r--r--drivers/i2c/chips/lm63.c24
-rw-r--r--drivers/i2c/chips/lm75.c4
-rw-r--r--drivers/i2c/chips/lm77.c14
-rw-r--r--drivers/i2c/chips/lm78.c36
-rw-r--r--drivers/i2c/chips/lm80.c20
-rw-r--r--drivers/i2c/chips/lm83.c6
-rw-r--r--drivers/i2c/chips/lm85.c72
-rw-r--r--drivers/i2c/chips/lm87.c46
-rw-r--r--drivers/i2c/chips/lm90.c12
-rw-r--r--drivers/i2c/chips/lm92.c14
-rw-r--r--drivers/i2c/chips/max1619.c6
-rw-r--r--drivers/i2c/chips/pc87360.c68
-rw-r--r--drivers/i2c/chips/pcf8574.c6
-rw-r--r--drivers/i2c/chips/pcf8591.c10
-rw-r--r--drivers/i2c/chips/sis5595.c34
-rw-r--r--drivers/i2c/chips/smsc47b397.c4
-rw-r--r--drivers/i2c/chips/smsc47m1.c20
-rw-r--r--drivers/i2c/chips/via686a.c32
-rw-r--r--drivers/i2c/chips/w83627hf.c56
-rw-r--r--drivers/i2c/chips/w83781d.c52
-rw-r--r--drivers/i2c/chips/w83l785ts.c4
-rw-r--r--drivers/i2c/i2c-core.c4
-rw-r--r--drivers/ieee1394/dv1394.c6
-rw-r--r--drivers/ieee1394/ieee1394_core.c8
-rw-r--r--drivers/ieee1394/ieee1394_core.h3
-rw-r--r--drivers/ieee1394/nodemgr.c27
-rw-r--r--drivers/ieee1394/raw1394.c10
-rw-r--r--drivers/ieee1394/sbp2.c2
-rw-r--r--drivers/ieee1394/video1394.c4
-rw-r--r--drivers/infiniband/core/sysfs.c122
-rw-r--r--drivers/input/evdev.c9
-rw-r--r--drivers/input/gameport/gameport.c4
-rw-r--r--drivers/input/input.c10
-rw-r--r--drivers/input/joydev.c8
-rw-r--r--drivers/input/keyboard/atkbd.c4
-rw-r--r--drivers/input/mouse/psmouse.h4
-rw-r--r--drivers/input/mousedev.c16
-rw-r--r--drivers/input/serio/serio.c16
-rw-r--r--drivers/input/tsdev.c9
-rw-r--r--drivers/isdn/capi/capi.c14
-rw-r--r--drivers/macintosh/adb.c9
-rw-r--r--drivers/macintosh/therm_adt746x.c11
-rw-r--r--drivers/macintosh/therm_pm72.c4
-rw-r--r--drivers/macintosh/therm_windtunnel.c4
-rw-r--r--drivers/mca/mca-bus.c4
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c13
-rw-r--r--drivers/message/fusion/mptscsih.c2
-rw-r--r--drivers/message/fusion/mptscsih.h2
-rw-r--r--drivers/mmc/mmc_sysfs.c2
-rw-r--r--drivers/net/ppp_generic.c14
-rw-r--r--drivers/net/wan/cosa.c12
-rw-r--r--drivers/pci/hotplug/cpqphp_sysfs.c4
-rw-r--r--drivers/pci/hotplug/pci_hotplug_core.c4
-rw-r--r--drivers/pci/hotplug/rpadlpar_sysfs.c2
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c4
-rw-r--r--drivers/pci/pci-driver.c26
-rw-r--r--drivers/pci/pci-sysfs.c21
-rw-r--r--drivers/pci/pcie/portdrv_core.c139
-rw-r--r--drivers/pcmcia/ds.c4
-rw-r--r--drivers/pnp/card.c4
-rw-r--r--drivers/pnp/driver.c12
-rw-r--r--drivers/pnp/interface.c8
-rw-r--r--drivers/s390/block/dasd_devmap.c10
-rw-r--r--drivers/s390/block/dcssblk.c24
-rw-r--r--drivers/s390/char/raw3270.c6
-rw-r--r--drivers/s390/char/tape_class.c10
-rw-r--r--drivers/s390/char/tape_core.c10
-rw-r--r--drivers/s390/char/vmlogrdr.c22
-rw-r--r--drivers/s390/cio/ccwgroup.c6
-rw-r--r--drivers/s390/cio/chsc.c6
-rw-r--r--drivers/s390/cio/cmf.c12
-rw-r--r--drivers/s390/cio/device.c14
-rw-r--r--drivers/s390/net/claw.c40
-rw-r--r--drivers/s390/net/ctcmain.c18
-rw-r--r--drivers/s390/net/lcs.c10
-rw-r--r--drivers/s390/net/netiucv.c44
-rw-r--r--drivers/s390/net/qeth_sys.c126
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c2
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c10
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c10
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_unit.c6
-rw-r--r--drivers/scsi/53c700.c2
-rw-r--r--drivers/scsi/arm/eesox.c4
-rw-r--r--drivers/scsi/arm/powertec.c4
-rw-r--r--drivers/scsi/ipr.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c4
-rw-r--r--drivers/scsi/osst.c10
-rw-r--r--drivers/scsi/scsi_sysfs.c42
-rw-r--r--drivers/scsi/scsi_transport_spi.c16
-rw-r--r--drivers/scsi/sg.c14
-rw-r--r--drivers/scsi/st.c28
-rw-r--r--drivers/sh/superhyway/superhyway-sysfs.c2
-rw-r--r--drivers/usb/core/devices.c2
-rw-r--r--drivers/usb/core/file.c13
-rw-r--r--drivers/usb/core/hcd.c61
-rw-r--r--drivers/usb/core/sysfs.c26
-rw-r--r--drivers/usb/core/usb.c53
-rw-r--r--drivers/usb/gadget/dummy_hcd.c4
-rw-r--r--drivers/usb/gadget/file_storage.c8
-rw-r--r--drivers/usb/gadget/net2280.c6
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c10
-rw-r--r--drivers/usb/host/ohci-dbg.c10
-rw-r--r--drivers/usb/input/aiptek.c78
-rw-r--r--drivers/usb/misc/cytherm.c20
-rw-r--r--drivers/usb/misc/phidgetkit.c14
-rw-r--r--drivers/usb/misc/phidgetservo.c4
-rw-r--r--drivers/usb/misc/usbled.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c6
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/video/fbmem.c10
-rw-r--r--drivers/video/gbefb.c4
-rw-r--r--drivers/video/w100fb.c12
-rw-r--r--drivers/w1/w1.c16
-rw-r--r--drivers/w1/w1_family.h4
-rw-r--r--drivers/w1/w1_smem.c8
-rw-r--r--drivers/w1/w1_therm.c8
-rw-r--r--drivers/zorro/zorro-sysfs.c4
178 files changed, 2153 insertions, 2128 deletions
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}
70static ssize_t acpi_device_attr_store(struct kobject *kobj, 70static 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
78static struct sysfs_ops acpi_device_sysfs_ops = { 78static 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
3obj-y := core.o sys.o bus.o \ 3obj-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
7obj-y += power/ 7obj-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);
4extern int bus_add_driver(struct device_driver *); 4extern int bus_add_driver(struct device_driver *);
5extern void bus_remove_driver(struct device_driver *); 5extern void bus_remove_driver(struct device_driver *);
6 6
7extern void driver_detach(struct device_driver * drv);
8
7static inline struct class_device *to_class_dev(struct kobject *obj) 9static 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
136decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
137 134
138static 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
161static int __bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 136static 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,
204int bus_for_each_dev(struct bus_type * bus, struct device * start, 162int 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
182static 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,
235int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, 208int 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
259void 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 */
284int 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 */
311int 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 */
353void 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
386void 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
405static 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
413static int device_add_attrs(struct bus_type * bus, struct device * dev) 226static 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)
749EXPORT_SYMBOL_GPL(bus_for_each_dev); 560EXPORT_SYMBOL_GPL(bus_for_each_dev);
750EXPORT_SYMBOL_GPL(bus_for_each_drv); 561EXPORT_SYMBOL_GPL(bus_for_each_drv);
751 562
752EXPORT_SYMBOL_GPL(driver_probe_device);
753EXPORT_SYMBOL_GPL(device_bind_driver);
754EXPORT_SYMBOL_GPL(device_release_driver);
755EXPORT_SYMBOL_GPL(device_attach);
756EXPORT_SYMBOL_GPL(driver_attach);
757
758EXPORT_SYMBOL_GPL(bus_add_device); 563EXPORT_SYMBOL_GPL(bus_add_device);
759EXPORT_SYMBOL_GPL(bus_remove_device); 564EXPORT_SYMBOL_GPL(bus_remove_device);
760EXPORT_SYMBOL_GPL(bus_register); 565EXPORT_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
166static void class_create_release(struct class *cls)
167{
168 kfree(cls);
169}
170
171static 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 */
187struct 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
210error:
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 */
222void 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
265static char *class_hotplug_name(struct kset *kset, struct kobject *kobj) 329static 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}
378static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
379 442
380void class_device_initialize(struct class_device *class_dev) 443void 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 */
543struct 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
573error:
574 kfree(class_dev);
575 return ERR_PTR(retval);
576}
577
447void class_device_del(struct class_device *class_dev) 578void 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 */
624void 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
480int class_device_rename(struct class_device *class_dev, char *new_name) 642int 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);
576EXPORT_SYMBOL_GPL(class_unregister); 738EXPORT_SYMBOL_GPL(class_unregister);
577EXPORT_SYMBOL_GPL(class_get); 739EXPORT_SYMBOL_GPL(class_get);
578EXPORT_SYMBOL_GPL(class_put); 740EXPORT_SYMBOL_GPL(class_put);
741EXPORT_SYMBOL_GPL(class_create);
742EXPORT_SYMBOL_GPL(class_destroy);
579 743
580EXPORT_SYMBOL_GPL(class_device_register); 744EXPORT_SYMBOL_GPL(class_device_register);
581EXPORT_SYMBOL_GPL(class_device_unregister); 745EXPORT_SYMBOL_GPL(class_device_unregister);
@@ -584,6 +748,8 @@ EXPORT_SYMBOL_GPL(class_device_add);
584EXPORT_SYMBOL_GPL(class_device_del); 748EXPORT_SYMBOL_GPL(class_device_del);
585EXPORT_SYMBOL_GPL(class_device_get); 749EXPORT_SYMBOL_GPL(class_device_get);
586EXPORT_SYMBOL_GPL(class_device_put); 750EXPORT_SYMBOL_GPL(class_device_put);
751EXPORT_SYMBOL_GPL(class_device_create);
752EXPORT_SYMBOL_GPL(class_device_destroy);
587EXPORT_SYMBOL_GPL(class_device_create_file); 753EXPORT_SYMBOL_GPL(class_device_create_file);
588EXPORT_SYMBOL_GPL(class_device_remove_file); 754EXPORT_SYMBOL_GPL(class_device_remove_file);
589EXPORT_SYMBOL_GPL(class_device_create_bin_file); 755EXPORT_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
15struct class_simple {
16 struct class class;
17};
18#define to_class_simple(d) container_of(d, struct class_simple, class)
19
20struct 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
26static LIST_HEAD(simple_dev_list);
27static DEFINE_SPINLOCK(simple_dev_list_lock);
28
29static 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
35static 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 */
53struct 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
75error:
76 kfree(cs);
77 return ERR_PTR(retval);
78}
79EXPORT_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 */
88void class_simple_destroy(struct class_simple *cs)
89{
90 if ((cs == NULL) || (IS_ERR(cs)))
91 return;
92
93 class_unregister(&cs->class);
94}
95EXPORT_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 */
113struct 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
148error:
149 kfree(s_dev);
150 return ERR_PTR(retval);
151}
152EXPORT_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 */
162int 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}
170EXPORT_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 */
179void 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}
199EXPORT_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
105static char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) 105static 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
370static 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 */
388int device_for_each_child(struct device * dev, void * data, 388int 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 */
413struct 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
421int __init devices_init(void) 402int __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);
433EXPORT_SYMBOL_GPL(device_unregister); 414EXPORT_SYMBOL_GPL(device_unregister);
434EXPORT_SYMBOL_GPL(get_device); 415EXPORT_SYMBOL_GPL(get_device);
435EXPORT_SYMBOL_GPL(put_device); 416EXPORT_SYMBOL_GPL(put_device);
436EXPORT_SYMBOL_GPL(device_find);
437 417
438EXPORT_SYMBOL_GPL(device_create_file); 418EXPORT_SYMBOL_GPL(device_create_file);
439EXPORT_SYMBOL_GPL(device_remove_file); 419EXPORT_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 */
41void 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 */
68static 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
108static 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 */
125int 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
139static 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 */
171void 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
185static 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
203void 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 */
220void 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
244EXPORT_SYMBOL_GPL(device_bind_driver);
245EXPORT_SYMBOL_GPL(device_release_driver);
246EXPORT_SYMBOL_GPL(device_attach);
247EXPORT_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 */
41static DECLARE_MUTEX (pools_lock); 41static DECLARE_MUTEX (pools_lock);
42 42
43static ssize_t 43static ssize_t
44show_pools (struct device *dev, char *buf) 44show_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
22static 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
37int 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
55EXPORT_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 */
86int driver_register(struct device_driver * drv) 123int 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 */
139int __init register_node(struct node *node, int num, struct node *parent) 139int 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 */
163void 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
157int __init register_node_type(void) 173static 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
23int resume_device(struct device * dev) 23int 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
27static ssize_t state_show(struct device * dev, char * buf) 27static 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
32static ssize_t state_store(struct device * dev, const char * buf, size_t n) 32static 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
56static struct sysfs_ops sysfs_ops = { 56static 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;
36static struct semaphore emsgs_sema; 36static struct semaphore emsgs_sema;
37static spinlock_t emsgs_lock; 37static spinlock_t emsgs_lock;
38static int nblocked_emsgs_readers; 38static int nblocked_emsgs_readers;
39static struct class_simple *aoe_class; 39static struct class *aoe_class;
40static struct aoe_chardev chardevs[] = { 40static 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
223static char pg_scratch[512]; /* scratch block buffer */ 223static char pg_scratch[512]; /* scratch block buffer */
224 224
225static struct class_simple *pg_class; 225static 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
690out_class: 690out_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);
693out_chrdev: 693out_chrdev:
694 unregister_chrdev(major, "pg"); 694 unregister_chrdev(major, "pg");
695out: 695out:
@@ -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 */
245static struct class_simple *pt_class; 245static struct class *pt_class;
246 246
247static inline int status_reg(struct pi_adapter *pi) 247static 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
996out_class: 996out_class:
997 class_simple_destroy(pt_class); 997 class_destroy(pt_class);
998out_chrdev: 998out_chrdev:
999 unregister_chrdev(major, "pt"); 999 unregister_chrdev(major, "pt");
1000out: 1000out:
@@ -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
433static ssize_t ub_diag_show(struct device *dev, char *page) 433static 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
147static struct class_simple *dsp56k_class; 147static struct class *dsp56k_class;
148 148
149static int dsp56k_reset(void) 149static 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
528out_class: 528out_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);
531out_chrdev: 531out_chrdev:
532 unregister_chrdev(DSP56K_MAJOR, "dsp56k"); 532 unregister_chrdev(DSP56K_MAJOR, "dsp56k");
533out: 533out:
@@ -537,8 +537,8 @@ module_init(dsp56k_init_driver);
537 537
538static void __exit dsp56k_cleanup_driver(void) 538static 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
102static struct class_simple *zft_class; 102static 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
1469static ssize_t hvcs_partner_vtys_show(struct device *dev, char *buf) 1469static 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}
1481static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL); 1481static DEVICE_ATTR(partner_vtys, S_IRUGO, hvcs_partner_vtys_show, NULL);
1482 1482
1483static ssize_t hvcs_partner_clcs_show(struct device *dev, char *buf) 1483static 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}
1495static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL); 1495static DEVICE_ATTR(partner_clcs, S_IRUGO, hvcs_partner_clcs_show, NULL);
1496 1496
1497static ssize_t hvcs_current_vty_store(struct device *dev, const char * buf, 1497static 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
1508static ssize_t hvcs_current_vty_show(struct device *dev, char *buf) 1508static 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)
1521static DEVICE_ATTR(current_vty, 1521static 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
1524static ssize_t hvcs_vterm_state_store(struct device *dev, const char *buf, 1524static 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
1562static ssize_t hvcs_vterm_state_show(struct device *dev, char *buf) 1562static 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)
1574static DEVICE_ATTR(vterm_state, S_IRUGO | S_IWUSR, 1574static 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
1577static ssize_t hvcs_index_show(struct device *dev, char *buf) 1577static 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];
302static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0}; 302static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
303 303
304/* for sysfs class support */ 304/* for sysfs class support */
305static struct class_simple *ip2_class; 305static 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
800out_class: 800out_class:
801 class_simple_destroy(ip2_class); 801 class_destroy(ip2_class);
802out_chrdev: 802out_chrdev:
803 unregister_chrdev(IP2_IPL_MAJOR, "ip2"); 803 unregister_chrdev(IP2_IPL_MAJOR, "ip2");
804out: 804out:
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
523static struct class_simple *ipmi_class; 523static struct class *ipmi_class;
524 524
525static void ipmi_new_smi(int if_num) 525static 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
535static void ipmi_smi_gone(int if_num) 535static 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
589static __exit void cleanup_ipmi(void) 589static __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
795static struct class_simple *istallion_class; 795static 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 @@
146static struct lp_struct lp_table[LP_NO]; 146static struct lp_struct lp_table[LP_NO];
147 147
148static unsigned int lp_count = 0; 148static unsigned int lp_count = 0;
149static struct class_simple *lp_class; 149static struct class *lp_class;
150 150
151#ifdef CONFIG_LP_CONSOLE 151#ifdef CONFIG_LP_CONSOLE
152static struct parport *console_registered; // initially NULL 152static 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
932out_class: 932out_class:
933 class_simple_destroy(lp_class); 933 class_destroy(lp_class);
934out_devfs: 934out_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
702static ssize_t show_algo(struct device *dev, char *buf) 702static 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
718static ssize_t store_algo(struct device *dev, const char *buf, size_t count) 718static 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
859static struct class_simple *mem_class; 859static struct class *mem_class;
860 860
861static int __init chr_dev_init(void) 861static 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 */
183static struct class_simple *misc_class; 183static struct class *misc_class;
184 184
185static struct file_operations misc_fops = { 185static 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) \
475static ssize_t mwave_show_##attr_name(struct device *dev, char *buf) \ 475static 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
740static struct class_simple *ppdev_class; 740static struct class *ppdev_class;
741 741
742static struct file_operations pp_fops = { 742static 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
753static void pp_attach(struct parport *port) 753static 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
759static void pp_detach(struct parport *port) 759static 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
764static struct parport_driver pp_driver = { 764static 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);
802out_chrdev: 802out_chrdev:
803 unregister_chrdev(PP_MAJOR, CHRDEV); 803 unregister_chrdev(PP_MAJOR, CHRDEV);
804out: 804out:
@@ -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
30static struct class_simple *raw_class; 30static struct class *raw_class;
31static struct raw_device_data raw_devices[MAX_RAW_MINORS]; 31static struct raw_device_data raw_devices[MAX_RAW_MINORS];
32static DECLARE_MUTEX(raw_mutex); 32static DECLARE_MUTEX(raw_mutex);
33static struct file_operations raw_ctl_fops; /* forward declaration */ 33static struct file_operations raw_ctl_fops; /* forward declaration */
@@ -127,8 +127,8 @@ raw_ioctl(struct inode *inode, struct file *filp,
127 127
128static void bind_device(struct raw_config_request *rq) 128static 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
360static 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
722static struct class_simple *stallion_class; 722static 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 */
90static unsigned int tp_count; /* tipar count */ 90static unsigned int tp_count; /* tipar count */
91static unsigned long opened; /* opened devices */ 91static unsigned long opened; /* opened devices */
92 92
93static struct class_simple *tipar_class; 93static 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
460out_class: 460out_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);
463out: 463out:
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
215static ssize_t show_pcrs(struct device *dev, char *buf) 215static 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
258static ssize_t show_pubek(struct device *dev, char *buf) 258static 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
333static ssize_t show_caps(struct device *dev, char *buf) 333static 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
2657static struct class_simple *tty_class; 2657static 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,
2701void tty_unregister_device(struct tty_driver *driver, unsigned index) 2701void 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
2707EXPORT_SYMBOL(tty_register_device); 2707EXPORT_SYMBOL(tty_register_device);
@@ -2918,7 +2918,7 @@ extern int vty_init(void);
2918 2918
2919static int __init tty_class_init(void) 2919static 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
477static struct class_simple *vc_class; 477static struct class *vc_class;
478 478
479void vcs_make_devfs(struct tty_struct *tty) 479void 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}
490void vcs_remove_devfs(struct tty_struct *tty) 490void 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
498int __init vcs_init(void) 498int __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
238static struct mtget viomtget[VIOTAPE_MAX_TAPE]; 238static struct mtget viomtget[VIOTAPE_MAX_TAPE];
239 239
240static struct class_simple *tape_class; 240static struct class *tape_class;
241 241
242static struct device *tape_device[VIOTAPE_MAX_TAPE]; 242static 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
1072unreg_class: 1072unreg_class:
1073 class_simple_destroy(tape_class); 1073 class_destroy(tape_class);
1074unreg_chrdev: 1074unreg_chrdev:
1075 unregister_chrdev(VIOTAPE_MAJOR, "viotape"); 1075 unregister_chrdev(VIOTAPE_MAJOR, "viotape");
1076clear_handler: 1076clear_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
20static ssize_t dio_show_id(struct device *dev, char *buf) 20static 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}
27static DEVICE_ATTR(id, S_IRUGO, dio_show_id, NULL); 27static DEVICE_ATTR(id, S_IRUGO, dio_show_id, NULL);
28 28
29static ssize_t dio_show_ipl(struct device *dev, char *buf) 29static 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}
36static DEVICE_ATTR(ipl, S_IRUGO, dio_show_ipl, NULL); 36static DEVICE_ATTR(ipl, S_IRUGO, dio_show_ipl, NULL);
37 37
38static ssize_t dio_show_secid(struct device *dev, char *buf) 38static 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}
45static DEVICE_ATTR(secid, S_IRUGO, dio_show_secid, NULL); 45static DEVICE_ATTR(secid, S_IRUGO, dio_show_secid, NULL);
46 46
47static ssize_t dio_show_name(struct device *dev, char *buf) 47static 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}
54static DEVICE_ATTR(name, S_IRUGO, dio_show_name, NULL); 54static DEVICE_ATTR(name, S_IRUGO, dio_show_name, NULL);
55 55
56static ssize_t dio_show_resource(struct device *dev, char *buf) 56static 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
152static ssize_t eisa_show_sig (struct device *dev, char *buf) 152static 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
158static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL); 158static DEVICE_ATTR(signature, S_IRUGO, eisa_show_sig, NULL);
159 159
160static ssize_t eisa_show_state (struct device *dev, char *buf) 160static 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) \
140static ssize_t show_##value(struct device *dev, char *buf) \ 140static 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);
150show(remote_temp_input); 150show(remote_temp_input);
151 151
152#define show2(value) \ 152#define show2(value) \
153static ssize_t show_##value(struct device *dev, char *buf) \ 153static 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);
159show2(die_code); 159show2(die_code);
160 160
161#define set(value, reg) \ 161#define set(value, reg) \
162static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 162static 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) \
156static ssize_t show_in##offset(struct device *dev, char *buf) \ 156static 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} \
162static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 162static 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} \
168static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 168static 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);
180show_in(5); 180show_in(5);
181 181
182#define show_temp(offset) \ 182#define show_temp(offset) \
183static ssize_t show_temp##offset(struct device *dev, char *buf) \ 183static 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} \
188static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 188static 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} \
193static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 193static 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);
200show_temp(2); 200show_temp(2);
201 201
202#define set_in(offset) \ 202#define set_in(offset) \
203static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ 203static 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} \
217static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ 217static 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);
240set_in(5); 240set_in(5);
241 241
242#define set_temp(offset) \ 242#define set_temp(offset) \
243static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 243static 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} \
257static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 257static 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, \
275set_temp(1); 275set_temp(1);
276set_temp(2); 276set_temp(2);
277 277
278static ssize_t show_alarms(struct device *dev, char *buf) 278static 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}
283static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 283static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
284 284
285static ssize_t show_vid(struct device *dev, char *buf) 285static 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}
290static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); 290static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL);
291 291
292static ssize_t show_vrm(struct device *dev, char *buf) 292static 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}
297static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 297static 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
714static ssize_t show_in(struct device *dev, char *buf, int nr) 715static 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}
719static ssize_t show_in_min(struct device *dev, char *buf, int nr) 723static 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}
724static ssize_t set_in_min(struct device *dev, const char *buf, 731static 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}
737static ssize_t show_in_max(struct device *dev, char *buf, int nr) 746static 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}
742static ssize_t set_in_max(struct device *dev, const char *buf, 754static 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) \
757static ssize_t show_in##offset (struct device *dev, char *buf) \ 771static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \
758{ \ 772 NULL, offset); \
759 return show_in(dev, buf, offset); \ 773static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
760} \ 774 show_in_min, set_in_min, offset); \
761static ssize_t show_in##offset##_min (struct device *dev, char *buf) \ 775static 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} \
765static 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} \
770static ssize_t show_in##offset##_max (struct device *dev, char *buf) \
771{ \
772 return show_in_max(dev, buf, offset); \
773} \
774static 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} \
779static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in##offset, NULL); \
780static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
781 show_in##offset##_min, set_in##offset##_min); \
782static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
783 show_in##offset##_max, set_in##offset##_max);
784 777
785 778
786in_reg(0); 779in_reg(0);
@@ -800,19 +793,19 @@ in_reg(13);
800in_reg(14); 793in_reg(14);
801in_reg(15); 794in_reg(15);
802 795
803static ssize_t show_in16(struct device *dev, char *buf) 796static 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}
809static ssize_t show_in16_min(struct device *dev, char *buf) 802static 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}
815static ssize_t set_in16_min(struct device *dev, const char *buf, size_t count) 808static 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}
827static ssize_t show_in16_max(struct device *dev, char *buf) 820static 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}
833static ssize_t set_in16_max(struct device *dev, const char *buf, size_t count) 826static 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
846static DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL); 839static SENSOR_DEVICE_ATTR(in16_input, S_IRUGO, show_in16, NULL, 16);
847static DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min); 840static SENSOR_DEVICE_ATTR(in16_min, S_IRUGO | S_IWUSR, show_in16_min, set_in16_min, 16);
848static DEVICE_ATTR(in16_max, S_IRUGO | S_IWUSR, show_in16_max, set_in16_max); 841static 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
855static ssize_t show_fan(struct device *dev, char *buf, int nr) 848static 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}
861static ssize_t show_fan_min(struct device *dev, char *buf, int nr) 857static 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}
867static ssize_t set_fan_min(struct device *dev, const char *buf, 866static 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) \
883static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 884static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \
884{ \ 885 offset - 1); \
885 return show_fan(dev, buf, offset - 1); \ 886static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
886} \ 887 show_fan_min, set_fan_min, offset - 1);
887static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \
888{ \
889 return show_fan_min(dev, buf, offset - 1); \
890} \
891static 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} \
896static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL); \
897static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
898 show_fan_##offset##_min, set_fan_##offset##_min);
899 888
900fan_offset(1); 889fan_offset(1);
901fan_offset(2); 890fan_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 */
929static ssize_t show_fan_div(struct device *dev, char *buf, int nr) 918static 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}
934static ssize_t set_fan_div(struct device *dev, const char *buf, 926static 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) \
970static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 964static 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} \
974static 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} \
979static DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
980 show_fan_##offset##_div, set_fan_##offset##_div);
981 966
982fan_offset_div(1); 967fan_offset_div(1);
983fan_offset_div(2); 968fan_offset_div(2);
@@ -989,19 +974,27 @@ fan_offset_div(7);
989fan_offset_div(8); 974fan_offset_div(8);
990 975
991/* Temps */ 976/* Temps */
992static ssize_t show_temp(struct device *dev, char *buf, int nr) 977static 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}
997static ssize_t show_temp_min(struct device *dev, char *buf, int nr) 985static 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}
1002static ssize_t set_temp_min(struct device *dev, const char *buf, 993static 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}
1016static ssize_t show_temp_max(struct device *dev, char *buf, int nr) 1009static 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}
1021static ssize_t set_temp_max(struct device *dev, const char *buf, 1017static 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
1036static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 1034#define temp_reg(offset) \
1037{ \ 1035static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \
1038 return show_temp(dev, buf, offset - 1); \ 1036 NULL, offset - 1); \
1039} \ 1037static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
1040static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ 1038 show_temp_min, set_temp_min, offset - 1); \
1041{ \ 1039static 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} \
1044static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \
1045{ \
1046 return show_temp_max(dev, buf, offset - 1); \
1047} \
1048static 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} \
1053static 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} \
1058static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp_##offset, NULL); \
1059static DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
1060 show_temp_##offset##_min, set_temp_##offset##_min); \
1061static DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
1062 show_temp_##offset##_max, set_temp_##offset##_max);
1063 1041
1064 1042
1065temp_reg(1); 1043temp_reg(1);
1066temp_reg(2); 1044temp_reg(2);
1067temp_reg(3); 1045temp_reg(3);
1068 1046
1069static ssize_t show_temp_offset(struct device *dev, char *buf, int nr) 1047static 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}
1074static ssize_t set_temp_offset(struct device *dev, const char *buf, 1055static 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) \
1090static ssize_t show_temp_##offset##_offset (struct device *dev, char *buf) \ 1074static 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} \
1094static 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} \
1099static DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \
1100 show_temp_##offset##_offset, set_temp_##offset##_offset);
1101 1076
1102temp_offset_reg(1); 1077temp_offset_reg(1);
1103temp_offset_reg(2); 1078temp_offset_reg(2);
1104temp_offset_reg(3); 1079temp_offset_reg(3);
1105 1080
1106static ssize_t show_temp_auto_point1_temp_hyst(struct device *dev, char *buf, 1081static 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}
1113static ssize_t show_temp_auto_point2_temp(struct device *dev, char *buf, 1090static 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}
1120static ssize_t show_temp_auto_point1_temp(struct device *dev, char *buf, 1099static 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}
1126static ssize_t set_temp_auto_point1_temp(struct device *dev, const char *buf, 1107static 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) \
1142static ssize_t show_temp##offset##_auto_point1_temp (struct device *dev, \ 1125static 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); \ 1128static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \
1146} \ 1129 show_temp_auto_point1_temp_hyst, NULL, offset - 1); \
1147static ssize_t set_temp##offset##_auto_point1_temp (struct device *dev, \ 1130static 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} \
1152static 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} \
1157static 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} \
1162static 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); \
1165static DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO, \
1166 show_temp##offset##_auto_point1_temp_hyst, NULL); \
1167static DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \
1168 show_temp##offset##_auto_point2_temp, NULL);
1169 1132
1170temp_auto_point(1); 1133temp_auto_point(1);
1171temp_auto_point(2); 1134temp_auto_point(2);
1172temp_auto_point(3); 1135temp_auto_point(3);
1173 1136
1174static ssize_t show_temp_crit_enable(struct device *dev, char *buf) 1137static 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}
1179static ssize_t set_temp_crit_enable(struct device *dev, const char *buf, 1143static 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
1196static DEVICE_ATTR(temp1_crit_enable, S_IRUGO | S_IWUSR, 1160#define temp_crit_enable(offset) \
1197 show_temp_crit_enable, set_temp_crit_enable); 1161static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \
1198
1199static DEVICE_ATTR(temp2_crit_enable, S_IRUGO | S_IWUSR,
1200 show_temp_crit_enable, set_temp_crit_enable);
1201
1202static 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
1164temp_crit_enable(1);
1165temp_crit_enable(2);
1166temp_crit_enable(3);
1205 1167
1206static ssize_t show_temp_crit(struct device *dev, char *buf, int nr) 1168static 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}
1211static ssize_t set_temp_crit(struct device *dev, const char *buf, 1176static 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) \
1227static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ 1194static 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} \
1231static 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} \
1236static DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
1237 show_temp_##offset##_crit, set_temp_##offset##_crit);
1238 1196
1239temp_crit_reg(1); 1197temp_crit_reg(1);
1240temp_crit_reg(2); 1198temp_crit_reg(2);
1241temp_crit_reg(3); 1199temp_crit_reg(3);
1242 1200
1243static ssize_t show_analog_out_reg(struct device *dev, char *buf) 1201static 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}
1248static ssize_t set_analog_out_reg(struct device *dev, const char *buf, 1206static 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,
1262static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg, 1220static DEVICE_ATTR(analog_out, S_IRUGO | S_IWUSR, show_analog_out_reg,
1263 set_analog_out_reg); 1221 set_analog_out_reg);
1264 1222
1265static ssize_t show_vid_reg(struct device *dev, char *buf) 1223static 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
1271static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); 1229static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL);
1272 1230
1273static ssize_t show_vrm_reg(struct device *dev, char *buf) 1231static 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}
1278static ssize_t store_vrm_reg(struct device *dev, const char *buf, 1236static 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
1288static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 1246static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
1289 1247
1290static ssize_t show_alarms_reg(struct device *dev, char *buf) 1248static 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
1296static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); 1254static DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
1297 1255
1298static ssize_t show_alarm_mask(struct device *dev, char *buf) 1256static 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}
1303static ssize_t set_alarm_mask(struct device *dev, const char *buf, 1261static 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
1334static ssize_t show_gpio(struct device *dev, char *buf) 1292static 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}
1339static ssize_t set_gpio(struct device *dev, const char *buf, 1297static 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,
1359static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio); 1317static DEVICE_ATTR(gpio, S_IRUGO | S_IWUSR, show_gpio, set_gpio);
1360 1318
1361 1319
1362static ssize_t show_gpio_mask(struct device *dev, char *buf) 1320static 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}
1367static ssize_t set_gpio_mask(struct device *dev, const char *buf, 1325static 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
1387static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask); 1345static DEVICE_ATTR(gpio_mask, S_IRUGO | S_IWUSR, show_gpio_mask, set_gpio_mask);
1388 1346
1389static ssize_t show_pwm_reg(struct device *dev, char *buf) 1347static 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}
1394static ssize_t set_pwm_reg(struct device *dev, const char *buf, 1352static 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}
1410static ssize_t show_auto_pwm_min(struct device *dev, char *buf) 1368static 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}
1415static ssize_t set_auto_pwm_min(struct device *dev, const char *buf, 1373static 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}
1432static ssize_t show_auto_pwm_max(struct device *dev, char *buf) 1390static 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}
1436static ssize_t show_pwm_enable(struct device *dev, char *buf) 1394static 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}
1441static ssize_t set_pwm_enable(struct device *dev, const char *buf, 1399static 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) \
295static ssize_t show_fan_auto_channel_##offset (struct device *dev, char *buf) \ 295static 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} \
299static ssize_t set_fan_auto_channel_##offset (struct device *dev, \ 299static 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) \
360static ssize_t show_auto_temp_##offset##_off (struct device *dev, char *buf) \ 360static 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} \
364static ssize_t show_auto_temp_##offset##_min (struct device *dev, char *buf) \ 364static 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} \
368static ssize_t show_auto_temp_##offset##_max (struct device *dev, char *buf) \ 368static 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} \
372static ssize_t set_auto_temp_##offset##_min (struct device *dev, \ 372static 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} \
377static ssize_t set_auto_temp_##offset##_max (struct device *dev, \ 377static 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) \
424static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ 424static 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} \
428static ssize_t set_pwm_##offset (struct device *dev, \ 428static 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) \
560static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 560static 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} \
564static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 564static 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} \
568static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 568static 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} \
572static ssize_t set_fan_##offset##_min (struct device *dev, \ 572static 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} \
577static ssize_t set_fan_##offset##_div (struct device *dev, \ 577static 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) \
670static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 670static 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} \
674static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ 674static 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} \
678static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ 678static 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} \
682static ssize_t show_temp_##offset##_crit (struct device *dev, char *buf) \ 682static 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} \
686static ssize_t set_temp_##offset##_min (struct device *dev, \ 686static 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} \
691static ssize_t set_temp_##offset##_max (struct device *dev, \ 691static 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} \
696static ssize_t set_temp_##offset##_crit (struct device *dev, \ 696static 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);
712temp_reg(3); 712temp_reg(3);
713 713
714/* Alarms */ 714/* Alarms */
715static ssize_t show_alarms(struct device *dev, char *buf) 715static 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) \
262static ssize_t \ 262static 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} \
267static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ 267static DEVICE_ATTR(in##offset##_input, S_IRUGO, \
268 show_in##offset, NULL); \ 268 show_in##offset, NULL); \
269static ssize_t \ 269static 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} \
274static ssize_t \ 274static 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} \
279static ssize_t set_in##offset##_min (struct device *dev, \ 279static 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} \
284static ssize_t set_in##offset##_max (struct device *dev, \ 284static 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) \
392static ssize_t show_fan##offset(struct device *dev, char *buf) \ 392static 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} \
396static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ 396static 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} \
400static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ 400static 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} \
404static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ 404static 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} \
409static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ 409static 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);
482set_temp_reg(HYST, temp_hyst); 482set_temp_reg(HYST, temp_hyst);
483 483
484#define sysfs_temp(num) \ 484#define sysfs_temp(num) \
485static ssize_t show_temp##num(struct device *dev, char *buf) \ 485static 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} \
489static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL); \ 489static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL); \
490static ssize_t show_temp_max##num(struct device *dev, char *buf) \ 490static 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} \
494static ssize_t set_temp_max##num(struct device *dev, const char *buf, \ 494static 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} \
499static DEVICE_ATTR(temp##num##_max, S_IRUGO | S_IWUSR, \ 499static 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); \
501static ssize_t show_temp_hyst##num(struct device *dev, char *buf) \ 501static 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} \
505static ssize_t set_temp_hyst##num(struct device *dev, const char *buf, \ 505static 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
525static ssize_t show_vid(struct device *dev, char *buf) 525static 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);
533device_create_file(&client->dev, &dev_attr_cpu0_vid) 533device_create_file(&client->dev, &dev_attr_cpu0_vid)
534 534
535/* VRM */ 535/* VRM */
536static ssize_t show_vrm(struct device *dev, char *buf) 536static 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
542static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 542static 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) \
554device_create_file(&client->dev, &dev_attr_vrm); 554device_create_file(&client->dev, &dev_attr_vrm);
555 555
556static ssize_t show_alarms(struct device *dev, char *buf) 556static 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);
564device_create_file(&client->dev, &dev_attr_alarms) 564device_create_file(&client->dev, &dev_attr_alarms)
565 565
566/* 1 PWM */ 566/* 1 PWM */
567static ssize_t show_pwm1(struct device *dev, char *buf) 567static 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
573static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) 573static 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
587static ssize_t show_pwm_enable1(struct device *dev, char *buf) 587static 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
593static ssize_t set_pwm_enable1(struct device *dev, const char *buf, 593static 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) \
140static ssize_t show_##value(struct device *dev, char *buf) \ 140static 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);
148show(temp_max); 148show(temp_max);
149 149
150#define set_temp(suffix, value, reg) \ 150#define set_temp(suffix, value, reg) \
151static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ 151static 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, \
165set_temp(min, temp_min, DS1621_REG_TEMP_MIN); 165set_temp(min, temp_min, DS1621_REG_TEMP_MIN);
166set_temp(max, temp_max, DS1621_REG_TEMP_MAX); 166set_temp(max, temp_max, DS1621_REG_TEMP_MAX);
167 167
168static ssize_t show_alarms(struct device *dev, char *buf) 168static 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) \
159static ssize_t show_##kind##sub (struct fscher_data *, char *, int); \ 159static ssize_t show_##kind##sub (struct fscher_data *, char *, int); \
160static ssize_t show_##kind##offset##sub (struct device *, char *); \ 160static ssize_t show_##kind##offset##sub (struct device *, struct device_attribute *attr, char *); \
161static ssize_t show_##kind##offset##sub (struct device *dev, char *buf) \ 161static 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) \
168static ssize_t set_##kind##sub (struct i2c_client *, struct fscher_data *, const char *, size_t, int, int); \ 168static ssize_t set_##kind##sub (struct i2c_client *, struct fscher_data *, const char *, size_t, int, int); \
169static ssize_t set_##kind##offset##sub (struct device *, const char *, size_t); \ 169static ssize_t set_##kind##offset##sub (struct device *, struct device_attribute *attr, const char *, size_t); \
170static ssize_t set_##kind##offset##sub (struct device *dev, const char *buf, size_t count) \ 170static 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
248static ssize_t show_volt_12(struct device *dev, char *buf) 248static 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
254static ssize_t show_volt_5(struct device *dev, char *buf) 254static 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
260static ssize_t show_volt_batt(struct device *dev, char *buf) 260static 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 */
330static ssize_t show_event(struct device *dev, char *buf) 330static 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) \
167static ssize_t show_##suffix(struct device *dev, char *buf) \ 167static 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) \
174static ssize_t show_##suffix(struct device *dev, char *buf) \ 174static 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);
205show(BEEP_MASK, beep_mask, beep_mask); 205show(BEEP_MASK, beep_mask, beep_mask);
206 206
207#define set(type, suffix, value, reg) \ 207#define set(type, suffix, value, reg) \
208static ssize_t set_##suffix(struct device *dev, const char *buf, \ 208static 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) \
223static ssize_t set_##suffix(struct device *dev, const char *buf, \ 223static 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);
258set_bits(BOOL, beep_enable, beep_enable, GL518_REG_CONF, 0x04, 2); 258set_bits(BOOL, beep_enable, beep_enable, GL518_REG_CONF, 0x04, 2);
259set(BEEP_MASK, beep_mask, beep_mask, GL518_REG_ALARM); 259set(BEEP_MASK, beep_mask, beep_mask, GL518_REG_ALARM);
260 260
261static ssize_t set_fan_min1(struct device *dev, const char *buf, size_t count) 261static 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
287static ssize_t set_fan_min2(struct device *dev, const char *buf, size_t count) 287static 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) \
150static ssize_t get_##type##item (struct gl520_data *, char *, int); \ 150static ssize_t get_##type##item (struct gl520_data *, char *, int); \
151static ssize_t get_##type##n##item (struct device *, char *); \ 151static ssize_t get_##type##n##item (struct device *, struct device_attribute *attr, char *); \
152static ssize_t get_##type##n##item (struct device *dev, char *buf) \ 152static 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) \
159static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \ 159static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \
160static ssize_t set_##type##n##item (struct device *, const char *, size_t); \ 160static ssize_t set_##type##n##item (struct device *, struct device_attribute *attr, const char *, size_t); \
161static ssize_t set_##type##n##item (struct device *dev, const char *buf, size_t count) \ 161static 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) \
292static ssize_t \ 292static 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) \
300static ssize_t \ 300static 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} \
305static ssize_t \ 305static 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} \
310static ssize_t set_in##offset##_min (struct device *dev, \ 310static 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} \
315static ssize_t set_in##offset##_max (struct device *dev, \ 315static 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) \
386static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 386static 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} \
390static ssize_t \ 390static ssize_t \
391show_temp_##offset##_max (struct device *dev, char *buf) \ 391show_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} \
395static ssize_t \ 395static ssize_t \
396show_temp_##offset##_min (struct device *dev, char *buf) \ 396show_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} \
400static ssize_t set_temp_##offset##_max (struct device *dev, \ 400static 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} \
405static ssize_t set_temp_##offset##_min (struct device *dev, \ 405static 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) \
456static ssize_t show_sensor_##offset (struct device *dev, char *buf) \ 456static 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} \
460static ssize_t set_sensor_##offset (struct device *dev, \ 460static 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) \
603static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 603static 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} \
607static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 607static 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} \
611static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 611static 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} \
615static ssize_t set_fan_##offset##_min (struct device *dev, \ 615static 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} \
620static ssize_t set_fan_##offset##_div (struct device *dev, \ 620static 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);
633show_fan_offset(3); 633show_fan_offset(3);
634 634
635#define show_pwm_offset(offset) \ 635#define show_pwm_offset(offset) \
636static ssize_t show_pwm##offset##_enable (struct device *dev, \ 636static 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} \
641static ssize_t show_pwm##offset (struct device *dev, char *buf) \ 641static 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} \
645static ssize_t set_pwm##offset##_enable (struct device *dev, \ 645static 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} \
650static ssize_t set_pwm##offset (struct device *dev, \ 650static 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);
663show_pwm_offset(3); 663show_pwm_offset(3);
664 664
665/* Alarms */ 665/* Alarms */
666static ssize_t show_alarms(struct device *dev, char *buf) 666static 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)
671static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 671static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
672 672
673static ssize_t 673static ssize_t
674show_vrm_reg(struct device *dev, char *buf) 674show_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}
679static ssize_t 679static ssize_t
680store_vrm_reg(struct device *dev, const char *buf, size_t count) 680store_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);
693device_create_file(&client->dev, &dev_attr_vrm) 693device_create_file(&client->dev, &dev_attr_vrm)
694 694
695static ssize_t 695static ssize_t
696show_vid_reg(struct device *dev, char *buf) 696show_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) \
180static ssize_t show_##value(struct device *dev, char *buf) \ 180static 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) \
185show_fan(fan1_input); 185show_fan(fan1_input);
186show_fan(fan1_low); 186show_fan(fan1_low);
187 187
188static ssize_t set_fan1_low(struct device *dev, const char *buf, 188static 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
205static ssize_t show_pwm1(struct device *dev, char *buf) 205static 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
213static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) 213static 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
232static ssize_t show_pwm1_enable(struct device *dev, char *buf) 232static 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) \
239static ssize_t show_##value(struct device *dev, char *buf) \ 239static 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) \
245static ssize_t show_##value(struct device *dev, char *buf) \ 245static 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);
255show_temp8(temp2_crit); 255show_temp8(temp2_crit);
256 256
257#define set_temp8(value, reg) \ 257#define set_temp8(value, reg) \
258static ssize_t set_##value(struct device *dev, const char *buf, \ 258static 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) \
272static ssize_t set_##value(struct device *dev, const char *buf, \ 272static 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 */
292static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) 292static 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 */
301static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, 301static 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
317static ssize_t show_alarms(struct device *dev, char *buf) 317static 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) \
78static ssize_t show_##value(struct device *dev, char *buf) \ 78static 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);
85show(temp_input); 85show(temp_input);
86 86
87#define set(value, reg) \ 87#define set(value, reg) \
88static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 88static 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) \
106static ssize_t show_##value(struct device *dev, char *buf) \ 106static 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);
116show(alarms); 116show(alarms);
117 117
118/* read routines for hysteresis values */ 118/* read routines for hysteresis values */
119static ssize_t show_temp_crit_hyst(struct device *dev, char *buf) 119static 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}
124static ssize_t show_temp_min_hyst(struct device *dev, char *buf) 124static 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}
129static ssize_t show_temp_max_hyst(struct device *dev, char *buf) 129static 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) \
137static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 137static 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 */
155static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t count) 155static 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 */
170static ssize_t set_temp_crit(struct device *dev, const char *buf, size_t count) 170static 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) \
226static ssize_t \ 226static 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} \
231static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ 231static DEVICE_ATTR(in##offset##_input, S_IRUGO, \
232 show_in##offset, NULL); \ 232 show_in##offset, NULL); \
233static ssize_t \ 233static 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} \
238static ssize_t \ 238static 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} \
243static ssize_t set_in##offset##_min (struct device *dev, \ 243static 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} \
248static ssize_t set_in##offset##_max (struct device *dev, \ 248static 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);
264show_in_offset(6); 264show_in_offset(6);
265 265
266/* Temperature */ 266/* Temperature */
267static ssize_t show_temp(struct device *dev, char *buf) 267static 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
273static ssize_t show_temp_over(struct device *dev, char *buf) 273static 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
279static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) 279static 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
292static ssize_t show_temp_hyst(struct device *dev, char *buf) 292static 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
298static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) 298static 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) \
401static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 401static 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} \
405static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 405static 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} \
409static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 409static 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} \
413static ssize_t set_fan_##offset##_min (struct device *dev, \ 413static 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);\
419static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ 419static 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
422static ssize_t set_fan_1_div(struct device *dev, const char *buf, 422static 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
428static ssize_t set_fan_2_div(struct device *dev, const char *buf, 428static 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,
443static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL); 443static DEVICE_ATTR(fan3_div, S_IRUGO, show_fan_3_div, NULL);
444 444
445/* VID */ 445/* VID */
446static ssize_t show_vid(struct device *dev, char *buf) 446static 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)
451static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 451static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
452 452
453/* Alarms */ 453/* Alarms */
454static ssize_t show_alarms(struct device *dev, char *buf) 454static 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) \
159static ssize_t show_in_##suffix(struct device *dev, char *buf) \ 159static 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]);
184show_in(input6, in[6]); 184show_in(input6, in[6]);
185 185
186#define set_in(suffix, value, reg) \ 186#define set_in(suffix, value, reg) \
187static ssize_t set_in_##suffix(struct device *dev, const char *buf, \ 187static 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));
213set_in(max6, in_max[6], LM80_REG_IN_MAX(6)); 213set_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) \
216static ssize_t show_fan_##suffix(struct device *dev, char *buf) \ 216static 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]);
225show_fan(input2, fan[1], fan_div[1]); 225show_fan(input2, fan[1], fan_div[1]);
226 226
227#define show_fan_div(suffix, value) \ 227#define show_fan_div(suffix, value) \
228static ssize_t show_fan_div##suffix(struct device *dev, char *buf) \ 228static 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]);
234show_fan_div(2, fan_div[1]); 234show_fan_div(2, fan_div[1]);
235 235
236#define set_fan(suffix, value, reg, div) \ 236#define set_fan(suffix, value, reg, div) \
237static ssize_t set_fan_##suffix(struct device *dev, const char *buf, \ 237static 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) \
295static ssize_t set_fan_div##number(struct device *dev, const char *buf, \ 295static 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, \
300set_fan_div(1); 300set_fan_div(1);
301set_fan_div(2); 301set_fan_div(2);
302 302
303static ssize_t show_temp_input1(struct device *dev, char *buf) 303static 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) \
310static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ 310static 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);
318show_temp(os_hyst, temp_os_hyst); 318show_temp(os_hyst, temp_os_hyst);
319 319
320#define set_temp(suffix, value, reg) \ 320#define set_temp(suffix, value, reg) \
321static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ 321static 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);
336set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX); 336set_temp(os_max, temp_os_max, LM80_REG_TEMP_OS_MAX);
337set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST); 337set_temp(os_hyst, temp_os_hyst, LM80_REG_TEMP_OS_HYST);
338 338
339static ssize_t show_alarms(struct device *dev, char *buf) 339static 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) \
158static ssize_t show_temp_##suffix(struct device *dev, char *buf) \ 158static 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]);
171show_temp(crit, temp_crit); 171show_temp(crit, temp_crit);
172 172
173#define set_temp(suffix, value, reg) \ 173#define set_temp(suffix, value, reg) \
174static ssize_t set_temp_##suffix(struct device *dev, const char *buf, \ 174static 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);
190set_temp(high4, temp_high[3], LM83_REG_W_REMOTE3_HIGH); 190set_temp(high4, temp_high[3], LM83_REG_W_REMOTE3_HIGH);
191set_temp(crit, temp_crit, LM83_REG_W_TCRIT); 191set_temp(crit, temp_crit, LM83_REG_W_TCRIT);
192 192
193static ssize_t show_alarms(struct device *dev, char *buf) 193static 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) \
429static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 429static 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} \
433static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 433static 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} \
437static ssize_t set_fan_##offset##_min (struct device *dev, \ 437static 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
454static ssize_t show_vid_reg(struct device *dev, char *buf) 454static 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
460static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); 460static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
461 461
462static ssize_t show_vrm_reg(struct device *dev, char *buf) 462static 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
468static ssize_t store_vrm_reg(struct device *dev, const char *buf, size_t count) 468static 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
479static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 479static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
480 480
481static ssize_t show_alarms_reg(struct device *dev, char *buf) 481static 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) \
519static ssize_t show_pwm_##offset (struct device *dev, char *buf) \ 519static 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} \
523static ssize_t set_pwm_##offset (struct device *dev, \ 523static 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} \
528static ssize_t show_pwm_enable##offset (struct device *dev, char *buf) \ 528static 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) \
588static ssize_t show_in_##offset (struct device *dev, char *buf) \ 588static 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} \
592static ssize_t show_in_##offset##_min (struct device *dev, char *buf) \ 592static 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} \
596static ssize_t show_in_##offset##_max (struct device *dev, char *buf) \ 596static 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} \
600static ssize_t set_in_##offset##_min (struct device *dev, \ 600static 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} \
605static ssize_t set_in_##offset##_max (struct device *dev, \ 605static 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) \
669static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 669static 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} \
673static ssize_t show_temp_##offset##_min (struct device *dev, char *buf) \ 673static 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} \
677static ssize_t show_temp_##offset##_max (struct device *dev, char *buf) \ 677static 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} \
681static ssize_t set_temp_##offset##_min (struct device *dev, \ 681static 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} \
686static ssize_t set_temp_##offset##_max (struct device *dev, \ 686static 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) \
789static ssize_t show_pwm##offset##_auto_channels (struct device *dev, \ 789static 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} \
794static ssize_t set_pwm##offset##_auto_channels (struct device *dev, \ 794static 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} \
799static ssize_t show_pwm##offset##_auto_pwm_min (struct device *dev, \ 799static 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} \
804static ssize_t set_pwm##offset##_auto_pwm_min (struct device *dev, \ 804static 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} \
809static ssize_t show_pwm##offset##_auto_pwm_minctl (struct device *dev, \ 809static 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} \
814static ssize_t set_pwm##offset##_auto_pwm_minctl (struct device *dev, \ 814static 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} \
819static ssize_t show_pwm##offset##_auto_pwm_freq (struct device *dev, \ 819static 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} \
824static ssize_t set_pwm##offset##_auto_pwm_freq(struct device *dev, \ 824static 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) \
965static ssize_t show_temp##offset##_auto_temp_off (struct device *dev, \ 965static 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} \
970static ssize_t set_temp##offset##_auto_temp_off (struct device *dev, \ 970static 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} \
975static ssize_t show_temp##offset##_auto_temp_min (struct device *dev, \ 975static 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} \
980static ssize_t set_temp##offset##_auto_temp_min (struct device *dev, \ 980static 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} \
985static ssize_t show_temp##offset##_auto_temp_max (struct device *dev, \ 985static 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} \
990static ssize_t set_temp##offset##_auto_temp_max (struct device *dev, \ 990static 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} \
995static ssize_t show_temp##offset##_auto_temp_crit (struct device *dev, \ 995static 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} \
1000static ssize_t set_temp##offset##_auto_temp_crit (struct device *dev, \ 1000static 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) \
221static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ 221static 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} \
227static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 227static 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} \
233static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 233static 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) \
277static ssize_t set_in##offset##_min(struct device *dev, \ 277static 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} \
283static ssize_t set_in##offset##_max(struct device *dev, \ 283static 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);
300set_in(7); 300set_in(7);
301 301
302#define show_temp(offset) \ 302#define show_temp(offset) \
303static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ 303static 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} \
308static ssize_t show_temp##offset##_low(struct device *dev, char *buf) \ 308static 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} \
313static ssize_t show_temp##offset##_high(struct device *dev, char *buf) \ 313static 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) \
349static ssize_t set_temp##offset##_low(struct device *dev, \ 349static 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} \
355static ssize_t set_temp##offset##_high(struct device *dev, \ 355static 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);
366set_temp(2); 366set_temp(2);
367set_temp(3); 367set_temp(3);
368 368
369static ssize_t show_temp_crit_int(struct device *dev, char *buf) 369static 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
375static ssize_t show_temp_crit_ext(struct device *dev, char *buf) 375static 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);
383static DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit_ext, NULL); 383static DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit_ext, NULL);
384 384
385#define show_fan(offset) \ 385#define show_fan(offset) \
386static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ 386static 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} \
392static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ 392static 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} \
398static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ 398static 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) \
468static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ 468static 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} \
474static ssize_t set_fan##offset##_div(struct device *dev, const char *buf, \ 474static 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, \
483set_fan(1); 483set_fan(1);
484set_fan(2); 484set_fan(2);
485 485
486static ssize_t show_alarms(struct device *dev, char *buf) 486static 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}
491static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 491static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
492 492
493static ssize_t show_vid(struct device *dev, char *buf) 493static 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}
498static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 498static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
499 499
500static ssize_t show_vrm(struct device *dev, char *buf) 500static 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}
505static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 505static 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}
512static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); 512static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
513 513
514static ssize_t show_aout(struct device *dev, char *buf) 514static 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}
519static ssize_t set_aout(struct device *dev, const char *buf, size_t count) 519static 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) \
221static ssize_t show_##value(struct device *dev, char *buf) \ 221static 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);
233show_temp(temp_crit2, TEMP1_FROM_REG); 233show_temp(temp_crit2, TEMP1_FROM_REG);
234 234
235#define set_temp1(value, reg) \ 235#define set_temp1(value, reg) \
236static ssize_t set_##value(struct device *dev, const char *buf, \ 236static 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) \
253static ssize_t set_##value(struct device *dev, const char *buf, \ 253static 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);
275set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT); 275set_temp1(temp_crit2, LM90_REG_W_REMOTE_CRIT);
276 276
277#define show_temp_hyst(value, basereg) \ 277#define show_temp_hyst(value, basereg) \
278static ssize_t show_##value(struct device *dev, char *buf) \ 278static 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) \
284show_temp_hyst(temp_hyst1, temp_crit1); 284show_temp_hyst(temp_hyst1, temp_crit1);
285show_temp_hyst(temp_hyst2, temp_crit2); 285show_temp_hyst(temp_hyst2, temp_crit2);
286 286
287static ssize_t set_temp_hyst1(struct device *dev, const char *buf, 287static 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
303static ssize_t show_alarms(struct device *dev, char *buf) 303static 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) \
143static ssize_t show_##value(struct device *dev, char *buf) \ 143static 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);
151show_temp(temp1_max); 151show_temp(temp1_max);
152 152
153#define set_temp(value, reg) \ 153#define set_temp(value, reg) \
154static ssize_t set_##value(struct device *dev, const char *buf, \ 154static 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);
168set_temp(temp1_min, LM92_REG_TEMP_LOW); 168set_temp(temp1_min, LM92_REG_TEMP_LOW);
169set_temp(temp1_max, LM92_REG_TEMP_HIGH); 169set_temp(temp1_max, LM92_REG_TEMP_HIGH);
170 170
171static ssize_t show_temp1_crit_hyst(struct device *dev, char *buf) 171static 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}
177static ssize_t show_temp1_max_hyst(struct device *dev, char *buf) 177static 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}
183static ssize_t show_temp1_min_hyst(struct device *dev, char *buf) 183static 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
190static ssize_t set_temp1_crit_hyst(struct device *dev, const char *buf, 190static 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
205static ssize_t show_alarms(struct device *dev, char *buf) 205static 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) \
125static ssize_t show_##value(struct device *dev, char *buf) \ 125static 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);
135show_temp(temp_hyst2); 135show_temp(temp_hyst2);
136 136
137#define set_temp2(value, reg) \ 137#define set_temp2(value, reg) \
138static ssize_t set_##value(struct device *dev, const char *buf, \ 138static 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);
154set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT); 154set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT);
155set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST); 155set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST);
156 156
157static ssize_t show_alarms(struct device *dev, char *buf) 157static 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) \
285static ssize_t show_fan##offset##_input(struct device *dev, char *buf) \ 285static 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} \
291static ssize_t show_fan##offset##_min(struct device *dev, char *buf) \ 291static 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} \
297static ssize_t show_fan##offset##_div(struct device *dev, char *buf) \ 297static 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} \
303static ssize_t show_fan##offset##_status(struct device *dev, char *buf) \ 303static 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} \
309static ssize_t set_fan##offset##_min(struct device *dev, const char *buf, \ 309static 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)
324show_and_set_fan(3) 324show_and_set_fan(3)
325 325
326#define show_and_set_pwm(offset) \ 326#define show_and_set_pwm(offset) \
327static ssize_t show_pwm##offset(struct device *dev, char *buf) \ 327static 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} \
335static ssize_t set_pwm##offset(struct device *dev, const char *buf, \ 335static 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)
354show_and_set_pwm(3) 354show_and_set_pwm(3)
355 355
356#define show_and_set_in(offset) \ 356#define show_and_set_in(offset) \
357static ssize_t show_in##offset##_input(struct device *dev, char *buf) \ 357static 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} \
363static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 363static 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} \
369static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 369static 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} \
375static ssize_t show_in##offset##_status(struct device *dev, char *buf) \ 375static 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} \
380static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ 380static 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} \
394static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ 394static 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)
427show_and_set_in(10) 427show_and_set_in(10)
428 428
429#define show_and_set_therm(offset) \ 429#define show_and_set_therm(offset) \
430static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ 430static 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} \
436static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 436static 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} \
442static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 442static 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} \
448static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ 448static 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} \
454static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ 454static 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} \
459static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 459static 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} \
473static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 473static 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} \
487static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ 487static 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)
512show_and_set_therm(5) 512show_and_set_therm(5)
513show_and_set_therm(6) 513show_and_set_therm(6)
514 514
515static ssize_t show_vid(struct device *dev, char *buf) 515static 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}
520static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 520static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
521 521
522static ssize_t show_vrm(struct device *dev, char *buf) 522static 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}
527static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 527static 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}
534static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); 534static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
535 535
536static ssize_t show_in_alarms(struct device *dev, char *buf) 536static 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)
541static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); 541static 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) \
544static ssize_t show_temp##offset##_input(struct device *dev, char *buf) \ 544static 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} \
549static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 549static 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} \
554static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 554static 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}\
559static ssize_t show_temp##offset##_crit(struct device *dev, char *buf) \ 559static 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}\
564static ssize_t show_temp##offset##_status(struct device *dev, char *buf) \ 564static 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}\
569static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 569static 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} \
583static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 583static 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} \
597static ssize_t set_temp##offset##_crit(struct device *dev, const char *buf, \ 597static 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)
622show_and_set_temp(2) 622show_and_set_temp(2)
623show_and_set_temp(3) 623show_and_set_temp(3)
624 624
625static ssize_t show_temp_alarms(struct device *dev, char *buf) 625static 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 */
79static ssize_t show_read(struct device *dev, char *buf) 79static 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
87static DEVICE_ATTR(read, S_IRUGO, show_read, NULL); 87static DEVICE_ATTR(read, S_IRUGO, show_read, NULL);
88 88
89static ssize_t show_write(struct device *dev, char *buf) 89static 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
95static ssize_t set_write(struct device *dev, const char *buf, 95static 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) \
103static ssize_t show_in##channel##_input(struct device *dev, char *buf) \ 103static 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);
112show_in_channel(2); 112show_in_channel(2);
113show_in_channel(3); 113show_in_channel(3);
114 114
115static ssize_t show_out0_ouput(struct device *dev, char *buf) 115static 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
121static ssize_t set_out0_output(struct device *dev, const char *buf, size_t count) 121static 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
134static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 134static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO,
135 show_out0_ouput, set_out0_output); 135 show_out0_ouput, set_out0_output);
136 136
137static ssize_t show_out0_enable(struct device *dev, char *buf) 137static 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
143static ssize_t set_out0_enable(struct device *dev, const char *buf, size_t count) 143static 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) \
258static ssize_t \ 258static 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} \
263static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ 263static DEVICE_ATTR(in##offset##_input, S_IRUGO, \
264 show_in##offset, NULL); \ 264 show_in##offset, NULL); \
265static ssize_t \ 265static 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} \
270static ssize_t \ 270static 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} \
275static ssize_t set_in##offset##_min (struct device *dev, \ 275static 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} \
280static ssize_t set_in##offset##_max (struct device *dev, \ 280static 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);
294show_in_offset(4); 294show_in_offset(4);
295 295
296/* Temperature */ 296/* Temperature */
297static ssize_t show_temp(struct device *dev, char *buf) 297static 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
303static ssize_t show_temp_over(struct device *dev, char *buf) 303static 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
309static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count) 309static 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
322static ssize_t show_temp_hyst(struct device *dev, char *buf) 322static 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
328static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) 328static 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) \
429static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 429static 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} \
433static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 433static 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} \
437static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 437static 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} \
441static ssize_t set_fan_##offset##_min (struct device *dev, \ 441static 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, \
450show_fan_offset(1); 450show_fan_offset(1);
451show_fan_offset(2); 451show_fan_offset(2);
452 452
453static ssize_t set_fan_1_div(struct device *dev, const char *buf, 453static 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
459static ssize_t set_fan_2_div(struct device *dev, const char *buf, 459static 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 */
470static ssize_t show_alarms(struct device *dev, char *buf) 470static 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) \
175static ssize_t show_temp##num(struct device *dev, char *buf) \ 175static 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) \
204static ssize_t show_fan##num(struct device *dev, char *buf) \ 204static 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
187static ssize_t get_alarms(struct device *dev, char *buf) 187static 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) \
301static ssize_t get_fan##offset (struct device *dev, char *buf) \ 301static 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} \
305static ssize_t get_fan##offset##_min (struct device *dev, char *buf) \ 305static 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} \
309static ssize_t set_fan##offset##_min (struct device *dev, \ 309static 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} \
314static ssize_t get_fan##offset##_div (struct device *dev, char *buf) \ 314static 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} \
318static ssize_t set_fan##offset##_div (struct device *dev, \ 318static 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} \
323static ssize_t get_pwm##offset (struct device *dev, char *buf) \ 323static 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} \
327static ssize_t set_pwm##offset (struct device *dev, \ 327static 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} \
332static ssize_t get_pwm##offset##_en (struct device *dev, char *buf) \ 332static 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} \
336static ssize_t set_pwm##offset##_en (struct device *dev, \ 336static 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) \
388static ssize_t \ 388static 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} \
393static ssize_t \ 393static 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} \
398static ssize_t \ 398static 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} \
403static ssize_t set_in##offset##_min (struct device *dev, \ 403static 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} \
408static ssize_t set_in##offset##_max (struct device *dev, \ 408static 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) \
463static ssize_t show_temp_##offset (struct device *dev, char *buf) \ 463static 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} \
467static ssize_t \ 467static ssize_t \
468show_temp_##offset##_over (struct device *dev, char *buf) \ 468show_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} \
472static ssize_t \ 472static ssize_t \
473show_temp_##offset##_hyst (struct device *dev, char *buf) \ 473show_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} \
477static ssize_t set_temp_##offset##_over (struct device *dev, \ 477static 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} \
482static ssize_t set_temp_##offset##_hyst (struct device *dev, \ 482static 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) \
541static ssize_t show_fan_##offset (struct device *dev, char *buf) \ 541static 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} \
545static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ 545static 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} \
549static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ 549static 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} \
553static ssize_t set_fan_##offset##_min (struct device *dev, \ 553static 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} \
558static ssize_t set_fan_##offset##_div (struct device *dev, \ 558static 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);
570show_fan_offset(2); 570show_fan_offset(2);
571 571
572/* Alarms */ 572/* Alarms */
573static ssize_t show_alarms(struct device *dev, char *buf) { 573static 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) \
370static ssize_t \ 370static ssize_t \
371show_regs_in_##offset (struct device *dev, char *buf) \ 371show_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} \
375static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); 375static 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) \
378static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ 378static 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} \
382static ssize_t \ 382static ssize_t \
383store_regs_in_##reg##offset (struct device *dev, \ 383store_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
422static ssize_t show_regs_in_0(struct device *dev, char *buf) 422static 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
428static ssize_t show_regs_in_min0(struct device *dev, char *buf) 428static 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
434static ssize_t show_regs_in_max0(struct device *dev, char *buf) 434static 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
440static ssize_t store_regs_in_min0(struct device *dev, 440static 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
465static ssize_t store_regs_in_max0(struct device *dev, 465static 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) \
534static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ 534static 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} \
538static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); 538static 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) \
541static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ 541static 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} \
545static ssize_t \ 545static ssize_t \
546store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ 546store_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) \
610static ssize_t \ 610static ssize_t \
611show_regs_temp_##offset (struct device *dev, char *buf) \ 611show_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} \
615static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); 615static 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) \
618static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ 618static 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} \
622static ssize_t \ 622static ssize_t \
623store_regs_temp_##reg##offset (struct device *dev, \ 623store_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
647static ssize_t 647static ssize_t
648show_vid_reg(struct device *dev, char *buf) 648show_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);
655device_create_file(&client->dev, &dev_attr_cpu0_vid) 655device_create_file(&client->dev, &dev_attr_cpu0_vid)
656 656
657static ssize_t 657static ssize_t
658show_vrm_reg(struct device *dev, char *buf) 658show_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}
663static ssize_t 663static ssize_t
664store_vrm_reg(struct device *dev, const char *buf, size_t count) 664store_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);
677device_create_file(&client->dev, &dev_attr_vrm) 677device_create_file(&client->dev, &dev_attr_vrm)
678 678
679static ssize_t 679static ssize_t
680show_alarms_reg(struct device *dev, char *buf) 680show_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);
687device_create_file(&client->dev, &dev_attr_alarms) 687device_create_file(&client->dev, &dev_attr_alarms)
688 688
689#define show_beep_reg(REG, reg) \ 689#define show_beep_reg(REG, reg) \
690static ssize_t show_beep_##reg (struct device *dev, char *buf) \ 690static 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) \
735static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ 735static 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} \
739static ssize_t \ 739static ssize_t \
740store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ 740store_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) \
804static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ 804static 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} \
808static ssize_t \ 808static ssize_t \
809store_regs_fan_div_##offset (struct device *dev, \ 809store_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) \
864static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ 864static 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} \
868static ssize_t \ 868static ssize_t \
869store_regs_pwm_##offset (struct device *dev, const char *buf, size_t count) \ 869store_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) \
940static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ 940static 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} \
944static ssize_t \ 944static ssize_t \
945store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ 945store_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) \
311static ssize_t \ 311static ssize_t \
312show_regs_in_##offset (struct device *dev, char *buf) \ 312show_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} \
316static DEVICE_ATTR(in##offset##_input, S_IRUGO, show_regs_in_##offset, NULL); 316static 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) \
319static ssize_t show_regs_in_##reg##offset (struct device *dev, char *buf) \ 319static 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} \
323static ssize_t store_regs_in_##reg##offset (struct device *dev, const char *buf, size_t count) \ 323static 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) \
381static ssize_t show_regs_fan_##offset (struct device *dev, char *buf) \ 381static 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} \
385static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_regs_fan_##offset, NULL); 385static 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) \
388static ssize_t show_regs_fan_min##offset (struct device *dev, char *buf) \ 388static 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} \
392static ssize_t store_regs_fan_min##offset (struct device *dev, const char *buf, size_t count) \ 392static 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) \
454static ssize_t \ 454static ssize_t \
455show_regs_temp_##offset (struct device *dev, char *buf) \ 455show_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} \
459static DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_regs_temp_##offset, NULL); 459static 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) \
462static ssize_t show_regs_temp_##reg##offset (struct device *dev, char *buf) \ 462static 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} \
466static ssize_t store_regs_temp_##reg##offset (struct device *dev, const char *buf, size_t count) \ 466static 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
488static ssize_t 488static ssize_t
489show_vid_reg(struct device *dev, char *buf) 489show_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) \
498device_create_file(&client->dev, &dev_attr_cpu0_vid); 498device_create_file(&client->dev, &dev_attr_cpu0_vid);
499static ssize_t 499static ssize_t
500show_vrm_reg(struct device *dev, char *buf) 500show_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
506static ssize_t 506static ssize_t
507store_vrm_reg(struct device *dev, const char *buf, size_t count) 507store_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) \
522device_create_file(&client->dev, &dev_attr_vrm); 522device_create_file(&client->dev, &dev_attr_vrm);
523static ssize_t 523static ssize_t
524show_alarms_reg(struct device *dev, char *buf) 524show_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
531DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); 531DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL);
532#define device_create_file_alarms(client) \ 532#define device_create_file_alarms(client) \
533device_create_file(&client->dev, &dev_attr_alarms); 533device_create_file(&client->dev, &dev_attr_alarms);
534static ssize_t show_beep_mask (struct device *dev, char *buf) 534static 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}
540static ssize_t show_beep_enable (struct device *dev, char *buf) 540static 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) \
586static ssize_t show_regs_beep_##reg (struct device *dev, char *buf) \ 586static 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} \
590static ssize_t store_regs_beep_##reg (struct device *dev, const char *buf, size_t count) \ 590static 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) \
656static ssize_t show_regs_fan_div_##offset (struct device *dev, char *buf) \ 656static 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} \
660static ssize_t store_regs_fan_div_##offset (struct device *dev, const char *buf, size_t count) \ 660static 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) \
740static ssize_t show_regs_pwm_##offset (struct device *dev, char *buf) \ 740static 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} \
744static ssize_t store_regs_pwm_##offset (struct device *dev, \ 744static 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) \
753static ssize_t show_regs_pwmenable_##offset (struct device *dev, char *buf) \ 753static 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} \
757static ssize_t store_regs_pwmenable_##offset (struct device *dev, \ 757static 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) \
835static ssize_t show_regs_sensor_##offset (struct device *dev, char *buf) \ 835static 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} \
839static ssize_t store_regs_sensor_##offset (struct device *dev, const char *buf, size_t count) \ 839static 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
121static ssize_t show_temp(struct device *dev, char *buf) 121static 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
127static ssize_t show_temp_over(struct device *dev, char *buf) 127static 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
106static ssize_t show_adapter_name(struct device *dev, char *buf) 106static 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
120static ssize_t show_client_name(struct device *dev, char *buf) 120static 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 */
69const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" }; 69const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" };
70struct class_simple *hpsb_protocol_class; 70struct class *hpsb_protocol_class;
71 71
72#ifdef CONFIG_IEEE1394_VERBOSEDEBUG 72#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
73static void dump_packet(const char *text, quadlet_t *data, int size) 73static 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)
1159cleanup_csr: 1159cleanup_csr:
1160 cleanup_csr(); 1160 cleanup_csr();
1161release_class_protocol: 1161release_class_protocol:
1162 class_simple_destroy(hpsb_protocol_class); 1162 class_destroy(hpsb_protocol_class);
1163release_class_host: 1163release_class_host:
1164 class_unregister(&hpsb_host_class); 1164 class_unregister(&hpsb_host_class);
1165release_all_bus: 1165release_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 */
224extern struct bus_type ieee1394_bus_type; 224extern struct bus_type ieee1394_bus_type;
225extern struct class hpsb_host_class; 225extern struct class hpsb_host_class;
226extern struct class_simple *hpsb_protocol_class; 226extern 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) \
223static ssize_t fw_show_##class##_##field (struct device *dev, char *buf)\ 223static 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) \
235static ssize_t fw_show_##class##_##td_kv (struct device *dev, char *buf)\ 235static 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
268static ssize_t fw_show_ne_bus_options(struct device *dev, char *buf) 268static 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)
281static DEVICE_ATTR(bus_options,S_IRUGO,fw_show_ne_bus_options,NULL); 281static DEVICE_ATTR(bus_options,S_IRUGO,fw_show_ne_bus_options,NULL);
282 282
283 283
284static ssize_t fw_show_ne_tlabels_free(struct device *dev, char *buf) 284static 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)
289static DEVICE_ATTR(tlabels_free,S_IRUGO,fw_show_ne_tlabels_free,NULL); 289static DEVICE_ATTR(tlabels_free,S_IRUGO,fw_show_ne_tlabels_free,NULL);
290 290
291 291
292static ssize_t fw_show_ne_tlabels_allocations(struct device *dev, char *buf) 292static 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)
297static DEVICE_ATTR(tlabels_allocations,S_IRUGO,fw_show_ne_tlabels_allocations,NULL); 297static DEVICE_ATTR(tlabels_allocations,S_IRUGO,fw_show_ne_tlabels_allocations,NULL);
298 298
299 299
300static ssize_t fw_show_ne_tlabels_mask(struct device *dev, char *buf) 300static 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)
309static DEVICE_ATTR(tlabels_mask, S_IRUGO, fw_show_ne_tlabels_mask, NULL); 309static DEVICE_ATTR(tlabels_mask, S_IRUGO, fw_show_ne_tlabels_mask, NULL);
310 310
311 311
312static ssize_t fw_set_ignore_driver(struct device *dev, const char *buf, size_t count) 312static 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}
327static ssize_t fw_get_ignore_driver(struct device *dev, char *buf) 327static 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
698static 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
699static void nodemgr_remove_host_dev(struct device *dev) 704static 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
2935out_dev: 2935out_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));
2939out_unreg: 2939out_unreg:
2940 hpsb_unregister_highlevel(&raw1394_highlevel); 2940 hpsb_unregister_highlevel(&raw1394_highlevel);
2941out: 2941out:
@@ -2944,8 +2944,8 @@ out:
2944 2944
2945static void __exit cleanup_raw1394(void) 2945static 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
2651static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, char *buf) 2651static 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)
60struct port_attribute port_attr_##_name = __ATTR_RO(_name) 58struct port_attribute port_attr_##_name = __ATTR_RO(_name)
61 59
62struct port_table_attribute { 60struct 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
67static ssize_t port_attr_show(struct kobject *kobj, 66static 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
452static int alloc_group(struct attribute ***attr, 450static struct attribute **
453 ssize_t (*show)(struct ib_port *, 451alloc_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
494err: 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; 484err:
485 while (--i >= 0)
486 kfree(tab_attr[i]);
487 kfree(tab_attr);
488 return NULL;
504} 489}
505 490
506static int add_port(struct ib_device *device, int port_num) 491static 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
570err_free_pkey: 552err_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
578err_remove_gid: 558err_remove_gid:
579 sysfs_remove_group(&p->kobj, &p->gid_group); 559 sysfs_remove_group(&p->kobj, &p->gid_group);
580 560
581err_free_gid: 561err_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
589err_remove_pma: 567err_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
456static ssize_t gameport_show_description(struct device *dev, char *buf) 456static 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
462static ssize_t gameport_rebind_driver(struct device *dev, const char *buf, size_t count) 462static 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)
702static inline int input_proc_init(void) { return 0; } 702static inline int input_proc_init(void) { return 0; }
703#endif 703#endif
704 704
705struct class_simple *input_class; 705struct class *input_class;
706 706
707static int __init input_init(void) 707static 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
747subsys_initcall(input_init); 747subsys_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) \
220static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ 220static ssize_t atkbd_show_##_name(struct atkbd *, char *); \
221static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ 221static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \
222static ssize_t atkbd_do_show_##_name(struct device *d, char *b) \ 222static 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} \
226static ssize_t atkbd_do_set_##_name(struct device *d, const char *b, size_t s) \ 226static 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) \
92static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \ 92static ssize_t psmouse_attr_show_##_name(struct psmouse *, char *); \
93static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\ 93static ssize_t psmouse_attr_set_##_name(struct psmouse *, const char *, size_t);\
94static ssize_t psmouse_do_show_##_name(struct device *d, char *b) \ 94static 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} \
98static ssize_t psmouse_do_set_##_name(struct device *d, const char *b, size_t s)\ 98static 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
361static ssize_t serio_show_description(struct device *dev, char *buf) 361static 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
367static ssize_t serio_show_id_type(struct device *dev, char *buf) 367static 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
373static ssize_t serio_show_id_proto(struct device *dev, char *buf) 373static 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
379static ssize_t serio_show_id_id(struct device *dev, char *buf) 379static 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
385static ssize_t serio_show_id_extra(struct device *dev, char *buf) 385static 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
409static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) 409static 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
440static ssize_t serio_show_bind_mode(struct device *dev, char *buf) 440static 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
446static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t count) 446static 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
61static struct class_simple *capi_class; 61static struct class *capi_class;
62 62
63static int capi_major = 68; /* allocated */ 63static 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
80static struct class_simple *adb_dev_class; 80static struct class *adb_dev_class;
81 81
82struct adb_driver *adb_controller; 82struct adb_driver *adb_controller;
83struct notifier_block *adb_client_list = NULL; 83struct 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) \
460static ssize_t show_##name(struct device *dev, char *buf) \ 461static 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) \
466static ssize_t show_##name(struct device *dev, char *buf) \ 467static 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) \
472static ssize_t show_##name(struct device *dev, char *buf) \ 473static 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) \
481static ssize_t store_##name(struct device *dev, const char *buf, size_t n) \ 482static 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) \
494static ssize_t store_##name(struct device *dev, const char *buf, size_t n) \ 495static 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) \
688static ssize_t show_##name(struct device *dev, char *buf) \ 688static 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) \
697static ssize_t show_##name(struct device *dev, char *buf) \ 697static 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
109static ssize_t 109static ssize_t
110show_cpu_temperature( struct device *dev, char *buf ) 110show_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
115static ssize_t 115static ssize_t
116show_case_temperature( struct device *dev, char *buf ) 116show_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};
70EXPORT_SYMBOL (mca_bus_type); 70EXPORT_SYMBOL (mca_bus_type);
71 71
72static ssize_t mca_show_pos_id(struct device *dev, char *buf) 72static 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}
84static ssize_t mca_show_pos(struct device *dev, char *buf) 84static 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
59struct class_simple *dvb_class; 59static struct class *dvb_class;
60EXPORT_SYMBOL(dvb_class);
61 60
62static struct dvb_device* dvbdev_find_device (int minor) 61static 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:
429static void __exit exit_dvbdev(void) 428static 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
2340ssize_t 2340ssize_t
2341mptscsih_store_queue_depth(struct device *dev, const char *buf, size_t count) 2341mptscsih_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
103extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 103extern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r);
104extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 104extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
105extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 105extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
106extern ssize_t mptscsih_store_queue_depth(struct device *dev, const char *buf, size_t count); 106extern ssize_t mptscsih_store_queue_depth(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
107extern void mptscsih_timer_expired(unsigned long data); 107extern 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...) \
25static ssize_t mmc_##name##_show (struct device *dev, char *buf) \ 25static 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);
273static int ppp_disconnect_channel(struct channel *pch); 273static int ppp_disconnect_channel(struct channel *pch);
274static void ppp_destroy_channel(struct channel *pch); 274static void ppp_destroy_channel(struct channel *pch);
275 275
276static struct class_simple *ppp_class; 276static 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) */
279static inline int proto_to_npindex(int proto) 279static 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
878out_class: 878out_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);
881out_chrdev: 881out_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];
235static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, }; 235static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, };
236 236
237/* for class stuff*/ 237/* for class stuff*/
238static struct class_simple *cosa_class; 238static struct class *cosa_class;
239 239
240#ifdef MODULE 240#ifdef MODULE
241module_param_array(io, int, NULL, 0); 241module_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
41static ssize_t show_ctrl (struct device *dev, char *buf) 41static 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}
83static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); 83static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL);
84 84
85static ssize_t show_dev (struct device *dev, char *buf) 85static 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
79static ssize_t hotplug_slot_attr_store(struct kobject *kobj, 79static 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
87static struct sysfs_ops hotplug_slot_sysfs_ops = { 87static 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
54static struct sysfs_ops dlpar_attr_sysfs_ops = { 54static 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
41static ssize_t show_ctrl (struct device *dev, char *buf) 41static 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}
83static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL); 83static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL);
84 84
85static ssize_t show_dev (struct device *dev, char *buf) 85static 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) \
31static ssize_t \ 31static ssize_t \
32field##_show(struct device *dev, char *buf) \ 32field##_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");
44pci_config_attr(class, "0x%06x\n"); 44pci_config_attr(class, "0x%06x\n");
45pci_config_attr(irq, "%u\n"); 45pci_config_attr(irq, "%u\n");
46 46
47static ssize_t local_cpus_show(struct device *dev, char *buf) 47static 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 */
56static ssize_t 56static ssize_t
57resource_show(struct device * dev, char * buf) 57resource_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
76static ssize_t modalias_show(struct device *dev, char *buf) 76static 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
247static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, 244static 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, &reg); 267 pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &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, &reg16); 285 PCIE_CAPABILITIES_REG, &reg16);
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
320int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state) 317static 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; 331int 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
345int pcie_port_device_resume(struct pci_dev *dev) 337static 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
350int 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
372void pcie_port_device_remove(struct pci_dev *dev) 357static 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
373void 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
428void pcie_port_service_unregister(struct pcie_port_service_driver *new) 419void 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) \
607static ssize_t field##_show (struct device *dev, char *buf) \ 607static 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) \
614static ssize_t name##_show (struct device *dev, char *buf) \ 614static 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
143static ssize_t pnp_show_card_name(struct device *dmdev, char *buf) 143static 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
151static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL); 151static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL);
152 152
153static ssize_t pnp_show_card_ids(struct device *dmdev, char *buf) 153static 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
163static int count_devices(struct device * dev, void * c)
164{
165 int * count = c;
166 (*count)++;
167 return 0;
168}
169
163int pnp_register_driver(struct pnp_driver *drv) 170int 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
208static ssize_t pnp_show_options(struct device *dmdev, char *buf) 208static 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)
236static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL); 236static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL);
237 237
238 238
239static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf) 239static 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)
308extern struct semaphore pnp_res_mutex; 308extern struct semaphore pnp_res_mutex;
309 309
310static ssize_t 310static ssize_t
311pnp_set_current_resources(struct device * dmdev, const char * ubuf, size_t count) 311pnp_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
444static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR, 444static 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
447static ssize_t pnp_show_current_ids(struct device *dmdev, char *buf) 447static 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 */
617static ssize_t 617static ssize_t
618dasd_ro_show(struct device *dev, char *buf) 618dasd_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
631static ssize_t 631static ssize_t
632dasd_ro_store(struct device *dev, const char *buf, size_t count) 632dasd_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 */
658static ssize_t 658static ssize_t
659dasd_use_diag_show(struct device *dev, char *buf) 659dasd_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
672static ssize_t 672static ssize_t
673dasd_use_diag_store(struct device *dev, const char *buf, size_t count) 673dasd_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
698DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); 698DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
699 699
700static ssize_t 700static ssize_t
701dasd_discipline_show(struct device *dev, char *buf) 701dasd_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
48static ssize_t dcssblk_add_store(struct device * dev, const char * buf, 48static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf,
49 size_t count); 49 size_t count);
50static ssize_t dcssblk_remove_store(struct device * dev, const char * buf, 50static ssize_t dcssblk_remove_store(struct device * dev, struct device_attribute *attr, const char * buf,
51 size_t count); 51 size_t count);
52static ssize_t dcssblk_save_store(struct device * dev, const char * buf, 52static ssize_t dcssblk_save_store(struct device * dev, struct device_attribute *attr, const char * buf,
53 size_t count); 53 size_t count);
54static ssize_t dcssblk_save_show(struct device *dev, char *buf); 54static ssize_t dcssblk_save_show(struct device *dev, struct device_attribute *attr, char *buf);
55static ssize_t dcssblk_shared_store(struct device * dev, const char * buf, 55static ssize_t dcssblk_shared_store(struct device * dev, struct device_attribute *attr, const char * buf,
56 size_t count); 56 size_t count);
57static ssize_t dcssblk_shared_show(struct device *dev, char *buf); 57static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf);
58 58
59static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store); 59static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store);
60static DEVICE_ATTR(remove, S_IWUSR, NULL, dcssblk_remove_store); 60static 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 */
197static ssize_t 197static ssize_t
198dcssblk_shared_show(struct device *dev, char *buf) 198dcssblk_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
206static ssize_t 206static ssize_t
207dcssblk_shared_store(struct device *dev, const char *inbuf, size_t count) 207dcssblk_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 */
290static ssize_t 290static ssize_t
291dcssblk_save_show(struct device *dev, char *buf) 291dcssblk_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
299static ssize_t 299static ssize_t
300dcssblk_save_store(struct device *dev, const char *inbuf, size_t count) 300dcssblk_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 */
345static ssize_t 345static ssize_t
346dcssblk_add_store(struct device *dev, const char *buf, size_t count) 346dcssblk_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 */
519static ssize_t 519static ssize_t
520dcssblk_remove_store(struct device *dev, const char *buf, size_t count) 520dcssblk_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 */
1086static ssize_t 1086static ssize_t
1087raw3270_model_show(struct device *dev, char *buf) 1087raw3270_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)
1092static DEVICE_ATTR(model, 0444, raw3270_model_show, 0); 1092static DEVICE_ATTR(model, 0444, raw3270_model_show, 0);
1093 1093
1094static ssize_t 1094static ssize_t
1095raw3270_rows_show(struct device *dev, char *buf) 1095raw3270_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)
1100static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0); 1100static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0);
1101 1101
1102static ssize_t 1102static ssize_t
1103raw3270_columns_show(struct device *dev, char *buf) 1103raw3270_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);
17MODULE_LICENSE("GPL"); 17MODULE_LICENSE("GPL");
18 18
19struct class_simple *tape_class; 19static 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
112static int __init tape_init(void) 112static 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
119static void __exit tape_exit(void) 119static 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 */
109static ssize_t 109static ssize_t
110tape_medium_state_show(struct device *dev, char *buf) 110tape_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
119DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL); 119DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL);
120 120
121static ssize_t 121static ssize_t
122tape_first_minor_show(struct device *dev, char *buf) 122tape_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
131DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL); 131DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL);
132 132
133static ssize_t 133static ssize_t
134tape_state_show(struct device *dev, char *buf) 134tape_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
144DEVICE_ATTR(state, 0444, tape_state_show, NULL); 144DEVICE_ATTR(state, 0444, tape_state_show, NULL);
145 145
146static ssize_t 146static ssize_t
147tape_operation_show(struct device *dev, char *buf) 147tape_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
171DEVICE_ATTR(operation, 0444, tape_operation_show, NULL); 171DEVICE_ATTR(operation, 0444, tape_operation_show, NULL);
172 172
173static ssize_t 173static ssize_t
174tape_blocksize_show(struct device *dev, char *buf) 174tape_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
550static ssize_t 550static ssize_t
551vmlogrdr_autopurge_store(struct device * dev, const char * buf, size_t count) { 551vmlogrdr_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
569static ssize_t 569static ssize_t
570vmlogrdr_autopurge_show(struct device *dev, char *buf) { 570vmlogrdr_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
580static ssize_t 580static ssize_t
581vmlogrdr_purge_store(struct device * dev, const char * buf, size_t count) { 581vmlogrdr_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
621static ssize_t 621static ssize_t
622vmlogrdr_autorecording_store(struct device *dev, const char *buf, 622vmlogrdr_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
641static ssize_t 641static ssize_t
642vmlogrdr_autorecording_show(struct device *dev, char *buf) { 642vmlogrdr_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
652static ssize_t 652static ssize_t
653vmlogrdr_recording_store(struct device * dev, const char * buf, size_t count) { 653vmlogrdr_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
706static struct class_simple *vmlogrdr_class; 706static struct class *vmlogrdr_class;
707static struct device_driver vmlogrdr_driver = { 707static 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
747static void 747static void
748vmlogrdr_unregister_driver(void) { 748vmlogrdr_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
807static int 807static int
808vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv ) { 808vmlogrdr_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 */
79static ssize_t 79static ssize_t
80ccwgroup_ungroup_store(struct device *dev, const char *buf, size_t count) 80ccwgroup_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
312static ssize_t 312static ssize_t
313ccwgroup_online_store (struct device *dev, const char *buf, size_t count) 313ccwgroup_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
340static ssize_t 340static ssize_t
341ccwgroup_online_show (struct device *dev, char *buf) 341ccwgroup_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 */
854static ssize_t 854static ssize_t
855chp_status_show(struct device *dev, char *buf) 855chp_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
865static ssize_t 865static ssize_t
866chp_status_write(struct device *dev, const char *buf, size_t count) 866chp_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)
888static DEVICE_ATTR(status, 0644, chp_status_show, chp_status_write); 888static DEVICE_ATTR(status, 0644, chp_status_show, chp_status_write);
889 889
890static ssize_t 890static ssize_t
891chp_type_show(struct device *dev, char *buf) 891chp_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
798static ssize_t 798static ssize_t
799cmb_show_avg_sample_interval(struct device *dev, char *buf) 799cmb_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
815static ssize_t 815static ssize_t
816cmb_show_avg_utilization(struct device *dev, char *buf) 816cmb_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) \
845static ssize_t show_ ## name (struct device * dev, char * buf) \ 845static 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); } \
847static DEVICE_ATTR(name, 0444, show_ ## name, NULL); 847static DEVICE_ATTR(name, 0444, show_ ## name, NULL);
848 848
849#define cmf_attr_avg(name) \ 849#define cmf_attr_avg(name) \
850static ssize_t show_avg_ ## name (struct device * dev, char * buf) \ 850static 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); } \
852static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL); 852static 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
905static ssize_t cmb_enable_show(struct device *dev, char *buf) 905static 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
910static ssize_t cmb_enable_store(struct device *dev, const char *buf, size_t c) 910static 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 */
206static ssize_t 206static ssize_t
207chpids_show (struct device * dev, char * buf) 207chpids_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
221static ssize_t 221static ssize_t
222pimpampom_show (struct device * dev, char * buf) 222pimpampom_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
231static ssize_t 231static ssize_t
232devtype_show (struct device *dev, char *buf) 232devtype_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
244static ssize_t 244static ssize_t
245cutype_show (struct device *dev, char *buf) 245cutype_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
254static ssize_t 254static ssize_t
255online_show (struct device *dev, char *buf) 255online_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
352static ssize_t 352static ssize_t
353online_store (struct device *dev, const char *buf, size_t count) 353online_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
424static ssize_t 424static ssize_t
425available_show (struct device *dev, char *buf) 425available_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);
241static void dumpit (char *buf, int len); 241static void dumpit (char *buf, int len);
242#endif 242#endif
243/* sysfs Functions */ 243/* sysfs Functions */
244static ssize_t claw_hname_show(struct device *dev, char *buf); 244static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf);
245static ssize_t claw_hname_write(struct device *dev, 245static 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);
247static ssize_t claw_adname_show(struct device *dev, char *buf); 247static ssize_t claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf);
248static ssize_t claw_adname_write(struct device *dev, 248static 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);
250static ssize_t claw_apname_show(struct device *dev, char *buf); 250static ssize_t claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf);
251static ssize_t claw_apname_write(struct device *dev, 251static 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);
253static ssize_t claw_wbuff_show(struct device *dev, char *buf); 253static ssize_t claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
254static ssize_t claw_wbuff_write(struct device *dev, 254static 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);
256static ssize_t claw_rbuff_show(struct device *dev, char *buf); 256static ssize_t claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
257static ssize_t claw_rbuff_write(struct device *dev, 257static 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);
259static int claw_add_files(struct device *dev); 259static int claw_add_files(struct device *dev);
260static void claw_remove_files(struct device *dev); 260static 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 */
4151static ssize_t 4151static ssize_t
4152claw_hname_show(struct device *dev, char *buf) 4152claw_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
4164static ssize_t 4164static ssize_t
4165claw_hname_write(struct device *dev, const char *buf, size_t count) 4165claw_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)
4186static DEVICE_ATTR(host_name, 0644, claw_hname_show, claw_hname_write); 4186static DEVICE_ATTR(host_name, 0644, claw_hname_show, claw_hname_write);
4187 4187
4188static ssize_t 4188static ssize_t
4189claw_adname_show(struct device *dev, char *buf) 4189claw_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
4201static ssize_t 4201static ssize_t
4202claw_adname_write(struct device *dev, const char *buf, size_t count) 4202claw_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)
4223static DEVICE_ATTR(adapter_name, 0644, claw_adname_show, claw_adname_write); 4223static DEVICE_ATTR(adapter_name, 0644, claw_adname_show, claw_adname_write);
4224 4224
4225static ssize_t 4225static ssize_t
4226claw_apname_show(struct device *dev, char *buf) 4226claw_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
4239static ssize_t 4239static ssize_t
4240claw_apname_write(struct device *dev, const char *buf, size_t count) 4240claw_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)
4271static DEVICE_ATTR(api_type, 0644, claw_apname_show, claw_apname_write); 4271static DEVICE_ATTR(api_type, 0644, claw_apname_show, claw_apname_write);
4272 4272
4273static ssize_t 4273static ssize_t
4274claw_wbuff_show(struct device *dev, char *buf) 4274claw_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
4286static ssize_t 4286static ssize_t
4287claw_wbuff_write(struct device *dev, const char *buf, size_t count) 4287claw_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)
4312static DEVICE_ATTR(write_buffer, 0644, claw_wbuff_show, claw_wbuff_write); 4312static DEVICE_ATTR(write_buffer, 0644, claw_wbuff_show, claw_wbuff_write);
4313 4313
4314static ssize_t 4314static ssize_t
4315claw_rbuff_show(struct device *dev, char *buf) 4315claw_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
4327static ssize_t 4327static ssize_t
4328claw_rbuff_write(struct device *dev, const char *buf, size_t count) 4328claw_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
2471static ssize_t 2471static ssize_t
2472buffer_show(struct device *dev, char *buf) 2472buffer_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
2483static ssize_t 2483static ssize_t
2484buffer_write(struct device *dev, const char *buf, size_t count) 2484buffer_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
2532static ssize_t 2532static ssize_t
2533loglevel_show(struct device *dev, char *buf) 2533loglevel_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
2538static ssize_t 2538static ssize_t
2539loglevel_write(struct device *dev, const char *buf, size_t count) 2539loglevel_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
2591static ssize_t 2591static ssize_t
2592stats_show(struct device *dev, char *buf) 2592stats_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
2601static ssize_t 2601static ssize_t
2602stats_write(struct device *dev, const char *buf, size_t count) 2602stats_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
2656static ssize_t 2656static ssize_t
2657ctc_proto_show(struct device *dev, char *buf) 2657ctc_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
2668static ssize_t 2668static ssize_t
2669ctc_proto_store(struct device *dev, const char *buf, size_t count) 2669ctc_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
2689static ssize_t 2689static ssize_t
2690ctc_type_show(struct device *dev, char *buf) 2690ctc_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 */
1986static ssize_t 1986static ssize_t
1987lcs_portno_show (struct device *dev, char *buf) 1987lcs_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 */
2002static ssize_t 2002static ssize_t
2003lcs_portno_store (struct device *dev, const char *buf, size_t count) 2003lcs_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)
2021static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store); 2021static DEVICE_ATTR(portno, 0644, lcs_portno_show, lcs_portno_store);
2022 2022
2023static ssize_t 2023static ssize_t
2024lcs_type_show(struct device *dev, char *buf) 2024lcs_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)
2035static DEVICE_ATTR(type, 0444, lcs_type_show, NULL); 2035static DEVICE_ATTR(type, 0444, lcs_type_show, NULL);
2036 2036
2037static ssize_t 2037static ssize_t
2038lcs_timeout_show(struct device *dev, char *buf) 2038lcs_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
2047static ssize_t 2047static ssize_t
2048lcs_timeout_store (struct device *dev, const char *buf, size_t count) 2048lcs_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
1358static ssize_t 1358static ssize_t
1359user_show (struct device *dev, char *buf) 1359user_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
1367static ssize_t 1367static ssize_t
1368user_write (struct device *dev, const char *buf, size_t count) 1368user_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)
1422static DEVICE_ATTR(user, 0644, user_show, user_write); 1422static DEVICE_ATTR(user, 0644, user_show, user_write);
1423 1423
1424static ssize_t 1424static ssize_t
1425buffer_show (struct device *dev, char *buf) 1425buffer_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
1433static ssize_t 1433static ssize_t
1434buffer_write (struct device *dev, const char *buf, size_t count) 1434buffer_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)
1486static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write); 1486static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
1487 1487
1488static ssize_t 1488static ssize_t
1489dev_fsm_show (struct device *dev, char *buf) 1489dev_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)
1497static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL); 1497static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL);
1498 1498
1499static ssize_t 1499static ssize_t
1500conn_fsm_show (struct device *dev, char *buf) 1500conn_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)
1508static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL); 1508static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL);
1509 1509
1510static ssize_t 1510static ssize_t
1511maxmulti_show (struct device *dev, char *buf) 1511maxmulti_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
1519static ssize_t 1519static ssize_t
1520maxmulti_write (struct device *dev, const char *buf, size_t count) 1520maxmulti_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)
1529static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write); 1529static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write);
1530 1530
1531static ssize_t 1531static ssize_t
1532maxcq_show (struct device *dev, char *buf) 1532maxcq_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
1540static ssize_t 1540static ssize_t
1541maxcq_write (struct device *dev, const char *buf, size_t count) 1541maxcq_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)
1550static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write); 1550static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write);
1551 1551
1552static ssize_t 1552static ssize_t
1553sdoio_show (struct device *dev, char *buf) 1553sdoio_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
1561static ssize_t 1561static ssize_t
1562sdoio_write (struct device *dev, const char *buf, size_t count) 1562sdoio_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)
1571static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write); 1571static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write);
1572 1572
1573static ssize_t 1573static ssize_t
1574mdoio_show (struct device *dev, char *buf) 1574mdoio_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
1582static ssize_t 1582static ssize_t
1583mdoio_write (struct device *dev, const char *buf, size_t count) 1583mdoio_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)
1592static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write); 1592static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write);
1593 1593
1594static ssize_t 1594static ssize_t
1595txlen_show (struct device *dev, char *buf) 1595txlen_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
1603static ssize_t 1603static ssize_t
1604txlen_write (struct device *dev, const char *buf, size_t count) 1604txlen_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)
1613static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write); 1613static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write);
1614 1614
1615static ssize_t 1615static ssize_t
1616txtime_show (struct device *dev, char *buf) 1616txtime_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
1624static ssize_t 1624static ssize_t
1625txtime_write (struct device *dev, const char *buf, size_t count) 1625txtime_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)
1634static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write); 1634static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write);
1635 1635
1636static ssize_t 1636static ssize_t
1637txpend_show (struct device *dev, char *buf) 1637txpend_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
1645static ssize_t 1645static ssize_t
1646txpend_write (struct device *dev, const char *buf, size_t count) 1646txpend_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)
1655static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write); 1655static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write);
1656 1656
1657static ssize_t 1657static ssize_t
1658txmpnd_show (struct device *dev, char *buf) 1658txmpnd_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
1666static ssize_t 1666static ssize_t
1667txmpnd_write (struct device *dev, const char *buf, size_t count) 1667txmpnd_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
32static ssize_t 32static ssize_t
33qeth_dev_state_show(struct device *dev, char *buf) 33qeth_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)
58static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL); 58static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL);
59 59
60static ssize_t 60static ssize_t
61qeth_dev_chpid_show(struct device *dev, char *buf) 61qeth_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)
70static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL); 70static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL);
71 71
72static ssize_t 72static ssize_t
73qeth_dev_if_name_show(struct device *dev, char *buf) 73qeth_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)
81static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL); 81static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL);
82 82
83static ssize_t 83static ssize_t
84qeth_dev_card_type_show(struct device *dev, char *buf) 84qeth_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)
93static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL); 93static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL);
94 94
95static ssize_t 95static ssize_t
96qeth_dev_portno_show(struct device *dev, char *buf) 96qeth_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
105static ssize_t 105static ssize_t
106qeth_dev_portno_store(struct device *dev, const char *buf, size_t count) 106qeth_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)
129static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store); 129static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store);
130 130
131static ssize_t 131static ssize_t
132qeth_dev_portname_show(struct device *dev, char *buf) 132qeth_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
148static ssize_t 148static ssize_t
149qeth_dev_portname_store(struct device *dev, const char *buf, size_t count) 149qeth_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
179static ssize_t 179static ssize_t
180qeth_dev_checksum_show(struct device *dev, char *buf) 180qeth_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
190static ssize_t 190static ssize_t
191qeth_dev_checksum_store(struct device *dev, const char *buf, size_t count) 191qeth_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
220static ssize_t 220static ssize_t
221qeth_dev_prioqing_show(struct device *dev, char *buf) 221qeth_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
239static ssize_t 239static ssize_t
240qeth_dev_prioqing_store(struct device *dev, const char *buf, size_t count) 240qeth_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
292static ssize_t 292static ssize_t
293qeth_dev_bufcnt_show(struct device *dev, char *buf) 293qeth_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
303static ssize_t 303static ssize_t
304qeth_dev_bufcnt_store(struct device *dev, const char *buf, size_t count) 304qeth_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
362static ssize_t 362static ssize_t
363qeth_dev_route4_show(struct device *dev, char *buf) 363qeth_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
412static ssize_t 412static ssize_t
413qeth_dev_route4_store(struct device *dev, const char *buf, size_t count) 413qeth_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
427static ssize_t 427static ssize_t
428qeth_dev_route6_show(struct device *dev, char *buf) 428qeth_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
441static ssize_t 441static ssize_t
442qeth_dev_route6_store(struct device *dev, const char *buf, size_t count) 442qeth_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
463static ssize_t 463static ssize_t
464qeth_dev_add_hhlen_show(struct device *dev, char *buf) 464qeth_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
474static ssize_t 474static ssize_t
475qeth_dev_add_hhlen_store(struct device *dev, const char *buf, size_t count) 475qeth_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
501static ssize_t 501static ssize_t
502qeth_dev_fake_ll_show(struct device *dev, char *buf) 502qeth_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
512static ssize_t 512static ssize_t
513qeth_dev_fake_ll_store(struct device *dev, const char *buf, size_t count) 513qeth_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
538static ssize_t 538static ssize_t
539qeth_dev_fake_broadcast_show(struct device *dev, char *buf) 539qeth_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
549static ssize_t 549static ssize_t
550qeth_dev_fake_broadcast_store(struct device *dev, const char *buf, size_t count) 550qeth_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
576static ssize_t 576static ssize_t
577qeth_dev_recover_store(struct device *dev, const char *buf, size_t count) 577qeth_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)
596static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store); 596static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store);
597 597
598static ssize_t 598static ssize_t
599qeth_dev_broadcast_mode_show(struct device *dev, char *buf) 599qeth_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
615static ssize_t 615static ssize_t
616qeth_dev_broadcast_mode_store(struct device *dev, const char *buf, size_t count) 616qeth_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
653static ssize_t 653static ssize_t
654qeth_dev_canonical_macaddr_show(struct device *dev, char *buf) 654qeth_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
669static ssize_t 669static ssize_t
670qeth_dev_canonical_macaddr_store(struct device *dev, const char *buf, 670qeth_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
705static ssize_t 705static ssize_t
706qeth_dev_layer2_show(struct device *dev, char *buf) 706qeth_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
716static ssize_t 716static ssize_t
717qeth_dev_layer2_store(struct device *dev, const char *buf, size_t count) 717qeth_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
744static ssize_t 744static ssize_t
745qeth_dev_large_send_show(struct device *dev, char *buf) 745qeth_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
764static ssize_t 764static ssize_t
765qeth_dev_large_send_store(struct device *dev, const char *buf, size_t count) 765qeth_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
834static ssize_t 834static ssize_t
835qeth_dev_blkt_total_show(struct device *dev, char *buf) 835qeth_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
843static ssize_t 843static ssize_t
844qeth_dev_blkt_total_store(struct device *dev, const char *buf, size_t count) 844qeth_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
857static ssize_t 857static ssize_t
858qeth_dev_blkt_inter_show(struct device *dev, char *buf) 858qeth_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
866static ssize_t 866static ssize_t
867qeth_dev_blkt_inter_store(struct device *dev, const char *buf, size_t count) 867qeth_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
878static ssize_t 878static ssize_t
879qeth_dev_blkt_inter_jumbo_show(struct device *dev, char *buf) 879qeth_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
888static ssize_t 888static ssize_t
889qeth_dev_blkt_inter_jumbo_store(struct device *dev, const char *buf, size_t count) 889qeth_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
958static ssize_t 958static ssize_t
959qeth_dev_ipato_enable_show(struct device *dev, char *buf) 959qeth_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
971static ssize_t 971static ssize_t
972qeth_dev_ipato_enable_store(struct device *dev, const char *buf, size_t count) 972qeth_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
1006static ssize_t 1006static ssize_t
1007qeth_dev_ipato_invert4_show(struct device *dev, char *buf) 1007qeth_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
1020static ssize_t 1020static ssize_t
1021qeth_dev_ipato_invert4_store(struct device *dev, const char *buf, size_t count) 1021qeth_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
1086static ssize_t 1086static ssize_t
1087qeth_dev_ipato_add4_show(struct device *dev, char *buf) 1087qeth_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
1155static ssize_t 1155static ssize_t
1156qeth_dev_ipato_add4_store(struct device *dev, const char *buf, size_t count) 1156qeth_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
1188static ssize_t 1188static ssize_t
1189qeth_dev_ipato_del4_store(struct device *dev, const char *buf, size_t count) 1189qeth_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
1203static ssize_t 1203static ssize_t
1204qeth_dev_ipato_invert6_show(struct device *dev, char *buf) 1204qeth_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
1217static ssize_t 1217static ssize_t
1218qeth_dev_ipato_invert6_store(struct device *dev, const char *buf, size_t count) 1218qeth_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
1249static ssize_t 1249static ssize_t
1250qeth_dev_ipato_add6_show(struct device *dev, char *buf) 1250qeth_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
1260static ssize_t 1260static ssize_t
1261qeth_dev_ipato_add6_store(struct device *dev, const char *buf, size_t count) 1261qeth_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
1275static ssize_t 1275static ssize_t
1276qeth_dev_ipato_del6_store(struct device *dev, const char *buf, size_t count) 1276qeth_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
1343static ssize_t 1343static ssize_t
1344qeth_dev_vipa_add4_show(struct device *dev, char *buf) 1344qeth_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
1383static ssize_t 1383static ssize_t
1384qeth_dev_vipa_add4_store(struct device *dev, const char *buf, size_t count) 1384qeth_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
1415static ssize_t 1415static ssize_t
1416qeth_dev_vipa_del4_store(struct device *dev, const char *buf, size_t count) 1416qeth_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
1430static ssize_t 1430static ssize_t
1431qeth_dev_vipa_add6_show(struct device *dev, char *buf) 1431qeth_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
1441static ssize_t 1441static ssize_t
1442qeth_dev_vipa_add6_store(struct device *dev, const char *buf, size_t count) 1442qeth_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
1456static ssize_t 1456static ssize_t
1457qeth_dev_vipa_del6_store(struct device *dev, const char *buf, size_t count) 1457qeth_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
1524static ssize_t 1524static ssize_t
1525qeth_dev_rxip_add4_show(struct device *dev, char *buf) 1525qeth_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
1564static ssize_t 1564static ssize_t
1565qeth_dev_rxip_add4_store(struct device *dev, const char *buf, size_t count) 1565qeth_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
1596static ssize_t 1596static ssize_t
1597qeth_dev_rxip_del4_store(struct device *dev, const char *buf, size_t count) 1597qeth_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
1611static ssize_t 1611static ssize_t
1612qeth_dev_rxip_add6_show(struct device *dev, char *buf) 1612qeth_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
1622static ssize_t 1622static ssize_t
1623qeth_dev_rxip_add6_store(struct device *dev, const char *buf, size_t count) 1623qeth_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
1637static ssize_t 1637static ssize_t
1638qeth_dev_rxip_del6_store(struct device *dev, const char *buf, size_t count) 1638qeth_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) \
927static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \ 927static 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) \
53static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, \ 53static 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 */
92static ssize_t 92static ssize_t
93zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count) 93zfcp_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 */
137static ssize_t 137static ssize_t
138zfcp_sysfs_port_remove_store(struct device *dev, const char *buf, size_t count) 138zfcp_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 */
198static ssize_t 198static ssize_t
199zfcp_sysfs_adapter_failed_store(struct device *dev, 199zfcp_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 */
238static ssize_t 238static ssize_t
239zfcp_sysfs_adapter_failed_show(struct device *dev, char *buf) 239zfcp_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) \
56static ssize_t zfcp_sysfs_port_##_name##_show(struct device *dev, \ 56static 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 */
84static ssize_t 84static ssize_t
85zfcp_sysfs_unit_add_store(struct device *dev, const char *buf, size_t count) 85zfcp_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 */
127static ssize_t 127static ssize_t
128zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count) 128zfcp_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 */
188static ssize_t 188static ssize_t
189zfcp_sysfs_port_failed_store(struct device *dev, const char *buf, size_t count) 189zfcp_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 */
226static ssize_t 226static ssize_t
227zfcp_sysfs_port_failed_show(struct device *dev, char *buf) 227zfcp_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) \
56static ssize_t zfcp_sysfs_unit_##_name##_show(struct device *dev, \ 56static 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 */
88static ssize_t 88static ssize_t
89zfcp_sysfs_unit_failed_store(struct device *dev, const char *buf, size_t count) 89zfcp_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 */
125static ssize_t 125static ssize_t
126zfcp_sysfs_unit_failed_show(struct device *dev, char *buf) 126zfcp_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
2127static ssize_t 2127static ssize_t
2128NCR_700_show_active_tags(struct device *dev, char *buf) 2128NCR_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
469static ssize_t eesoxscsi_show_term(struct device *dev, char *buf) 469static 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
478static ssize_t eesoxscsi_store_term(struct device *dev, const char *buf, size_t len) 478static 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
272static ssize_t powertecscsi_show_term(struct device *dev, char *buf) 272static 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
281static ssize_t 281static ssize_t
282powertecscsi_store_term(struct device *dev, const char *buf, size_t len) 282powertecscsi_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 **/
2719static ssize_t ipr_show_adapter_handle(struct device *dev, char *buf) 2719static 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 *);
124static void megaraid_mbox_dpc(unsigned long); 124static void megaraid_mbox_dpc(unsigned long);
125 125
126static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); 126static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *);
127static ssize_t megaraid_sysfs_show_ldnum(struct device *, char *); 127static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *);
128 128
129static int megaraid_cmm_register(adapter_t *); 129static int megaraid_cmm_register(adapter_t *);
130static int megaraid_cmm_unregister(adapter_t *); 130static 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 */
4147static ssize_t 4147static ssize_t
4148megaraid_sysfs_show_ldnum(struct device *dev, char *buf) 4148megaraid_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
5609CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); 5609CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL);
5610 5610
5611static struct class_simple * osst_sysfs_class; 5611static struct class *osst_sysfs_class;
5612 5612
5613static int osst_sysfs_valid = 0; 5613static int osst_sysfs_valid = 0;
5614 5614
5615static void osst_sysfs_init(void) 5615static 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
5651static void osst_sysfs_cleanup(void) 5651static 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) \
232static ssize_t \ 232static ssize_t \
233sdev_show_##field (struct device *dev, char *buf) \ 233sdev_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 \
256static ssize_t \ 256static ssize_t \
257sdev_store_##field (struct device *dev, const char *buf, size_t count) \ 257sdev_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 \
276static ssize_t \ 276static ssize_t \
277sdev_store_##field (struct device *dev, const char *buf, size_t count) \ 277sdev_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");
317sdev_rd_attr (rev, "%.4s\n"); 317sdev_rd_attr (rev, "%.4s\n");
318 318
319static ssize_t 319static ssize_t
320sdev_show_timeout (struct device *dev, char *buf) 320sdev_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
327static ssize_t 327static ssize_t
328sdev_store_timeout (struct device *dev, const char *buf, size_t count) 328sdev_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)
337static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); 337static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
338 338
339static ssize_t 339static ssize_t
340store_rescan_field (struct device *dev, const char *buf, size_t count) 340store_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}
345static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); 345static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
346 346
347static ssize_t sdev_store_delete(struct device *dev, const char *buf, 347static 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,
353static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 353static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
354 354
355static ssize_t 355static ssize_t
356store_state_field(struct device *dev, const char *buf, size_t count) 356store_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
378static ssize_t 378static ssize_t
379show_state_field(struct device *dev, char *buf) 379show_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)
390static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); 390static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field);
391 391
392static ssize_t 392static ssize_t
393show_queue_type_field(struct device *dev, char *buf) 393show_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)
406static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); 406static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL);
407 407
408static ssize_t 408static ssize_t
409show_iostat_counterbits(struct device *dev, char *buf) 409show_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) \
417static ssize_t \ 417static ssize_t \
418show_iostat_##field(struct device *dev, char *buf) \ 418show_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
452static ssize_t sdev_store_queue_depth_rw(struct device *dev, const char *buf, 452static 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
478static ssize_t sdev_store_queue_type_rw(struct device *dev, const char *buf, 478static 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
672static 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 */
680void scsi_remove_target(struct device *dev) 687void 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}
696EXPORT_SYMBOL(scsi_remove_target); 700EXPORT_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");
348spi_transport_rd_attr(rti, "%d\n"); 348spi_transport_rd_attr(rti, "%d\n");
349spi_transport_rd_attr(pcomp_en, "%d\n"); 349spi_transport_rd_attr(pcomp_en, "%d\n");
350 350
351/* we only care about the first child device so we return 1 */
352static 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
351static ssize_t 360static ssize_t
352store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) 361store_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}
364static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); 368static 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
1433static struct class_simple * sg_sysfs_class; 1433static struct class *sg_sysfs_class;
1434 1434
1435static int sg_sysfs_valid = 0; 1435static 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);
1694err_out: 1694err_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;
84static int st_dev_max; 84static int st_dev_max;
85static int st_nr_dev; 85static int st_nr_dev;
86 86
87static struct class_simple *st_sysfs_class; 87static struct class *st_sysfs_class;
88 88
89MODULE_AUTHOR("Kai Makisara"); 89MODULE_AUTHOR("Kai Makisara");
90MODULE_DESCRIPTION("SCSI Tape Driver"); 90MODULE_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)
4161static void __exit exit_st(void) 4163static 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) \
18static ssize_t name##_show(struct device *dev, char *buf) \ 18static 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
71static struct class_simple *usb_class; 71static struct class *usb_class;
72 72
73int usb_major_init(void) 73int 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
96void usb_major_cleanup(void) 97void 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 */
654struct usb_bus *usb_bus_get (struct usb_bus *bus) 654struct 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) 661static 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 */
669void usb_bus_put (struct usb_bus *bus) 670void 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
677static void usb_host_release(struct class_device *class_dev) 678static 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
685static struct class usb_host_class = {
686 .name = "usb_host",
687 .release = &usb_host_release,
688};
689 679
690int usb_host_init(void) 680int 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
695void usb_host_cleanup(void) 690void 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)
761static int usb_register_bus(struct usb_bus *bus) 755static 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) \
27static ssize_t show_##field (struct device *dev, char *buf) \ 27static 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")
46usb_actconfig_attr (bmAttributes, 1, "%2x\n") 46usb_actconfig_attr (bmAttributes, 1, "%2x\n")
47usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") 47usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
48 48
49static ssize_t show_configuration_string(struct device *dev, char *buf) 49static 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);
69usb_actconfig_show(bConfigurationValue, 1, "%u\n"); 69usb_actconfig_show(bConfigurationValue, 1, "%u\n");
70 70
71static ssize_t 71static ssize_t
72set_bConfigurationValue (struct device *dev, const char *buf, size_t count) 72set_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) \
90static ssize_t show_##name(struct device *dev, char *buf) \ 90static 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);
107usb_string_attr(serial); 107usb_string_attr(serial);
108 108
109static ssize_t 109static ssize_t
110show_speed (struct device *dev, char *buf) 110show_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)
133static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); 133static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
134 134
135static ssize_t 135static ssize_t
136show_devnum (struct device *dev, char *buf) 136show_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)
143static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); 143static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL);
144 144
145static ssize_t 145static ssize_t
146show_version (struct device *dev, char *buf) 146show_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)
155static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); 155static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
156 156
157static ssize_t 157static ssize_t
158show_maxchild (struct device *dev, char *buf) 158show_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) \
169static ssize_t \ 169static ssize_t \
170show_##field (struct device *dev, char *buf) \ 170show_##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) \
185static ssize_t \ 185static ssize_t \
186show_##field (struct device *dev, char *buf) \ 186show_##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) \
256static ssize_t \ 256static ssize_t \
257show_##field (struct device *dev, char *buf) \ 257show_##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")
269usb_intf_attr (bInterfaceSubClass, "%02x\n") 269usb_intf_attr (bInterfaceSubClass, "%02x\n")
270usb_intf_attr (bInterfaceProtocol, "%02x\n") 270usb_intf_attr (bInterfaceProtocol, "%02x\n")
271 271
272static ssize_t show_interface_string(struct device *dev, char *buf) 272static 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}
287static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); 287static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL);
288 288
289static ssize_t show_modalias(struct device *dev, char *buf) 289static 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
472static 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 */
474struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) 499struct 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
498static int usb_device_match (struct device *dev, struct device_driver *drv) 509static 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 */
635static ssize_t 635static ssize_t
636show_function (struct device *dev, char *buf) 636show_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
1602static ssize_t 1602static ssize_t
1603show_urbs (struct device *dev, char *buf) 1603show_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
3557static ssize_t show_ro(struct device *dev, char *buf) 3557static 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
3564static ssize_t show_file(struct device *dev, char *buf) 3564static 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
3592static ssize_t store_ro(struct device *dev, const char *buf, size_t count) 3592static 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
3616static ssize_t store_file(struct device *dev, const char *buf, size_t count) 3616static 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 */
1471static ssize_t 1471static ssize_t
1472show_function (struct device *_dev, char *buf) 1472show_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)
1482static DEVICE_ATTR (function, S_IRUGO, show_function, NULL); 1482static DEVICE_ATTR (function, S_IRUGO, show_function, NULL);
1483 1483
1484static ssize_t 1484static ssize_t
1485show_registers (struct device *_dev, char *buf) 1485show_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)
1637static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL); 1637static DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
1638 1638
1639static ssize_t 1639static ssize_t
1640show_queues (struct device *_dev, char *buf) 1640show_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 */
1431static ssize_t 1431static ssize_t
1432show_function (struct device *_dev, char *buf) 1432show_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
736static inline void create_debug_files (struct ehci_hcd *ehci) 736static 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
745static inline void remove_debug_files (struct ehci_hcd *ehci) 745static 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
685static inline void create_debug_files (struct ohci_hcd *ohci) 685static 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
695static inline void remove_debug_files (struct ohci_hcd *ohci) 695static 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 */
1028static ssize_t show_tabletSize(struct device *dev, char *buf) 1028static 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 */
1051static ssize_t show_tabletProductId(struct device *dev, char *buf) 1051static 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 */
1067static ssize_t show_tabletVendorId(struct device *dev, char *buf) 1067static 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 */
1082static ssize_t show_tabletManufacturer(struct device *dev, char *buf) 1082static 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 */
1099static ssize_t show_tabletProduct(struct device *dev, char *buf) 1099static 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 */
1117static ssize_t show_tabletPointerMode(struct device *dev, char *buf) 1117static 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
1145static ssize_t 1145static ssize_t
1146store_tabletPointerMode(struct device *dev, const char *buf, size_t count) 1146store_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 */
1171static ssize_t show_tabletCoordinateMode(struct device *dev, char *buf) 1171static 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
1195static ssize_t 1195static ssize_t
1196store_tabletCoordinateMode(struct device *dev, const char *buf, size_t count) 1196store_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 */
1220static ssize_t show_tabletToolMode(struct device *dev, char *buf) 1220static 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
1264static ssize_t 1264static ssize_t
1265store_tabletToolMode(struct device *dev, const char *buf, size_t count) 1265store_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 */
1298static ssize_t show_tabletXtilt(struct device *dev, char *buf) 1298static 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
1313static ssize_t 1313static ssize_t
1314store_tabletXtilt(struct device *dev, const char *buf, size_t count) 1314store_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 */
1340static ssize_t show_tabletYtilt(struct device *dev, char *buf) 1340static 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
1355static ssize_t 1355static ssize_t
1356store_tabletYtilt(struct device *dev, const char *buf, size_t count) 1356store_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 */
1382static ssize_t show_tabletJitterDelay(struct device *dev, char *buf) 1382static 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
1392static ssize_t 1392static ssize_t
1393store_tabletJitterDelay(struct device *dev, const char *buf, size_t count) 1393store_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 */
1412static ssize_t show_tabletProgrammableDelay(struct device *dev, char *buf) 1412static 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
1423static ssize_t 1423static ssize_t
1424store_tabletProgrammableDelay(struct device *dev, const char *buf, size_t count) 1424store_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 */
1443static ssize_t show_tabletInputDevice(struct device *dev, char *buf) 1443static 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 */
1460static ssize_t show_tabletEventsReceived(struct device *dev, char *buf) 1460static 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 */
1476static ssize_t show_tabletDiagnosticMessage(struct device *dev, char *buf) 1476static 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 */
1518static ssize_t show_tabletStylusUpper(struct device *dev, char *buf) 1518static 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
1542static ssize_t 1542static ssize_t
1543store_tabletStylusUpper(struct device *dev, const char *buf, size_t count) 1543store_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 */
1568static ssize_t show_tabletStylusLower(struct device *dev, char *buf) 1568static 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
1592static ssize_t 1592static ssize_t
1593store_tabletStylusLower(struct device *dev, const char *buf, size_t count) 1593store_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 */
1618static ssize_t show_tabletMouseLeft(struct device *dev, char *buf) 1618static 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
1646static ssize_t 1646static ssize_t
1647store_tabletMouseLeft(struct device *dev, const char *buf, size_t count) 1647store_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 */
1672static ssize_t show_tabletMouseMiddle(struct device *dev, char *buf) 1672static 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
1700static ssize_t 1700static ssize_t
1701store_tabletMouseMiddle(struct device *dev, const char *buf, size_t count) 1701store_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 */
1728static ssize_t show_tabletMouseRight(struct device *dev, char *buf) 1728static 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
1756static ssize_t 1756static ssize_t
1757store_tabletMouseRight(struct device *dev, const char *buf, size_t count) 1757store_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 */
1783static ssize_t show_tabletWheel(struct device *dev, char *buf) 1783static 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
1798static ssize_t 1798static ssize_t
1799store_tabletWheel(struct device *dev, const char *buf, size_t count) 1799store_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 */
1817static ssize_t show_tabletExecute(struct device *dev, char *buf) 1817static 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
1831static ssize_t 1831static ssize_t
1832store_tabletExecute(struct device *dev, const char *buf, size_t count) 1832store_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 */
1858static ssize_t show_tabletODMCode(struct device *dev, char *buf) 1858static 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 */
1874static ssize_t show_tabletModelCode(struct device *dev, char *buf) 1874static 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 */
1890static ssize_t show_firmwareCode(struct device *dev, char *buf) 1890static 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
88static ssize_t show_brightness(struct device *dev, char *buf) 88static 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
96static ssize_t set_brightness(struct device *dev, const char *buf, 96static 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
141static ssize_t show_temp(struct device *dev, char *buf) 141static 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
177static ssize_t set_temp(struct device *dev, const char *buf, size_t count) 177static 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
187static ssize_t show_button(struct device *dev, char *buf) 187static 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
218static ssize_t set_button(struct device *dev, const char *buf, size_t count) 218static 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)
223static DEVICE_ATTR(button, S_IRUGO, show_button, set_button); 223static DEVICE_ATTR(button, S_IRUGO, show_button, set_button);
224 224
225 225
226static ssize_t show_port0(struct device *dev, char *buf) 226static 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
252static ssize_t set_port0(struct device *dev, const char *buf, size_t count) 252static 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
284static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR | S_IWGRP, show_port0, set_port0); 284static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR | S_IWGRP, show_port0, set_port0);
285 285
286static ssize_t show_port1(struct device *dev, char *buf) 286static 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
312static ssize_t set_port1(struct device *dev, const char *buf, size_t count) 312static 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) \
176static ssize_t lcd_line_##number(struct device *dev, const char *buf, size_t count) \ 176static 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);
184set_lcd_line(1); 184set_lcd_line(1);
185set_lcd_line(2); 185set_lcd_line(2);
186 186
187static ssize_t set_backlight(struct device *dev, const char *buf, size_t count) 187static 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
235static ssize_t enable_lcd_files(struct device *dev, const char *buf, size_t count) 235static 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) \
310static ssize_t set_output##value(struct device *dev, const char *buf, \ 310static 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 \
327static ssize_t show_output##value(struct device *dev, char *buf) \ 327static 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);
343show_set_output(8); /* should be MAX_INTERFACES - 1 */ 343show_set_output(8); /* should be MAX_INTERFACES - 1 */
344 344
345#define show_input(value) \ 345#define show_input(value) \
346static ssize_t show_input##value(struct device *dev, char *buf) \ 346static 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);
362show_input(8); /* should be MAX_INTERFACES - 1 */ 362show_input(8); /* should be MAX_INTERFACES - 1 */
363 363
364#define show_sensor(value) \ 364#define show_sensor(value) \
365static ssize_t show_sensor##value(struct device *dev, char *buf) \ 365static 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) \
210static ssize_t set_servo##value (struct device *dev, \ 210static 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 \
236static ssize_t show_servo##value (struct device *dev, char *buf) \ 236static 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) \
84static ssize_t show_##value(struct device *dev, char *buf) \ 84static 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} \
91static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 91static 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
1221static ssize_t show_latency_timer(struct device *dev, char *buf) 1221static 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. */
1248static ssize_t store_latency_timer(struct device *dev, const char *valbuf, 1248static 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. */
1279static ssize_t store_event_char(struct device *dev, const char *valbuf, 1279static 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 */
401static ssize_t show_max_sectors(struct device *dev, char *buf) 401static 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 */
409static ssize_t store_max_sectors(struct device *dev, const char *buf, 409static 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
1043static struct class_simple *fb_class; 1043static 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);
1210static void __exit 1210static void __exit
1211fbmem_exit(void) 1211fbmem_exit(void)
1212{ 1212{
1213 class_simple_destroy(fb_class); 1213 class_destroy(fb_class);
1214} 1214}
1215 1215
1216module_exit(fbmem_exit); 1216module_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
1048static ssize_t gbefb_show_memsize(struct device *dev, char *buf) 1048static 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
1053static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL); 1053static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
1054 1054
1055static ssize_t gbefb_show_rev(struct device *device, char *buf) 1055static 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
104static ssize_t rotation_show(struct device *dev, char *buf) 104static 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
112static ssize_t rotation_store(struct device *dev, const char *buf, size_t count) 112static 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
135static DEVICE_ATTR(rotation, 0644, rotation_show, rotation_store); 135static DEVICE_ATTR(rotation, 0644, rotation_show, rotation_store);
136 136
137static ssize_t w100fb_reg_read(struct device *dev, const char *buf, size_t count) 137static 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
147static DEVICE_ATTR(reg_read, 0200, NULL, w100fb_reg_read); 147static DEVICE_ATTR(reg_read, 0200, NULL, w100fb_reg_read);
148 148
149static ssize_t w100fb_reg_write(struct device *dev, const char *buf, size_t count) 149static 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
163static DEVICE_ATTR(reg_write, 0200, NULL, w100fb_reg_write); 163static DEVICE_ATTR(reg_write, 0200, NULL, w100fb_reg_write);
164 164
165 165
166static ssize_t fastsysclk_show(struct device *dev, char *buf) 166static 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
174static ssize_t fastsysclk_store(struct device *dev, const char *buf, size_t count) 174static 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
91static ssize_t w1_default_read_name(struct device *dev, char *buf) 91static 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
140static ssize_t w1_master_attribute_show_name(struct device *dev, char *buf) 140static 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
155static ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf) 155static 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
169static ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf) 169static 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
176static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf) 176static 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
190static ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf) 190static 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
204static ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf) 204static 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
218static ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf) 218static 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
35struct w1_family_ops 35struct 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");
36MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>"); 36MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
37MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family."); 37MODULE_DESCRIPTION("Driver for 1-wire Dallas network protocol, 64bit memory family.");
38 38
39static ssize_t w1_smem_read_name(struct device *, char *); 39static ssize_t w1_smem_read_name(struct device *, struct device_attribute *attr, char *);
40static ssize_t w1_smem_read_val(struct device *, char *); 40static ssize_t w1_smem_read_val(struct device *, struct device_attribute *attr, char *);
41static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t); 41static ssize_t w1_smem_read_bin(struct kobject *, char *, loff_t, size_t);
42 42
43static struct w1_family_ops w1_smem_fops = { 43static 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
50static ssize_t w1_smem_read_name(struct device *dev, char *buf) 50static 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
57static ssize_t w1_smem_read_val(struct device *dev, char *buf) 57static 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
45static ssize_t w1_therm_read_name(struct device *, char *); 45static ssize_t w1_therm_read_name(struct device *, struct device_attribute *attr, char *);
46static ssize_t w1_therm_read_temp(struct device *, char *); 46static ssize_t w1_therm_read_temp(struct device *, struct device_attribute *attr, char *);
47static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t); 47static ssize_t w1_therm_read_bin(struct kobject *, char *, loff_t, size_t);
48 48
49static struct w1_family_ops w1_therm_fops = { 49static 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
56static ssize_t w1_therm_read_name(struct device *dev, char *buf) 56static 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
80static ssize_t w1_therm_read_temp(struct device *dev, char *buf) 80static 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) \
23static ssize_t \ 23static ssize_t \
24show_##name(struct device *dev, char *buf) \ 24show_##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");
36zorro_config_attr(slotaddr, slotaddr, "0x%04x\n"); 36zorro_config_attr(slotaddr, slotaddr, "0x%04x\n");
37zorro_config_attr(slotsize, slotsize, "0x%04x\n"); 37zorro_config_attr(slotsize, slotsize, "0x%04x\n");
38 38
39static ssize_t zorro_show_resource(struct device *dev, char *buf) 39static 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