aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 15:40:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 15:40:26 -0400
commitc813b4e16ead3c3df98ac84419d4df2adf33fe01 (patch)
tree2ca4a5b6966d833b6149e3dda7a4e85d1255779c /drivers
parentc8d8a2321f9c4ee18fbcc399fdc2a77e580a03b9 (diff)
parent02683ffdf655b4ae15245376ba6fea6d9e5829a6 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits) UIO: Fix mapping of logical and virtual memory UIO: add automata sercos3 pci card support UIO: Change driver name of uio_pdrv UIO: Add alignment warnings for uio-mem Driver core: add bus_sort_breadthfirst() function NET: convert the phy_device file to use bus_find_device_by_name kobject: Cleanup kobject_rename and !CONFIG_SYSFS kobject: Fix kobject_rename and !CONFIG_SYSFS sysfs: Make dir and name args to sysfs_notify() const platform: add new device registration helper sysfs: use ilookup5() instead of ilookup5_nowait() PNP: create device attributes via default device attributes Driver core: make bus_find_device_by_name() more robust usb: turn dev_warn+WARN_ON combos into dev_WARN debug: use dev_WARN() rather than WARN_ON() in device_pm_add() debug: Introduce a dev_WARN() function sysfs: fix deadlock device model: Do a quickcheck for driver binding before doing an expensive check Driver core: Fix cleanup in device_create_vargs(). Driver core: Clarify device cleanup. ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/bus.c54
-rw-r--r--drivers/base/core.c30
-rw-r--r--drivers/base/dd.c3
-rw-r--r--drivers/base/platform.c49
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/block/aoe/aoechr.c6
-rw-r--r--drivers/block/paride/pg.c5
-rw-r--r--drivers/block/paride/pt.c10
-rw-r--r--drivers/block/pktcdvd.c5
-rw-r--r--drivers/char/bsr.c5
-rw-r--r--drivers/char/dsp56k.c4
-rw-r--r--drivers/char/ip2/ip2main.c12
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c2
-rw-r--r--drivers/char/istallion.c5
-rw-r--r--drivers/char/lp.c4
-rw-r--r--drivers/char/mem.c6
-rw-r--r--drivers/char/misc.c4
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c2
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c3
-rw-r--r--drivers/char/ppdev.c5
-rw-r--r--drivers/char/raw.c7
-rw-r--r--drivers/char/snsc.c4
-rw-r--r--drivers/char/stallion.c4
-rw-r--r--drivers/char/tty_io.c2
-rw-r--r--drivers/char/vc_screen.c12
-rw-r--r--drivers/char/viotape.c8
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c3
-rw-r--r--drivers/dca/dca-sysfs.c8
-rw-r--r--drivers/firmware/iscsi_ibft.c18
-rw-r--r--drivers/hid/hidraw.c5
-rw-r--r--drivers/hwmon/hwmon.c4
-rw-r--r--drivers/i2c/i2c-dev.c6
-rw-r--r--drivers/ide/ide-probe.c4
-rw-r--r--drivers/ide/ide-tape.c11
-rw-r--r--drivers/ieee1394/dv1394.c8
-rw-r--r--drivers/ieee1394/raw1394.c8
-rw-r--r--drivers/ieee1394/video1394.c5
-rw-r--r--drivers/infiniband/core/cm.c6
-rw-r--r--drivers/infiniband/core/user_mad.c12
-rw-r--r--drivers/infiniband/core/uverbs_main.c9
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c2
-rw-r--r--drivers/isdn/capi/capi.c3
-rw-r--r--drivers/leds/led-class.c4
-rw-r--r--drivers/macintosh/adb.c3
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c2
-rw-r--r--drivers/misc/phantom.c6
-rw-r--r--drivers/mtd/mtdchar.c10
-rw-r--r--drivers/net/phy/phy_device.c8
-rw-r--r--drivers/net/ppp_generic.c4
-rw-r--r--drivers/net/wan/cosa.c4
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c6
-rw-r--r--drivers/pci/probe.c50
-rw-r--r--drivers/pnp/base.h2
-rw-r--r--drivers/pnp/core.c10
-rw-r--r--drivers/pnp/driver.c1
-rw-r--r--drivers/pnp/interface.c37
-rw-r--r--drivers/power/power_supply_core.c4
-rw-r--r--drivers/s390/char/raw3270.c14
-rw-r--r--drivers/s390/char/tape_class.c6
-rw-r--r--drivers/s390/char/vmlogrdr.c8
-rw-r--r--drivers/s390/char/vmur.c5
-rw-r--r--drivers/scsi/ch.c6
-rw-r--r--drivers/scsi/dpt_i2o.c2
-rw-r--r--drivers/scsi/osst.c3
-rw-r--r--drivers/scsi/sg.c10
-rw-r--r--drivers/scsi/st.c11
-rw-r--r--drivers/spi/spidev.c7
-rw-r--r--drivers/uio/Kconfig13
-rw-r--r--drivers/uio/Makefile1
-rw-r--r--drivers/uio/uio.c26
-rw-r--r--drivers/uio/uio_pdrv.c2
-rw-r--r--drivers/uio/uio_sercos3.c243
-rw-r--r--drivers/usb/core/devio.c6
-rw-r--r--drivers/usb/core/file.c6
-rw-r--r--drivers/usb/core/hcd.c5
-rw-r--r--drivers/usb/gadget/Makefile23
-rw-r--r--drivers/usb/gadget/cdc2.c25
-rw-r--r--drivers/usb/gadget/ether.c28
-rw-r--r--drivers/usb/gadget/f_ecm.c108
-rw-r--r--drivers/usb/gadget/f_loopback.c34
-rw-r--r--drivers/usb/gadget/f_subset.c44
-rw-r--r--drivers/usb/gadget/file_storage.c12
-rw-r--r--drivers/usb/gadget/gmidi.c15
-rw-r--r--drivers/usb/gadget/printer.c18
-rw-r--r--drivers/usb/gadget/rndis.c115
-rw-r--r--drivers/usb/gadget/serial.c18
-rw-r--r--drivers/usb/gadget/u_ether.c4
-rw-r--r--drivers/usb/gadget/zero.c17
-rw-r--r--drivers/usb/host/uhci-q.c24
-rw-r--r--drivers/usb/misc/phidgetkit.c5
-rw-r--r--drivers/usb/misc/phidgetmotorcontrol.c5
-rw-r--r--drivers/usb/misc/phidgetservo.c5
-rw-r--r--drivers/usb/mon/mon_bin.c6
-rw-r--r--drivers/video/console/fbcon.c4
-rw-r--r--drivers/video/display/display-sysfs.c9
-rw-r--r--drivers/video/fbmem.c5
96 files changed, 896 insertions, 518 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index ef522ae55480..5aee1c0169ea 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -333,9 +333,7 @@ static int match_name(struct device *dev, void *data)
333{ 333{
334 const char *name = data; 334 const char *name = data;
335 335
336 if (strcmp(name, dev->bus_id) == 0) 336 return sysfs_streq(name, dev->bus_id);
337 return 1;
338 return 0;
339} 337}
340 338
341/** 339/**
@@ -982,6 +980,56 @@ struct klist *bus_get_device_klist(struct bus_type *bus)
982} 980}
983EXPORT_SYMBOL_GPL(bus_get_device_klist); 981EXPORT_SYMBOL_GPL(bus_get_device_klist);
984 982
983/*
984 * Yes, this forcably breaks the klist abstraction temporarily. It
985 * just wants to sort the klist, not change reference counts and
986 * take/drop locks rapidly in the process. It does all this while
987 * holding the lock for the list, so objects can't otherwise be
988 * added/removed while we're swizzling.
989 */
990static void device_insertion_sort_klist(struct device *a, struct list_head *list,
991 int (*compare)(const struct device *a,
992 const struct device *b))
993{
994 struct list_head *pos;
995 struct klist_node *n;
996 struct device *b;
997
998 list_for_each(pos, list) {
999 n = container_of(pos, struct klist_node, n_node);
1000 b = container_of(n, struct device, knode_bus);
1001 if (compare(a, b) <= 0) {
1002 list_move_tail(&a->knode_bus.n_node,
1003 &b->knode_bus.n_node);
1004 return;
1005 }
1006 }
1007 list_move_tail(&a->knode_bus.n_node, list);
1008}
1009
1010void bus_sort_breadthfirst(struct bus_type *bus,
1011 int (*compare)(const struct device *a,
1012 const struct device *b))
1013{
1014 LIST_HEAD(sorted_devices);
1015 struct list_head *pos, *tmp;
1016 struct klist_node *n;
1017 struct device *dev;
1018 struct klist *device_klist;
1019
1020 device_klist = bus_get_device_klist(bus);
1021
1022 spin_lock(&device_klist->k_lock);
1023 list_for_each_safe(pos, tmp, &device_klist->k_list) {
1024 n = container_of(pos, struct klist_node, n_node);
1025 dev = container_of(n, struct device, knode_bus);
1026 device_insertion_sort_klist(dev, &sorted_devices, compare);
1027 }
1028 list_splice(&sorted_devices, &device_klist->k_list);
1029 spin_unlock(&device_klist->k_lock);
1030}
1031EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
1032
985int __init buses_init(void) 1033int __init buses_init(void)
986{ 1034{
987 bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); 1035 bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b98cb1416a2d..8c2cc2648f5a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -523,11 +523,16 @@ static void klist_children_put(struct klist_node *n)
523 * device_initialize - init device structure. 523 * device_initialize - init device structure.
524 * @dev: device. 524 * @dev: device.
525 * 525 *
526 * This prepares the device for use by other layers, 526 * This prepares the device for use by other layers by initializing
527 * including adding it to the device hierarchy. 527 * its fields.
528 * It is the first half of device_register(), if called by 528 * It is the first half of device_register(), if called by
529 * that, though it can also be called separately, so one 529 * that function, though it can also be called separately, so one
530 * may use @dev's fields (e.g. the refcount). 530 * may use @dev's fields. In particular, get_device()/put_device()
531 * may be used for reference counting of @dev after calling this
532 * function.
533 *
534 * NOTE: Use put_device() to give up your reference instead of freeing
535 * @dev directly once you have called this function.
531 */ 536 */
532void device_initialize(struct device *dev) 537void device_initialize(struct device *dev)
533{ 538{
@@ -835,9 +840,13 @@ static void device_remove_sys_dev_entry(struct device *dev)
835 * This is part 2 of device_register(), though may be called 840 * This is part 2 of device_register(), though may be called
836 * separately _iff_ device_initialize() has been called separately. 841 * separately _iff_ device_initialize() has been called separately.
837 * 842 *
838 * This adds it to the kobject hierarchy via kobject_add(), adds it 843 * This adds @dev to the kobject hierarchy via kobject_add(), adds it
839 * to the global and sibling lists for the device, then 844 * to the global and sibling lists for the device, then
840 * adds it to the other relevant subsystems of the driver model. 845 * adds it to the other relevant subsystems of the driver model.
846 *
847 * NOTE: _Never_ directly free @dev after calling this function, even
848 * if it returned an error! Always use put_device() to give up your
849 * reference instead.
841 */ 850 */
842int device_add(struct device *dev) 851int device_add(struct device *dev)
843{ 852{
@@ -965,6 +974,10 @@ done:
965 * I.e. you should only call the two helpers separately if 974 * I.e. you should only call the two helpers separately if
966 * have a clearly defined need to use and refcount the device 975 * have a clearly defined need to use and refcount the device
967 * before it is added to the hierarchy. 976 * before it is added to the hierarchy.
977 *
978 * NOTE: _Never_ directly free @dev after calling this function, even
979 * if it returned an error! Always use put_device() to give up the
980 * reference initialized in this function instead.
968 */ 981 */
969int device_register(struct device *dev) 982int device_register(struct device *dev)
970{ 983{
@@ -1243,7 +1256,7 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
1243 return dev; 1256 return dev;
1244 1257
1245error: 1258error:
1246 kfree(dev); 1259 put_device(dev);
1247 return ERR_PTR(retval); 1260 return ERR_PTR(retval);
1248} 1261}
1249EXPORT_SYMBOL_GPL(device_create_vargs); 1262EXPORT_SYMBOL_GPL(device_create_vargs);
@@ -1314,6 +1327,11 @@ EXPORT_SYMBOL_GPL(device_destroy);
1314 * device_rename - renames a device 1327 * device_rename - renames a device
1315 * @dev: the pointer to the struct device to be renamed 1328 * @dev: the pointer to the struct device to be renamed
1316 * @new_name: the new name of the device 1329 * @new_name: the new name of the device
1330 *
1331 * It is the responsibility of the caller to provide mutual
1332 * exclusion between two different calls of device_rename
1333 * on the same device to ensure that new_name is valid and
1334 * won't conflict with other devices.
1317 */ 1335 */
1318int device_rename(struct device *dev, char *new_name) 1336int device_rename(struct device *dev, char *new_name)
1319{ 1337{
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 3ac443b2ac08..20febc00a525 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -257,6 +257,9 @@ static int __driver_attach(struct device *dev, void *data)
257 * is an error. 257 * is an error.
258 */ 258 */
259 259
260 if (drv->bus->match && !drv->bus->match(dev, drv))
261 return 0;
262
260 if (dev->parent) /* Needed for USB */ 263 if (dev->parent) /* Needed for USB */
261 down(&dev->parent->sem); 264 down(&dev->parent->sem);
262 down(&dev->sem); 265 down(&dev->sem);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 66b710c28812..dfcbfe504867 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -394,6 +394,53 @@ error:
394} 394}
395EXPORT_SYMBOL_GPL(platform_device_register_simple); 395EXPORT_SYMBOL_GPL(platform_device_register_simple);
396 396
397/**
398 * platform_device_register_data
399 * @parent: parent device for the device we're adding
400 * @name: base name of the device we're adding
401 * @id: instance id
402 * @data: platform specific data for this platform device
403 * @size: size of platform specific data
404 *
405 * This function creates a simple platform device that requires minimal
406 * resource and memory management. Canned release function freeing memory
407 * allocated for the device allows drivers using such devices to be
408 * unloaded without waiting for the last reference to the device to be
409 * dropped.
410 */
411struct platform_device *platform_device_register_data(
412 struct device *parent,
413 const char *name, int id,
414 const void *data, size_t size)
415{
416 struct platform_device *pdev;
417 int retval;
418
419 pdev = platform_device_alloc(name, id);
420 if (!pdev) {
421 retval = -ENOMEM;
422 goto error;
423 }
424
425 pdev->dev.parent = parent;
426
427 if (size) {
428 retval = platform_device_add_data(pdev, data, size);
429 if (retval)
430 goto error;
431 }
432
433 retval = platform_device_add(pdev);
434 if (retval)
435 goto error;
436
437 return pdev;
438
439error:
440 platform_device_put(pdev);
441 return ERR_PTR(retval);
442}
443
397static int platform_drv_probe(struct device *_dev) 444static int platform_drv_probe(struct device *_dev)
398{ 445{
399 struct platform_driver *drv = to_platform_driver(_dev->driver); 446 struct platform_driver *drv = to_platform_driver(_dev->driver);
@@ -865,7 +912,7 @@ static int platform_pm_restore_noirq(struct device *dev)
865 912
866#endif /* !CONFIG_HIBERNATION */ 913#endif /* !CONFIG_HIBERNATION */
867 914
868struct pm_ext_ops platform_pm_ops = { 915static struct pm_ext_ops platform_pm_ops = {
869 .base = { 916 .base = {
870 .prepare = platform_pm_prepare, 917 .prepare = platform_pm_prepare,
871 .complete = platform_pm_complete, 918 .complete = platform_pm_complete,
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 03bde7524bc3..692c20ba5144 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -83,7 +83,7 @@ void device_pm_add(struct device *dev)
83 * transition is in progress in order to avoid leaving them 83 * transition is in progress in order to avoid leaving them
84 * unhandled down the road 84 * unhandled down the road
85 */ 85 */
86 WARN_ON(true); 86 dev_WARN(dev, "Parentless device registered during a PM transaction\n");
87 } 87 }
88 88
89 list_add_tail(&dev->power.entry, &dpm_list); 89 list_add_tail(&dev->power.entry, &dpm_list);
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 1f56d2c5b7fc..200efc4d2c1e 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -284,9 +284,9 @@ aoechr_init(void)
284 return PTR_ERR(aoe_class); 284 return PTR_ERR(aoe_class);
285 } 285 }
286 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 286 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
287 device_create_drvdata(aoe_class, NULL, 287 device_create(aoe_class, NULL,
288 MKDEV(AOE_MAJOR, chardevs[i].minor), 288 MKDEV(AOE_MAJOR, chardevs[i].minor), NULL,
289 NULL, chardevs[i].name); 289 chardevs[i].name);
290 290
291 return 0; 291 return 0;
292} 292}
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index d731ca42f802..9dfa27163001 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -686,9 +686,8 @@ static int __init pg_init(void)
686 for (unit = 0; unit < PG_UNITS; unit++) { 686 for (unit = 0; unit < PG_UNITS; unit++) {
687 struct pg *dev = &devices[unit]; 687 struct pg *dev = &devices[unit];
688 if (dev->present) 688 if (dev->present)
689 device_create_drvdata(pg_class, NULL, 689 device_create(pg_class, NULL, MKDEV(major, unit), NULL,
690 MKDEV(major, unit), NULL, 690 "pg%u", unit);
691 "pg%u", unit);
692 } 691 }
693 err = 0; 692 err = 0;
694 goto out; 693 goto out;
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 673b8b2fd337..5ae229656eaa 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -979,12 +979,10 @@ static int __init pt_init(void)
979 979
980 for (unit = 0; unit < PT_UNITS; unit++) 980 for (unit = 0; unit < PT_UNITS; unit++)
981 if (pt[unit].present) { 981 if (pt[unit].present) {
982 device_create_drvdata(pt_class, NULL, 982 device_create(pt_class, NULL, MKDEV(major, unit), NULL,
983 MKDEV(major, unit), NULL, 983 "pt%d", unit);
984 "pt%d", unit); 984 device_create(pt_class, NULL, MKDEV(major, unit + 128),
985 device_create_drvdata(pt_class, NULL, 985 NULL, "pt%dn", unit);
986 MKDEV(major, unit + 128), NULL,
987 "pt%dn", unit);
988 } 986 }
989 goto out; 987 goto out;
990 988
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 0e077150568b..195ca7c720f5 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -302,9 +302,8 @@ static struct kobj_type kobj_pkt_type_wqueue = {
302static void pkt_sysfs_dev_new(struct pktcdvd_device *pd) 302static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
303{ 303{
304 if (class_pktcdvd) { 304 if (class_pktcdvd) {
305 pd->dev = device_create_drvdata(class_pktcdvd, NULL, 305 pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, NULL,
306 pd->pkt_dev, NULL, 306 "%s", pd->name);
307 "%s", pd->name);
308 if (IS_ERR(pd->dev)) 307 if (IS_ERR(pd->dev))
309 pd->dev = NULL; 308 pd->dev = NULL;
310 } 309 }
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index b650b4e48e50..456f54db73e2 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -229,9 +229,8 @@ static int bsr_create_devs(struct device_node *bn)
229 if (result) 229 if (result)
230 goto out_err; 230 goto out_err;
231 231
232 cur->bsr_device = device_create_drvdata(bsr_class, NULL, 232 cur->bsr_device = device_create(bsr_class, NULL, cur->bsr_dev,
233 cur->bsr_dev, 233 cur, cur->bsr_name);
234 cur, cur->bsr_name);
235 if (!cur->bsr_device) { 234 if (!cur->bsr_device) {
236 printk(KERN_ERR "device_create failed for %s\n", 235 printk(KERN_ERR "device_create failed for %s\n",
237 cur->bsr_name); 236 cur->bsr_name);
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index ca7c72a486b2..85832ab924e6 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -508,8 +508,8 @@ static int __init dsp56k_init_driver(void)
508 err = PTR_ERR(dsp56k_class); 508 err = PTR_ERR(dsp56k_class);
509 goto out_chrdev; 509 goto out_chrdev;
510 } 510 }
511 device_create_drvdata(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), 511 device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL,
512 NULL, "dsp56k"); 512 "dsp56k");
513 513
514 printk(banner); 514 printk(banner);
515 goto out; 515 goto out;
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 6774572d3759..70e0ebc30bd0 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -745,12 +745,12 @@ static int __init ip2_loadmain(void)
745 745
746 pB = i2BoardPtrTable[i]; 746 pB = i2BoardPtrTable[i];
747 if (pB != NULL) { 747 if (pB != NULL) {
748 device_create_drvdata(ip2_class, NULL, 748 device_create(ip2_class, NULL,
749 MKDEV(IP2_IPL_MAJOR, 4 * i), 749 MKDEV(IP2_IPL_MAJOR, 4 * i),
750 NULL, "ipl%d", i); 750 NULL, "ipl%d", i);
751 device_create_drvdata(ip2_class, NULL, 751 device_create(ip2_class, NULL,
752 MKDEV(IP2_IPL_MAJOR, 4 * i + 1), 752 MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
753 NULL, "stat%d", i); 753 NULL, "stat%d", i);
754 754
755 for (box = 0; box < ABS_MAX_BOXES; box++) 755 for (box = 0; box < ABS_MAX_BOXES; box++)
756 for (j = 0; j < ABS_BIGGEST_BOX; j++) 756 for (j = 0; j < ABS_BIGGEST_BOX; j++)
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index 64e1c169e826..835a33c8d5f5 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -871,7 +871,7 @@ static void ipmi_new_smi(int if_num, struct device *device)
871 entry->dev = dev; 871 entry->dev = dev;
872 872
873 mutex_lock(&reg_list_mutex); 873 mutex_lock(&reg_list_mutex);
874 device_create_drvdata(ipmi_class, device, dev, NULL, "ipmi%d", if_num); 874 device_create(ipmi_class, device, dev, NULL, "ipmi%d", if_num);
875 list_add(&entry->link, &reg_list); 875 list_add(&entry->link, &reg_list);
876 mutex_unlock(&reg_list_mutex); 876 mutex_unlock(&reg_list_mutex);
877} 877}
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 505d7a1f6b8c..44e5d60f517e 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -4600,9 +4600,8 @@ static int __init istallion_module_init(void)
4600 4600
4601 istallion_class = class_create(THIS_MODULE, "staliomem"); 4601 istallion_class = class_create(THIS_MODULE, "staliomem");
4602 for (i = 0; i < 4; i++) 4602 for (i = 0; i < 4; i++)
4603 device_create_drvdata(istallion_class, NULL, 4603 device_create(istallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i),
4604 MKDEV(STL_SIOMEMMAJOR, i), 4604 NULL, "staliomem%d", i);
4605 NULL, "staliomem%d", i);
4606 4605
4607 return 0; 4606 return 0;
4608err_deinit: 4607err_deinit:
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 3f2719b9f77b..e444c2dba160 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -813,8 +813,8 @@ static int lp_register(int nr, struct parport *port)
813 if (reset) 813 if (reset)
814 lp_reset(nr); 814 lp_reset(nr);
815 815
816 device_create_drvdata(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL, 816 device_create(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL,
817 "lp%d", nr); 817 "lp%d", nr);
818 818
819 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, 819 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name,
820 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); 820 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven");
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 672b08e694d0..6431f6921a67 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -992,9 +992,9 @@ static int __init chr_dev_init(void)
992 992
993 mem_class = class_create(THIS_MODULE, "mem"); 993 mem_class = class_create(THIS_MODULE, "mem");
994 for (i = 0; i < ARRAY_SIZE(devlist); i++) 994 for (i = 0; i < ARRAY_SIZE(devlist); i++)
995 device_create_drvdata(mem_class, NULL, 995 device_create(mem_class, NULL,
996 MKDEV(MEM_MAJOR, devlist[i].minor), 996 MKDEV(MEM_MAJOR, devlist[i].minor), NULL,
997 NULL, devlist[i].name); 997 devlist[i].name);
998 998
999 return 0; 999 return 0;
1000} 1000}
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 999aa779c08a..a5e0db9d7662 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -217,8 +217,8 @@ int misc_register(struct miscdevice * misc)
217 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); 217 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
218 dev = MKDEV(MISC_MAJOR, misc->minor); 218 dev = MKDEV(MISC_MAJOR, misc->minor);
219 219
220 misc->this_device = device_create_drvdata(misc_class, misc->parent, 220 misc->this_device = device_create(misc_class, misc->parent, dev, NULL,
221 dev, NULL, "%s", misc->name); 221 "%s", misc->name);
222 if (IS_ERR(misc->this_device)) { 222 if (IS_ERR(misc->this_device)) {
223 err = PTR_ERR(misc->this_device); 223 err = PTR_ERR(misc->this_device);
224 goto out; 224 goto out;
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 1c5bf99895ed..dbb912574569 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1871,7 +1871,7 @@ static int cm4000_probe(struct pcmcia_device *link)
1871 return ret; 1871 return ret;
1872 } 1872 }
1873 1873
1874 device_create_drvdata(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i); 1874 device_create(cmm_class, NULL, MKDEV(major, i), NULL, "cmm%d", i);
1875 1875
1876 return 0; 1876 return 0;
1877} 1877}
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 2d7c906435b7..4f0723b07974 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -637,8 +637,7 @@ static int reader_probe(struct pcmcia_device *link)
637 return ret; 637 return ret;
638 } 638 }
639 639
640 device_create_drvdata(cmx_class, NULL, MKDEV(major, i), NULL, 640 device_create(cmx_class, NULL, MKDEV(major, i), NULL, "cmx%d", i);
641 "cmx%d", i);
642 641
643 return 0; 642 return 0;
644} 643}
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index bee39fdfba73..c84c34fb1231 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -760,9 +760,8 @@ static const struct file_operations pp_fops = {
760 760
761static void pp_attach(struct parport *port) 761static void pp_attach(struct parport *port)
762{ 762{
763 device_create_drvdata(ppdev_class, port->dev, 763 device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number),
764 MKDEV(PP_MAJOR, port->number), 764 NULL, "parport%d", port->number);
765 NULL, "parport%d", port->number);
766} 765}
767 766
768static void pp_detach(struct parport *port) 767static void pp_detach(struct parport *port)
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 47b8cf281d4a..e139372d0e69 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -131,8 +131,8 @@ raw_ioctl(struct inode *inode, struct file *filp,
131static void bind_device(struct raw_config_request *rq) 131static void bind_device(struct raw_config_request *rq)
132{ 132{
133 device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); 133 device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
134 device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), 134 device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), NULL,
135 NULL, "raw%d", rq->raw_minor); 135 "raw%d", rq->raw_minor);
136} 136}
137 137
138/* 138/*
@@ -283,8 +283,7 @@ static int __init raw_init(void)
283 ret = PTR_ERR(raw_class); 283 ret = PTR_ERR(raw_class);
284 goto error_region; 284 goto error_region;
285 } 285 }
286 device_create_drvdata(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, 286 device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
287 "rawctl");
288 287
289 return 0; 288 return 0;
290 289
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 3ce60df14c0a..32b74de18f5f 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -444,8 +444,8 @@ scdrv_init(void)
444 continue; 444 continue;
445 } 445 }
446 446
447 device_create_drvdata(snsc_class, NULL, dev, NULL, 447 device_create(snsc_class, NULL, dev, NULL,
448 "%s", devname); 448 "%s", devname);
449 449
450 ia64_sn_irtr_intr_enable(scd->scd_nasid, 450 ia64_sn_irtr_intr_enable(scd->scd_nasid,
451 0 /*ignored */ , 451 0 /*ignored */ ,
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 8b8f07a7f505..963b03fb29e5 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -4743,8 +4743,8 @@ static int __init stallion_module_init(void)
4743 if (IS_ERR(stallion_class)) 4743 if (IS_ERR(stallion_class))
4744 printk("STALLION: failed to create class\n"); 4744 printk("STALLION: failed to create class\n");
4745 for (i = 0; i < 4; i++) 4745 for (i = 0; i < 4; i++)
4746 device_create_drvdata(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), 4746 device_create(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i),
4747 NULL, "staliomem%d", i); 4747 NULL, "staliomem%d", i);
4748 4748
4749 return 0; 4749 return 0;
4750err_unrtty: 4750err_unrtty:
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 3f48d88cffc0..59f472143f08 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2850,7 +2850,7 @@ struct device *tty_register_device(struct tty_driver *driver, unsigned index,
2850 else 2850 else
2851 tty_line_name(driver, index, name); 2851 tty_line_name(driver, index, name);
2852 2852
2853 return device_create_drvdata(tty_class, device, dev, NULL, name); 2853 return device_create(tty_class, device, dev, NULL, name);
2854} 2854}
2855EXPORT_SYMBOL(tty_register_device); 2855EXPORT_SYMBOL(tty_register_device);
2856 2856
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index c2ae52dd53d1..4f3b3f95fc42 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -481,10 +481,10 @@ static struct class *vc_class;
481 481
482void vcs_make_sysfs(struct tty_struct *tty) 482void vcs_make_sysfs(struct tty_struct *tty)
483{ 483{
484 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), 484 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), NULL,
485 NULL, "vcs%u", tty->index + 1); 485 "vcs%u", tty->index + 1);
486 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), 486 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), NULL,
487 NULL, "vcsa%u", tty->index + 1); 487 "vcsa%u", tty->index + 1);
488} 488}
489 489
490void vcs_remove_sysfs(struct tty_struct *tty) 490void vcs_remove_sysfs(struct tty_struct *tty)
@@ -499,7 +499,7 @@ int __init vcs_init(void)
499 panic("unable to get major %d for vcs device", VCS_MAJOR); 499 panic("unable to get major %d for vcs device", VCS_MAJOR);
500 vc_class = class_create(THIS_MODULE, "vc"); 500 vc_class = class_create(THIS_MODULE, "vc");
501 501
502 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); 502 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
503 device_create_drvdata(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); 503 device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
504 return 0; 504 return 0;
505} 505}
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 7a70a40ad639..ffc9254f7e02 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -886,10 +886,10 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
886 state[i].cur_part = 0; 886 state[i].cur_part = 0;
887 for (j = 0; j < MAX_PARTITIONS; ++j) 887 for (j = 0; j < MAX_PARTITIONS; ++j)
888 state[i].part_stat_rwi[j] = VIOT_IDLE; 888 state[i].part_stat_rwi[j] = VIOT_IDLE;
889 device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), 889 device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i), NULL,
890 NULL, "iseries!vt%d", i); 890 "iseries!vt%d", i);
891 device_create_drvdata(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), 891 device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), NULL,
892 NULL, "iseries!nvt%d", i); 892 "iseries!nvt%d", i);
893 printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " 893 printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries "
894 "resource %10.10s type %4.4s, model %3.3s\n", 894 "resource %10.10s type %4.4s, model %3.3s\n",
895 i, viotape_unitinfo[i].rsrcname, 895 i, viotape_unitinfo[i].rsrcname,
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 278c9857bcf5..ed132fe55d3d 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -657,8 +657,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
657 goto failed3; 657 goto failed3;
658 } 658 }
659 659
660 device_create_drvdata(icap_class, dev, devt, NULL, 660 device_create(icap_class, dev, devt, NULL, "%s%d", DRIVER_NAME, id);
661 "%s%d", DRIVER_NAME, id);
662 return 0; /* success */ 661 return 0; /* success */
663 662
664 failed3: 663 failed3:
diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c
index 7af4b403bd2d..bb538b9690e0 100644
--- a/drivers/dca/dca-sysfs.c
+++ b/drivers/dca/dca-sysfs.c
@@ -15,9 +15,8 @@ int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot)
15 struct device *cd; 15 struct device *cd;
16 static int req_count; 16 static int req_count;
17 17
18 cd = device_create_drvdata(dca_class, dca->cd, 18 cd = device_create(dca_class, dca->cd, MKDEV(0, slot + 1), NULL,
19 MKDEV(0, slot + 1), NULL, 19 "requester%d", req_count++);
20 "requester%d", req_count++);
21 if (IS_ERR(cd)) 20 if (IS_ERR(cd))
22 return PTR_ERR(cd); 21 return PTR_ERR(cd);
23 return 0; 22 return 0;
@@ -48,8 +47,7 @@ idr_try_again:
48 return err; 47 return err;
49 } 48 }
50 49
51 cd = device_create_drvdata(dca_class, dev, MKDEV(0, 0), NULL, 50 cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id);
52 "dca%d", dca->id);
53 if (IS_ERR(cd)) { 51 if (IS_ERR(cd)) {
54 spin_lock(&dca_idr_lock); 52 spin_lock(&dca_idr_lock);
55 idr_remove(&dca_idr, dca->id); 53 idr_remove(&dca_idr, dca->id);
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index b91ef63126ed..deb154aa47c4 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -334,9 +334,9 @@ static void ibft_release(struct kobject *kobj)
334/* 334/*
335 * Routines for parsing the iBFT data to be human readable. 335 * Routines for parsing the iBFT data to be human readable.
336 */ 336 */
337ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry, 337static ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry,
338 struct ibft_attribute *attr, 338 struct ibft_attribute *attr,
339 char *buf) 339 char *buf)
340{ 340{
341 struct ibft_initiator *initiator = entry->initiator; 341 struct ibft_initiator *initiator = entry->initiator;
342 void *ibft_loc = entry->header; 342 void *ibft_loc = entry->header;
@@ -376,9 +376,9 @@ ssize_t ibft_attr_show_initiator(struct ibft_kobject *entry,
376 return str - buf; 376 return str - buf;
377} 377}
378 378
379ssize_t ibft_attr_show_nic(struct ibft_kobject *entry, 379static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
380 struct ibft_attribute *attr, 380 struct ibft_attribute *attr,
381 char *buf) 381 char *buf)
382{ 382{
383 struct ibft_nic *nic = entry->nic; 383 struct ibft_nic *nic = entry->nic;
384 void *ibft_loc = entry->header; 384 void *ibft_loc = entry->header;
@@ -440,9 +440,9 @@ ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
440 return str - buf; 440 return str - buf;
441}; 441};
442 442
443ssize_t ibft_attr_show_target(struct ibft_kobject *entry, 443static ssize_t ibft_attr_show_target(struct ibft_kobject *entry,
444 struct ibft_attribute *attr, 444 struct ibft_attribute *attr,
445 char *buf) 445 char *buf)
446{ 446{
447 struct ibft_tgt *tgt = entry->tgt; 447 struct ibft_tgt *tgt = entry->tgt;
448 void *ibft_loc = entry->header; 448 void *ibft_loc = entry->header;
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 497e0d1dd3c3..af3edb98df43 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -326,9 +326,8 @@ int hidraw_connect(struct hid_device *hid)
326 goto out; 326 goto out;
327 } 327 }
328 328
329 dev->dev = device_create_drvdata(hidraw_class, NULL, 329 dev->dev = device_create(hidraw_class, NULL, MKDEV(hidraw_major, minor),
330 MKDEV(hidraw_major, minor), NULL, 330 NULL, "%s%d", "hidraw", minor);
331 "%s%d", "hidraw", minor);
332 331
333 if (IS_ERR(dev->dev)) { 332 if (IS_ERR(dev->dev)) {
334 spin_lock(&minors_lock); 333 spin_lock(&minors_lock);
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 7321a88a5112..076a59cdabe9 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -55,8 +55,8 @@ again:
55 return ERR_PTR(err); 55 return ERR_PTR(err);
56 56
57 id = id & MAX_ID_MASK; 57 id = id & MAX_ID_MASK;
58 hwdev = device_create_drvdata(hwmon_class, dev, MKDEV(0, 0), NULL, 58 hwdev = device_create(hwmon_class, dev, MKDEV(0, 0), NULL,
59 HWMON_ID_FORMAT, id); 59 HWMON_ID_FORMAT, id);
60 60
61 if (IS_ERR(hwdev)) { 61 if (IS_ERR(hwdev)) {
62 spin_lock(&idr_lock); 62 spin_lock(&idr_lock);
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 307d976c9b69..c171988a9f51 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -521,9 +521,9 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
521 return PTR_ERR(i2c_dev); 521 return PTR_ERR(i2c_dev);
522 522
523 /* register this i2c device with the driver core */ 523 /* register this i2c device with the driver core */
524 i2c_dev->dev = device_create_drvdata(i2c_dev_class, &adap->dev, 524 i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
525 MKDEV(I2C_MAJOR, adap->nr), 525 MKDEV(I2C_MAJOR, adap->nr), NULL,
526 NULL, "i2c-%d", adap->nr); 526 "i2c-%d", adap->nr);
527 if (IS_ERR(i2c_dev->dev)) { 527 if (IS_ERR(i2c_dev->dev)) {
528 res = PTR_ERR(i2c_dev->dev); 528 res = PTR_ERR(i2c_dev->dev);
529 goto error; 529 goto error;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index f27baa5f140e..19f8c7770a25 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -657,8 +657,8 @@ static int ide_register_port(ide_hwif_t *hwif)
657 goto out; 657 goto out;
658 } 658 }
659 659
660 hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, 660 hwif->portdev = device_create(ide_port_class, &hwif->gendev,
661 MKDEV(0, 0), hwif, hwif->name); 661 MKDEV(0, 0), hwif, hwif->name);
662 if (IS_ERR(hwif->portdev)) { 662 if (IS_ERR(hwif->portdev)) {
663 ret = PTR_ERR(hwif->portdev); 663 ret = PTR_ERR(hwif->portdev);
664 device_unregister(&hwif->gendev); 664 device_unregister(&hwif->gendev);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 25ac60f53273..d879c7797cde 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2420,12 +2420,11 @@ static int ide_tape_probe(ide_drive_t *drive)
2420 2420
2421 idetape_setup(drive, tape, minor); 2421 idetape_setup(drive, tape, minor);
2422 2422
2423 device_create_drvdata(idetape_sysfs_class, &drive->gendev, 2423 device_create(idetape_sysfs_class, &drive->gendev,
2424 MKDEV(IDETAPE_MAJOR, minor), NULL, 2424 MKDEV(IDETAPE_MAJOR, minor), NULL, "%s", tape->name);
2425 "%s", tape->name); 2425 device_create(idetape_sysfs_class, &drive->gendev,
2426 device_create_drvdata(idetape_sysfs_class, &drive->gendev, 2426 MKDEV(IDETAPE_MAJOR, minor + 128), NULL,
2427 MKDEV(IDETAPE_MAJOR, minor + 128), NULL, 2427 "n%s", tape->name);
2428 "n%s", tape->name);
2429 2428
2430 g->fops = &idetape_block_ops; 2429 g->fops = &idetape_block_ops;
2431 ide_register_region(g); 2430 ide_register_region(g);
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index b6eb2cf25914..9236c0d5a122 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2296,10 +2296,10 @@ static void dv1394_add_host(struct hpsb_host *host)
2296 2296
2297 ohci = (struct ti_ohci *)host->hostdata; 2297 ohci = (struct ti_ohci *)host->hostdata;
2298 2298
2299 device_create_drvdata(hpsb_protocol_class, NULL, 2299 device_create(hpsb_protocol_class, NULL,
2300 MKDEV(IEEE1394_MAJOR, 2300 MKDEV(IEEE1394_MAJOR,
2301 IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), NULL, 2301 IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)),
2302 "dv1394-%d", id); 2302 NULL, "dv1394-%d", id);
2303 2303
2304 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); 2304 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE);
2305 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); 2305 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT);
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index 6fa9e4a21840..c7833bb37ae1 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -3010,10 +3010,10 @@ static int __init init_raw1394(void)
3010 hpsb_register_highlevel(&raw1394_highlevel); 3010 hpsb_register_highlevel(&raw1394_highlevel);
3011 3011
3012 if (IS_ERR 3012 if (IS_ERR
3013 (device_create_drvdata( 3013 (device_create(hpsb_protocol_class, NULL,
3014 hpsb_protocol_class, NULL, 3014 MKDEV(IEEE1394_MAJOR,
3015 MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16), 3015 IEEE1394_MINOR_BLOCK_RAW1394 * 16),
3016 NULL, RAW1394_DEVICE_NAME))) { 3016 NULL, RAW1394_DEVICE_NAME))) {
3017 ret = -EFAULT; 3017 ret = -EFAULT;
3018 goto out_unreg; 3018 goto out_unreg;
3019 } 3019 }
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index 25db6e67fa4e..6e73b06eed4f 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -1341,9 +1341,8 @@ static void video1394_add_host (struct hpsb_host *host)
1341 hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id); 1341 hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id);
1342 1342
1343 minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id; 1343 minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id;
1344 device_create_drvdata(hpsb_protocol_class, NULL, 1344 device_create(hpsb_protocol_class, NULL, MKDEV(IEEE1394_MAJOR, minor),
1345 MKDEV(IEEE1394_MAJOR, minor), NULL, 1345 NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
1346 "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
1347} 1346}
1348 1347
1349 1348
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 3cab0cedfca2..a78d35aecee3 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3691,9 +3691,9 @@ static void cm_add_one(struct ib_device *ib_device)
3691 cm_dev->ib_device = ib_device; 3691 cm_dev->ib_device = ib_device;
3692 cm_get_ack_delay(cm_dev); 3692 cm_get_ack_delay(cm_dev);
3693 3693
3694 cm_dev->device = device_create_drvdata(&cm_class, &ib_device->dev, 3694 cm_dev->device = device_create(&cm_class, &ib_device->dev,
3695 MKDEV(0, 0), NULL, 3695 MKDEV(0, 0), NULL,
3696 "%s", ib_device->name); 3696 "%s", ib_device->name);
3697 if (!cm_dev->device) { 3697 if (!cm_dev->device) {
3698 kfree(cm_dev); 3698 kfree(cm_dev);
3699 return; 3699 return;
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
index 268a2d23b7c9..8c46f2257098 100644
--- a/drivers/infiniband/core/user_mad.c
+++ b/drivers/infiniband/core/user_mad.c
@@ -1016,9 +1016,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
1016 if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) 1016 if (cdev_add(port->cdev, base_dev + port->dev_num, 1))
1017 goto err_cdev; 1017 goto err_cdev;
1018 1018
1019 port->dev = device_create_drvdata(umad_class, device->dma_device, 1019 port->dev = device_create(umad_class, device->dma_device,
1020 port->cdev->dev, port, 1020 port->cdev->dev, port,
1021 "umad%d", port->dev_num); 1021 "umad%d", port->dev_num);
1022 if (IS_ERR(port->dev)) 1022 if (IS_ERR(port->dev))
1023 goto err_cdev; 1023 goto err_cdev;
1024 1024
@@ -1036,9 +1036,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
1036 if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) 1036 if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1))
1037 goto err_sm_cdev; 1037 goto err_sm_cdev;
1038 1038
1039 port->sm_dev = device_create_drvdata(umad_class, device->dma_device, 1039 port->sm_dev = device_create(umad_class, device->dma_device,
1040 port->sm_cdev->dev, port, 1040 port->sm_cdev->dev, port,
1041 "issm%d", port->dev_num); 1041 "issm%d", port->dev_num);
1042 if (IS_ERR(port->sm_dev)) 1042 if (IS_ERR(port->sm_dev))
1043 goto err_sm_cdev; 1043 goto err_sm_cdev;
1044 1044
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index aeee856c4060..d85af1b67027 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -764,12 +764,9 @@ static void ib_uverbs_add_one(struct ib_device *device)
764 if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) 764 if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1))
765 goto err_cdev; 765 goto err_cdev;
766 766
767 uverbs_dev->dev = device_create_drvdata(uverbs_class, 767 uverbs_dev->dev = device_create(uverbs_class, device->dma_device,
768 device->dma_device, 768 uverbs_dev->cdev->dev, uverbs_dev,
769 uverbs_dev->cdev->dev, 769 "uverbs%d", uverbs_dev->devnum);
770 uverbs_dev,
771 "uverbs%d",
772 uverbs_dev->devnum);
773 if (IS_ERR(uverbs_dev->dev)) 770 if (IS_ERR(uverbs_dev->dev))
774 goto err_cdev; 771 goto err_cdev;
775 772
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 56c0eda3c077..1af1f3a907c6 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -2455,7 +2455,7 @@ static int init_cdev(int minor, char *name, const struct file_operations *fops,
2455 goto err_cdev; 2455 goto err_cdev;
2456 } 2456 }
2457 2457
2458 device = device_create_drvdata(ipath_class, NULL, dev, NULL, name); 2458 device = device_create(ipath_class, NULL, dev, NULL, name);
2459 2459
2460 if (IS_ERR(device)) { 2460 if (IS_ERR(device)) {
2461 ret = PTR_ERR(device); 2461 ret = PTR_ERR(device);
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 798d7f3e42ef..1b5bf87c4cf4 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1553,8 +1553,7 @@ static int __init capi_init(void)
1553 return PTR_ERR(capi_class); 1553 return PTR_ERR(capi_class);
1554 } 1554 }
1555 1555
1556 device_create_drvdata(capi_class, NULL, MKDEV(capi_major, 0), NULL, 1556 device_create(capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi");
1557 "capi");
1558 1557
1559#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE 1558#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1560 if (capinc_tty_init() < 0) { 1559 if (capinc_tty_init() < 0) {
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 559a40861c39..ee74ee7b2acc 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -103,8 +103,8 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
103{ 103{
104 int rc; 104 int rc;
105 105
106 led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev, 106 led_cdev->dev = device_create(leds_class, parent, 0, led_cdev,
107 "%s", led_cdev->name); 107 "%s", led_cdev->name);
108 if (IS_ERR(led_cdev->dev)) 108 if (IS_ERR(led_cdev->dev))
109 return PTR_ERR(led_cdev->dev); 109 return PTR_ERR(led_cdev->dev);
110 110
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index cae52485208a..23741cec45e3 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -862,8 +862,7 @@ adbdev_init(void)
862 adb_dev_class = class_create(THIS_MODULE, "adb"); 862 adb_dev_class = class_create(THIS_MODULE, "adb");
863 if (IS_ERR(adb_dev_class)) 863 if (IS_ERR(adb_dev_class))
864 return; 864 return;
865 device_create_drvdata(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, 865 device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb");
866 "adb");
867 866
868 platform_device_register(&adb_pfdev); 867 platform_device_register(&adb_pfdev);
869 platform_driver_probe(&adb_pfdrv, adb_dummy_probe); 868 platform_driver_probe(&adb_pfdrv, adb_dummy_probe);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index e7132770a3bf..665776d72a48 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -233,7 +233,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
233 233
234 mutex_unlock(&dvbdev_register_lock); 234 mutex_unlock(&dvbdev_register_lock);
235 235
236 clsdev = device_create_drvdata(dvb_class, adap->device, 236 clsdev = device_create(dvb_class, adap->device,
237 MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 237 MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
238 NULL, "dvb%d.%s%d", adap->num, dnames[type], id); 238 NULL, "dvb%d.%s%d", adap->num, dnames[type], id);
239 if (IS_ERR(clsdev)) { 239 if (IS_ERR(clsdev)) {
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index daf585689ce3..abdebe347383 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -399,9 +399,9 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
399 goto err_irq; 399 goto err_irq;
400 } 400 }
401 401
402 if (IS_ERR(device_create_drvdata(phantom_class, &pdev->dev, 402 if (IS_ERR(device_create(phantom_class, &pdev->dev,
403 MKDEV(phantom_major, minor), 403 MKDEV(phantom_major, minor), NULL,
404 NULL, "phantom%u", minor))) 404 "phantom%u", minor)))
405 dev_err(&pdev->dev, "can't create device\n"); 405 dev_err(&pdev->dev, "can't create device\n");
406 406
407 pci_set_drvdata(pdev, pht); 407 pci_set_drvdata(pdev, pht);
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index e00d424e6575..1c74762dec89 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -26,13 +26,11 @@ static void mtd_notify_add(struct mtd_info* mtd)
26 if (!mtd) 26 if (!mtd)
27 return; 27 return;
28 28
29 device_create_drvdata(mtd_class, NULL, 29 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
30 MKDEV(MTD_CHAR_MAJOR, mtd->index*2), 30 NULL, "mtd%d", mtd->index);
31 NULL, "mtd%d", mtd->index);
32 31
33 device_create_drvdata(mtd_class, NULL, 32 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
34 MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), 33 NULL, "mtd%dro", mtd->index);
35 NULL, "mtd%dro", mtd->index);
36} 34}
37 35
38static void mtd_notify_remove(struct mtd_info* mtd) 36static void mtd_notify_remove(struct mtd_info* mtd)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index f11e900b437b..e11b03b2b25a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -309,11 +309,6 @@ void phy_disconnect(struct phy_device *phydev)
309} 309}
310EXPORT_SYMBOL(phy_disconnect); 310EXPORT_SYMBOL(phy_disconnect);
311 311
312static int phy_compare_id(struct device *dev, void *data)
313{
314 return strcmp((char *)data, dev->bus_id) ? 0 : 1;
315}
316
317/** 312/**
318 * phy_attach - attach a network device to a particular PHY device 313 * phy_attach - attach a network device to a particular PHY device
319 * @dev: network device to attach 314 * @dev: network device to attach
@@ -337,8 +332,7 @@ struct phy_device *phy_attach(struct net_device *dev,
337 332
338 /* Search the list of PHY devices on the mdio bus for the 333 /* Search the list of PHY devices on the mdio bus for the
339 * PHY with the requested name */ 334 * PHY with the requested name */
340 d = bus_find_device(bus, NULL, (void *)bus_id, phy_compare_id); 335 d = bus_find_device_by_name(bus, NULL, bus_id);
341
342 if (d) { 336 if (d) {
343 phydev = to_phy_device(d); 337 phydev = to_phy_device(d);
344 } else { 338 } else {
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 94818ee3cef5..7e857e938adb 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -866,8 +866,8 @@ static int __init ppp_init(void)
866 err = PTR_ERR(ppp_class); 866 err = PTR_ERR(ppp_class);
867 goto out_chrdev; 867 goto out_chrdev;
868 } 868 }
869 device_create_drvdata(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), 869 device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL,
870 NULL, "ppp"); 870 "ppp");
871 } 871 }
872 872
873out: 873out:
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index f14051556c87..7f97f8d08c39 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -388,8 +388,8 @@ static int __init cosa_init(void)
388 goto out_chrdev; 388 goto out_chrdev;
389 } 389 }
390 for (i = 0; i < nr_cards; i++) 390 for (i = 0; i < nr_cards; i++)
391 device_create_drvdata(cosa_class, NULL, MKDEV(cosa_major, i), 391 device_create(cosa_class, NULL, MKDEV(cosa_major, i), NULL,
392 NULL, "cosa%d", i); 392 "cosa%d", i);
393 err = 0; 393 err = 0;
394 goto out; 394 goto out;
395 395
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index c9e4a435b2fc..1a019e98dac3 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -533,11 +533,11 @@ static int __init init_mac80211_hwsim(void)
533 data = hw->priv; 533 data = hw->priv;
534 data->hw = hw; 534 data->hw = hw;
535 535
536 data->dev = device_create_drvdata(hwsim_class, NULL, 0, hw, 536 data->dev = device_create(hwsim_class, NULL, 0, hw,
537 "hwsim%d", i); 537 "hwsim%d", i);
538 if (IS_ERR(data->dev)) { 538 if (IS_ERR(data->dev)) {
539 printk(KERN_DEBUG 539 printk(KERN_DEBUG
540 "mac80211_hwsim: device_create_drvdata " 540 "mac80211_hwsim: device_create "
541 "failed (%ld)\n", PTR_ERR(data->dev)); 541 "failed (%ld)\n", PTR_ERR(data->dev));
542 err = -ENOMEM; 542 err = -ENOMEM;
543 goto failed_drvdata; 543 goto failed_drvdata;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 36698e57b97f..dd9161a054e1 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1237,8 +1237,11 @@ EXPORT_SYMBOL(pci_scan_bridge);
1237EXPORT_SYMBOL_GPL(pci_scan_child_bus); 1237EXPORT_SYMBOL_GPL(pci_scan_child_bus);
1238#endif 1238#endif
1239 1239
1240static int __init pci_sort_bf_cmp(const struct pci_dev *a, const struct pci_dev *b) 1240static int __init pci_sort_bf_cmp(const struct device *d_a, const struct device *d_b)
1241{ 1241{
1242 const struct pci_dev *a = to_pci_dev(d_a);
1243 const struct pci_dev *b = to_pci_dev(d_b);
1244
1242 if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1; 1245 if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1;
1243 else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1; 1246 else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1;
1244 1247
@@ -1251,50 +1254,7 @@ static int __init pci_sort_bf_cmp(const struct pci_dev *a, const struct pci_dev
1251 return 0; 1254 return 0;
1252} 1255}
1253 1256
1254/*
1255 * Yes, this forcably breaks the klist abstraction temporarily. It
1256 * just wants to sort the klist, not change reference counts and
1257 * take/drop locks rapidly in the process. It does all this while
1258 * holding the lock for the list, so objects can't otherwise be
1259 * added/removed while we're swizzling.
1260 */
1261static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head *list)
1262{
1263 struct list_head *pos;
1264 struct klist_node *n;
1265 struct device *dev;
1266 struct pci_dev *b;
1267
1268 list_for_each(pos, list) {
1269 n = container_of(pos, struct klist_node, n_node);
1270 dev = container_of(n, struct device, knode_bus);
1271 b = to_pci_dev(dev);
1272 if (pci_sort_bf_cmp(a, b) <= 0) {
1273 list_move_tail(&a->dev.knode_bus.n_node, &b->dev.knode_bus.n_node);
1274 return;
1275 }
1276 }
1277 list_move_tail(&a->dev.knode_bus.n_node, list);
1278}
1279
1280void __init pci_sort_breadthfirst(void) 1257void __init pci_sort_breadthfirst(void)
1281{ 1258{
1282 LIST_HEAD(sorted_devices); 1259 bus_sort_breadthfirst(&pci_bus_type, &pci_sort_bf_cmp);
1283 struct list_head *pos, *tmp;
1284 struct klist_node *n;
1285 struct device *dev;
1286 struct pci_dev *pdev;
1287 struct klist *device_klist;
1288
1289 device_klist = bus_get_device_klist(&pci_bus_type);
1290
1291 spin_lock(&device_klist->k_lock);
1292 list_for_each_safe(pos, tmp, &device_klist->k_list) {
1293 n = container_of(pos, struct klist_node, n_node);
1294 dev = container_of(n, struct device, knode_bus);
1295 pdev = to_pci_dev(dev);
1296 pci_insertion_sort_klist(pdev, &sorted_devices);
1297 }
1298 list_splice(&sorted_devices, &device_klist->k_list);
1299 spin_unlock(&device_klist->k_lock);
1300} 1260}
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 7cc7bf5304aa..3b8b9d3cb03d 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6extern spinlock_t pnp_lock; 6extern spinlock_t pnp_lock;
7extern struct device_attribute pnp_interface_attrs[];
7void *pnp_alloc(long size); 8void *pnp_alloc(long size);
8 9
9int pnp_register_protocol(struct pnp_protocol *protocol); 10int pnp_register_protocol(struct pnp_protocol *protocol);
@@ -16,7 +17,6 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
16 17
17int pnp_add_device(struct pnp_dev *dev); 18int pnp_add_device(struct pnp_dev *dev);
18struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); 19struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id);
19int pnp_interface_attach_device(struct pnp_dev *dev);
20 20
21int pnp_add_card(struct pnp_card *card); 21int pnp_add_card(struct pnp_card *card);
22void pnp_remove_card(struct pnp_card *card); 22void pnp_remove_card(struct pnp_card *card);
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index cc0aeaed6179..817fe626e15b 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -159,21 +159,13 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
159 159
160int __pnp_add_device(struct pnp_dev *dev) 160int __pnp_add_device(struct pnp_dev *dev)
161{ 161{
162 int ret;
163
164 pnp_fixup_device(dev); 162 pnp_fixup_device(dev);
165 dev->status = PNP_READY; 163 dev->status = PNP_READY;
166 spin_lock(&pnp_lock); 164 spin_lock(&pnp_lock);
167 list_add_tail(&dev->global_list, &pnp_global); 165 list_add_tail(&dev->global_list, &pnp_global);
168 list_add_tail(&dev->protocol_list, &dev->protocol->devices); 166 list_add_tail(&dev->protocol_list, &dev->protocol->devices);
169 spin_unlock(&pnp_lock); 167 spin_unlock(&pnp_lock);
170 168 return device_register(&dev->dev);
171 ret = device_register(&dev->dev);
172 if (ret)
173 return ret;
174
175 pnp_interface_attach_device(dev);
176 return 0;
177} 169}
178 170
179/* 171/*
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index d3f869ee1d92..e3f7e89c4dfb 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -206,6 +206,7 @@ struct bus_type pnp_bus_type = {
206 .remove = pnp_device_remove, 206 .remove = pnp_device_remove,
207 .suspend = pnp_bus_suspend, 207 .suspend = pnp_bus_suspend,
208 .resume = pnp_bus_resume, 208 .resume = pnp_bus_resume,
209 .dev_attrs = pnp_interface_attrs,
209}; 210};
210 211
211int pnp_register_driver(struct pnp_driver *drv) 212int pnp_register_driver(struct pnp_driver *drv)
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index a876ecf7028c..478a4a739c00 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -243,8 +243,6 @@ static ssize_t pnp_show_options(struct device *dmdev,
243 return ret; 243 return ret;
244} 244}
245 245
246static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL);
247
248static ssize_t pnp_show_current_resources(struct device *dmdev, 246static ssize_t pnp_show_current_resources(struct device *dmdev,
249 struct device_attribute *attr, 247 struct device_attribute *attr,
250 char *buf) 248 char *buf)
@@ -420,9 +418,6 @@ done:
420 return count; 418 return count;
421} 419}
422 420
423static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR,
424 pnp_show_current_resources, pnp_set_current_resources);
425
426static ssize_t pnp_show_current_ids(struct device *dmdev, 421static ssize_t pnp_show_current_ids(struct device *dmdev,
427 struct device_attribute *attr, char *buf) 422 struct device_attribute *attr, char *buf)
428{ 423{
@@ -437,27 +432,11 @@ static ssize_t pnp_show_current_ids(struct device *dmdev,
437 return (str - buf); 432 return (str - buf);
438} 433}
439 434
440static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL); 435struct device_attribute pnp_interface_attrs[] = {
441 436 __ATTR(resources, S_IRUGO | S_IWUSR,
442int pnp_interface_attach_device(struct pnp_dev *dev) 437 pnp_show_current_resources,
443{ 438 pnp_set_current_resources),
444 int rc = device_create_file(&dev->dev, &dev_attr_options); 439 __ATTR(options, S_IRUGO, pnp_show_options, NULL),
445 440 __ATTR(id, S_IRUGO, pnp_show_current_ids, NULL),
446 if (rc) 441 __ATTR_NULL,
447 goto err; 442};
448 rc = device_create_file(&dev->dev, &dev_attr_resources);
449 if (rc)
450 goto err_opt;
451 rc = device_create_file(&dev->dev, &dev_attr_id);
452 if (rc)
453 goto err_res;
454
455 return 0;
456
457err_res:
458 device_remove_file(&dev->dev, &dev_attr_resources);
459err_opt:
460 device_remove_file(&dev->dev, &dev_attr_options);
461err:
462 return rc;
463}
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index cb1ccb472921..3007695f90c8 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -91,8 +91,8 @@ int power_supply_register(struct device *parent, struct power_supply *psy)
91{ 91{
92 int rc = 0; 92 int rc = 0;
93 93
94 psy->dev = device_create_drvdata(power_supply_class, parent, 0, 94 psy->dev = device_create(power_supply_class, parent, 0, psy,
95 psy, "%s", psy->name); 95 "%s", psy->name);
96 if (IS_ERR(psy->dev)) { 96 if (IS_ERR(psy->dev)) {
97 rc = PTR_ERR(psy->dev); 97 rc = PTR_ERR(psy->dev);
98 goto dev_create_failed; 98 goto dev_create_failed;
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 1792b2c0130e..0b15cf107ec9 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -1168,19 +1168,17 @@ static int raw3270_create_attributes(struct raw3270 *rp)
1168 if (rc) 1168 if (rc)
1169 goto out; 1169 goto out;
1170 1170
1171 rp->clttydev = device_create_drvdata(class3270, &rp->cdev->dev, 1171 rp->clttydev = device_create(class3270, &rp->cdev->dev,
1172 MKDEV(IBM_TTY3270_MAJOR, rp->minor), 1172 MKDEV(IBM_TTY3270_MAJOR, rp->minor), NULL,
1173 NULL, 1173 "tty%s", dev_name(&rp->cdev->dev));
1174 "tty%s", dev_name(&rp->cdev->dev));
1175 if (IS_ERR(rp->clttydev)) { 1174 if (IS_ERR(rp->clttydev)) {
1176 rc = PTR_ERR(rp->clttydev); 1175 rc = PTR_ERR(rp->clttydev);
1177 goto out_ttydev; 1176 goto out_ttydev;
1178 } 1177 }
1179 1178
1180 rp->cltubdev = device_create_drvdata(class3270, &rp->cdev->dev, 1179 rp->cltubdev = device_create(class3270, &rp->cdev->dev,
1181 MKDEV(IBM_FS3270_MAJOR, rp->minor), 1180 MKDEV(IBM_FS3270_MAJOR, rp->minor), NULL,
1182 NULL, 1181 "tub%s", dev_name(&rp->cdev->dev));
1183 "tub%s", dev_name(&rp->cdev->dev));
1184 if (!IS_ERR(rp->cltubdev)) 1182 if (!IS_ERR(rp->cltubdev))
1185 goto out; 1183 goto out;
1186 1184
diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c
index 12c2a5aaf31b..ddc914ccea8f 100644
--- a/drivers/s390/char/tape_class.c
+++ b/drivers/s390/char/tape_class.c
@@ -69,9 +69,9 @@ struct tape_class_device *register_tape_dev(
69 if (rc) 69 if (rc)
70 goto fail_with_cdev; 70 goto fail_with_cdev;
71 71
72 tcd->class_device = device_create_drvdata(tape_class, device, 72 tcd->class_device = device_create(tape_class, device,
73 tcd->char_device->dev, 73 tcd->char_device->dev, NULL,
74 NULL, "%s", tcd->device_name); 74 "%s", tcd->device_name);
75 rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; 75 rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0;
76 if (rc) 76 if (rc)
77 goto fail_with_cdev; 77 goto fail_with_cdev;
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index 42173cc34610..24762727bc27 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -747,10 +747,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
747 device_unregister(dev); 747 device_unregister(dev);
748 return ret; 748 return ret;
749 } 749 }
750 priv->class_device = device_create_drvdata(vmlogrdr_class, dev, 750 priv->class_device = device_create(vmlogrdr_class, dev,
751 MKDEV(vmlogrdr_major, 751 MKDEV(vmlogrdr_major,
752 priv->minor_num), 752 priv->minor_num),
753 priv, "%s", dev_name(dev)); 753 priv, "%s", dev_name(dev));
754 if (IS_ERR(priv->class_device)) { 754 if (IS_ERR(priv->class_device)) {
755 ret = PTR_ERR(priv->class_device); 755 ret = PTR_ERR(priv->class_device);
756 priv->class_device=NULL; 756 priv->class_device=NULL;
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 6fdfa5ddeca8..9020eba620ee 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -896,9 +896,8 @@ static int ur_set_online(struct ccw_device *cdev)
896 goto fail_free_cdev; 896 goto fail_free_cdev;
897 } 897 }
898 898
899 urd->device = device_create_drvdata(vmur_class, NULL, 899 urd->device = device_create(vmur_class, NULL, urd->char_device->dev,
900 urd->char_device->dev, NULL, 900 NULL, "%s", node_id);
901 "%s", node_id);
902 if (IS_ERR(urd->device)) { 901 if (IS_ERR(urd->device)) {
903 rc = PTR_ERR(urd->device); 902 rc = PTR_ERR(urd->device);
904 TRACE("ur_set_online: device_create rc=%d\n", rc); 903 TRACE("ur_set_online: device_create rc=%d\n", rc);
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 3c257fe0893e..88ecf94ad979 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -914,9 +914,9 @@ static int ch_probe(struct device *dev)
914 ch->minor = minor; 914 ch->minor = minor;
915 sprintf(ch->name,"ch%d",ch->minor); 915 sprintf(ch->name,"ch%d",ch->minor);
916 916
917 class_dev = device_create_drvdata(ch_sysfs_class, dev, 917 class_dev = device_create(ch_sysfs_class, dev,
918 MKDEV(SCSI_CHANGER_MAJOR, ch->minor), 918 MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch,
919 ch, "s%s", ch->name); 919 "s%s", ch->name);
920 if (IS_ERR(class_dev)) { 920 if (IS_ERR(class_dev)) {
921 printk(KERN_WARNING "ch%d: device_create failed\n", 921 printk(KERN_WARNING "ch%d: device_create failed\n",
922 ch->minor); 922 ch->minor);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 1fe0901e8119..8aba4fdfb522 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -271,7 +271,7 @@ rebuild_sys_tab:
271 pHba->initialized = TRUE; 271 pHba->initialized = TRUE;
272 pHba->state &= ~DPTI_STATE_RESET; 272 pHba->state &= ~DPTI_STATE_RESET;
273 if (adpt_sysfs_class) { 273 if (adpt_sysfs_class) {
274 struct device *dev = device_create_drvdata(adpt_sysfs_class, 274 struct device *dev = device_create(adpt_sysfs_class,
275 NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), NULL, 275 NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), NULL,
276 "dpti%d", pHba->unit); 276 "dpti%d", pHba->unit);
277 if (IS_ERR(dev)) { 277 if (IS_ERR(dev)) {
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 1c79f9794f4e..0ea78d9a37db 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5708,7 +5708,8 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S
5708 struct device *osst_member; 5708 struct device *osst_member;
5709 int err; 5709 int err;
5710 5710
5711 osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name); 5711 osst_member = device_create(osst_sysfs_class, device, dev, STp,
5712 "%s", name);
5712 if (IS_ERR(osst_member)) { 5713 if (IS_ERR(osst_member)) {
5713 printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); 5714 printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name);
5714 return PTR_ERR(osst_member); 5715 return PTR_ERR(osst_member);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ba9b9bbd4e73..93bd59a1ed79 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1450,12 +1450,10 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf)
1450 if (sg_sysfs_valid) { 1450 if (sg_sysfs_valid) {
1451 struct device *sg_class_member; 1451 struct device *sg_class_member;
1452 1452
1453 sg_class_member = device_create_drvdata(sg_sysfs_class, 1453 sg_class_member = device_create(sg_sysfs_class, cl_dev->parent,
1454 cl_dev->parent, 1454 MKDEV(SCSI_GENERIC_MAJOR,
1455 MKDEV(SCSI_GENERIC_MAJOR, 1455 sdp->index),
1456 sdp->index), 1456 sdp, "%s", disk->disk_name);
1457 sdp,
1458 "%s", disk->disk_name);
1459 if (IS_ERR(sg_class_member)) { 1457 if (IS_ERR(sg_class_member)) {
1460 printk(KERN_ERR "sg_add: " 1458 printk(KERN_ERR "sg_add: "
1461 "device_create failed\n"); 1459 "device_create failed\n");
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index c2bb53e3d941..5c28d08f18f4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4428,13 +4428,10 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode)
4428 snprintf(name, 10, "%s%s%s", rew ? "n" : "", 4428 snprintf(name, 10, "%s%s%s", rew ? "n" : "",
4429 STp->disk->disk_name, st_formats[i]); 4429 STp->disk->disk_name, st_formats[i]);
4430 st_class_member = 4430 st_class_member =
4431 device_create_drvdata(st_sysfs_class, 4431 device_create(st_sysfs_class, &STp->device->sdev_gendev,
4432 &STp->device->sdev_gendev, 4432 MKDEV(SCSI_TAPE_MAJOR,
4433 MKDEV(SCSI_TAPE_MAJOR, 4433 TAPE_MINOR(dev_num, mode, rew)),
4434 TAPE_MINOR(dev_num, 4434 &STp->modes[mode], "%s", name);
4435 mode, rew)),
4436 &STp->modes[mode],
4437 "%s", name);
4438 if (IS_ERR(st_class_member)) { 4435 if (IS_ERR(st_class_member)) {
4439 printk(KERN_WARNING "st%d: device_create failed\n", 4436 printk(KERN_WARNING "st%d: device_create failed\n",
4440 dev_num); 4437 dev_num);
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index e5e0cfed5e3b..89a43755a453 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -583,10 +583,9 @@ static int spidev_probe(struct spi_device *spi)
583 struct device *dev; 583 struct device *dev;
584 584
585 spidev->devt = MKDEV(SPIDEV_MAJOR, minor); 585 spidev->devt = MKDEV(SPIDEV_MAJOR, minor);
586 dev = device_create_drvdata(spidev_class, &spi->dev, 586 dev = device_create(spidev_class, &spi->dev, spidev->devt,
587 spidev->devt, spidev, 587 spidev, "spidev%d.%d",
588 "spidev%d.%d", 588 spi->master->bus_num, spi->chip_select);
589 spi->master->bus_num, spi->chip_select);
590 status = IS_ERR(dev) ? PTR_ERR(dev) : 0; 589 status = IS_ERR(dev) ? PTR_ERR(dev) : 0;
591 } else { 590 } else {
592 dev_dbg(&spi->dev, "no minor number available!\n"); 591 dev_dbg(&spi->dev, "no minor number available!\n");
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 4190be64917f..04b954cfce76 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -58,4 +58,17 @@ config UIO_SMX
58 58
59 If you compile this as a module, it will be called uio_smx. 59 If you compile this as a module, it will be called uio_smx.
60 60
61config UIO_SERCOS3
62 tristate "Automata Sercos III PCI card driver"
63 default n
64 help
65 Userspace I/O interface for the Sercos III PCI card from
66 Automata GmbH. The userspace part of this driver will be
67 available for download from the Automata GmbH web site.
68
69 Automata GmbH: http://www.automataweb.com
70 Sercos III interface: http://www.sercos.com
71
72 If you compile this as a module, it will be called uio_sercos3.
73
61endif 74endif
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index 8667bbdef904..e69558149859 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_UIO_CIF) += uio_cif.o
3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o
4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o 4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
5obj-$(CONFIG_UIO_SMX) += uio_smx.o 5obj-$(CONFIG_UIO_SMX) += uio_smx.o
6obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 3a6934bf7131..5dccf057a7dd 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -67,6 +67,11 @@ static ssize_t map_size_show(struct uio_mem *mem, char *buf)
67 return sprintf(buf, "0x%lx\n", mem->size); 67 return sprintf(buf, "0x%lx\n", mem->size);
68} 68}
69 69
70static ssize_t map_offset_show(struct uio_mem *mem, char *buf)
71{
72 return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK);
73}
74
70struct uio_sysfs_entry { 75struct uio_sysfs_entry {
71 struct attribute attr; 76 struct attribute attr;
72 ssize_t (*show)(struct uio_mem *, char *); 77 ssize_t (*show)(struct uio_mem *, char *);
@@ -77,10 +82,13 @@ static struct uio_sysfs_entry addr_attribute =
77 __ATTR(addr, S_IRUGO, map_addr_show, NULL); 82 __ATTR(addr, S_IRUGO, map_addr_show, NULL);
78static struct uio_sysfs_entry size_attribute = 83static struct uio_sysfs_entry size_attribute =
79 __ATTR(size, S_IRUGO, map_size_show, NULL); 84 __ATTR(size, S_IRUGO, map_size_show, NULL);
85static struct uio_sysfs_entry offset_attribute =
86 __ATTR(offset, S_IRUGO, map_offset_show, NULL);
80 87
81static struct attribute *attrs[] = { 88static struct attribute *attrs[] = {
82 &addr_attribute.attr, 89 &addr_attribute.attr,
83 &size_attribute.attr, 90 &size_attribute.attr,
91 &offset_attribute.attr,
84 NULL, /* need to NULL terminate the list of attributes */ 92 NULL, /* need to NULL terminate the list of attributes */
85}; 93};
86 94
@@ -482,15 +490,23 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
482{ 490{
483 struct uio_device *idev = vma->vm_private_data; 491 struct uio_device *idev = vma->vm_private_data;
484 struct page *page; 492 struct page *page;
493 unsigned long offset;
485 494
486 int mi = uio_find_mem_index(vma); 495 int mi = uio_find_mem_index(vma);
487 if (mi < 0) 496 if (mi < 0)
488 return VM_FAULT_SIGBUS; 497 return VM_FAULT_SIGBUS;
489 498
499 /*
500 * We need to subtract mi because userspace uses offset = N*PAGE_SIZE
501 * to use mem[N].
502 */
503 offset = (vmf->pgoff - mi) << PAGE_SHIFT;
504
490 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) 505 if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
491 page = virt_to_page(idev->info->mem[mi].addr); 506 page = virt_to_page(idev->info->mem[mi].addr + offset);
492 else 507 else
493 page = vmalloc_to_page((void*)idev->info->mem[mi].addr); 508 page = vmalloc_to_page((void *)idev->info->mem[mi].addr
509 + offset);
494 get_page(page); 510 get_page(page);
495 vmf->page = page; 511 vmf->page = page;
496 return 0; 512 return 0;
@@ -682,9 +698,9 @@ int __uio_register_device(struct module *owner,
682 if (ret) 698 if (ret)
683 goto err_get_minor; 699 goto err_get_minor;
684 700
685 idev->dev = device_create_drvdata(uio_class->class, parent, 701 idev->dev = device_create(uio_class->class, parent,
686 MKDEV(uio_major, idev->minor), idev, 702 MKDEV(uio_major, idev->minor), idev,
687 "uio%d", idev->minor); 703 "uio%d", idev->minor);
688 if (IS_ERR(idev->dev)) { 704 if (IS_ERR(idev->dev)) {
689 printk(KERN_ERR "UIO: device register failed\n"); 705 printk(KERN_ERR "UIO: device register failed\n");
690 ret = PTR_ERR(idev->dev); 706 ret = PTR_ERR(idev->dev);
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c
index 0b4ef39cd85d..d494ce9288c3 100644
--- a/drivers/uio/uio_pdrv.c
+++ b/drivers/uio/uio_pdrv.c
@@ -12,7 +12,7 @@
12#include <linux/uio_driver.h> 12#include <linux/uio_driver.h>
13#include <linux/stringify.h> 13#include <linux/stringify.h>
14 14
15#define DRIVER_NAME "uio" 15#define DRIVER_NAME "uio_pdrv"
16 16
17struct uio_platdata { 17struct uio_platdata {
18 struct uio_info *uioinfo; 18 struct uio_info *uioinfo;
diff --git a/drivers/uio/uio_sercos3.c b/drivers/uio/uio_sercos3.c
new file mode 100644
index 000000000000..a6d1b2bc47f3
--- /dev/null
+++ b/drivers/uio/uio_sercos3.c
@@ -0,0 +1,243 @@
1/* sercos3: UIO driver for the Automata Sercos III PCI card
2
3 Copyright (C) 2008 Linutronix GmbH
4 Author: John Ogness <john.ogness@linutronix.de>
5
6 This is a straight-forward UIO driver, where interrupts are disabled
7 by the interrupt handler and re-enabled via a write to the UIO device
8 by the userspace-part.
9
10 The only part that may seem odd is the use of a logical OR when
11 storing and restoring enabled interrupts. This is done because the
12 userspace-part could directly modify the Interrupt Enable Register
13 at any time. To reduce possible conflicts, the kernel driver uses
14 a logical OR to make more controlled changes (rather than blindly
15 overwriting previous values).
16
17 Race conditions exist if the userspace-part directly modifies the
18 Interrupt Enable Register while in operation. The consequences are
19 that certain interrupts would fail to be enabled or disabled. For
20 this reason, the userspace-part should only directly modify the
21 Interrupt Enable Register at the beginning (to get things going).
22 The userspace-part can safely disable interrupts at any time using
23 a write to the UIO device.
24*/
25
26#include <linux/device.h>
27#include <linux/module.h>
28#include <linux/pci.h>
29#include <linux/uio_driver.h>
30#include <linux/io.h>
31
32/* ID's for SERCOS III PCI card (PLX 9030) */
33#define SERCOS_SUB_VENDOR_ID 0x1971
34#define SERCOS_SUB_SYSID_3530 0x3530
35#define SERCOS_SUB_SYSID_3535 0x3535
36#define SERCOS_SUB_SYSID_3780 0x3780
37
38/* Interrupt Enable Register */
39#define IER0_OFFSET 0x08
40
41/* Interrupt Status Register */
42#define ISR0_OFFSET 0x18
43
44struct sercos3_priv {
45 u32 ier0_cache;
46 spinlock_t ier0_cache_lock;
47};
48
49/* this function assumes ier0_cache_lock is locked! */
50static void sercos3_disable_interrupts(struct uio_info *info,
51 struct sercos3_priv *priv)
52{
53 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET;
54
55 /* add enabled interrupts to cache */
56 priv->ier0_cache |= ioread32(ier0);
57
58 /* disable interrupts */
59 iowrite32(0, ier0);
60}
61
62/* this function assumes ier0_cache_lock is locked! */
63static void sercos3_enable_interrupts(struct uio_info *info,
64 struct sercos3_priv *priv)
65{
66 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET;
67
68 /* restore previously enabled interrupts */
69 iowrite32(ioread32(ier0) | priv->ier0_cache, ier0);
70 priv->ier0_cache = 0;
71}
72
73static irqreturn_t sercos3_handler(int irq, struct uio_info *info)
74{
75 struct sercos3_priv *priv = info->priv;
76 void __iomem *isr0 = info->mem[3].internal_addr + ISR0_OFFSET;
77 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET;
78
79 if (!(ioread32(isr0) & ioread32(ier0)))
80 return IRQ_NONE;
81
82 spin_lock(&priv->ier0_cache_lock);
83 sercos3_disable_interrupts(info, priv);
84 spin_unlock(&priv->ier0_cache_lock);
85
86 return IRQ_HANDLED;
87}
88
89static int sercos3_irqcontrol(struct uio_info *info, s32 irq_on)
90{
91 struct sercos3_priv *priv = info->priv;
92
93 spin_lock_irq(&priv->ier0_cache_lock);
94 if (irq_on)
95 sercos3_enable_interrupts(info, priv);
96 else
97 sercos3_disable_interrupts(info, priv);
98 spin_unlock_irq(&priv->ier0_cache_lock);
99
100 return 0;
101}
102
103static int sercos3_setup_iomem(struct pci_dev *dev, struct uio_info *info,
104 int n, int pci_bar)
105{
106 info->mem[n].addr = pci_resource_start(dev, pci_bar);
107 if (!info->mem[n].addr)
108 return -1;
109 info->mem[n].internal_addr = ioremap(pci_resource_start(dev, pci_bar),
110 pci_resource_len(dev, pci_bar));
111 if (!info->mem[n].internal_addr)
112 return -1;
113 info->mem[n].size = pci_resource_len(dev, pci_bar);
114 info->mem[n].memtype = UIO_MEM_PHYS;
115 return 0;
116}
117
118static int __devinit sercos3_pci_probe(struct pci_dev *dev,
119 const struct pci_device_id *id)
120{
121 struct uio_info *info;
122 struct sercos3_priv *priv;
123 int i;
124
125 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL);
126 if (!info)
127 return -ENOMEM;
128
129 priv = kzalloc(sizeof(struct sercos3_priv), GFP_KERNEL);
130 if (!priv)
131 goto out_free;
132
133 if (pci_enable_device(dev))
134 goto out_free_priv;
135
136 if (pci_request_regions(dev, "sercos3"))
137 goto out_disable;
138
139 /* we only need PCI BAR's 0, 2, 3, 4, 5 */
140 if (sercos3_setup_iomem(dev, info, 0, 0))
141 goto out_unmap;
142 if (sercos3_setup_iomem(dev, info, 1, 2))
143 goto out_unmap;
144 if (sercos3_setup_iomem(dev, info, 2, 3))
145 goto out_unmap;
146 if (sercos3_setup_iomem(dev, info, 3, 4))
147 goto out_unmap;
148 if (sercos3_setup_iomem(dev, info, 4, 5))
149 goto out_unmap;
150
151 spin_lock_init(&priv->ier0_cache_lock);
152 info->priv = priv;
153 info->name = "Sercos_III_PCI";
154 info->version = "0.0.1";
155 info->irq = dev->irq;
156 info->irq_flags = IRQF_DISABLED | IRQF_SHARED;
157 info->handler = sercos3_handler;
158 info->irqcontrol = sercos3_irqcontrol;
159
160 pci_set_drvdata(dev, info);
161
162 if (uio_register_device(&dev->dev, info))
163 goto out_unmap;
164
165 return 0;
166
167out_unmap:
168 for (i = 0; i < 5; i++) {
169 if (info->mem[i].internal_addr)
170 iounmap(info->mem[i].internal_addr);
171 }
172 pci_release_regions(dev);
173out_disable:
174 pci_disable_device(dev);
175out_free_priv:
176 kfree(priv);
177out_free:
178 kfree(info);
179 return -ENODEV;
180}
181
182static void sercos3_pci_remove(struct pci_dev *dev)
183{
184 struct uio_info *info = pci_get_drvdata(dev);
185 int i;
186
187 uio_unregister_device(info);
188 pci_release_regions(dev);
189 pci_disable_device(dev);
190 pci_set_drvdata(dev, NULL);
191 for (i = 0; i < 5; i++) {
192 if (info->mem[i].internal_addr)
193 iounmap(info->mem[i].internal_addr);
194 }
195 kfree(info->priv);
196 kfree(info);
197}
198
199static struct pci_device_id sercos3_pci_ids[] __devinitdata = {
200 {
201 .vendor = PCI_VENDOR_ID_PLX,
202 .device = PCI_DEVICE_ID_PLX_9030,
203 .subvendor = SERCOS_SUB_VENDOR_ID,
204 .subdevice = SERCOS_SUB_SYSID_3530,
205 },
206 {
207 .vendor = PCI_VENDOR_ID_PLX,
208 .device = PCI_DEVICE_ID_PLX_9030,
209 .subvendor = SERCOS_SUB_VENDOR_ID,
210 .subdevice = SERCOS_SUB_SYSID_3535,
211 },
212 {
213 .vendor = PCI_VENDOR_ID_PLX,
214 .device = PCI_DEVICE_ID_PLX_9030,
215 .subvendor = SERCOS_SUB_VENDOR_ID,
216 .subdevice = SERCOS_SUB_SYSID_3780,
217 },
218 { 0, }
219};
220
221static struct pci_driver sercos3_pci_driver = {
222 .name = "sercos3",
223 .id_table = sercos3_pci_ids,
224 .probe = sercos3_pci_probe,
225 .remove = sercos3_pci_remove,
226};
227
228static int __init sercos3_init_module(void)
229{
230 return pci_register_driver(&sercos3_pci_driver);
231}
232
233static void __exit sercos3_exit_module(void)
234{
235 pci_unregister_driver(&sercos3_pci_driver);
236}
237
238module_init(sercos3_init_module);
239module_exit(sercos3_exit_module);
240
241MODULE_DESCRIPTION("UIO driver for the Automata Sercos III PCI card");
242MODULE_AUTHOR("John Ogness <john.ogness@linutronix.de>");
243MODULE_LICENSE("GPL v2");
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 20290c5b1562..7a4fa791dc19 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1729,9 +1729,9 @@ static int usb_classdev_add(struct usb_device *dev)
1729{ 1729{
1730 struct device *cldev; 1730 struct device *cldev;
1731 1731
1732 cldev = device_create_drvdata(usb_classdev_class, &dev->dev, 1732 cldev = device_create(usb_classdev_class, &dev->dev, dev->dev.devt,
1733 dev->dev.devt, NULL, "usbdev%d.%d", 1733 NULL, "usbdev%d.%d", dev->bus->busnum,
1734 dev->bus->busnum, dev->devnum); 1734 dev->devnum);
1735 if (IS_ERR(cldev)) 1735 if (IS_ERR(cldev))
1736 return PTR_ERR(cldev); 1736 return PTR_ERR(cldev);
1737 dev->usb_classdev = cldev; 1737 dev->usb_classdev = cldev;
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 6b1b229e38cd..55f7f310924b 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -196,9 +196,9 @@ int usb_register_dev(struct usb_interface *intf,
196 ++temp; 196 ++temp;
197 else 197 else
198 temp = name; 198 temp = name;
199 intf->usb_dev = device_create_drvdata(usb_class->class, &intf->dev, 199 intf->usb_dev = device_create(usb_class->class, &intf->dev,
200 MKDEV(USB_MAJOR, minor), NULL, 200 MKDEV(USB_MAJOR, minor), NULL,
201 "%s", temp); 201 "%s", temp);
202 if (IS_ERR(intf->usb_dev)) { 202 if (IS_ERR(intf->usb_dev)) {
203 down_write(&minor_rwsem); 203 down_write(&minor_rwsem);
204 usb_minors[intf->minor] = NULL; 204 usb_minors[intf->minor] = NULL;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8ab389dca2b9..c8035a8216bd 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -818,9 +818,8 @@ static int usb_register_bus(struct usb_bus *bus)
818 set_bit (busnum, busmap.busmap); 818 set_bit (busnum, busmap.busmap);
819 bus->busnum = busnum; 819 bus->busnum = busnum;
820 820
821 bus->dev = device_create_drvdata(usb_host_class, bus->controller, 821 bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0),
822 MKDEV(0, 0), bus, 822 bus, "usb_host%d", busnum);
823 "usb_host%d", busnum);
824 result = PTR_ERR(bus->dev); 823 result = PTR_ERR(bus->dev);
825 if (IS_ERR(bus->dev)) 824 if (IS_ERR(bus->dev))
826 goto error_create_class_dev; 825 goto error_create_class_dev;
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index fcb5cb9094d9..2267fa0b51b2 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -22,24 +22,15 @@ obj-$(CONFIG_USB_M66592) += m66592-udc.o
22# 22#
23# USB gadget drivers 23# USB gadget drivers
24# 24#
25C_UTILS = composite.o usbstring.o config.o epautoconf.o 25g_zero-objs := zero.o
26 26g_ether-objs := ether.o
27g_zero-objs := zero.o f_sourcesink.o f_loopback.o $(C_UTILS) 27g_serial-objs := serial.o
28g_ether-objs := ether.o u_ether.o f_subset.o f_ecm.o $(C_UTILS) 28g_midi-objs := gmidi.o
29g_serial-objs := serial.o u_serial.o f_acm.o f_serial.o $(C_UTILS)
30g_midi-objs := gmidi.o usbstring.o config.o epautoconf.o
31gadgetfs-objs := inode.o 29gadgetfs-objs := inode.o
32g_file_storage-objs := file_storage.o usbstring.o config.o \ 30g_file_storage-objs := file_storage.o
33 epautoconf.o 31g_printer-objs := printer.o
34g_printer-objs := printer.o usbstring.o config.o \ 32g_cdc-objs := cdc2.o
35 epautoconf.o
36g_cdc-objs := cdc2.o u_ether.o f_ecm.o \
37 u_serial.o f_acm.o $(C_UTILS)
38 33
39ifeq ($(CONFIG_USB_ETH_RNDIS),y)
40 g_ether-objs += f_rndis.o rndis.o
41endif
42
43obj-$(CONFIG_USB_ZERO) += g_zero.o 34obj-$(CONFIG_USB_ZERO) += g_zero.o
44obj-$(CONFIG_USB_ETH) += g_ether.o 35obj-$(CONFIG_USB_ETH) += g_ether.o
45obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o 36obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o
diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c
index a39a4b940c33..a724fc149850 100644
--- a/drivers/usb/gadget/cdc2.c
+++ b/drivers/usb/gadget/cdc2.c
@@ -43,6 +43,25 @@
43 43
44/*-------------------------------------------------------------------------*/ 44/*-------------------------------------------------------------------------*/
45 45
46/*
47 * Kbuild is not very cooperative with respect to linking separately
48 * compiled library objects into one module. So for now we won't use
49 * separate compilation ... ensuring init/exit sections work to shrink
50 * the runtime footprint, and giving us at least some parts of what
51 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
52 */
53
54#include "composite.c"
55#include "usbstring.c"
56#include "config.c"
57#include "epautoconf.c"
58#include "u_serial.c"
59#include "f_acm.c"
60#include "f_ecm.c"
61#include "u_ether.c"
62
63/*-------------------------------------------------------------------------*/
64
46static struct usb_device_descriptor device_desc = { 65static struct usb_device_descriptor device_desc = {
47 .bLength = sizeof device_desc, 66 .bLength = sizeof device_desc,
48 .bDescriptorType = USB_DT_DEVICE, 67 .bDescriptorType = USB_DT_DEVICE,
@@ -148,7 +167,8 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
148 int status; 167 int status;
149 168
150 if (!can_support_ecm(cdev->gadget)) { 169 if (!can_support_ecm(cdev->gadget)) {
151 ERROR(cdev, "controller '%s' not usable\n", gadget->name); 170 dev_err(&gadget->dev, "controller '%s' not usable\n",
171 gadget->name);
152 return -EINVAL; 172 return -EINVAL;
153 } 173 }
154 174
@@ -203,7 +223,8 @@ static int __init cdc_bind(struct usb_composite_dev *cdev)
203 if (status < 0) 223 if (status < 0)
204 goto fail1; 224 goto fail1;
205 225
206 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); 226 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
227 DRIVER_DESC);
207 228
208 return 0; 229 return 0;
209 230
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index bcac2e68660d..944c8e889ab4 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -96,6 +96,28 @@ static inline bool has_rndis(void)
96 96
97/*-------------------------------------------------------------------------*/ 97/*-------------------------------------------------------------------------*/
98 98
99/*
100 * Kbuild is not very cooperative with respect to linking separately
101 * compiled library objects into one module. So for now we won't use
102 * separate compilation ... ensuring init/exit sections work to shrink
103 * the runtime footprint, and giving us at least some parts of what
104 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
105 */
106#include "composite.c"
107#include "usbstring.c"
108#include "config.c"
109#include "epautoconf.c"
110
111#include "f_ecm.c"
112#include "f_subset.c"
113#ifdef CONFIG_USB_ETH_RNDIS
114#include "f_rndis.c"
115#include "rndis.c"
116#endif
117#include "u_ether.c"
118
119/*-------------------------------------------------------------------------*/
120
99/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! 121/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
100 * Instead: allocate your own, using normal USB-IF procedures. 122 * Instead: allocate your own, using normal USB-IF procedures.
101 */ 123 */
@@ -293,7 +315,8 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
293 * but if the controller isn't recognized at all then 315 * but if the controller isn't recognized at all then
294 * that assumption is a bit more likely to be wrong. 316 * that assumption is a bit more likely to be wrong.
295 */ 317 */
296 WARNING(cdev, "controller '%s' not recognized; trying %s\n", 318 dev_warn(&gadget->dev,
319 "controller '%s' not recognized; trying %s\n",
297 gadget->name, 320 gadget->name,
298 eth_config_driver.label); 321 eth_config_driver.label);
299 device_desc.bcdDevice = 322 device_desc.bcdDevice =
@@ -332,7 +355,8 @@ static int __init eth_bind(struct usb_composite_dev *cdev)
332 if (status < 0) 355 if (status < 0)
333 goto fail; 356 goto fail;
334 357
335 INFO(cdev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); 358 dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n",
359 DRIVER_DESC);
336 360
337 return 0; 361 return 0;
338 362
diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c
index a2b5c092bda0..4ae579948e54 100644
--- a/drivers/usb/gadget/f_ecm.c
+++ b/drivers/usb/gadget/f_ecm.c
@@ -83,7 +83,7 @@ static inline struct f_ecm *func_to_ecm(struct usb_function *f)
83} 83}
84 84
85/* peak (theoretical) bulk transfer rate in bits-per-second */ 85/* peak (theoretical) bulk transfer rate in bits-per-second */
86static inline unsigned bitrate(struct usb_gadget *g) 86static inline unsigned ecm_bitrate(struct usb_gadget *g)
87{ 87{
88 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) 88 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
89 return 13 * 512 * 8 * 1000 * 8; 89 return 13 * 512 * 8 * 1000 * 8;
@@ -107,7 +107,7 @@ static inline unsigned bitrate(struct usb_gadget *g)
107 */ 107 */
108 108
109#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */ 109#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */
110#define STATUS_BYTECOUNT 16 /* 8 byte header + data */ 110#define ECM_STATUS_BYTECOUNT 16 /* 8 byte header + data */
111 111
112 112
113/* interface descriptor: */ 113/* interface descriptor: */
@@ -125,8 +125,8 @@ static struct usb_interface_descriptor ecm_control_intf __initdata = {
125 /* .iInterface = DYNAMIC */ 125 /* .iInterface = DYNAMIC */
126}; 126};
127 127
128static struct usb_cdc_header_desc header_desc __initdata = { 128static struct usb_cdc_header_desc ecm_header_desc __initdata = {
129 .bLength = sizeof header_desc, 129 .bLength = sizeof ecm_header_desc,
130 .bDescriptorType = USB_DT_CS_INTERFACE, 130 .bDescriptorType = USB_DT_CS_INTERFACE,
131 .bDescriptorSubType = USB_CDC_HEADER_TYPE, 131 .bDescriptorSubType = USB_CDC_HEADER_TYPE,
132 132
@@ -141,8 +141,8 @@ static struct usb_cdc_union_desc ecm_union_desc __initdata = {
141 /* .bSlaveInterface0 = DYNAMIC */ 141 /* .bSlaveInterface0 = DYNAMIC */
142}; 142};
143 143
144static struct usb_cdc_ether_desc ether_desc __initdata = { 144static struct usb_cdc_ether_desc ecm_desc __initdata = {
145 .bLength = sizeof ether_desc, 145 .bLength = sizeof ecm_desc,
146 .bDescriptorType = USB_DT_CS_INTERFACE, 146 .bDescriptorType = USB_DT_CS_INTERFACE,
147 .bDescriptorSubType = USB_CDC_ETHERNET_TYPE, 147 .bDescriptorSubType = USB_CDC_ETHERNET_TYPE,
148 148
@@ -186,17 +186,17 @@ static struct usb_interface_descriptor ecm_data_intf __initdata = {
186 186
187/* full speed support: */ 187/* full speed support: */
188 188
189static struct usb_endpoint_descriptor fs_notify_desc __initdata = { 189static struct usb_endpoint_descriptor fs_ecm_notify_desc __initdata = {
190 .bLength = USB_DT_ENDPOINT_SIZE, 190 .bLength = USB_DT_ENDPOINT_SIZE,
191 .bDescriptorType = USB_DT_ENDPOINT, 191 .bDescriptorType = USB_DT_ENDPOINT,
192 192
193 .bEndpointAddress = USB_DIR_IN, 193 .bEndpointAddress = USB_DIR_IN,
194 .bmAttributes = USB_ENDPOINT_XFER_INT, 194 .bmAttributes = USB_ENDPOINT_XFER_INT,
195 .wMaxPacketSize = __constant_cpu_to_le16(STATUS_BYTECOUNT), 195 .wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
196 .bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC, 196 .bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC,
197}; 197};
198 198
199static struct usb_endpoint_descriptor fs_in_desc __initdata = { 199static struct usb_endpoint_descriptor fs_ecm_in_desc __initdata = {
200 .bLength = USB_DT_ENDPOINT_SIZE, 200 .bLength = USB_DT_ENDPOINT_SIZE,
201 .bDescriptorType = USB_DT_ENDPOINT, 201 .bDescriptorType = USB_DT_ENDPOINT,
202 202
@@ -204,7 +204,7 @@ static struct usb_endpoint_descriptor fs_in_desc __initdata = {
204 .bmAttributes = USB_ENDPOINT_XFER_BULK, 204 .bmAttributes = USB_ENDPOINT_XFER_BULK,
205}; 205};
206 206
207static struct usb_endpoint_descriptor fs_out_desc __initdata = { 207static struct usb_endpoint_descriptor fs_ecm_out_desc __initdata = {
208 .bLength = USB_DT_ENDPOINT_SIZE, 208 .bLength = USB_DT_ENDPOINT_SIZE,
209 .bDescriptorType = USB_DT_ENDPOINT, 209 .bDescriptorType = USB_DT_ENDPOINT,
210 210
@@ -212,34 +212,34 @@ static struct usb_endpoint_descriptor fs_out_desc __initdata = {
212 .bmAttributes = USB_ENDPOINT_XFER_BULK, 212 .bmAttributes = USB_ENDPOINT_XFER_BULK,
213}; 213};
214 214
215static struct usb_descriptor_header *eth_fs_function[] __initdata = { 215static struct usb_descriptor_header *ecm_fs_function[] __initdata = {
216 /* CDC ECM control descriptors */ 216 /* CDC ECM control descriptors */
217 (struct usb_descriptor_header *) &ecm_control_intf, 217 (struct usb_descriptor_header *) &ecm_control_intf,
218 (struct usb_descriptor_header *) &header_desc, 218 (struct usb_descriptor_header *) &ecm_header_desc,
219 (struct usb_descriptor_header *) &ecm_union_desc, 219 (struct usb_descriptor_header *) &ecm_union_desc,
220 (struct usb_descriptor_header *) &ether_desc, 220 (struct usb_descriptor_header *) &ecm_desc,
221 /* NOTE: status endpoint might need to be removed */ 221 /* NOTE: status endpoint might need to be removed */
222 (struct usb_descriptor_header *) &fs_notify_desc, 222 (struct usb_descriptor_header *) &fs_ecm_notify_desc,
223 /* data interface, altsettings 0 and 1 */ 223 /* data interface, altsettings 0 and 1 */
224 (struct usb_descriptor_header *) &ecm_data_nop_intf, 224 (struct usb_descriptor_header *) &ecm_data_nop_intf,
225 (struct usb_descriptor_header *) &ecm_data_intf, 225 (struct usb_descriptor_header *) &ecm_data_intf,
226 (struct usb_descriptor_header *) &fs_in_desc, 226 (struct usb_descriptor_header *) &fs_ecm_in_desc,
227 (struct usb_descriptor_header *) &fs_out_desc, 227 (struct usb_descriptor_header *) &fs_ecm_out_desc,
228 NULL, 228 NULL,
229}; 229};
230 230
231/* high speed support: */ 231/* high speed support: */
232 232
233static struct usb_endpoint_descriptor hs_notify_desc __initdata = { 233static struct usb_endpoint_descriptor hs_ecm_notify_desc __initdata = {
234 .bLength = USB_DT_ENDPOINT_SIZE, 234 .bLength = USB_DT_ENDPOINT_SIZE,
235 .bDescriptorType = USB_DT_ENDPOINT, 235 .bDescriptorType = USB_DT_ENDPOINT,
236 236
237 .bEndpointAddress = USB_DIR_IN, 237 .bEndpointAddress = USB_DIR_IN,
238 .bmAttributes = USB_ENDPOINT_XFER_INT, 238 .bmAttributes = USB_ENDPOINT_XFER_INT,
239 .wMaxPacketSize = __constant_cpu_to_le16(STATUS_BYTECOUNT), 239 .wMaxPacketSize = __constant_cpu_to_le16(ECM_STATUS_BYTECOUNT),
240 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4, 240 .bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
241}; 241};
242static struct usb_endpoint_descriptor hs_in_desc __initdata = { 242static struct usb_endpoint_descriptor hs_ecm_in_desc __initdata = {
243 .bLength = USB_DT_ENDPOINT_SIZE, 243 .bLength = USB_DT_ENDPOINT_SIZE,
244 .bDescriptorType = USB_DT_ENDPOINT, 244 .bDescriptorType = USB_DT_ENDPOINT,
245 245
@@ -248,7 +248,7 @@ static struct usb_endpoint_descriptor hs_in_desc __initdata = {
248 .wMaxPacketSize = __constant_cpu_to_le16(512), 248 .wMaxPacketSize = __constant_cpu_to_le16(512),
249}; 249};
250 250
251static struct usb_endpoint_descriptor hs_out_desc __initdata = { 251static struct usb_endpoint_descriptor hs_ecm_out_desc __initdata = {
252 .bLength = USB_DT_ENDPOINT_SIZE, 252 .bLength = USB_DT_ENDPOINT_SIZE,
253 .bDescriptorType = USB_DT_ENDPOINT, 253 .bDescriptorType = USB_DT_ENDPOINT,
254 254
@@ -257,19 +257,19 @@ static struct usb_endpoint_descriptor hs_out_desc __initdata = {
257 .wMaxPacketSize = __constant_cpu_to_le16(512), 257 .wMaxPacketSize = __constant_cpu_to_le16(512),
258}; 258};
259 259
260static struct usb_descriptor_header *eth_hs_function[] __initdata = { 260static struct usb_descriptor_header *ecm_hs_function[] __initdata = {
261 /* CDC ECM control descriptors */ 261 /* CDC ECM control descriptors */
262 (struct usb_descriptor_header *) &ecm_control_intf, 262 (struct usb_descriptor_header *) &ecm_control_intf,
263 (struct usb_descriptor_header *) &header_desc, 263 (struct usb_descriptor_header *) &ecm_header_desc,
264 (struct usb_descriptor_header *) &ecm_union_desc, 264 (struct usb_descriptor_header *) &ecm_union_desc,
265 (struct usb_descriptor_header *) &ether_desc, 265 (struct usb_descriptor_header *) &ecm_desc,
266 /* NOTE: status endpoint might need to be removed */ 266 /* NOTE: status endpoint might need to be removed */
267 (struct usb_descriptor_header *) &hs_notify_desc, 267 (struct usb_descriptor_header *) &hs_ecm_notify_desc,
268 /* data interface, altsettings 0 and 1 */ 268 /* data interface, altsettings 0 and 1 */
269 (struct usb_descriptor_header *) &ecm_data_nop_intf, 269 (struct usb_descriptor_header *) &ecm_data_nop_intf,
270 (struct usb_descriptor_header *) &ecm_data_intf, 270 (struct usb_descriptor_header *) &ecm_data_intf,
271 (struct usb_descriptor_header *) &hs_in_desc, 271 (struct usb_descriptor_header *) &hs_ecm_in_desc,
272 (struct usb_descriptor_header *) &hs_out_desc, 272 (struct usb_descriptor_header *) &hs_ecm_out_desc,
273 NULL, 273 NULL,
274}; 274};
275 275
@@ -329,14 +329,14 @@ static void ecm_do_notify(struct f_ecm *ecm)
329 event->bNotificationType = USB_CDC_NOTIFY_SPEED_CHANGE; 329 event->bNotificationType = USB_CDC_NOTIFY_SPEED_CHANGE;
330 event->wValue = cpu_to_le16(0); 330 event->wValue = cpu_to_le16(0);
331 event->wLength = cpu_to_le16(8); 331 event->wLength = cpu_to_le16(8);
332 req->length = STATUS_BYTECOUNT; 332 req->length = ECM_STATUS_BYTECOUNT;
333 333
334 /* SPEED_CHANGE data is up/down speeds in bits/sec */ 334 /* SPEED_CHANGE data is up/down speeds in bits/sec */
335 data = req->buf + sizeof *event; 335 data = req->buf + sizeof *event;
336 data[0] = cpu_to_le32(bitrate(cdev->gadget)); 336 data[0] = cpu_to_le32(ecm_bitrate(cdev->gadget));
337 data[1] = data[0]; 337 data[1] = data[0];
338 338
339 DBG(cdev, "notify speed %d\n", bitrate(cdev->gadget)); 339 DBG(cdev, "notify speed %d\n", ecm_bitrate(cdev->gadget));
340 ecm->notify_state = ECM_NOTIFY_NONE; 340 ecm->notify_state = ECM_NOTIFY_NONE;
341 break; 341 break;
342 } 342 }
@@ -628,13 +628,13 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
628 status = -ENODEV; 628 status = -ENODEV;
629 629
630 /* allocate instance-specific endpoints */ 630 /* allocate instance-specific endpoints */
631 ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc); 631 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_in_desc);
632 if (!ep) 632 if (!ep)
633 goto fail; 633 goto fail;
634 ecm->port.in_ep = ep; 634 ecm->port.in_ep = ep;
635 ep->driver_data = cdev; /* claim */ 635 ep->driver_data = cdev; /* claim */
636 636
637 ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc); 637 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_out_desc);
638 if (!ep) 638 if (!ep)
639 goto fail; 639 goto fail;
640 ecm->port.out_ep = ep; 640 ecm->port.out_ep = ep;
@@ -644,7 +644,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
644 * don't treat it that way. It's simpler, and some newer CDC 644 * don't treat it that way. It's simpler, and some newer CDC
645 * profiles (wireless handsets) no longer treat it as optional. 645 * profiles (wireless handsets) no longer treat it as optional.
646 */ 646 */
647 ep = usb_ep_autoconfig(cdev->gadget, &fs_notify_desc); 647 ep = usb_ep_autoconfig(cdev->gadget, &fs_ecm_notify_desc);
648 if (!ep) 648 if (!ep)
649 goto fail; 649 goto fail;
650 ecm->notify = ep; 650 ecm->notify = ep;
@@ -656,47 +656,47 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
656 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL); 656 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
657 if (!ecm->notify_req) 657 if (!ecm->notify_req)
658 goto fail; 658 goto fail;
659 ecm->notify_req->buf = kmalloc(STATUS_BYTECOUNT, GFP_KERNEL); 659 ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL);
660 if (!ecm->notify_req->buf) 660 if (!ecm->notify_req->buf)
661 goto fail; 661 goto fail;
662 ecm->notify_req->context = ecm; 662 ecm->notify_req->context = ecm;
663 ecm->notify_req->complete = ecm_notify_complete; 663 ecm->notify_req->complete = ecm_notify_complete;
664 664
665 /* copy descriptors, and track endpoint copies */ 665 /* copy descriptors, and track endpoint copies */
666 f->descriptors = usb_copy_descriptors(eth_fs_function); 666 f->descriptors = usb_copy_descriptors(ecm_fs_function);
667 if (!f->descriptors) 667 if (!f->descriptors)
668 goto fail; 668 goto fail;
669 669
670 ecm->fs.in = usb_find_endpoint(eth_fs_function, 670 ecm->fs.in = usb_find_endpoint(ecm_fs_function,
671 f->descriptors, &fs_in_desc); 671 f->descriptors, &fs_ecm_in_desc);
672 ecm->fs.out = usb_find_endpoint(eth_fs_function, 672 ecm->fs.out = usb_find_endpoint(ecm_fs_function,
673 f->descriptors, &fs_out_desc); 673 f->descriptors, &fs_ecm_out_desc);
674 ecm->fs.notify = usb_find_endpoint(eth_fs_function, 674 ecm->fs.notify = usb_find_endpoint(ecm_fs_function,
675 f->descriptors, &fs_notify_desc); 675 f->descriptors, &fs_ecm_notify_desc);
676 676
677 /* support all relevant hardware speeds... we expect that when 677 /* support all relevant hardware speeds... we expect that when
678 * hardware is dual speed, all bulk-capable endpoints work at 678 * hardware is dual speed, all bulk-capable endpoints work at
679 * both speeds 679 * both speeds
680 */ 680 */
681 if (gadget_is_dualspeed(c->cdev->gadget)) { 681 if (gadget_is_dualspeed(c->cdev->gadget)) {
682 hs_in_desc.bEndpointAddress = 682 hs_ecm_in_desc.bEndpointAddress =
683 fs_in_desc.bEndpointAddress; 683 fs_ecm_in_desc.bEndpointAddress;
684 hs_out_desc.bEndpointAddress = 684 hs_ecm_out_desc.bEndpointAddress =
685 fs_out_desc.bEndpointAddress; 685 fs_ecm_out_desc.bEndpointAddress;
686 hs_notify_desc.bEndpointAddress = 686 hs_ecm_notify_desc.bEndpointAddress =
687 fs_notify_desc.bEndpointAddress; 687 fs_ecm_notify_desc.bEndpointAddress;
688 688
689 /* copy descriptors, and track endpoint copies */ 689 /* copy descriptors, and track endpoint copies */
690 f->hs_descriptors = usb_copy_descriptors(eth_hs_function); 690 f->hs_descriptors = usb_copy_descriptors(ecm_hs_function);
691 if (!f->hs_descriptors) 691 if (!f->hs_descriptors)
692 goto fail; 692 goto fail;
693 693
694 ecm->hs.in = usb_find_endpoint(eth_hs_function, 694 ecm->hs.in = usb_find_endpoint(ecm_hs_function,
695 f->hs_descriptors, &hs_in_desc); 695 f->hs_descriptors, &hs_ecm_in_desc);
696 ecm->hs.out = usb_find_endpoint(eth_hs_function, 696 ecm->hs.out = usb_find_endpoint(ecm_hs_function,
697 f->hs_descriptors, &hs_out_desc); 697 f->hs_descriptors, &hs_ecm_out_desc);
698 ecm->hs.notify = usb_find_endpoint(eth_hs_function, 698 ecm->hs.notify = usb_find_endpoint(ecm_hs_function,
699 f->hs_descriptors, &hs_notify_desc); 699 f->hs_descriptors, &hs_ecm_notify_desc);
700 } 700 }
701 701
702 /* NOTE: all that is done without knowing or caring about 702 /* NOTE: all that is done without knowing or caring about
@@ -795,7 +795,7 @@ int __init ecm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
795 if (status < 0) 795 if (status < 0)
796 return status; 796 return status;
797 ecm_string_defs[1].id = status; 797 ecm_string_defs[1].id = status;
798 ether_desc.iMACAddress = status; 798 ecm_desc.iMACAddress = status;
799 } 799 }
800 800
801 /* allocate and initialize one new instance */ 801 /* allocate and initialize one new instance */
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
index eda4cde72c82..87dde012dacc 100644
--- a/drivers/usb/gadget/f_loopback.c
+++ b/drivers/usb/gadget/f_loopback.c
@@ -70,7 +70,7 @@ static struct usb_interface_descriptor loopback_intf = {
70 70
71/* full speed support: */ 71/* full speed support: */
72 72
73static struct usb_endpoint_descriptor fs_source_desc = { 73static struct usb_endpoint_descriptor fs_loop_source_desc = {
74 .bLength = USB_DT_ENDPOINT_SIZE, 74 .bLength = USB_DT_ENDPOINT_SIZE,
75 .bDescriptorType = USB_DT_ENDPOINT, 75 .bDescriptorType = USB_DT_ENDPOINT,
76 76
@@ -78,7 +78,7 @@ static struct usb_endpoint_descriptor fs_source_desc = {
78 .bmAttributes = USB_ENDPOINT_XFER_BULK, 78 .bmAttributes = USB_ENDPOINT_XFER_BULK,
79}; 79};
80 80
81static struct usb_endpoint_descriptor fs_sink_desc = { 81static struct usb_endpoint_descriptor fs_loop_sink_desc = {
82 .bLength = USB_DT_ENDPOINT_SIZE, 82 .bLength = USB_DT_ENDPOINT_SIZE,
83 .bDescriptorType = USB_DT_ENDPOINT, 83 .bDescriptorType = USB_DT_ENDPOINT,
84 84
@@ -88,14 +88,14 @@ static struct usb_endpoint_descriptor fs_sink_desc = {
88 88
89static struct usb_descriptor_header *fs_loopback_descs[] = { 89static struct usb_descriptor_header *fs_loopback_descs[] = {
90 (struct usb_descriptor_header *) &loopback_intf, 90 (struct usb_descriptor_header *) &loopback_intf,
91 (struct usb_descriptor_header *) &fs_sink_desc, 91 (struct usb_descriptor_header *) &fs_loop_sink_desc,
92 (struct usb_descriptor_header *) &fs_source_desc, 92 (struct usb_descriptor_header *) &fs_loop_source_desc,
93 NULL, 93 NULL,
94}; 94};
95 95
96/* high speed support: */ 96/* high speed support: */
97 97
98static struct usb_endpoint_descriptor hs_source_desc = { 98static struct usb_endpoint_descriptor hs_loop_source_desc = {
99 .bLength = USB_DT_ENDPOINT_SIZE, 99 .bLength = USB_DT_ENDPOINT_SIZE,
100 .bDescriptorType = USB_DT_ENDPOINT, 100 .bDescriptorType = USB_DT_ENDPOINT,
101 101
@@ -103,7 +103,7 @@ static struct usb_endpoint_descriptor hs_source_desc = {
103 .wMaxPacketSize = __constant_cpu_to_le16(512), 103 .wMaxPacketSize = __constant_cpu_to_le16(512),
104}; 104};
105 105
106static struct usb_endpoint_descriptor hs_sink_desc = { 106static struct usb_endpoint_descriptor hs_loop_sink_desc = {
107 .bLength = USB_DT_ENDPOINT_SIZE, 107 .bLength = USB_DT_ENDPOINT_SIZE,
108 .bDescriptorType = USB_DT_ENDPOINT, 108 .bDescriptorType = USB_DT_ENDPOINT,
109 109
@@ -113,8 +113,8 @@ static struct usb_endpoint_descriptor hs_sink_desc = {
113 113
114static struct usb_descriptor_header *hs_loopback_descs[] = { 114static struct usb_descriptor_header *hs_loopback_descs[] = {
115 (struct usb_descriptor_header *) &loopback_intf, 115 (struct usb_descriptor_header *) &loopback_intf,
116 (struct usb_descriptor_header *) &hs_source_desc, 116 (struct usb_descriptor_header *) &hs_loop_source_desc,
117 (struct usb_descriptor_header *) &hs_sink_desc, 117 (struct usb_descriptor_header *) &hs_loop_sink_desc,
118 NULL, 118 NULL,
119}; 119};
120 120
@@ -152,7 +152,7 @@ loopback_bind(struct usb_configuration *c, struct usb_function *f)
152 152
153 /* allocate endpoints */ 153 /* allocate endpoints */
154 154
155 loop->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc); 155 loop->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_loop_source_desc);
156 if (!loop->in_ep) { 156 if (!loop->in_ep) {
157autoconf_fail: 157autoconf_fail:
158 ERROR(cdev, "%s: can't autoconfigure on %s\n", 158 ERROR(cdev, "%s: can't autoconfigure on %s\n",
@@ -161,17 +161,17 @@ autoconf_fail:
161 } 161 }
162 loop->in_ep->driver_data = cdev; /* claim */ 162 loop->in_ep->driver_data = cdev; /* claim */
163 163
164 loop->out_ep = usb_ep_autoconfig(cdev->gadget, &fs_sink_desc); 164 loop->out_ep = usb_ep_autoconfig(cdev->gadget, &fs_loop_sink_desc);
165 if (!loop->out_ep) 165 if (!loop->out_ep)
166 goto autoconf_fail; 166 goto autoconf_fail;
167 loop->out_ep->driver_data = cdev; /* claim */ 167 loop->out_ep->driver_data = cdev; /* claim */
168 168
169 /* support high speed hardware */ 169 /* support high speed hardware */
170 if (gadget_is_dualspeed(c->cdev->gadget)) { 170 if (gadget_is_dualspeed(c->cdev->gadget)) {
171 hs_source_desc.bEndpointAddress = 171 hs_loop_source_desc.bEndpointAddress =
172 fs_source_desc.bEndpointAddress; 172 fs_loop_source_desc.bEndpointAddress;
173 hs_sink_desc.bEndpointAddress = 173 hs_loop_sink_desc.bEndpointAddress =
174 fs_sink_desc.bEndpointAddress; 174 fs_loop_sink_desc.bEndpointAddress;
175 f->hs_descriptors = hs_loopback_descs; 175 f->hs_descriptors = hs_loopback_descs;
176 } 176 }
177 177
@@ -255,8 +255,10 @@ enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop)
255 struct usb_request *req; 255 struct usb_request *req;
256 unsigned i; 256 unsigned i;
257 257
258 src = ep_choose(cdev->gadget, &hs_source_desc, &fs_source_desc); 258 src = ep_choose(cdev->gadget,
259 sink = ep_choose(cdev->gadget, &hs_sink_desc, &fs_sink_desc); 259 &hs_loop_source_desc, &fs_loop_source_desc);
260 sink = ep_choose(cdev->gadget,
261 &hs_loop_sink_desc, &fs_loop_sink_desc);
260 262
261 /* one endpoint writes data back IN to the host */ 263 /* one endpoint writes data back IN to the host */
262 ep = loop->in_ep; 264 ep = loop->in_ep;
diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c
index acb8d233aa1d..fe1832875771 100644
--- a/drivers/usb/gadget/f_subset.c
+++ b/drivers/usb/gadget/f_subset.c
@@ -103,8 +103,8 @@ static struct usb_interface_descriptor subset_data_intf __initdata = {
103 /* .iInterface = DYNAMIC */ 103 /* .iInterface = DYNAMIC */
104}; 104};
105 105
106static struct usb_cdc_header_desc header_desc __initdata = { 106static struct usb_cdc_header_desc mdlm_header_desc __initdata = {
107 .bLength = sizeof header_desc, 107 .bLength = sizeof mdlm_header_desc,
108 .bDescriptorType = USB_DT_CS_INTERFACE, 108 .bDescriptorType = USB_DT_CS_INTERFACE,
109 .bDescriptorSubType = USB_CDC_HEADER_TYPE, 109 .bDescriptorSubType = USB_CDC_HEADER_TYPE,
110 110
@@ -152,7 +152,7 @@ static struct usb_cdc_ether_desc ether_desc __initdata = {
152 152
153/* full speed support: */ 153/* full speed support: */
154 154
155static struct usb_endpoint_descriptor fs_in_desc __initdata = { 155static struct usb_endpoint_descriptor fs_subset_in_desc __initdata = {
156 .bLength = USB_DT_ENDPOINT_SIZE, 156 .bLength = USB_DT_ENDPOINT_SIZE,
157 .bDescriptorType = USB_DT_ENDPOINT, 157 .bDescriptorType = USB_DT_ENDPOINT,
158 158
@@ -160,7 +160,7 @@ static struct usb_endpoint_descriptor fs_in_desc __initdata = {
160 .bmAttributes = USB_ENDPOINT_XFER_BULK, 160 .bmAttributes = USB_ENDPOINT_XFER_BULK,
161}; 161};
162 162
163static struct usb_endpoint_descriptor fs_out_desc __initdata = { 163static struct usb_endpoint_descriptor fs_subset_out_desc __initdata = {
164 .bLength = USB_DT_ENDPOINT_SIZE, 164 .bLength = USB_DT_ENDPOINT_SIZE,
165 .bDescriptorType = USB_DT_ENDPOINT, 165 .bDescriptorType = USB_DT_ENDPOINT,
166 166
@@ -170,18 +170,18 @@ static struct usb_endpoint_descriptor fs_out_desc __initdata = {
170 170
171static struct usb_descriptor_header *fs_eth_function[] __initdata = { 171static struct usb_descriptor_header *fs_eth_function[] __initdata = {
172 (struct usb_descriptor_header *) &subset_data_intf, 172 (struct usb_descriptor_header *) &subset_data_intf,
173 (struct usb_descriptor_header *) &header_desc, 173 (struct usb_descriptor_header *) &mdlm_header_desc,
174 (struct usb_descriptor_header *) &mdlm_desc, 174 (struct usb_descriptor_header *) &mdlm_desc,
175 (struct usb_descriptor_header *) &mdlm_detail_desc, 175 (struct usb_descriptor_header *) &mdlm_detail_desc,
176 (struct usb_descriptor_header *) &ether_desc, 176 (struct usb_descriptor_header *) &ether_desc,
177 (struct usb_descriptor_header *) &fs_in_desc, 177 (struct usb_descriptor_header *) &fs_subset_in_desc,
178 (struct usb_descriptor_header *) &fs_out_desc, 178 (struct usb_descriptor_header *) &fs_subset_out_desc,
179 NULL, 179 NULL,
180}; 180};
181 181
182/* high speed support: */ 182/* high speed support: */
183 183
184static struct usb_endpoint_descriptor hs_in_desc __initdata = { 184static struct usb_endpoint_descriptor hs_subset_in_desc __initdata = {
185 .bLength = USB_DT_ENDPOINT_SIZE, 185 .bLength = USB_DT_ENDPOINT_SIZE,
186 .bDescriptorType = USB_DT_ENDPOINT, 186 .bDescriptorType = USB_DT_ENDPOINT,
187 187
@@ -189,7 +189,7 @@ static struct usb_endpoint_descriptor hs_in_desc __initdata = {
189 .wMaxPacketSize = __constant_cpu_to_le16(512), 189 .wMaxPacketSize = __constant_cpu_to_le16(512),
190}; 190};
191 191
192static struct usb_endpoint_descriptor hs_out_desc __initdata = { 192static struct usb_endpoint_descriptor hs_subset_out_desc __initdata = {
193 .bLength = USB_DT_ENDPOINT_SIZE, 193 .bLength = USB_DT_ENDPOINT_SIZE,
194 .bDescriptorType = USB_DT_ENDPOINT, 194 .bDescriptorType = USB_DT_ENDPOINT,
195 195
@@ -199,12 +199,12 @@ static struct usb_endpoint_descriptor hs_out_desc __initdata = {
199 199
200static struct usb_descriptor_header *hs_eth_function[] __initdata = { 200static struct usb_descriptor_header *hs_eth_function[] __initdata = {
201 (struct usb_descriptor_header *) &subset_data_intf, 201 (struct usb_descriptor_header *) &subset_data_intf,
202 (struct usb_descriptor_header *) &header_desc, 202 (struct usb_descriptor_header *) &mdlm_header_desc,
203 (struct usb_descriptor_header *) &mdlm_desc, 203 (struct usb_descriptor_header *) &mdlm_desc,
204 (struct usb_descriptor_header *) &mdlm_detail_desc, 204 (struct usb_descriptor_header *) &mdlm_detail_desc,
205 (struct usb_descriptor_header *) &ether_desc, 205 (struct usb_descriptor_header *) &ether_desc,
206 (struct usb_descriptor_header *) &hs_in_desc, 206 (struct usb_descriptor_header *) &hs_subset_in_desc,
207 (struct usb_descriptor_header *) &hs_out_desc, 207 (struct usb_descriptor_header *) &hs_subset_out_desc,
208 NULL, 208 NULL,
209}; 209};
210 210
@@ -281,13 +281,13 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
281 status = -ENODEV; 281 status = -ENODEV;
282 282
283 /* allocate instance-specific endpoints */ 283 /* allocate instance-specific endpoints */
284 ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc); 284 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_in_desc);
285 if (!ep) 285 if (!ep)
286 goto fail; 286 goto fail;
287 geth->port.in_ep = ep; 287 geth->port.in_ep = ep;
288 ep->driver_data = cdev; /* claim */ 288 ep->driver_data = cdev; /* claim */
289 289
290 ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc); 290 ep = usb_ep_autoconfig(cdev->gadget, &fs_subset_out_desc);
291 if (!ep) 291 if (!ep)
292 goto fail; 292 goto fail;
293 geth->port.out_ep = ep; 293 geth->port.out_ep = ep;
@@ -297,9 +297,9 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
297 f->descriptors = usb_copy_descriptors(fs_eth_function); 297 f->descriptors = usb_copy_descriptors(fs_eth_function);
298 298
299 geth->fs.in = usb_find_endpoint(fs_eth_function, 299 geth->fs.in = usb_find_endpoint(fs_eth_function,
300 f->descriptors, &fs_in_desc); 300 f->descriptors, &fs_subset_in_desc);
301 geth->fs.out = usb_find_endpoint(fs_eth_function, 301 geth->fs.out = usb_find_endpoint(fs_eth_function,
302 f->descriptors, &fs_out_desc); 302 f->descriptors, &fs_subset_out_desc);
303 303
304 304
305 /* support all relevant hardware speeds... we expect that when 305 /* support all relevant hardware speeds... we expect that when
@@ -307,18 +307,18 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
307 * both speeds 307 * both speeds
308 */ 308 */
309 if (gadget_is_dualspeed(c->cdev->gadget)) { 309 if (gadget_is_dualspeed(c->cdev->gadget)) {
310 hs_in_desc.bEndpointAddress = 310 hs_subset_in_desc.bEndpointAddress =
311 fs_in_desc.bEndpointAddress; 311 fs_subset_in_desc.bEndpointAddress;
312 hs_out_desc.bEndpointAddress = 312 hs_subset_out_desc.bEndpointAddress =
313 fs_out_desc.bEndpointAddress; 313 fs_subset_out_desc.bEndpointAddress;
314 314
315 /* copy descriptors, and track endpoint copies */ 315 /* copy descriptors, and track endpoint copies */
316 f->hs_descriptors = usb_copy_descriptors(hs_eth_function); 316 f->hs_descriptors = usb_copy_descriptors(hs_eth_function);
317 317
318 geth->hs.in = usb_find_endpoint(hs_eth_function, 318 geth->hs.in = usb_find_endpoint(hs_eth_function,
319 f->hs_descriptors, &hs_in_desc); 319 f->hs_descriptors, &hs_subset_in_desc);
320 geth->hs.out = usb_find_endpoint(hs_eth_function, 320 geth->hs.out = usb_find_endpoint(hs_eth_function,
321 f->hs_descriptors, &hs_out_desc); 321 f->hs_descriptors, &hs_subset_out_desc);
322 } 322 }
323 323
324 /* NOTE: all that is done without knowing or caring about 324 /* NOTE: all that is done without knowing or caring about
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index ea2c31d18080..0c632d22a631 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -245,6 +245,18 @@
245#include "gadget_chips.h" 245#include "gadget_chips.h"
246 246
247 247
248
249/*
250 * Kbuild is not very cooperative with respect to linking separately
251 * compiled library objects into one module. So for now we won't use
252 * separate compilation ... ensuring init/exit sections work to shrink
253 * the runtime footprint, and giving us at least some parts of what
254 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
255 */
256#include "usbstring.c"
257#include "config.c"
258#include "epautoconf.c"
259
248/*-------------------------------------------------------------------------*/ 260/*-------------------------------------------------------------------------*/
249 261
250#define DRIVER_DESC "File-backed Storage Gadget" 262#define DRIVER_DESC "File-backed Storage Gadget"
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index ea8651e3da1a..6eee760410d6 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -35,6 +35,21 @@
35 35
36#include "gadget_chips.h" 36#include "gadget_chips.h"
37 37
38
39/*
40 * Kbuild is not very cooperative with respect to linking separately
41 * compiled library objects into one module. So for now we won't use
42 * separate compilation ... ensuring init/exit sections work to shrink
43 * the runtime footprint, and giving us at least some parts of what
44 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
45 */
46#include "usbstring.c"
47#include "config.c"
48#include "epautoconf.c"
49
50/*-------------------------------------------------------------------------*/
51
52
38MODULE_AUTHOR("Ben Williamson"); 53MODULE_AUTHOR("Ben Williamson");
39MODULE_LICENSE("GPL v2"); 54MODULE_LICENSE("GPL v2");
40 55
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index e0090085b78e..2b3b9e1dd2ee 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -53,6 +53,20 @@
53 53
54#include "gadget_chips.h" 54#include "gadget_chips.h"
55 55
56
57/*
58 * Kbuild is not very cooperative with respect to linking separately
59 * compiled library objects into one module. So for now we won't use
60 * separate compilation ... ensuring init/exit sections work to shrink
61 * the runtime footprint, and giving us at least some parts of what
62 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
63 */
64#include "usbstring.c"
65#include "config.c"
66#include "epautoconf.c"
67
68/*-------------------------------------------------------------------------*/
69
56#define DRIVER_DESC "Printer Gadget" 70#define DRIVER_DESC "Printer Gadget"
57#define DRIVER_VERSION "2007 OCT 06" 71#define DRIVER_VERSION "2007 OCT 06"
58 72
@@ -1360,8 +1374,8 @@ printer_bind(struct usb_gadget *gadget)
1360 1374
1361 1375
1362 /* Setup the sysfs files for the printer gadget. */ 1376 /* Setup the sysfs files for the printer gadget. */
1363 dev->pdev = device_create_drvdata(usb_gadget_class, NULL, 1377 dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno,
1364 g_printer_devno, NULL, "g_printer"); 1378 NULL, "g_printer");
1365 if (IS_ERR(dev->pdev)) { 1379 if (IS_ERR(dev->pdev)) {
1366 ERROR(dev, "Failed to create device: g_printer\n"); 1380 ERROR(dev, "Failed to create device: g_printer\n");
1367 goto fail; 1381 goto fail;
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 7228e8562236..8c26f5ea2b83 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -57,11 +57,6 @@ MODULE_PARM_DESC (rndis_debug, "enable debugging");
57#define rndis_debug 0 57#define rndis_debug 0
58#endif 58#endif
59 59
60#define DBG(str,args...) do { \
61 if (rndis_debug) \
62 pr_debug(str , ## args); \
63 } while (0)
64
65#define RNDIS_MAX_CONFIGS 1 60#define RNDIS_MAX_CONFIGS 1
66 61
67 62
@@ -183,9 +178,9 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
183 if (!resp) return -ENOMEM; 178 if (!resp) return -ENOMEM;
184 179
185 if (buf_len && rndis_debug > 1) { 180 if (buf_len && rndis_debug > 1) {
186 DBG("query OID %08x value, len %d:\n", OID, buf_len); 181 pr_debug("query OID %08x value, len %d:\n", OID, buf_len);
187 for (i = 0; i < buf_len; i += 16) { 182 for (i = 0; i < buf_len; i += 16) {
188 DBG("%03d: %08x %08x %08x %08x\n", i, 183 pr_debug("%03d: %08x %08x %08x %08x\n", i,
189 get_unaligned_le32(&buf[i]), 184 get_unaligned_le32(&buf[i]),
190 get_unaligned_le32(&buf[i + 4]), 185 get_unaligned_le32(&buf[i + 4]),
191 get_unaligned_le32(&buf[i + 8]), 186 get_unaligned_le32(&buf[i + 8]),
@@ -209,7 +204,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
209 204
210 /* mandatory */ 205 /* mandatory */
211 case OID_GEN_SUPPORTED_LIST: 206 case OID_GEN_SUPPORTED_LIST:
212 DBG("%s: OID_GEN_SUPPORTED_LIST\n", __func__); 207 pr_debug("%s: OID_GEN_SUPPORTED_LIST\n", __func__);
213 length = sizeof (oid_supported_list); 208 length = sizeof (oid_supported_list);
214 count = length / sizeof (u32); 209 count = length / sizeof (u32);
215 for (i = 0; i < count; i++) 210 for (i = 0; i < count; i++)
@@ -219,7 +214,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
219 214
220 /* mandatory */ 215 /* mandatory */
221 case OID_GEN_HARDWARE_STATUS: 216 case OID_GEN_HARDWARE_STATUS:
222 DBG("%s: OID_GEN_HARDWARE_STATUS\n", __func__); 217 pr_debug("%s: OID_GEN_HARDWARE_STATUS\n", __func__);
223 /* Bogus question! 218 /* Bogus question!
224 * Hardware must be ready to receive high level protocols. 219 * Hardware must be ready to receive high level protocols.
225 * BTW: 220 * BTW:
@@ -232,14 +227,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
232 227
233 /* mandatory */ 228 /* mandatory */
234 case OID_GEN_MEDIA_SUPPORTED: 229 case OID_GEN_MEDIA_SUPPORTED:
235 DBG("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__); 230 pr_debug("%s: OID_GEN_MEDIA_SUPPORTED\n", __func__);
236 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); 231 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium);
237 retval = 0; 232 retval = 0;
238 break; 233 break;
239 234
240 /* mandatory */ 235 /* mandatory */
241 case OID_GEN_MEDIA_IN_USE: 236 case OID_GEN_MEDIA_IN_USE:
242 DBG("%s: OID_GEN_MEDIA_IN_USE\n", __func__); 237 pr_debug("%s: OID_GEN_MEDIA_IN_USE\n", __func__);
243 /* one medium, one transport... (maybe you do it better) */ 238 /* one medium, one transport... (maybe you do it better) */
244 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium); 239 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr].medium);
245 retval = 0; 240 retval = 0;
@@ -247,7 +242,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
247 242
248 /* mandatory */ 243 /* mandatory */
249 case OID_GEN_MAXIMUM_FRAME_SIZE: 244 case OID_GEN_MAXIMUM_FRAME_SIZE:
250 DBG("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__); 245 pr_debug("%s: OID_GEN_MAXIMUM_FRAME_SIZE\n", __func__);
251 if (rndis_per_dev_params [configNr].dev) { 246 if (rndis_per_dev_params [configNr].dev) {
252 *outbuf = cpu_to_le32 ( 247 *outbuf = cpu_to_le32 (
253 rndis_per_dev_params [configNr].dev->mtu); 248 rndis_per_dev_params [configNr].dev->mtu);
@@ -258,7 +253,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
258 /* mandatory */ 253 /* mandatory */
259 case OID_GEN_LINK_SPEED: 254 case OID_GEN_LINK_SPEED:
260 if (rndis_debug > 1) 255 if (rndis_debug > 1)
261 DBG("%s: OID_GEN_LINK_SPEED\n", __func__); 256 pr_debug("%s: OID_GEN_LINK_SPEED\n", __func__);
262 if (rndis_per_dev_params [configNr].media_state 257 if (rndis_per_dev_params [configNr].media_state
263 == NDIS_MEDIA_STATE_DISCONNECTED) 258 == NDIS_MEDIA_STATE_DISCONNECTED)
264 *outbuf = __constant_cpu_to_le32 (0); 259 *outbuf = __constant_cpu_to_le32 (0);
@@ -270,7 +265,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
270 265
271 /* mandatory */ 266 /* mandatory */
272 case OID_GEN_TRANSMIT_BLOCK_SIZE: 267 case OID_GEN_TRANSMIT_BLOCK_SIZE:
273 DBG("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__); 268 pr_debug("%s: OID_GEN_TRANSMIT_BLOCK_SIZE\n", __func__);
274 if (rndis_per_dev_params [configNr].dev) { 269 if (rndis_per_dev_params [configNr].dev) {
275 *outbuf = cpu_to_le32 ( 270 *outbuf = cpu_to_le32 (
276 rndis_per_dev_params [configNr].dev->mtu); 271 rndis_per_dev_params [configNr].dev->mtu);
@@ -280,7 +275,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
280 275
281 /* mandatory */ 276 /* mandatory */
282 case OID_GEN_RECEIVE_BLOCK_SIZE: 277 case OID_GEN_RECEIVE_BLOCK_SIZE:
283 DBG("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__); 278 pr_debug("%s: OID_GEN_RECEIVE_BLOCK_SIZE\n", __func__);
284 if (rndis_per_dev_params [configNr].dev) { 279 if (rndis_per_dev_params [configNr].dev) {
285 *outbuf = cpu_to_le32 ( 280 *outbuf = cpu_to_le32 (
286 rndis_per_dev_params [configNr].dev->mtu); 281 rndis_per_dev_params [configNr].dev->mtu);
@@ -290,7 +285,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
290 285
291 /* mandatory */ 286 /* mandatory */
292 case OID_GEN_VENDOR_ID: 287 case OID_GEN_VENDOR_ID:
293 DBG("%s: OID_GEN_VENDOR_ID\n", __func__); 288 pr_debug("%s: OID_GEN_VENDOR_ID\n", __func__);
294 *outbuf = cpu_to_le32 ( 289 *outbuf = cpu_to_le32 (
295 rndis_per_dev_params [configNr].vendorID); 290 rndis_per_dev_params [configNr].vendorID);
296 retval = 0; 291 retval = 0;
@@ -298,7 +293,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
298 293
299 /* mandatory */ 294 /* mandatory */
300 case OID_GEN_VENDOR_DESCRIPTION: 295 case OID_GEN_VENDOR_DESCRIPTION:
301 DBG("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__); 296 pr_debug("%s: OID_GEN_VENDOR_DESCRIPTION\n", __func__);
302 length = strlen (rndis_per_dev_params [configNr].vendorDescr); 297 length = strlen (rndis_per_dev_params [configNr].vendorDescr);
303 memcpy (outbuf, 298 memcpy (outbuf,
304 rndis_per_dev_params [configNr].vendorDescr, length); 299 rndis_per_dev_params [configNr].vendorDescr, length);
@@ -306,7 +301,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
306 break; 301 break;
307 302
308 case OID_GEN_VENDOR_DRIVER_VERSION: 303 case OID_GEN_VENDOR_DRIVER_VERSION:
309 DBG("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__); 304 pr_debug("%s: OID_GEN_VENDOR_DRIVER_VERSION\n", __func__);
310 /* Created as LE */ 305 /* Created as LE */
311 *outbuf = rndis_driver_version; 306 *outbuf = rndis_driver_version;
312 retval = 0; 307 retval = 0;
@@ -314,14 +309,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
314 309
315 /* mandatory */ 310 /* mandatory */
316 case OID_GEN_CURRENT_PACKET_FILTER: 311 case OID_GEN_CURRENT_PACKET_FILTER:
317 DBG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__); 312 pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __func__);
318 *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter); 313 *outbuf = cpu_to_le32 (*rndis_per_dev_params[configNr].filter);
319 retval = 0; 314 retval = 0;
320 break; 315 break;
321 316
322 /* mandatory */ 317 /* mandatory */
323 case OID_GEN_MAXIMUM_TOTAL_SIZE: 318 case OID_GEN_MAXIMUM_TOTAL_SIZE:
324 DBG("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__); 319 pr_debug("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__);
325 *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); 320 *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE);
326 retval = 0; 321 retval = 0;
327 break; 322 break;
@@ -329,14 +324,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
329 /* mandatory */ 324 /* mandatory */
330 case OID_GEN_MEDIA_CONNECT_STATUS: 325 case OID_GEN_MEDIA_CONNECT_STATUS:
331 if (rndis_debug > 1) 326 if (rndis_debug > 1)
332 DBG("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__); 327 pr_debug("%s: OID_GEN_MEDIA_CONNECT_STATUS\n", __func__);
333 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr] 328 *outbuf = cpu_to_le32 (rndis_per_dev_params [configNr]
334 .media_state); 329 .media_state);
335 retval = 0; 330 retval = 0;
336 break; 331 break;
337 332
338 case OID_GEN_PHYSICAL_MEDIUM: 333 case OID_GEN_PHYSICAL_MEDIUM:
339 DBG("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__); 334 pr_debug("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__);
340 *outbuf = __constant_cpu_to_le32 (0); 335 *outbuf = __constant_cpu_to_le32 (0);
341 retval = 0; 336 retval = 0;
342 break; 337 break;
@@ -346,7 +341,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
346 * versions emit undefined RNDIS messages. DOCUMENT ALL THESE! 341 * versions emit undefined RNDIS messages. DOCUMENT ALL THESE!
347 */ 342 */
348 case OID_GEN_MAC_OPTIONS: /* from WinME */ 343 case OID_GEN_MAC_OPTIONS: /* from WinME */
349 DBG("%s: OID_GEN_MAC_OPTIONS\n", __func__); 344 pr_debug("%s: OID_GEN_MAC_OPTIONS\n", __func__);
350 *outbuf = __constant_cpu_to_le32( 345 *outbuf = __constant_cpu_to_le32(
351 NDIS_MAC_OPTION_RECEIVE_SERIALIZED 346 NDIS_MAC_OPTION_RECEIVE_SERIALIZED
352 | NDIS_MAC_OPTION_FULL_DUPLEX); 347 | NDIS_MAC_OPTION_FULL_DUPLEX);
@@ -358,7 +353,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
358 /* mandatory */ 353 /* mandatory */
359 case OID_GEN_XMIT_OK: 354 case OID_GEN_XMIT_OK:
360 if (rndis_debug > 1) 355 if (rndis_debug > 1)
361 DBG("%s: OID_GEN_XMIT_OK\n", __func__); 356 pr_debug("%s: OID_GEN_XMIT_OK\n", __func__);
362 if (stats) { 357 if (stats) {
363 *outbuf = cpu_to_le32(stats->tx_packets 358 *outbuf = cpu_to_le32(stats->tx_packets
364 - stats->tx_errors - stats->tx_dropped); 359 - stats->tx_errors - stats->tx_dropped);
@@ -369,7 +364,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
369 /* mandatory */ 364 /* mandatory */
370 case OID_GEN_RCV_OK: 365 case OID_GEN_RCV_OK:
371 if (rndis_debug > 1) 366 if (rndis_debug > 1)
372 DBG("%s: OID_GEN_RCV_OK\n", __func__); 367 pr_debug("%s: OID_GEN_RCV_OK\n", __func__);
373 if (stats) { 368 if (stats) {
374 *outbuf = cpu_to_le32(stats->rx_packets 369 *outbuf = cpu_to_le32(stats->rx_packets
375 - stats->rx_errors - stats->rx_dropped); 370 - stats->rx_errors - stats->rx_dropped);
@@ -380,7 +375,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
380 /* mandatory */ 375 /* mandatory */
381 case OID_GEN_XMIT_ERROR: 376 case OID_GEN_XMIT_ERROR:
382 if (rndis_debug > 1) 377 if (rndis_debug > 1)
383 DBG("%s: OID_GEN_XMIT_ERROR\n", __func__); 378 pr_debug("%s: OID_GEN_XMIT_ERROR\n", __func__);
384 if (stats) { 379 if (stats) {
385 *outbuf = cpu_to_le32(stats->tx_errors); 380 *outbuf = cpu_to_le32(stats->tx_errors);
386 retval = 0; 381 retval = 0;
@@ -390,7 +385,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
390 /* mandatory */ 385 /* mandatory */
391 case OID_GEN_RCV_ERROR: 386 case OID_GEN_RCV_ERROR:
392 if (rndis_debug > 1) 387 if (rndis_debug > 1)
393 DBG("%s: OID_GEN_RCV_ERROR\n", __func__); 388 pr_debug("%s: OID_GEN_RCV_ERROR\n", __func__);
394 if (stats) { 389 if (stats) {
395 *outbuf = cpu_to_le32(stats->rx_errors); 390 *outbuf = cpu_to_le32(stats->rx_errors);
396 retval = 0; 391 retval = 0;
@@ -399,7 +394,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
399 394
400 /* mandatory */ 395 /* mandatory */
401 case OID_GEN_RCV_NO_BUFFER: 396 case OID_GEN_RCV_NO_BUFFER:
402 DBG("%s: OID_GEN_RCV_NO_BUFFER\n", __func__); 397 pr_debug("%s: OID_GEN_RCV_NO_BUFFER\n", __func__);
403 if (stats) { 398 if (stats) {
404 *outbuf = cpu_to_le32(stats->rx_dropped); 399 *outbuf = cpu_to_le32(stats->rx_dropped);
405 retval = 0; 400 retval = 0;
@@ -410,7 +405,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
410 405
411 /* mandatory */ 406 /* mandatory */
412 case OID_802_3_PERMANENT_ADDRESS: 407 case OID_802_3_PERMANENT_ADDRESS:
413 DBG("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__); 408 pr_debug("%s: OID_802_3_PERMANENT_ADDRESS\n", __func__);
414 if (rndis_per_dev_params [configNr].dev) { 409 if (rndis_per_dev_params [configNr].dev) {
415 length = ETH_ALEN; 410 length = ETH_ALEN;
416 memcpy (outbuf, 411 memcpy (outbuf,
@@ -422,7 +417,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
422 417
423 /* mandatory */ 418 /* mandatory */
424 case OID_802_3_CURRENT_ADDRESS: 419 case OID_802_3_CURRENT_ADDRESS:
425 DBG("%s: OID_802_3_CURRENT_ADDRESS\n", __func__); 420 pr_debug("%s: OID_802_3_CURRENT_ADDRESS\n", __func__);
426 if (rndis_per_dev_params [configNr].dev) { 421 if (rndis_per_dev_params [configNr].dev) {
427 length = ETH_ALEN; 422 length = ETH_ALEN;
428 memcpy (outbuf, 423 memcpy (outbuf,
@@ -434,7 +429,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
434 429
435 /* mandatory */ 430 /* mandatory */
436 case OID_802_3_MULTICAST_LIST: 431 case OID_802_3_MULTICAST_LIST:
437 DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); 432 pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__);
438 /* Multicast base address only */ 433 /* Multicast base address only */
439 *outbuf = __constant_cpu_to_le32 (0xE0000000); 434 *outbuf = __constant_cpu_to_le32 (0xE0000000);
440 retval = 0; 435 retval = 0;
@@ -442,21 +437,21 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
442 437
443 /* mandatory */ 438 /* mandatory */
444 case OID_802_3_MAXIMUM_LIST_SIZE: 439 case OID_802_3_MAXIMUM_LIST_SIZE:
445 DBG("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__); 440 pr_debug("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__);
446 /* Multicast base address only */ 441 /* Multicast base address only */
447 *outbuf = __constant_cpu_to_le32 (1); 442 *outbuf = __constant_cpu_to_le32 (1);
448 retval = 0; 443 retval = 0;
449 break; 444 break;
450 445
451 case OID_802_3_MAC_OPTIONS: 446 case OID_802_3_MAC_OPTIONS:
452 DBG("%s: OID_802_3_MAC_OPTIONS\n", __func__); 447 pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__);
453 break; 448 break;
454 449
455 /* ieee802.3 statistics OIDs (table 4-4) */ 450 /* ieee802.3 statistics OIDs (table 4-4) */
456 451
457 /* mandatory */ 452 /* mandatory */
458 case OID_802_3_RCV_ERROR_ALIGNMENT: 453 case OID_802_3_RCV_ERROR_ALIGNMENT:
459 DBG("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__); 454 pr_debug("%s: OID_802_3_RCV_ERROR_ALIGNMENT\n", __func__);
460 if (stats) { 455 if (stats) {
461 *outbuf = cpu_to_le32(stats->rx_frame_errors); 456 *outbuf = cpu_to_le32(stats->rx_frame_errors);
462 retval = 0; 457 retval = 0;
@@ -465,14 +460,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
465 460
466 /* mandatory */ 461 /* mandatory */
467 case OID_802_3_XMIT_ONE_COLLISION: 462 case OID_802_3_XMIT_ONE_COLLISION:
468 DBG("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__); 463 pr_debug("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__);
469 *outbuf = __constant_cpu_to_le32 (0); 464 *outbuf = __constant_cpu_to_le32 (0);
470 retval = 0; 465 retval = 0;
471 break; 466 break;
472 467
473 /* mandatory */ 468 /* mandatory */
474 case OID_802_3_XMIT_MORE_COLLISIONS: 469 case OID_802_3_XMIT_MORE_COLLISIONS:
475 DBG("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__); 470 pr_debug("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__);
476 *outbuf = __constant_cpu_to_le32 (0); 471 *outbuf = __constant_cpu_to_le32 (0);
477 retval = 0; 472 retval = 0;
478 break; 473 break;
@@ -504,9 +499,9 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
504 return -ENOMEM; 499 return -ENOMEM;
505 500
506 if (buf_len && rndis_debug > 1) { 501 if (buf_len && rndis_debug > 1) {
507 DBG("set OID %08x value, len %d:\n", OID, buf_len); 502 pr_debug("set OID %08x value, len %d:\n", OID, buf_len);
508 for (i = 0; i < buf_len; i += 16) { 503 for (i = 0; i < buf_len; i += 16) {
509 DBG("%03d: %08x %08x %08x %08x\n", i, 504 pr_debug("%03d: %08x %08x %08x %08x\n", i,
510 get_unaligned_le32(&buf[i]), 505 get_unaligned_le32(&buf[i]),
511 get_unaligned_le32(&buf[i + 4]), 506 get_unaligned_le32(&buf[i + 4]),
512 get_unaligned_le32(&buf[i + 8]), 507 get_unaligned_le32(&buf[i + 8]),
@@ -525,7 +520,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
525 * MULTICAST, ALL_MULTICAST, BROADCAST 520 * MULTICAST, ALL_MULTICAST, BROADCAST
526 */ 521 */
527 *params->filter = (u16)get_unaligned_le32(buf); 522 *params->filter = (u16)get_unaligned_le32(buf);
528 DBG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n", 523 pr_debug("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
529 __func__, *params->filter); 524 __func__, *params->filter);
530 525
531 /* this call has a significant side effect: it's 526 /* this call has a significant side effect: it's
@@ -547,7 +542,7 @@ static int gen_ndis_set_resp (u8 configNr, u32 OID, u8 *buf, u32 buf_len,
547 542
548 case OID_802_3_MULTICAST_LIST: 543 case OID_802_3_MULTICAST_LIST:
549 /* I think we can ignore this */ 544 /* I think we can ignore this */
550 DBG("%s: OID_802_3_MULTICAST_LIST\n", __func__); 545 pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__);
551 retval = 0; 546 retval = 0;
552 break; 547 break;
553 548
@@ -606,7 +601,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf)
606 rndis_resp_t *r; 601 rndis_resp_t *r;
607 struct rndis_params *params = rndis_per_dev_params + configNr; 602 struct rndis_params *params = rndis_per_dev_params + configNr;
608 603
609 // DBG("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); 604 /* pr_debug("%s: OID = %08X\n", __func__, cpu_to_le32(buf->OID)); */
610 if (!params->dev) 605 if (!params->dev)
611 return -ENOTSUPP; 606 return -ENOTSUPP;
612 607
@@ -659,15 +654,15 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf)
659 BufOffset = le32_to_cpu (buf->InformationBufferOffset); 654 BufOffset = le32_to_cpu (buf->InformationBufferOffset);
660 655
661#ifdef VERBOSE_DEBUG 656#ifdef VERBOSE_DEBUG
662 DBG("%s: Length: %d\n", __func__, BufLength); 657 pr_debug("%s: Length: %d\n", __func__, BufLength);
663 DBG("%s: Offset: %d\n", __func__, BufOffset); 658 pr_debug("%s: Offset: %d\n", __func__, BufOffset);
664 DBG("%s: InfoBuffer: ", __func__); 659 pr_debug("%s: InfoBuffer: ", __func__);
665 660
666 for (i = 0; i < BufLength; i++) { 661 for (i = 0; i < BufLength; i++) {
667 DBG("%02x ", *(((u8 *) buf) + i + 8 + BufOffset)); 662 pr_debug("%02x ", *(((u8 *) buf) + i + 8 + BufOffset));
668 } 663 }
669 664
670 DBG("\n"); 665 pr_debug("\n");
671#endif 666#endif
672 667
673 resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT); 668 resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
@@ -821,14 +816,14 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
821 /* For USB: responses may take up to 10 seconds */ 816 /* For USB: responses may take up to 10 seconds */
822 switch (MsgType) { 817 switch (MsgType) {
823 case REMOTE_NDIS_INITIALIZE_MSG: 818 case REMOTE_NDIS_INITIALIZE_MSG:
824 DBG("%s: REMOTE_NDIS_INITIALIZE_MSG\n", 819 pr_debug("%s: REMOTE_NDIS_INITIALIZE_MSG\n",
825 __func__ ); 820 __func__ );
826 params->state = RNDIS_INITIALIZED; 821 params->state = RNDIS_INITIALIZED;
827 return rndis_init_response (configNr, 822 return rndis_init_response (configNr,
828 (rndis_init_msg_type *) buf); 823 (rndis_init_msg_type *) buf);
829 824
830 case REMOTE_NDIS_HALT_MSG: 825 case REMOTE_NDIS_HALT_MSG:
831 DBG("%s: REMOTE_NDIS_HALT_MSG\n", 826 pr_debug("%s: REMOTE_NDIS_HALT_MSG\n",
832 __func__ ); 827 __func__ );
833 params->state = RNDIS_UNINITIALIZED; 828 params->state = RNDIS_UNINITIALIZED;
834 if (params->dev) { 829 if (params->dev) {
@@ -846,7 +841,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
846 (rndis_set_msg_type *) buf); 841 (rndis_set_msg_type *) buf);
847 842
848 case REMOTE_NDIS_RESET_MSG: 843 case REMOTE_NDIS_RESET_MSG:
849 DBG("%s: REMOTE_NDIS_RESET_MSG\n", 844 pr_debug("%s: REMOTE_NDIS_RESET_MSG\n",
850 __func__ ); 845 __func__ );
851 return rndis_reset_response (configNr, 846 return rndis_reset_response (configNr,
852 (rndis_reset_msg_type *) buf); 847 (rndis_reset_msg_type *) buf);
@@ -854,7 +849,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
854 case REMOTE_NDIS_KEEPALIVE_MSG: 849 case REMOTE_NDIS_KEEPALIVE_MSG:
855 /* For USB: host does this every 5 seconds */ 850 /* For USB: host does this every 5 seconds */
856 if (rndis_debug > 1) 851 if (rndis_debug > 1)
857 DBG("%s: REMOTE_NDIS_KEEPALIVE_MSG\n", 852 pr_debug("%s: REMOTE_NDIS_KEEPALIVE_MSG\n",
858 __func__ ); 853 __func__ );
859 return rndis_keepalive_response (configNr, 854 return rndis_keepalive_response (configNr,
860 (rndis_keepalive_msg_type *) 855 (rndis_keepalive_msg_type *)
@@ -870,7 +865,7 @@ int rndis_msg_parser (u8 configNr, u8 *buf)
870 { 865 {
871 unsigned i; 866 unsigned i;
872 for (i = 0; i < MsgLength; i += 16) { 867 for (i = 0; i < MsgLength; i += 16) {
873 DBG("%03d: " 868 pr_debug("%03d: "
874 " %02x %02x %02x %02x" 869 " %02x %02x %02x %02x"
875 " %02x %02x %02x %02x" 870 " %02x %02x %02x %02x"
876 " %02x %02x %02x %02x" 871 " %02x %02x %02x %02x"
@@ -905,18 +900,18 @@ int rndis_register(void (*resp_avail)(void *v), void *v)
905 rndis_per_dev_params [i].used = 1; 900 rndis_per_dev_params [i].used = 1;
906 rndis_per_dev_params [i].resp_avail = resp_avail; 901 rndis_per_dev_params [i].resp_avail = resp_avail;
907 rndis_per_dev_params [i].v = v; 902 rndis_per_dev_params [i].v = v;
908 DBG("%s: configNr = %d\n", __func__, i); 903 pr_debug("%s: configNr = %d\n", __func__, i);
909 return i; 904 return i;
910 } 905 }
911 } 906 }
912 DBG("failed\n"); 907 pr_debug("failed\n");
913 908
914 return -ENODEV; 909 return -ENODEV;
915} 910}
916 911
917void rndis_deregister (int configNr) 912void rndis_deregister (int configNr)
918{ 913{
919 DBG("%s: \n", __func__ ); 914 pr_debug("%s: \n", __func__);
920 915
921 if (configNr >= RNDIS_MAX_CONFIGS) return; 916 if (configNr >= RNDIS_MAX_CONFIGS) return;
922 rndis_per_dev_params [configNr].used = 0; 917 rndis_per_dev_params [configNr].used = 0;
@@ -926,7 +921,7 @@ void rndis_deregister (int configNr)
926 921
927int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter) 922int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
928{ 923{
929 DBG("%s:\n", __func__ ); 924 pr_debug("%s:\n", __func__);
930 if (!dev) 925 if (!dev)
931 return -EINVAL; 926 return -EINVAL;
932 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 927 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
@@ -939,7 +934,7 @@ int rndis_set_param_dev(u8 configNr, struct net_device *dev, u16 *cdc_filter)
939 934
940int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr) 935int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr)
941{ 936{
942 DBG("%s:\n", __func__ ); 937 pr_debug("%s:\n", __func__);
943 if (!vendorDescr) return -1; 938 if (!vendorDescr) return -1;
944 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 939 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
945 940
@@ -951,7 +946,7 @@ int rndis_set_param_vendor (u8 configNr, u32 vendorID, const char *vendorDescr)
951 946
952int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed) 947int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed)
953{ 948{
954 DBG("%s: %u %u\n", __func__, medium, speed); 949 pr_debug("%s: %u %u\n", __func__, medium, speed);
955 if (configNr >= RNDIS_MAX_CONFIGS) return -1; 950 if (configNr >= RNDIS_MAX_CONFIGS) return -1;
956 951
957 rndis_per_dev_params [configNr].medium = medium; 952 rndis_per_dev_params [configNr].medium = medium;
@@ -1114,7 +1109,7 @@ static ssize_t rndis_proc_write(struct file *file, const char __user *buffer,
1114 break; 1109 break;
1115 default: 1110 default:
1116 if (fl_speed) p->speed = speed; 1111 if (fl_speed) p->speed = speed;
1117 else DBG("%c is not valid\n", c); 1112 else pr_debug("%c is not valid\n", c);
1118 break; 1113 break;
1119 } 1114 }
1120 1115
@@ -1159,12 +1154,12 @@ int __init rndis_init (void)
1159 &rndis_proc_fops, 1154 &rndis_proc_fops,
1160 (void *)(rndis_per_dev_params + i)))) 1155 (void *)(rndis_per_dev_params + i))))
1161 { 1156 {
1162 DBG("%s :remove entries", __func__); 1157 pr_debug("%s :remove entries", __func__);
1163 while (i) { 1158 while (i) {
1164 sprintf (name, NAME_TEMPLATE, --i); 1159 sprintf (name, NAME_TEMPLATE, --i);
1165 remove_proc_entry (name, NULL); 1160 remove_proc_entry (name, NULL);
1166 } 1161 }
1167 DBG("\n"); 1162 pr_debug("\n");
1168 return -EIO; 1163 return -EIO;
1169 } 1164 }
1170#endif 1165#endif
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index b3699afff002..3faa7a7022df 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -30,6 +30,24 @@
30 30
31/*-------------------------------------------------------------------------*/ 31/*-------------------------------------------------------------------------*/
32 32
33/*
34 * Kbuild is not very cooperative with respect to linking separately
35 * compiled library objects into one module. So for now we won't use
36 * separate compilation ... ensuring init/exit sections work to shrink
37 * the runtime footprint, and giving us at least some parts of what
38 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
39 */
40#include "composite.c"
41#include "usbstring.c"
42#include "config.c"
43#include "epautoconf.c"
44
45#include "f_acm.c"
46#include "f_serial.c"
47#include "u_serial.c"
48
49/*-------------------------------------------------------------------------*/
50
33/* Thanks to NetChip Technologies for donating this product ID. 51/* Thanks to NetChip Technologies for donating this product ID.
34* 52*
35* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!! 53* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 3791e6271903..dbd575a194f3 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -52,7 +52,7 @@
52 * this single "physical" link to be used by multiple virtual links.) 52 * this single "physical" link to be used by multiple virtual links.)
53 */ 53 */
54 54
55#define DRIVER_VERSION "29-May-2008" 55#define UETH__VERSION "29-May-2008"
56 56
57struct eth_dev { 57struct eth_dev {
58 /* lock is held while accessing port_usb 58 /* lock is held while accessing port_usb
@@ -170,7 +170,7 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
170 struct eth_dev *dev = netdev_priv(net); 170 struct eth_dev *dev = netdev_priv(net);
171 171
172 strlcpy(p->driver, "g_ether", sizeof p->driver); 172 strlcpy(p->driver, "g_ether", sizeof p->driver);
173 strlcpy(p->version, DRIVER_VERSION, sizeof p->version); 173 strlcpy(p->version, UETH__VERSION, sizeof p->version);
174 strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version); 174 strlcpy(p->fw_version, dev->gadget->name, sizeof p->fw_version);
175 strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); 175 strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
176} 176}
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index aa0bd4f126a1..361d9659ac48 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -59,6 +59,23 @@
59 59
60/*-------------------------------------------------------------------------*/ 60/*-------------------------------------------------------------------------*/
61 61
62/*
63 * Kbuild is not very cooperative with respect to linking separately
64 * compiled library objects into one module. So for now we won't use
65 * separate compilation ... ensuring init/exit sections work to shrink
66 * the runtime footprint, and giving us at least some parts of what
67 * a "gcc --combine ... part1.c part2.c part3.c ... " build would.
68 */
69#include "composite.c"
70#include "usbstring.c"
71#include "config.c"
72#include "epautoconf.c"
73
74#include "f_sourcesink.c"
75#include "f_loopback.c"
76
77/*-------------------------------------------------------------------------*/
78
62#define DRIVER_VERSION "Cinco de Mayo 2008" 79#define DRIVER_VERSION "Cinco de Mayo 2008"
63 80
64static const char longname[] = "Gadget Zero"; 81static const char longname[] = "Gadget Zero";
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index db645936eedd..1f0c2cf26e5d 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -123,14 +123,10 @@ static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci)
123 123
124static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td) 124static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td)
125{ 125{
126 if (!list_empty(&td->list)) { 126 if (!list_empty(&td->list))
127 dev_warn(uhci_dev(uhci), "td %p still in list!\n", td); 127 dev_WARN(uhci_dev(uhci), "td %p still in list!\n", td);
128 WARN_ON(1); 128 if (!list_empty(&td->fl_list))
129 } 129 dev_WARN(uhci_dev(uhci), "td %p still in fl_list!\n", td);
130 if (!list_empty(&td->fl_list)) {
131 dev_warn(uhci_dev(uhci), "td %p still in fl_list!\n", td);
132 WARN_ON(1);
133 }
134 130
135 dma_pool_free(uhci->td_pool, td, td->dma_handle); 131 dma_pool_free(uhci->td_pool, td, td->dma_handle);
136} 132}
@@ -295,10 +291,8 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,
295static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh) 291static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
296{ 292{
297 WARN_ON(qh->state != QH_STATE_IDLE && qh->udev); 293 WARN_ON(qh->state != QH_STATE_IDLE && qh->udev);
298 if (!list_empty(&qh->queue)) { 294 if (!list_empty(&qh->queue))
299 dev_warn(uhci_dev(uhci), "qh %p list not empty!\n", qh); 295 dev_WARN(uhci_dev(uhci), "qh %p list not empty!\n", qh);
300 WARN_ON(1);
301 }
302 296
303 list_del(&qh->node); 297 list_del(&qh->node);
304 if (qh->udev) { 298 if (qh->udev) {
@@ -746,11 +740,9 @@ static void uhci_free_urb_priv(struct uhci_hcd *uhci,
746{ 740{
747 struct uhci_td *td, *tmp; 741 struct uhci_td *td, *tmp;
748 742
749 if (!list_empty(&urbp->node)) { 743 if (!list_empty(&urbp->node))
750 dev_warn(uhci_dev(uhci), "urb %p still on QH's list!\n", 744 dev_WARN(uhci_dev(uhci), "urb %p still on QH's list!\n",
751 urbp->urb); 745 urbp->urb);
752 WARN_ON(1);
753 }
754 746
755 list_for_each_entry_safe(td, tmp, &urbp->td_list, list) { 747 list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {
756 uhci_remove_td_from_urbp(td); 748 uhci_remove_td_from_urbp(td);
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c
index 4cfa25b0f44e..cc8e0a926f99 100644
--- a/drivers/usb/misc/phidgetkit.c
+++ b/drivers/usb/misc/phidgetkit.c
@@ -595,9 +595,8 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic
595 } while(value); 595 } while(value);
596 kit->dev_no = bit; 596 kit->dev_no = bit;
597 597
598 kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev, 598 kit->dev = device_create(phidget_class, &kit->udev->dev, MKDEV(0, 0),
599 MKDEV(0, 0), kit, 599 kit, "interfacekit%d", kit->dev_no);
600 "interfacekit%d", kit->dev_no);
601 if (IS_ERR(kit->dev)) { 600 if (IS_ERR(kit->dev)) {
602 rc = PTR_ERR(kit->dev); 601 rc = PTR_ERR(kit->dev);
603 kit->dev = NULL; 602 kit->dev = NULL;
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c
index 9b4696f21b22..38088b44349e 100644
--- a/drivers/usb/misc/phidgetmotorcontrol.c
+++ b/drivers/usb/misc/phidgetmotorcontrol.c
@@ -365,9 +365,8 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic
365 } while(value); 365 } while(value);
366 mc->dev_no = bit; 366 mc->dev_no = bit;
367 367
368 mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev, 368 mc->dev = device_create(phidget_class, &mc->udev->dev, MKDEV(0, 0), mc,
369 MKDEV(0, 0), mc, 369 "motorcontrol%d", mc->dev_no);
370 "motorcontrol%d", mc->dev_no);
371 if (IS_ERR(mc->dev)) { 370 if (IS_ERR(mc->dev)) {
372 rc = PTR_ERR(mc->dev); 371 rc = PTR_ERR(mc->dev);
373 mc->dev = NULL; 372 mc->dev = NULL;
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c
index 1ca7ddb41d4d..bef6fe16364b 100644
--- a/drivers/usb/misc/phidgetservo.c
+++ b/drivers/usb/misc/phidgetservo.c
@@ -275,9 +275,8 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id)
275 } while (value); 275 } while (value);
276 dev->dev_no = bit; 276 dev->dev_no = bit;
277 277
278 dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev, 278 dev->dev = device_create(phidget_class, &dev->udev->dev, MKDEV(0, 0),
279 MKDEV(0, 0), dev, 279 dev, "servo%d", dev->dev_no);
280 "servo%d", dev->dev_no);
281 if (IS_ERR(dev->dev)) { 280 if (IS_ERR(dev->dev)) {
282 rc = PTR_ERR(dev->dev); 281 rc = PTR_ERR(dev->dev);
283 dev->dev = NULL; 282 dev->dev = NULL;
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 6566fc0a3228..c9de3f027aab 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1162,9 +1162,9 @@ int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus)
1162 if (minor >= MON_BIN_MAX_MINOR) 1162 if (minor >= MON_BIN_MAX_MINOR)
1163 return 0; 1163 return 0;
1164 1164
1165 dev = device_create_drvdata(mon_bin_class, ubus? ubus->controller: NULL, 1165 dev = device_create(mon_bin_class, ubus ? ubus->controller : NULL,
1166 MKDEV(MAJOR(mon_bin_dev0), minor), NULL, 1166 MKDEV(MAJOR(mon_bin_dev0), minor), NULL,
1167 "usbmon%d", minor); 1167 "usbmon%d", minor);
1168 if (IS_ERR(dev)) 1168 if (IS_ERR(dev))
1169 return 0; 1169 return 0;
1170 1170
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 93a080e827cc..64b3d30027b8 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3573,8 +3573,8 @@ static int __init fb_console_init(void)
3573 3573
3574 acquire_console_sem(); 3574 acquire_console_sem();
3575 fb_register_client(&fbcon_event_notifier); 3575 fb_register_client(&fbcon_event_notifier);
3576 fbcon_device = device_create_drvdata(fb_class, NULL, MKDEV(0, 0), 3576 fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL,
3577 NULL, "fbcon"); 3577 "fbcon");
3578 3578
3579 if (IS_ERR(fbcon_device)) { 3579 if (IS_ERR(fbcon_device)) {
3580 printk(KERN_WARNING "Unable to create device " 3580 printk(KERN_WARNING "Unable to create device "
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
index 6ef800bdf482..4830b1bf51e5 100644
--- a/drivers/video/display/display-sysfs.c
+++ b/drivers/video/display/display-sysfs.c
@@ -153,12 +153,9 @@ struct display_device *display_device_register(struct display_driver *driver,
153 mutex_unlock(&allocated_dsp_lock); 153 mutex_unlock(&allocated_dsp_lock);
154 154
155 if (!ret) { 155 if (!ret) {
156 new_dev->dev = device_create_drvdata(display_class, 156 new_dev->dev = device_create(display_class, parent,
157 parent, 157 MKDEV(0, 0), new_dev,
158 MKDEV(0,0), 158 "display%d", new_dev->idx);
159 new_dev,
160 "display%d",
161 new_dev->idx);
162 if (!IS_ERR(new_dev->dev)) { 159 if (!IS_ERR(new_dev->dev)) {
163 new_dev->parent = parent; 160 new_dev->parent = parent;
164 new_dev->driver = driver; 161 new_dev->driver = driver;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 3f18bb9abad0..217c5118ae9e 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1430,9 +1430,8 @@ register_framebuffer(struct fb_info *fb_info)
1430 break; 1430 break;
1431 fb_info->node = i; 1431 fb_info->node = i;
1432 1432
1433 fb_info->dev = device_create_drvdata(fb_class, fb_info->device, 1433 fb_info->dev = device_create(fb_class, fb_info->device,
1434 MKDEV(FB_MAJOR, i), NULL, 1434 MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
1435 "fb%d", i);
1436 if (IS_ERR(fb_info->dev)) { 1435 if (IS_ERR(fb_info->dev)) {
1437 /* Not fatal */ 1436 /* Not fatal */
1438 printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev)); 1437 printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev));