From: Greg Kroah-Hartman Date: Fri, 24 Oct 2014 09:54:02 +0000 (+0800) Subject: greybus: module: enable all sysfs attributes X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1962 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=44dd970be94a468c60e0745536f29115dd40d368;p=karo-tx-linux.git greybus: module: enable all sysfs attributes We were thinking that module attributes were known at the time the device was created in the system, so we could query them to know if the sysfs file was present or not. Unfortunatly that's not the case, we create the device before we parse the values, so just always show the sysfs attributes. If there is no such attribute, the sysfs file will be empty (i.e. for the string attributes.) Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/sysfs.c b/drivers/staging/greybus/sysfs.c index 2777b8cf5b3a..42d54eb07377 100644 --- a/drivers/staging/greybus/sysfs.c +++ b/drivers/staging/greybus/sysfs.c @@ -74,27 +74,8 @@ static struct attribute *module_attrs[] = { NULL, }; -static umode_t module_attrs_are_visible(struct kobject *kobj, - struct attribute *a, int n) -{ - struct gb_module *gmod = to_gb_module(kobj_to_dev(kobj)); - umode_t mode = a->mode; - - if (a == &dev_attr_module_vendor_string.attr && gmod->vendor_string) - return mode; - if (a == &dev_attr_module_product_string.attr && gmod->product_string) - return mode; - if (gmod->vendor || gmod->product || gmod->version) - return mode; - if (gmod->unique_id) - return mode; - - return 0; -} - static struct attribute_group module_attr_grp = { .attrs = module_attrs, - .is_visible = module_attrs_are_visible, }; const struct attribute_group *greybus_module_groups[] = {