diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2016-06-23 04:58:15 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2018-05-23 02:06:56 -0400 |
commit | 199652309a4d6635fca19d7528d73ab9e219bd9a (patch) | |
tree | 65a98a1d959e122d596b1fb12464d5d9cf9eb489 | |
parent | 1c21765cb3aeb17a90bfc494a63abbd4c31480bf (diff) |
s390/cio: add helper to query utility strings per given ccw device
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/ccwdev.h | 1 | ||||
-rw-r--r-- | drivers/s390/cio/device_ops.c | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h index 20bce136b2e5..a29dd430fb40 100644 --- a/arch/s390/include/asm/ccwdev.h +++ b/arch/s390/include/asm/ccwdev.h | |||
@@ -231,4 +231,5 @@ int ccw_device_siosl(struct ccw_device *); | |||
231 | extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *); | 231 | extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *); |
232 | 232 | ||
233 | struct channel_path_desc_fmt0 *ccw_device_get_chp_desc(struct ccw_device *, int); | 233 | struct channel_path_desc_fmt0 *ccw_device_get_chp_desc(struct ccw_device *, int); |
234 | u8 *ccw_device_get_util_str(struct ccw_device *cdev, int chp_idx); | ||
234 | #endif /* _S390_CCWDEV_H_ */ | 235 | #endif /* _S390_CCWDEV_H_ */ |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index aecfebb74157..4435ae0b3027 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
@@ -473,6 +473,36 @@ struct channel_path_desc_fmt0 *ccw_device_get_chp_desc(struct ccw_device *cdev, | |||
473 | } | 473 | } |
474 | 474 | ||
475 | /** | 475 | /** |
476 | * ccw_device_get_util_str() - return newly allocated utility strings | ||
477 | * @cdev: device to obtain the utility strings for | ||
478 | * @chp_idx: index of the channel path | ||
479 | * | ||
480 | * On success return a newly allocated copy of the utility strings | ||
481 | * associated with the given channel path. Return %NULL on error. | ||
482 | */ | ||
483 | u8 *ccw_device_get_util_str(struct ccw_device *cdev, int chp_idx) | ||
484 | { | ||
485 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
486 | struct channel_path *chp; | ||
487 | struct chp_id chpid; | ||
488 | u8 *util_str; | ||
489 | |||
490 | chp_id_init(&chpid); | ||
491 | chpid.id = sch->schib.pmcw.chpid[chp_idx]; | ||
492 | chp = chpid_to_chp(chpid); | ||
493 | |||
494 | util_str = kmalloc(sizeof(chp->desc_fmt3.util_str), GFP_KERNEL); | ||
495 | if (!util_str) | ||
496 | return NULL; | ||
497 | |||
498 | mutex_lock(&chp->lock); | ||
499 | memcpy(util_str, chp->desc_fmt3.util_str, sizeof(chp->desc_fmt3.util_str)); | ||
500 | mutex_unlock(&chp->lock); | ||
501 | |||
502 | return util_str; | ||
503 | } | ||
504 | |||
505 | /** | ||
476 | * ccw_device_get_id() - obtain a ccw device id | 506 | * ccw_device_get_id() - obtain a ccw device id |
477 | * @cdev: device to obtain the id for | 507 | * @cdev: device to obtain the id for |
478 | * @dev_id: where to fill in the values | 508 | * @dev_id: where to fill in the values |
@@ -682,3 +712,4 @@ EXPORT_SYMBOL(ccw_device_start_key); | |||
682 | EXPORT_SYMBOL(ccw_device_get_ciw); | 712 | EXPORT_SYMBOL(ccw_device_get_ciw); |
683 | EXPORT_SYMBOL(ccw_device_get_path_mask); | 713 | EXPORT_SYMBOL(ccw_device_get_path_mask); |
684 | EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); | 714 | EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); |
715 | EXPORT_SYMBOL_GPL(ccw_device_get_util_str); | ||