Re: [PATCH] pci: show dma_mask bits in /sys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 24, 2009 at 06:21:21PM -0800, Yinghai Lu wrote:
> 
> so could catch if the driver set the correct dma_mask.

Per gregkh's email last year, this needs documentation to go with it.
    http://lkml.indiana.edu/hypermail/linux/kernel/0810.2/3595.html

Code is good.

Reviewed-by: Grant Grundler <grundler@xxxxxxxxxx>

thanks,
grant

> 
> Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
> 
> ---
>  drivers/pci/pci-sysfs.c |   17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> Index: linux-2.6/drivers/pci/pci-sysfs.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/pci-sysfs.c
> +++ linux-2.6/drivers/pci/pci-sysfs.c
> @@ -184,6 +184,21 @@ numa_node_show(struct device *dev, struc
>  #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)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
> @@ -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),
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux