forked from luck/tmp_suning_uos_patched
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
592fbbe4bc
commit
1b21d5e166
|
@ -1359,7 +1359,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
|
|||
/* let kernel drivers try to (re)bind to the interface */
|
||||
case USBDEVFS_CONNECT:
|
||||
usb_unlock_device(ps->dev);
|
||||
bus_rescan_devices(intf->dev.bus);
|
||||
retval = bus_rescan_devices(intf->dev.bus);
|
||||
usb_lock_device(ps->dev);
|
||||
break;
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver,
|
|||
u32 idVendor = 0;
|
||||
u32 idProduct = 0;
|
||||
int fields = 0;
|
||||
int retval = 0;
|
||||
|
||||
fields = sscanf(buf, "%x %x", &idVendor, &idProduct);
|
||||
if (fields < 2)
|
||||
|
@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver,
|
|||
spin_unlock(&usb_drv->dynids.lock);
|
||||
|
||||
if (get_driver(driver)) {
|
||||
driver_attach(driver);
|
||||
retval = driver_attach(driver);
|
||||
put_driver(driver);
|
||||
}
|
||||
|
||||
if (retval)
|
||||
return retval;
|
||||
return count;
|
||||
}
|
||||
static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
|
||||
|
@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
|
|||
{
|
||||
struct device *dev = &iface->dev;
|
||||
struct usb_device *udev = interface_to_usbdev(iface);
|
||||
int retval = 0;
|
||||
|
||||
if (dev->driver)
|
||||
return -EBUSY;
|
||||
|
@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver,
|
|||
* the future device_add() bind it, bypassing probe()
|
||||
*/
|
||||
if (device_is_registered(dev))
|
||||
device_bind_driver(dev);
|
||||
retval = device_bind_driver(dev);
|
||||
|
||||
return 0;
|
||||
return retval;
|
||||
}
|
||||
EXPORT_SYMBOL(usb_driver_claim_interface);
|
||||
|
||||
|
|
|
@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev)
|
|||
kfree(ep_dev);
|
||||
}
|
||||
|
||||
void usb_create_ep_files(struct device *parent,
|
||||
struct usb_host_endpoint *endpoint,
|
||||
struct usb_device *udev)
|
||||
int usb_create_ep_files(struct device *parent,
|
||||
struct usb_host_endpoint *endpoint,
|
||||
struct usb_device *udev)
|
||||
{
|
||||
char name[8];
|
||||
struct ep_device *ep_dev;
|
||||
|
@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent,
|
|||
retval = device_register(&ep_dev->dev);
|
||||
if (retval)
|
||||
goto error;
|
||||
sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
|
||||
retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
|
||||
if (retval)
|
||||
goto error_group;
|
||||
|
||||
endpoint->ep_dev = ep_dev;
|
||||
|
||||
/* create the symlink to the old-style "ep_XX" directory */
|
||||
sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
|
||||
sysfs_create_link(&parent->kobj, &endpoint->ep_dev->dev.kobj, name);
|
||||
|
||||
retval = sysfs_create_link(&parent->kobj,
|
||||
&endpoint->ep_dev->dev.kobj, name);
|
||||
if (retval)
|
||||
goto error_link;
|
||||
exit:
|
||||
return;
|
||||
return retval;
|
||||
|
||||
error_link:
|
||||
sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
|
||||
|
||||
error_group:
|
||||
device_unregister(&ep_dev->dev);
|
||||
endpoint->ep_dev = NULL;
|
||||
destroy_endpoint_class();
|
||||
return retval;
|
||||
error:
|
||||
kfree(ep_dev);
|
||||
return;
|
||||
destroy_endpoint_class();
|
||||
return retval;
|
||||
}
|
||||
|
||||
void usb_remove_ep_files(struct usb_host_endpoint *endpoint)
|
||||
|
|
|
@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = {
|
|||
.attrs = dev_attrs,
|
||||
};
|
||||
|
||||
void usb_create_sysfs_dev_files (struct usb_device *udev)
|
||||
int usb_create_sysfs_dev_files(struct usb_device *udev)
|
||||
{
|
||||
struct device *dev = &udev->dev;
|
||||
int retval;
|
||||
|
||||
sysfs_create_group(&dev->kobj, &dev_attr_grp);
|
||||
retval = sysfs_create_group(&dev->kobj, &dev_attr_grp);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
if (udev->manufacturer)
|
||||
device_create_file (dev, &dev_attr_manufacturer);
|
||||
if (udev->product)
|
||||
device_create_file (dev, &dev_attr_product);
|
||||
if (udev->serial)
|
||||
device_create_file (dev, &dev_attr_serial);
|
||||
usb_create_ep_files(dev, &udev->ep0, udev);
|
||||
if (udev->manufacturer) {
|
||||
retval = device_create_file (dev, &dev_attr_manufacturer);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
if (udev->product) {
|
||||
retval = device_create_file (dev, &dev_attr_product);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
if (udev->serial) {
|
||||
retval = device_create_file (dev, &dev_attr_serial);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
retval = usb_create_ep_files(dev, &udev->ep0, udev);
|
||||
if (retval)
|
||||
goto error;
|
||||
return 0;
|
||||
error:
|
||||
usb_remove_ep_files(&udev->ep0);
|
||||
device_remove_file(dev, &dev_attr_manufacturer);
|
||||
device_remove_file(dev, &dev_attr_product);
|
||||
device_remove_file(dev, &dev_attr_serial);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void usb_remove_sysfs_dev_files (struct usb_device *udev)
|
||||
|
@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
|
|||
usb_remove_ep_files(&iface_desc->endpoint[i]);
|
||||
}
|
||||
|
||||
void usb_create_sysfs_intf_files (struct usb_interface *intf)
|
||||
int usb_create_sysfs_intf_files(struct usb_interface *intf)
|
||||
{
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct usb_host_interface *alt = intf->cur_altsetting;
|
||||
int retval;
|
||||
|
||||
sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);
|
||||
retval = sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);
|
||||
if (retval)
|
||||
goto error;
|
||||
|
||||
if (alt->string == NULL)
|
||||
alt->string = usb_cache_string(udev, alt->desc.iInterface);
|
||||
if (alt->string)
|
||||
device_create_file(&intf->dev, &dev_attr_interface);
|
||||
retval = device_create_file(&intf->dev, &dev_attr_interface);
|
||||
usb_create_intf_ep_files(intf, udev);
|
||||
return 0;
|
||||
error:
|
||||
if (alt->string)
|
||||
device_remove_file(&intf->dev, &dev_attr_interface);
|
||||
sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
|
||||
usb_remove_intf_ep_files(intf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void usb_remove_sysfs_intf_files (struct usb_interface *intf)
|
||||
|
|
|
@ -147,11 +147,13 @@ static int __find_interface(struct device * dev, void * data)
|
|||
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
|
||||
{
|
||||
struct find_interface_arg argb;
|
||||
int retval;
|
||||
|
||||
argb.minor = minor;
|
||||
argb.interface = NULL;
|
||||
driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
|
||||
__find_interface);
|
||||
/* eat the error, it will be in argb.interface */
|
||||
retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
|
||||
__find_interface);
|
||||
return argb.interface;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Functions local to drivers/usb/core/ */
|
||||
|
||||
extern void usb_create_sysfs_dev_files (struct usb_device *dev);
|
||||
extern int usb_create_sysfs_dev_files (struct usb_device *dev);
|
||||
extern void usb_remove_sysfs_dev_files (struct usb_device *dev);
|
||||
extern void usb_create_sysfs_intf_files (struct usb_interface *intf);
|
||||
extern int usb_create_sysfs_intf_files (struct usb_interface *intf);
|
||||
extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);
|
||||
extern void usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint,
|
||||
extern int usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint,
|
||||
struct usb_device *udev);
|
||||
extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user