OSDN Git Service

ARM: 7648/1: pci: Allow passing per-controller private data
authorThierry Reding <thierry.reding@avionic-design.de>
Mon, 11 Feb 2013 07:46:10 +0000 (08:46 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 16 Feb 2013 17:54:25 +0000 (17:54 +0000)
In order to allow drivers to specify private data for each controller,
this commit adds a private_data field to the struct hw_pci. This field
is an array of nr_controllers pointers that will be used to initialize
the private_data field of the corresponding controller's pci_sys_data
structure.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/mach/pci.h
arch/arm/kernel/bios32.c

index db9fedb..5cf2e97 100644 (file)
@@ -23,6 +23,7 @@ struct hw_pci {
 #endif
        struct pci_ops  *ops;
        int             nr_controllers;
+       void            **private_data;
        int             (*setup)(int nr, struct pci_sys_data *);
        struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
        void            (*preinit)(void);
index da7b0c9..a1f73b5 100644 (file)
@@ -464,6 +464,9 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
                sys->map_irq = hw->map_irq;
                INIT_LIST_HEAD(&sys->resources);
 
+               if (hw->private_data)
+                       sys->private_data = hw->private_data[nr];
+
                ret = hw->setup(nr, sys);
 
                if (ret > 0) {