From: Viswas G <Viswas.G@xxxxxxxxxxxxx> Added sysfs attribute to show number of phys. Signed-off-by: Deepak Ukey <deepak.ukey@xxxxxxxxxxxxx> Signed-off-by: Viswas G <Viswas.G@xxxxxxxxxxxxx> Signed-off-by: Vishakha Channapattan <vishakhavc@xxxxxxxxxx> Signed-off-by: Bhavesh Jashnani <bjashnani@xxxxxxxxxx> Signed-off-by: Radha Ramachandran <radha@xxxxxxxxxx> Signed-off-by: Akshat Jain <akshatzen@xxxxxxxxxx> Signed-off-by: Yu Zheng <yuuzheng@xxxxxxxxxx> --- drivers/scsi/pm8001/pm8001_ctl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 69458b318a20..704c0daa7937 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -89,6 +89,25 @@ static ssize_t controller_fatal_error_show(struct device *cdev, } static DEVICE_ATTR_RO(controller_fatal_error); +/** + * pm8001_ctl_num_phys_show - Number of phys + * @cdev:pointer to embedded class device + * @buf:the buffer returned + * A sysfs 'read-only' shost attribute. + */ +static ssize_t num_phys_show(struct device *cdev, + struct device_attribute *attr, char *buf) +{ + int ret; + struct Scsi_Host *shost = class_to_shost(cdev); + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; + + ret = sprintf(buf, "%d", pm8001_ha->chip->n_phy); + return ret; +} +static DEVICE_ATTR_RO(num_phys); + /** * pm8001_ctl_fw_version_show - firmware version * @cdev: pointer to embedded class device @@ -825,6 +844,7 @@ static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP, struct device_attribute *pm8001_host_attrs[] = { &dev_attr_interface_rev, &dev_attr_controller_fatal_error, + &dev_attr_num_phys, &dev_attr_fw_version, &dev_attr_update_fw, &dev_attr_aap_log, -- 2.16.3