aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-11-27 05:22:57 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-04-15 12:16:39 -0400
commit368704a65be8620df795ccbeb44e025dafbc3e1f (patch)
treeaa2a9b9f4466d6ddeca83617cdb375fa43fc71b8
parent12283a4035691697977083a5ac1e00ad5cfa6a3d (diff)
s390/pci: add report_error attribute
Provide an report_error attribute to send an adapter-error notification associated with a PCI function. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/pci/pci_sysfs.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index f37a5808883d..ed484dc84d14 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -12,6 +12,8 @@
12#include <linux/stat.h> 12#include <linux/stat.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14 14
15#include <asm/sclp.h>
16
15#define zpci_attr(name, fmt, member) \ 17#define zpci_attr(name, fmt, member) \
16static ssize_t name##_show(struct device *dev, \ 18static ssize_t name##_show(struct device *dev, \
17 struct device_attribute *attr, char *buf) \ 19 struct device_attribute *attr, char *buf) \
@@ -77,8 +79,29 @@ static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
77 sizeof(zdev->util_str)); 79 sizeof(zdev->util_str));
78} 80}
79static BIN_ATTR_RO(util_string, CLP_UTIL_STR_LEN); 81static BIN_ATTR_RO(util_string, CLP_UTIL_STR_LEN);
82
83static ssize_t report_error_write(struct file *filp, struct kobject *kobj,
84 struct bin_attribute *attr, char *buf,
85 loff_t off, size_t count)
86{
87 struct zpci_report_error_header *report = (void *) buf;
88 struct device *dev = kobj_to_dev(kobj);
89 struct pci_dev *pdev = to_pci_dev(dev);
90 struct zpci_dev *zdev = to_zpci(pdev);
91 int ret;
92
93 if (off || (count < sizeof(*report)))
94 return -EINVAL;
95
96 ret = sclp_pci_report(report, zdev->fh, zdev->fid);
97
98 return ret ? ret : count;
99}
100static BIN_ATTR(report_error, S_IWUSR, NULL, report_error_write, PAGE_SIZE);
101
80static struct bin_attribute *zpci_bin_attrs[] = { 102static struct bin_attribute *zpci_bin_attrs[] = {
81 &bin_attr_util_string, 103 &bin_attr_util_string,
104 &bin_attr_report_error,
82 NULL, 105 NULL,
83}; 106};
84 107