aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 18:49:37 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 18:49:37 -0400
commitefefc6eb38d43b8e5daef482f575d767b002004e (patch)
tree8a3933db1f8721f9bcc9912c800dc8406f4bdf94 /drivers/usb/core
parent117494a1b65183f0e3fcc817b07944bc5c465050 (diff)
parentcd59abfcc441b2abb4cf2cd62c1eb0f02a60e8dd (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (75 commits) PM: merge device power-management source files sysfs: add copyrights kobject: update the copyrights kset: add some kerneldoc to help describe what these strange things are Driver core: rename ktype_edd and ktype_efivar Driver core: rename ktype_driver Driver core: rename ktype_device Driver core: rename ktype_class driver core: remove subsystem_init() sysfs: move sysfs file poll implementation to sysfs_open_dirent sysfs: implement sysfs_open_dirent sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir sysfs: make sysfs_root a regular directory dirent sysfs: open code sysfs_attach_dentry() sysfs: make s_elem an anonymous union sysfs: make bin attr open get active reference of parent too sysfs: kill unnecessary NULL pointer check in sysfs_release() sysfs: kill unnecessary sysfs_get() in open paths sysfs: reposition sysfs_dirent->s_mode. sysfs: kill sysfs_update_file() ...
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/devio.c6
-rw-r--r--drivers/usb/core/driver.c29
-rw-r--r--drivers/usb/core/message.c28
3 files changed, 16 insertions, 47 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index e5ad76b4a738..f013b4012c9a 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1591,6 +1591,7 @@ static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wai
1591} 1591}
1592 1592
1593const struct file_operations usbdev_file_operations = { 1593const struct file_operations usbdev_file_operations = {
1594 .owner = THIS_MODULE,
1594 .llseek = usbdev_lseek, 1595 .llseek = usbdev_lseek,
1595 .read = usbdev_read, 1596 .read = usbdev_read,
1596 .poll = usbdev_poll, 1597 .poll = usbdev_poll,
@@ -1640,10 +1641,7 @@ static struct notifier_block usbdev_nb = {
1640}; 1641};
1641#endif 1642#endif
1642 1643
1643static struct cdev usb_device_cdev = { 1644static struct cdev usb_device_cdev;
1644 .kobj = {.name = "usb_device", },
1645 .owner = THIS_MODULE,
1646};
1647 1645
1648int __init usb_devio_init(void) 1646int __init usb_devio_init(void)
1649{ 1647{
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index c27bc080d84e..8586817698ad 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -581,12 +581,9 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)
581} 581}
582 582
583#ifdef CONFIG_HOTPLUG 583#ifdef CONFIG_HOTPLUG
584static int usb_uevent(struct device *dev, char **envp, int num_envp, 584static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
585 char *buffer, int buffer_size)
586{ 585{
587 struct usb_device *usb_dev; 586 struct usb_device *usb_dev;
588 int i = 0;
589 int length = 0;
590 587
591 if (!dev) 588 if (!dev)
592 return -ENODEV; 589 return -ENODEV;
@@ -615,51 +612,39 @@ static int usb_uevent(struct device *dev, char **envp, int num_envp,
615 * all the device descriptors we don't tell them about. Or 612 * all the device descriptors we don't tell them about. Or
616 * act as usermode drivers. 613 * act as usermode drivers.
617 */ 614 */
618 if (add_uevent_var(envp, num_envp, &i, 615 if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d",
619 buffer, buffer_size, &length,
620 "DEVICE=/proc/bus/usb/%03d/%03d",
621 usb_dev->bus->busnum, usb_dev->devnum)) 616 usb_dev->bus->busnum, usb_dev->devnum))
622 return -ENOMEM; 617 return -ENOMEM;
623#endif 618#endif
624 619
625 /* per-device configurations are common */ 620 /* per-device configurations are common */
626 if (add_uevent_var(envp, num_envp, &i, 621 if (add_uevent_var(env, "PRODUCT=%x/%x/%x",
627 buffer, buffer_size, &length,
628 "PRODUCT=%x/%x/%x",
629 le16_to_cpu(usb_dev->descriptor.idVendor), 622 le16_to_cpu(usb_dev->descriptor.idVendor),
630 le16_to_cpu(usb_dev->descriptor.idProduct), 623 le16_to_cpu(usb_dev->descriptor.idProduct),
631 le16_to_cpu(usb_dev->descriptor.bcdDevice))) 624 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
632 return -ENOMEM; 625 return -ENOMEM;
633 626
634 /* class-based driver binding models */ 627 /* class-based driver binding models */
635 if (add_uevent_var(envp, num_envp, &i, 628 if (add_uevent_var(env, "TYPE=%d/%d/%d",
636 buffer, buffer_size, &length,
637 "TYPE=%d/%d/%d",
638 usb_dev->descriptor.bDeviceClass, 629 usb_dev->descriptor.bDeviceClass,
639 usb_dev->descriptor.bDeviceSubClass, 630 usb_dev->descriptor.bDeviceSubClass,
640 usb_dev->descriptor.bDeviceProtocol)) 631 usb_dev->descriptor.bDeviceProtocol))
641 return -ENOMEM; 632 return -ENOMEM;
642 633
643 if (add_uevent_var(envp, num_envp, &i, 634 if (add_uevent_var(env, "BUSNUM=%03d",
644 buffer, buffer_size, &length,
645 "BUSNUM=%03d",
646 usb_dev->bus->busnum)) 635 usb_dev->bus->busnum))
647 return -ENOMEM; 636 return -ENOMEM;
648 637
649 if (add_uevent_var(envp, num_envp, &i, 638 if (add_uevent_var(env, "DEVNUM=%03d",
650 buffer, buffer_size, &length,
651 "DEVNUM=%03d",
652 usb_dev->devnum)) 639 usb_dev->devnum))
653 return -ENOMEM; 640 return -ENOMEM;
654 641
655 envp[i] = NULL;
656 return 0; 642 return 0;
657} 643}
658 644
659#else 645#else
660 646
661static int usb_uevent(struct device *dev, char **envp, 647static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
662 int num_envp, char *buffer, int buffer_size)
663{ 648{
664 return -ENODEV; 649 return -ENODEV;
665} 650}
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 98fcddba6908..c021af390372 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1344,14 +1344,11 @@ static void usb_release_interface(struct device *dev)
1344} 1344}
1345 1345
1346#ifdef CONFIG_HOTPLUG 1346#ifdef CONFIG_HOTPLUG
1347static int usb_if_uevent(struct device *dev, char **envp, int num_envp, 1347static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
1348 char *buffer, int buffer_size)
1349{ 1348{
1350 struct usb_device *usb_dev; 1349 struct usb_device *usb_dev;
1351 struct usb_interface *intf; 1350 struct usb_interface *intf;
1352 struct usb_host_interface *alt; 1351 struct usb_host_interface *alt;
1353 int i = 0;
1354 int length = 0;
1355 1352
1356 if (!dev) 1353 if (!dev)
1357 return -ENODEV; 1354 return -ENODEV;
@@ -1364,39 +1361,30 @@ static int usb_if_uevent(struct device *dev, char **envp, int num_envp,
1364 alt = intf->cur_altsetting; 1361 alt = intf->cur_altsetting;
1365 1362
1366#ifdef CONFIG_USB_DEVICEFS 1363#ifdef CONFIG_USB_DEVICEFS
1367 if (add_uevent_var(envp, num_envp, &i, 1364 if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d",
1368 buffer, buffer_size, &length,
1369 "DEVICE=/proc/bus/usb/%03d/%03d",
1370 usb_dev->bus->busnum, usb_dev->devnum)) 1365 usb_dev->bus->busnum, usb_dev->devnum))
1371 return -ENOMEM; 1366 return -ENOMEM;
1372#endif 1367#endif
1373 1368
1374 if (add_uevent_var(envp, num_envp, &i, 1369 if (add_uevent_var(env, "PRODUCT=%x/%x/%x",
1375 buffer, buffer_size, &length,
1376 "PRODUCT=%x/%x/%x",
1377 le16_to_cpu(usb_dev->descriptor.idVendor), 1370 le16_to_cpu(usb_dev->descriptor.idVendor),
1378 le16_to_cpu(usb_dev->descriptor.idProduct), 1371 le16_to_cpu(usb_dev->descriptor.idProduct),
1379 le16_to_cpu(usb_dev->descriptor.bcdDevice))) 1372 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
1380 return -ENOMEM; 1373 return -ENOMEM;
1381 1374
1382 if (add_uevent_var(envp, num_envp, &i, 1375 if (add_uevent_var(env, "TYPE=%d/%d/%d",
1383 buffer, buffer_size, &length,
1384 "TYPE=%d/%d/%d",
1385 usb_dev->descriptor.bDeviceClass, 1376 usb_dev->descriptor.bDeviceClass,
1386 usb_dev->descriptor.bDeviceSubClass, 1377 usb_dev->descriptor.bDeviceSubClass,
1387 usb_dev->descriptor.bDeviceProtocol)) 1378 usb_dev->descriptor.bDeviceProtocol))
1388 return -ENOMEM; 1379 return -ENOMEM;
1389 1380
1390 if (add_uevent_var(envp, num_envp, &i, 1381 if (add_uevent_var(env, "INTERFACE=%d/%d/%d",
1391 buffer, buffer_size, &length,
1392 "INTERFACE=%d/%d/%d",
1393 alt->desc.bInterfaceClass, 1382 alt->desc.bInterfaceClass,
1394 alt->desc.bInterfaceSubClass, 1383 alt->desc.bInterfaceSubClass,
1395 alt->desc.bInterfaceProtocol)) 1384 alt->desc.bInterfaceProtocol))
1396 return -ENOMEM; 1385 return -ENOMEM;
1397 1386
1398 if (add_uevent_var(envp, num_envp, &i, 1387 if (add_uevent_var(env,
1399 buffer, buffer_size, &length,
1400 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", 1388 "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X",
1401 le16_to_cpu(usb_dev->descriptor.idVendor), 1389 le16_to_cpu(usb_dev->descriptor.idVendor),
1402 le16_to_cpu(usb_dev->descriptor.idProduct), 1390 le16_to_cpu(usb_dev->descriptor.idProduct),
@@ -1409,14 +1397,12 @@ static int usb_if_uevent(struct device *dev, char **envp, int num_envp,
1409 alt->desc.bInterfaceProtocol)) 1397 alt->desc.bInterfaceProtocol))
1410 return -ENOMEM; 1398 return -ENOMEM;
1411 1399
1412 envp[i] = NULL;
1413 return 0; 1400 return 0;
1414} 1401}
1415 1402
1416#else 1403#else
1417 1404
1418static int usb_if_uevent(struct device *dev, char **envp, 1405static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
1419 int num_envp, char *buffer, int buffer_size)
1420{ 1406{
1421 return -ENODEV; 1407 return -ENODEV;
1422} 1408}