Skip to content

Commit b9dd652

Browse files
Sebastian OttMartin Schwidefsky
authored andcommitted
s390/cio: add util_string sysfs attribute
Export utility strings as a chpid's binary sysfs attribute. Signed-off-by: Sebastian Ott <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent fcc6dd4 commit b9dd652

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/s390/cio/chp.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,28 @@ static ssize_t chp_chid_external_show(struct device *dev,
384384
}
385385
static DEVICE_ATTR(chid_external, 0444, chp_chid_external_show, NULL);
386386

387+
static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
388+
struct bin_attribute *attr, char *buf,
389+
loff_t off, size_t count)
390+
{
391+
struct channel_path *chp = to_channelpath(kobj_to_dev(kobj));
392+
ssize_t rc;
393+
394+
mutex_lock(&chp->lock);
395+
rc = memory_read_from_buffer(buf, count, &off, chp->desc_fmt3.util_str,
396+
sizeof(chp->desc_fmt3.util_str));
397+
mutex_unlock(&chp->lock);
398+
399+
return rc;
400+
}
401+
static BIN_ATTR_RO(util_string,
402+
sizeof(((struct channel_path_desc_fmt3 *)0)->util_str));
403+
404+
static struct bin_attribute *chp_bin_attrs[] = {
405+
&bin_attr_util_string,
406+
NULL,
407+
};
408+
387409
static struct attribute *chp_attrs[] = {
388410
&dev_attr_status.attr,
389411
&dev_attr_configure.attr,
@@ -396,6 +418,7 @@ static struct attribute *chp_attrs[] = {
396418
};
397419
static struct attribute_group chp_attr_group = {
398420
.attrs = chp_attrs,
421+
.bin_attrs = chp_bin_attrs,
399422
};
400423
static const struct attribute_group *chp_attr_groups[] = {
401424
&chp_attr_group,

0 commit comments

Comments
 (0)