[PATCH 1/1] watchdog: wdat_wdt: Fix missing kerneldoc reported by W=1
From: Wong Vee Khee Fix the following warning while compiling with W=1. drivers/watchdog/wdat_wdt.c:48: warning: Function parameter or member 'instructions' not described in 'wdat_wdt' Signed-off-by: Wong Vee Khee --- drivers/watchdog/wdat_wdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c index 3065dd670a18..cec7917790e5 100644 --- a/drivers/watchdog/wdat_wdt.c +++ b/drivers/watchdog/wdat_wdt.c @@ -34,9 +34,9 @@ struct wdat_instruction { * @period: How long is one watchdog period in ms * @stopped_in_sleep: Is this watchdog stopped by the firmware in S1-S5 * @stopped: Was the watchdog stopped by the driver in suspend - * @actions: An array of instruction lists indexed by an action number from - * the WDAT table. There can be %NULL entries for not implemented - * actions. + * @instructions: An array of instruction lists indexed by an action number from + *the WDAT table. There can be %NULL entries for not implemented + *actions. */ struct wdat_wdt { struct platform_device *pdev; -- 2.17.0
Re: [PATCH] pci-sysfs: Make PCI bridge attribute visible in sysfs
On Mon, 2017-04-17 at 10:41 -0500, Bjorn Helgaas wrote: > On Mon, Apr 17, 2017 at 12:50 AM, Wong Vee Khee> wrote: > > > > From: vwong > > > > Export the PCIe link attributes of PCI bridges to sysfs. > This needs justification for *why* we should export these via sysfs. > > Some of these things, e.g., secondary/subordinate bus numbers, are > already visible to non-privileged users via "lspci -v". > We need to expose these attributes via sysfs due to several reasons listed below: 1) PCIe capabilities info such as Maximum/Actual link width and link speed only visible to privileged users via "lspci -vvv". The software that my team is working on need to get PCIe link information as non-root user. 2) From a client perspective, it require a lot of overhead parsing output of lspci to get PCIe capabilities. Our application is only interested in getting PCIe bridges but lspci print info for all PCIe devices. > > > > Signed-off-by: Wong Vee Khee > > Signed-off-by: Hui Chun Ong > > --- > > drivers/pci/pci-sysfs.c | 197 > > +- > > include/uapi/linux/pci_regs.h | 4 + > > 2 files changed, 197 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > > index 25d010d..a218c43 100644 > > --- a/drivers/pci/pci-sysfs.c > > +++ b/drivers/pci/pci-sysfs.c > > @@ -154,6 +154,127 @@ static ssize_t resource_show(struct device > > *dev, struct device_attribute *attr, > > } > > static DEVICE_ATTR_RO(resource); > > > > +static ssize_t max_link_speed_show(struct device *dev, > > + struct device_attribute *attr, > > char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u32 linkcap; > > + int err; > > + const char *speed; > > + > > + err = pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, > > ); > > + > > + if (!err && linkcap) { > if (err) > return -EINVAL; > > I don't think there's a reason to test "linkcap" here. Per spec, > zero > is not a valid value of LNKCAP, so if we got a zero, I think showing > "Unknown speed" would be fine. > > > > > + switch (linkcap & PCI_EXP_LNKCAP_MLS) { > > + case PCI_EXP_LNKCAP_MLS_8_0GB: > > + speed = "8 GT/s"; > > + break; > > + case PCI_EXP_LNKCAP_MLS_5_0GB: > > + speed = "5 GT/s"; > > + break; > > + case PCI_EXP_LNKCAP_MLS_2_5GB: > > + speed = "2.5 GT/s"; > > + break; > > + default: > > + speed = "Unknown speed"; > > + } > > + > > + return sprintf(buf, "%s\n", speed); > > + } > > + > > + return -EINVAL; > > +} > > +static DEVICE_ATTR_RO(max_link_speed); > > + > > +static ssize_t max_link_width_show(struct device *dev, > > + struct device_attribute *attr, > > char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u32 linkcap; > > + int err; > > + > > + err = pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, > > ); > > + > > + return err ? -EINVAL : sprintf( > > + buf, "%u\n", (linkcap & PCI_EXP_LNKCAP_MLW) >> 4); > if (err) > return -EINVAL; > > return sprintf(...); > > > > > +} > > +static DEVICE_ATTR_RO(max_link_width); > > + > > +static ssize_t current_link_speed_show(struct device *dev, > > + struct device_attribute > > *attr, char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u16 linkstat; > > + int err; > > + const char *speed; > > + > > + err = pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, > > ); > > + > > + if (!err && linkstat) { > See max_link_speed above. > > > > > + switch (linkstat & PCI_EXP_LNKSTA_CLS) { > > + case PCI_EXP_LNKSTA_CLS_8_0GB: > > + speed = "8 GT/s"; > > + break; > > + case PCI_EXP_LNKSTA_CLS_5_0GB: > > + speed = "5 GT/s"; > > + break; > > + case PCI_EXP_LNKSTA_CLS_2_5GB: > > + speed = "2.5 GT/s"; > > + break; > > + default: > > + speed = "Unknown speed"; > > + } > > + > > + return sprintf(buf, "%s\n", speed); > > + } > > + > > + return -EINVAL; > > +} > > +static DEVICE_ATTR_RO(current_link_speed); > > + > > +static ssize_t current_link_width_show(struct device *dev, > > + struct device_attribute > > *attr, char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u16 linkstat; > > +
Re: [PATCH] pci-sysfs: Make PCI bridge attribute visible in sysfs
On Mon, 2017-04-17 at 10:41 -0500, Bjorn Helgaas wrote: > On Mon, Apr 17, 2017 at 12:50 AM, Wong Vee Khee > wrote: > > > > From: vwong > > > > Export the PCIe link attributes of PCI bridges to sysfs. > This needs justification for *why* we should export these via sysfs. > > Some of these things, e.g., secondary/subordinate bus numbers, are > already visible to non-privileged users via "lspci -v". > We need to expose these attributes via sysfs due to several reasons listed below: 1) PCIe capabilities info such as Maximum/Actual link width and link speed only visible to privileged users via "lspci -vvv". The software that my team is working on need to get PCIe link information as non-root user. 2) From a client perspective, it require a lot of overhead parsing output of lspci to get PCIe capabilities. Our application is only interested in getting PCIe bridges but lspci print info for all PCIe devices. > > > > Signed-off-by: Wong Vee Khee > > Signed-off-by: Hui Chun Ong > > --- > > drivers/pci/pci-sysfs.c | 197 > > +- > > include/uapi/linux/pci_regs.h | 4 + > > 2 files changed, 197 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > > index 25d010d..a218c43 100644 > > --- a/drivers/pci/pci-sysfs.c > > +++ b/drivers/pci/pci-sysfs.c > > @@ -154,6 +154,127 @@ static ssize_t resource_show(struct device > > *dev, struct device_attribute *attr, > > } > > static DEVICE_ATTR_RO(resource); > > > > +static ssize_t max_link_speed_show(struct device *dev, > > + struct device_attribute *attr, > > char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u32 linkcap; > > + int err; > > + const char *speed; > > + > > + err = pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, > > ); > > + > > + if (!err && linkcap) { > if (err) > return -EINVAL; > > I don't think there's a reason to test "linkcap" here. Per spec, > zero > is not a valid value of LNKCAP, so if we got a zero, I think showing > "Unknown speed" would be fine. > > > > > + switch (linkcap & PCI_EXP_LNKCAP_MLS) { > > + case PCI_EXP_LNKCAP_MLS_8_0GB: > > + speed = "8 GT/s"; > > + break; > > + case PCI_EXP_LNKCAP_MLS_5_0GB: > > + speed = "5 GT/s"; > > + break; > > + case PCI_EXP_LNKCAP_MLS_2_5GB: > > + speed = "2.5 GT/s"; > > + break; > > + default: > > + speed = "Unknown speed"; > > + } > > + > > + return sprintf(buf, "%s\n", speed); > > + } > > + > > + return -EINVAL; > > +} > > +static DEVICE_ATTR_RO(max_link_speed); > > + > > +static ssize_t max_link_width_show(struct device *dev, > > + struct device_attribute *attr, > > char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u32 linkcap; > > + int err; > > + > > + err = pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, > > ); > > + > > + return err ? -EINVAL : sprintf( > > + buf, "%u\n", (linkcap & PCI_EXP_LNKCAP_MLW) >> 4); > if (err) > return -EINVAL; > > return sprintf(...); > > > > > +} > > +static DEVICE_ATTR_RO(max_link_width); > > + > > +static ssize_t current_link_speed_show(struct device *dev, > > + struct device_attribute > > *attr, char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u16 linkstat; > > + int err; > > + const char *speed; > > + > > + err = pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, > > ); > > + > > + if (!err && linkstat) { > See max_link_speed above. > > > > > + switch (linkstat & PCI_EXP_LNKSTA_CLS) { > > + case PCI_EXP_LNKSTA_CLS_8_0GB: > > + speed = "8 GT/s"; > > + break; > > + case PCI_EXP_LNKSTA_CLS_5_0GB: > > + speed = "5 GT/s"; > > + break; > > + case PCI_EXP_LNKSTA_CLS_2_5GB: > > + speed = "2.5 GT/s"; > > + break; > > + default: > > + speed = "Unknown speed"; > > + } > > + > > + return sprintf(buf, "%s\n", speed); > > + } > > + > > + return -EINVAL; > > +} > > +static DEVICE_ATTR_RO(current_link_speed); > > + > > +static ssize_t current_link_width_show(struct device *dev, > > + struct device_attribute > > *attr, char *buf) > > +{ > > + struct pci_dev *pci_dev = to_pci_dev(dev); > > + u16 linkstat; > > + int err; > > + > > + err = pcie_capability_read_word(pci_dev,