From: Yinghai Lu Date: Wed, 25 Nov 2009 02:21:21 +0000 (-0800) Subject: PCI: show dma_mask bits in /sys X-Git-Tag: MMI-PSA29.97-13-9~25687^2~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bb965401fd2afa26629b244e7bb2e48a117dc238;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git PCI: show dma_mask bits in /sys So we can catch if the driver sets an incorrect dma_mask. Reviewed-by: Grant Grundler Signed-off-by: Yinghai Lu Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 0fa707e2a0f8..c5df94e86678 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -183,6 +183,21 @@ numa_node_show(struct device *dev, struct device_attribute *attr, char *buf) } #endif +static ssize_t +dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct pci_dev *pdev = to_pci_dev(dev); + + return sprintf (buf, "%d\n", fls64(pdev->dma_mask)); +} + +static ssize_t +consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask)); +} + static ssize_t msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -314,6 +329,8 @@ struct device_attribute pci_dev_attrs[] = { #ifdef CONFIG_NUMA __ATTR_RO(numa_node), #endif + __ATTR_RO(dma_mask_bits), + __ATTR_RO(consistent_dma_mask_bits), __ATTR(enable, 0600, is_enabled_show, is_enabled_store), __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), broken_parity_status_show,broken_parity_status_store),