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 <greg@kroah.com>
This commit is contained in:
parent
c4a432d3db
commit
44dd970be9
|
@ -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[] = {
|
||||
|
|
Loading…
Reference in New Issue