Re: [02/21] powerpc/eeh: Add eeh_pe_state sysfs entry
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2014-10-01 03:43:43
On Tue, 2014-30-09 at 02:38:51 UTC, Gavin Shan wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c index e2595ba..eb15be4 100644 --- a/arch/powerpc/kernel/eeh_sysfs.c +++ b/arch/powerpc/kernel/eeh_sysfs.c@@ -54,6 +54,62 @@ EEH_SHOW_ATTR(eeh_mode, mode, "0x%x"); EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x"); EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); +static ssize_t eeh_pe_state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct pci_dev *pdev = to_pci_dev(dev); + struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); + int state; + + if (!edev || !edev->pe) + return -ENODEV; + + state = eeh_ops->get_state(edev->pe, NULL); + return sprintf(buf, "%08x %08x\n", + state, edev->pe->state);
Looking at all the other eeh sysfs files, they all use 0x%x. Which makes it much clearer when you're looking at the file in userspace that the content is hex. Please send an incremental patch to change the format to 0x%08x, unless there's a good reason not to. cheers