Skip to content

Commit e2773c6

Browse files
Deepak Ukeymartinkpetersen
authored andcommitted
scsi: pm80xx: Controller fatal error through sysfs
Added support to check controller fatal error through sysfs. Link: https://lore.kernel.org/r/[email protected] Acked-by: Jack Wang <[email protected]> Signed-off-by: Deepak Ukey <[email protected]> Signed-off-by: Viswas G <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 3e253d9 commit e2773c6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/scsi/pm8001/pm8001_ctl.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,25 @@ static ssize_t pm8001_ctl_mpi_interface_rev_show(struct device *cdev,
6969
static
7070
DEVICE_ATTR(interface_rev, S_IRUGO, pm8001_ctl_mpi_interface_rev_show, NULL);
7171

72+
/**
73+
* controller_fatal_error_show - check controller is under fatal err
74+
* @cdev: pointer to embedded class device
75+
* @buf: the buffer returned
76+
*
77+
* A sysfs 'read only' shost attribute.
78+
*/
79+
static ssize_t controller_fatal_error_show(struct device *cdev,
80+
struct device_attribute *attr, char *buf)
81+
{
82+
struct Scsi_Host *shost = class_to_shost(cdev);
83+
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
84+
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
85+
86+
return snprintf(buf, PAGE_SIZE, "%d\n",
87+
pm8001_ha->controller_fatal_error);
88+
}
89+
static DEVICE_ATTR_RO(controller_fatal_error);
90+
7291
/**
7392
* pm8001_ctl_fw_version_show - firmware version
7493
* @cdev: pointer to embedded class device
@@ -804,6 +823,7 @@ static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP,
804823
pm8001_show_update_fw, pm8001_store_update_fw);
805824
struct device_attribute *pm8001_host_attrs[] = {
806825
&dev_attr_interface_rev,
826+
&dev_attr_controller_fatal_error,
807827
&dev_attr_fw_version,
808828
&dev_attr_update_fw,
809829
&dev_attr_aap_log,

0 commit comments

Comments
 (0)