aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2014-04-16 10:11:00 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-05-20 02:58:49 -0400
commit93065d045a99391c60fa9ab8aca6b503f51b2e95 (patch)
tree9bc3b70075693d968da9bc24fdb3d854dba77108
parentb346953ddac0d57d4852ddc2b5cd9e16c84ddd59 (diff)
s390/pci: use pdev->dev.groups for attribute creation
Let the driver core handle attribute creation by putting all s390 specific pci attributes in an attribute group which is referenced by pdev->dev.groups in pcibios_add_device. Link: https://lkml.kernel.org/r/alpine.LFD.2.11.1404141101500.1529@denkbrett Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/include/asm/pci.h6
-rw-r--r--arch/s390/pci/pci.c6
-rw-r--r--arch/s390/pci/pci_sysfs.c44
3 files changed, 16 insertions, 40 deletions
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 2583466f576b..79b5f0783a30 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -120,6 +120,8 @@ static inline bool zdev_enabled(struct zpci_dev *zdev)
120 return (zdev->fh & (1UL << 31)) ? true : false; 120 return (zdev->fh & (1UL << 31)) ? true : false;
121} 121}
122 122
123extern const struct attribute_group *zpci_attr_groups[];
124
123/* ----------------------------------------------------------------------------- 125/* -----------------------------------------------------------------------------
124 Prototypes 126 Prototypes
125----------------------------------------------------------------------------- */ 127----------------------------------------------------------------------------- */
@@ -166,10 +168,6 @@ static inline void zpci_exit_slot(struct zpci_dev *zdev) {}
166struct zpci_dev *get_zdev(struct pci_dev *); 168struct zpci_dev *get_zdev(struct pci_dev *);
167struct zpci_dev *get_zdev_by_fid(u32); 169struct zpci_dev *get_zdev_by_fid(u32);
168 170
169/* sysfs */
170int zpci_sysfs_add_device(struct device *);
171void zpci_sysfs_remove_device(struct device *);
172
173/* DMA */ 171/* DMA */
174int zpci_dma_init(void); 172int zpci_dma_init(void);
175void zpci_dma_exit(void); 173void zpci_dma_exit(void);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 1df1d29ac81d..bdf02570d1df 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -530,11 +530,6 @@ static void zpci_unmap_resources(struct zpci_dev *zdev)
530 } 530 }
531} 531}
532 532
533int pcibios_add_platform_entries(struct pci_dev *pdev)
534{
535 return zpci_sysfs_add_device(&pdev->dev);
536}
537
538static int __init zpci_irq_init(void) 533static int __init zpci_irq_init(void)
539{ 534{
540 int rc; 535 int rc;
@@ -671,6 +666,7 @@ int pcibios_add_device(struct pci_dev *pdev)
671 int i; 666 int i;
672 667
673 zdev->pdev = pdev; 668 zdev->pdev = pdev;
669 pdev->dev.groups = zpci_attr_groups;
674 zpci_map_resources(zdev); 670 zpci_map_resources(zdev);
675 671
676 for (i = 0; i < PCI_BAR_COUNT; i++) { 672 for (i = 0; i < PCI_BAR_COUNT; i++) {
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index ebe2c1648fb5..f23da1c0a489 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -51,36 +51,18 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
51} 51}
52static DEVICE_ATTR_WO(recover); 52static DEVICE_ATTR_WO(recover);
53 53
54static struct device_attribute *zpci_dev_attrs[] = { 54static struct attribute *zpci_dev_attrs[] = {
55 &dev_attr_function_id, 55 &dev_attr_function_id.attr,
56 &dev_attr_function_handle, 56 &dev_attr_function_handle.attr,
57 &dev_attr_pchid, 57 &dev_attr_pchid.attr,
58 &dev_attr_pfgid, 58 &dev_attr_pfgid.attr,
59 &dev_attr_recover, 59 &dev_attr_recover.attr,
60 NULL,
61};
62static struct attribute_group zpci_attr_group = {
63 .attrs = zpci_dev_attrs,
64};
65const struct attribute_group *zpci_attr_groups[] = {
66 &zpci_attr_group,
60 NULL, 67 NULL,
61}; 68};
62
63int zpci_sysfs_add_device(struct device *dev)
64{
65 int i, rc = 0;
66
67 for (i = 0; zpci_dev_attrs[i]; i++) {
68 rc = device_create_file(dev, zpci_dev_attrs[i]);
69 if (rc)
70 goto error;
71 }
72 return 0;
73
74error:
75 while (--i >= 0)
76 device_remove_file(dev, zpci_dev_attrs[i]);
77 return rc;
78}
79
80void zpci_sysfs_remove_device(struct device *dev)
81{
82 int i;
83
84 for (i = 0; zpci_dev_attrs[i]; i++)
85 device_remove_file(dev, zpci_dev_attrs[i]);
86}