s390/pci: use pdev->dev.groups for attribute creation
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Wed, 30 Apr 2014 20:50:09 +0000 (14:50 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 22 May 2014 16:54:06 +0000 (10:54 -0600)
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>
arch/s390/include/asm/pci.h
arch/s390/pci/pci.c
arch/s390/pci/pci_sysfs.c

index 2583466f576b617181ed8b39f1db6c32106bd999..79b5f0783a30c3f9861c374d5a2cb0f2bb002fa4 100644 (file)
@@ -120,6 +120,8 @@ static inline bool zdev_enabled(struct zpci_dev *zdev)
        return (zdev->fh & (1UL << 31)) ? true : false;
 }
 
+extern const struct attribute_group *zpci_attr_groups[];
+
 /* -----------------------------------------------------------------------------
   Prototypes
 ----------------------------------------------------------------------------- */
@@ -166,10 +168,6 @@ static inline void zpci_exit_slot(struct zpci_dev *zdev) {}
 struct zpci_dev *get_zdev(struct pci_dev *);
 struct zpci_dev *get_zdev_by_fid(u32);
 
-/* sysfs */
-int zpci_sysfs_add_device(struct device *);
-void zpci_sysfs_remove_device(struct device *);
-
 /* DMA */
 int zpci_dma_init(void);
 void zpci_dma_exit(void);
index 1df1d29ac81d3710caafad1f7ce0094f530d721d..bdf02570d1dfab0c81146b4b609cbe45c9b445d7 100644 (file)
@@ -530,11 +530,6 @@ static void zpci_unmap_resources(struct zpci_dev *zdev)
        }
 }
 
-int pcibios_add_platform_entries(struct pci_dev *pdev)
-{
-       return zpci_sysfs_add_device(&pdev->dev);
-}
-
 static int __init zpci_irq_init(void)
 {
        int rc;
@@ -671,6 +666,7 @@ int pcibios_add_device(struct pci_dev *pdev)
        int i;
 
        zdev->pdev = pdev;
+       pdev->dev.groups = zpci_attr_groups;
        zpci_map_resources(zdev);
 
        for (i = 0; i < PCI_BAR_COUNT; i++) {
index ab4a91393005a920b876c610ed5d3d8605af5037..b56a3958f1a7125e1bfa97c293bbbc88879e598b 100644 (file)
@@ -72,36 +72,18 @@ static ssize_t store_recover(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover);
 
-static struct device_attribute *zpci_dev_attrs[] = {
-       &dev_attr_function_id,
-       &dev_attr_function_handle,
-       &dev_attr_pchid,
-       &dev_attr_pfgid,
-       &dev_attr_recover,
+static struct attribute *zpci_dev_attrs[] = {
+       &dev_attr_function_id.attr,
+       &dev_attr_function_handle.attr,
+       &dev_attr_pchid.attr,
+       &dev_attr_pfgid.attr,
+       &dev_attr_recover.attr,
+       NULL,
+};
+static struct attribute_group zpci_attr_group = {
+       .attrs = zpci_dev_attrs,
+};
+const struct attribute_group *zpci_attr_groups[] = {
+       &zpci_attr_group,
        NULL,
 };
-
-int zpci_sysfs_add_device(struct device *dev)
-{
-       int i, rc = 0;
-
-       for (i = 0; zpci_dev_attrs[i]; i++) {
-               rc = device_create_file(dev, zpci_dev_attrs[i]);
-               if (rc)
-                       goto error;
-       }
-       return 0;
-
-error:
-       while (--i >= 0)
-               device_remove_file(dev, zpci_dev_attrs[i]);
-       return rc;
-}
-
-void zpci_sysfs_remove_device(struct device *dev)
-{
-       int i;
-
-       for (i = 0; zpci_dev_attrs[i]; i++)
-               device_remove_file(dev, zpci_dev_attrs[i]);
-}
This page took 0.028535 seconds and 5 git commands to generate.