int usb_create_sysfs_dev_files(struct usb_device *udev) { struct device *dev = &udev->dev; int retval; /* Unforunately these attributes cannot be created before * the uevent is broadcast. */ retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); if (retval) goto error; retval = add_persist_attributes(dev); if (retval) goto error; retval = add_power_attributes(dev); if (retval) goto error; retval = usb_create_ep_files(dev, &udev->ep0, udev); if (retval) goto error; return 0; error: usb_remove_sysfs_dev_files(udev); return retval; }
int usb_create_sysfs_dev_files(struct usb_device *udev) { struct device *dev = &udev->dev; int retval; retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); if (retval) goto error; retval = add_persist_attributes(dev); if (retval) goto error; retval = add_power_attributes(dev); if (retval) goto error; return retval; error: usb_remove_sysfs_dev_files(udev); return retval; }
int usb_create_sysfs_dev_files(struct usb_device *udev) { struct device *dev = &udev->dev; int retval; retval = sysfs_create_group(&dev->kobj, &dev_attr_grp); if (retval) return retval; retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); if (retval) goto error; retval = add_power_attributes(dev); if (retval) goto error; 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_sysfs_dev_files(udev); return retval; }