Commit db2a54ca authored by federico.vaga@cern.ch's avatar federico.vaga@cern.ch

sysfs: fix symbolic link creation

The introduction on symbolic link was not 100% correct on patch

af1c35a5  Enumerate channels and channel-sets in sysfs

If a custom name is not assigned, DO NOT force one (like we did). Leave it
empty so that we can easily recognize this condition.

Change the sysfs 'name' attribute in order to use the proper variable
Signed-off-by: 's avatarfederico.vaga@cern.ch <federico.vaga@gmail.com>
parent 0aea6955
......@@ -642,12 +642,10 @@ static void zobj_create_link(struct zio_obj_head *head)
{
int err;
/* Create the symlink with custom channel name */
if (strlen(head->name) == 0) {
strncpy(head->name, dev_name(&head->dev), ZIO_OBJ_NAME_LEN);
if (strlen(head->name) == 0)
return;
}
/* Create the symlink with custom channel name */
err = sysfs_create_link(&head->dev.parent->kobj, &head->dev.kobj,
head->name);
if (err)
......
......@@ -481,7 +481,10 @@ int __zio_object_enable(struct zio_obj_head *head, unsigned int enable)
static ssize_t zobj_show_name(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", to_zio_head(dev)->name);
if (strlen(to_zio_head(dev)->name))
return sprintf(buf, "%s\n", to_zio_head(dev)->name);
else
return sprintf(buf, "%s\n", dev_name(dev));
}
/* Print the name of a zio object */
static ssize_t zobj_show_dev_type(struct device *dev,
......
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