Re: [PATCH] pci: make list affinity visible

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

 




Stephen Hemminger wrote:
> Looks like Mike created cpulistaffinty in sysfs but never completed the job.
> Sparse warned about cpulistaffinity attribute not being static, and then
> when I made it static, it was totally unused. This led to the observation
> that the associated sysfs file was not being created.  Assuming you want
> the sysfs file to exist, this is what is needed.
> 
> Signed-off-by: Stephen Hemminger <shemminger@xxxxxxxxxx>
> 
> --- a/drivers/pci/probe.c	2008-09-05 08:31:14.000000000 -0700
> +++ b/drivers/pci/probe.c	2008-09-05 08:37:35.000000000 -0700
> @@ -145,7 +145,7 @@ static ssize_t inline pci_bus_show_cpuli
>  }
>  
>  DEVICE_ATTR(cpuaffinity,     S_IRUGO, pci_bus_show_cpumaskaffinity, NULL);
> -DEVICE_ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL);
> +static DEVICE_ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL);
>  
>  /*
>   * PCI Bus Class
> @@ -1180,6 +1180,9 @@ struct pci_bus * pci_create_bus(struct d
>  	error = device_create_file(&b->dev, &dev_attr_cpuaffinity);
>  	if (error)
>  		goto dev_create_file_err;
> +	error = device_create_file(&b->dev, &dev_attr_cpulistaffinity);
> +	if (error)
> +		goto dev_create_file_err;
>  
>  	/* Create legacy_io and legacy_mem files for this bus */
>  	pci_create_legacy_files(b);

Thanks for catching this!

I think you want cpulistaffinity to be global so these changes can also be made.

-Mike
---
 drivers/pci/bus.c    |    7 +++++++
 drivers/pci/pci.h    |    1 +
 drivers/pci/remove.c |    1 +
 3 files changed, 9 insertions(+)

--- linux-2.6.tip.orig/drivers/pci/bus.c
+++ linux-2.6.tip/drivers/pci/bus.c
@@ -151,6 +151,13 @@ void pci_bus_add_devices(struct pci_bus 
 			if (retval)
 				dev_err(&dev->dev, "Error creating cpuaffinity"
 					" file, continuing...\n");
+
+			retval = device_create_file(&child_bus->dev,
+						&dev_attr_cpulistaffinity);
+			if (retval)
+				dev_err(&dev->dev,
+					"Error creating cpulistaffinity"
+					" file, continuing...\n");
 		}
 	}
 }
--- linux-2.6.tip.orig/drivers/pci/pci.h
+++ linux-2.6.tip/drivers/pci/pci.h
@@ -109,6 +109,7 @@ static inline int pci_no_d1d2(struct pci
 extern int pcie_mch_quirk;
 extern struct device_attribute pci_dev_attrs[];
 extern struct device_attribute dev_attr_cpuaffinity;
+extern struct device_attribute dev_attr_cpulistaffinity;
 
 /**
  * pci_match_one_device - Tell if a PCI device structure has a matching
--- linux-2.6.tip.orig/drivers/pci/remove.c
+++ linux-2.6.tip/drivers/pci/remove.c
@@ -73,6 +73,7 @@ void pci_remove_bus(struct pci_bus *pci_
 	up_write(&pci_bus_sem);
 	pci_remove_legacy_files(pci_bus);
 	device_remove_file(&pci_bus->dev, &dev_attr_cpuaffinity);
+	device_remove_file(&pci_bus->dev, &dev_attr_cpulistaffinity);
 	device_unregister(&pci_bus->dev);
 }
 EXPORT_SYMBOL(pci_remove_bus);
--
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