Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
19965230 1c21765c

+32
+1
arch/s390/include/asm/ccwdev.h
··· 231 231 extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *); 232 232 233 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 235 #endif /* _S390_CCWDEV_H_ */
+31
drivers/s390/cio/device_ops.c
··· 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 506 * ccw_device_get_id() - obtain a ccw device id 477 507 * @cdev: device to obtain the id for 478 508 * @dev_id: where to fill in the values ··· 712 682 EXPORT_SYMBOL(ccw_device_get_ciw); 713 683 EXPORT_SYMBOL(ccw_device_get_path_mask); 714 684 EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc); 685 + EXPORT_SYMBOL_GPL(ccw_device_get_util_str);