On Mon, 30 Jul 2012, Lan Tianyu wrote: > The hub is always supposed to support reset and its persist is enabled. > So hub doesn't need attribute avoid_reset_quirk. The patch is to take > attribute avoid_reset_quirk out of usb device's attribute group and > add or remove it in the usb_create/remove_sysfs_dev_files() if the device > is not a usb hub. > > Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx> > --- > drivers/usb/core/sysfs.c | 30 +++++++++++++++++++++++++++++- > 1 files changed, 29 insertions(+), 1 deletions(-) > > diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c > index d6c49d9..20b0add 100644 > --- a/drivers/usb/core/sysfs.c > +++ b/drivers/usb/core/sysfs.c > @@ -220,6 +220,30 @@ set_avoid_reset_quirk(struct device *dev, struct device_attribute *attr, > static DEVICE_ATTR(avoid_reset_quirk, S_IRUGO | S_IWUSR, > show_avoid_reset_quirk, set_avoid_reset_quirk); > > +static int add_avoid_reset_quirk_attributes(struct device *dev) > +{ > + int rc = 0; > + > + if (is_usb_device(dev)) { This test clearly is not needed. You call this function from only one place, and in that place it is known that the dev refers to a USB device. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html