diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2016-06-29 19:32:31 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2018-03-28 08:38:22 +0200 |
commit | b9dd652499d645707dda2b835a905455e3718157 (patch) | |
tree | e8eabede29ac35fbf396dfdbeda38be3944d6210 /drivers/s390/cio | |
parent | s390/chsc: query utility strings via fmt3 channel path descriptor (diff) | |
download | linux-b9dd652499d645707dda2b835a905455e3718157.tar.xz linux-b9dd652499d645707dda2b835a905455e3718157.zip |
s390/cio: add util_string sysfs attribute
Export utility strings as a chpid's binary sysfs attribute.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/chp.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index 41ecc08b1cf7..afbdee74147d 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c @@ -384,6 +384,28 @@ static ssize_t chp_chid_external_show(struct device *dev, } static DEVICE_ATTR(chid_external, 0444, chp_chid_external_show, NULL); +static ssize_t util_string_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, char *buf, + loff_t off, size_t count) +{ + struct channel_path *chp = to_channelpath(kobj_to_dev(kobj)); + ssize_t rc; + + mutex_lock(&chp->lock); + rc = memory_read_from_buffer(buf, count, &off, chp->desc_fmt3.util_str, + sizeof(chp->desc_fmt3.util_str)); + mutex_unlock(&chp->lock); + + return rc; +} +static BIN_ATTR_RO(util_string, + sizeof(((struct channel_path_desc_fmt3 *)0)->util_str)); + +static struct bin_attribute *chp_bin_attrs[] = { + &bin_attr_util_string, + NULL, +}; + static struct attribute *chp_attrs[] = { &dev_attr_status.attr, &dev_attr_configure.attr, @@ -396,6 +418,7 @@ static struct attribute *chp_attrs[] = { }; static struct attribute_group chp_attr_group = { .attrs = chp_attrs, + .bin_attrs = chp_bin_attrs, }; static const struct attribute_group *chp_attr_groups[] = { &chp_attr_group, |