Commit 44dd970b authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent c4a432d3
...@@ -74,27 +74,8 @@ static struct attribute *module_attrs[] = { ...@@ -74,27 +74,8 @@ static struct attribute *module_attrs[] = {
NULL, 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 = { static struct attribute_group module_attr_grp = {
.attrs = module_attrs, .attrs = module_attrs,
.is_visible = module_attrs_are_visible,
}; };
const struct attribute_group *greybus_module_groups[] = { const struct attribute_group *greybus_module_groups[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment