Message ID | 1427261761-22952-3-git-send-email-dja@axtens.net (mailing list archive) |
---|---|
State | Accepted |
Commit | ba9c8f227358bcbc80fca19e7a339883cbc956a5 |
Delegated to: | Michael Ellerman |
Headers | show |
On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: Why did we move it? Just for cleanliness? > Signed-off-by: Daniel Axtens <dja@axtens.net> > --- > arch/powerpc/platforms/powermac/pci.c | 17 +++++++++++++++++ > arch/powerpc/platforms/powermac/pmac.h | 4 ++++ > arch/powerpc/platforms/powermac/setup.c | 18 ------------------ > 3 files changed, 21 insertions(+), 18 deletions(-) > > diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c > index f4071a6..a792f45 100644 > --- a/arch/powerpc/platforms/powermac/pci.c > +++ b/arch/powerpc/platforms/powermac/pci.c > @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) > pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); > } > DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); > + > +#ifdef CONFIG_PPC64 > +int pmac_pci_probe_mode(struct pci_bus *bus) > +{ > + struct device_node *node = pci_bus_to_OF_node(bus); > + > + /* We need to use normal PCI probing for the AGP bus, > + * since the device for the AGP bridge isn't in the tree. > + * Same for the PCIe host on U4 and the HT host bridge. > + */ > + if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") || > + of_device_is_compatible(node, "u4-pcie") || > + of_device_is_compatible(node, "u3-ht"))) > + return PCI_PROBE_NORMAL; > + return PCI_PROBE_DEVTREE; > +} > +#endif /* CONFIG_PPC64 */ > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h > index 8327cce..46d2193 100644 > --- a/arch/powerpc/platforms/powermac/pmac.h > +++ b/arch/powerpc/platforms/powermac/pmac.h > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); > extern int pmac_nvram_init(void); > extern void pmac_pic_init(void); > > +#ifdef CONFIG_PPC64 > +extern int pmac_pci_probe_mode(struct pci_bus *bus); > +#endif You don't need to ifdef declarations, and you don't need extern. So just: > +int pmac_pci_probe_mode(struct pci_bus *bus); Is fine. cheers
On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: > On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: > > Why did we move it? Just for cleanliness? > > > Signed-off-by: Daniel Axtens <dja@axtens.net> > > --- > > arch/powerpc/platforms/powermac/pci.c | 17 +++++++++++++++++ > > arch/powerpc/platforms/powermac/pmac.h | 4 ++++ > > arch/powerpc/platforms/powermac/setup.c | 18 ------------------ > > 3 files changed, 21 insertions(+), 18 deletions(-) > > > > diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c > > index f4071a6..a792f45 100644 > > --- a/arch/powerpc/platforms/powermac/pci.c > > +++ b/arch/powerpc/platforms/powermac/pci.c > > @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) > > pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); > > } > > DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); > > + > > +#ifdef CONFIG_PPC64 > > +int pmac_pci_probe_mode(struct pci_bus *bus) > > +{ > > + struct device_node *node = pci_bus_to_OF_node(bus); > > + > > + /* We need to use normal PCI probing for the AGP bus, > > + * since the device for the AGP bridge isn't in the tree. > > + * Same for the PCIe host on U4 and the HT host bridge. > > + */ > > + if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") || > > + of_device_is_compatible(node, "u4-pcie") || > > + of_device_is_compatible(node, "u3-ht"))) > > + return PCI_PROBE_NORMAL; > > + return PCI_PROBE_DEVTREE; > > +} > > +#endif /* CONFIG_PPC64 */ > > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h > > index 8327cce..46d2193 100644 > > --- a/arch/powerpc/platforms/powermac/pmac.h > > +++ b/arch/powerpc/platforms/powermac/pmac.h > > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); > > extern int pmac_nvram_init(void); > > extern void pmac_pic_init(void); > > > > +#ifdef CONFIG_PPC64 > > +extern int pmac_pci_probe_mode(struct pci_bus *bus); > > +#endif > > You don't need to ifdef declarations, and you don't need extern. I like extern :-) If the rest of the file use it, I prefer if he continues doing so. > So just: > > > +int pmac_pci_probe_mode(struct pci_bus *bus); > > Is fine. > > cheers
On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: > On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: > > Why did we move it? Just for cleanliness? > I move it because in (what is currently) patch 14, I want to hook it into the PCI controller ops structure, which I define in pci.c. In that patch I make the definition static again and remove the prototype from the header. I saw two other options: - Move it to pci.c as part of patch 14 - Keep it in setup.c and just accept that it won't be static and will need a prototype in the header. I thought this was the least bad option, but I'm happy to do it another way. Either way I will explain it better in the next series. Regards, Daniel > > Signed-off-by: Daniel Axtens <dja@axtens.net> > > --- > > arch/powerpc/platforms/powermac/pci.c | 17 +++++++++++++++++ > > arch/powerpc/platforms/powermac/pmac.h | 4 ++++ > > arch/powerpc/platforms/powermac/setup.c | 18 ------------------ > > 3 files changed, 21 insertions(+), 18 deletions(-) > > > > diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c > > index f4071a6..a792f45 100644 > > --- a/arch/powerpc/platforms/powermac/pci.c > > +++ b/arch/powerpc/platforms/powermac/pci.c > > @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) > > pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); > > } > > DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); > > + > > +#ifdef CONFIG_PPC64 > > +int pmac_pci_probe_mode(struct pci_bus *bus) > > +{ > > + struct device_node *node = pci_bus_to_OF_node(bus); > > + > > + /* We need to use normal PCI probing for the AGP bus, > > + * since the device for the AGP bridge isn't in the tree. > > + * Same for the PCIe host on U4 and the HT host bridge. > > + */ > > + if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") || > > + of_device_is_compatible(node, "u4-pcie") || > > + of_device_is_compatible(node, "u3-ht"))) > > + return PCI_PROBE_NORMAL; > > + return PCI_PROBE_DEVTREE; > > +} > > +#endif /* CONFIG_PPC64 */ > > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h > > index 8327cce..46d2193 100644 > > --- a/arch/powerpc/platforms/powermac/pmac.h > > +++ b/arch/powerpc/platforms/powermac/pmac.h > > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); > > extern int pmac_nvram_init(void); > > extern void pmac_pic_init(void); > > > > +#ifdef CONFIG_PPC64 > > +extern int pmac_pci_probe_mode(struct pci_bus *bus); > > +#endif > > You don't need to ifdef declarations, and you don't need extern. > > So just: > > > +int pmac_pci_probe_mode(struct pci_bus *bus); > > Is fine. > > cheers
On Tue, 2015-03-31 at 08:46 +1100, Benjamin Herrenschmidt wrote: > On Mon, 2015-03-30 at 23:32 +1100, Michael Ellerman wrote: > > On Wed, 2015-25-03 at 05:35:36 UTC, Daniel Axtens wrote: > > > > Why did we move it? Just for cleanliness? > > > > > diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h > > > index 8327cce..46d2193 100644 > > > --- a/arch/powerpc/platforms/powermac/pmac.h > > > +++ b/arch/powerpc/platforms/powermac/pmac.h > > > @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); > > > extern int pmac_nvram_init(void); > > > extern void pmac_pic_init(void); > > > > > > +#ifdef CONFIG_PPC64 > > > +extern int pmac_pci_probe_mode(struct pci_bus *bus); > > > +#endif > > > > You don't need to ifdef declarations, and you don't need extern. > > I like extern :-) If the rest of the file use it, I prefer if he > continues doing so. I like Ponies. It's fashionable to not use it, and I expect we'll start seeing treewide extern-removal series soon enough, but whatever. cheers
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index f4071a6..a792f45 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1223,3 +1223,20 @@ static void fixup_u4_pcie(struct pci_dev* dev) pci_write_config_dword(dev, PCI_PREF_MEMORY_BASE, 0); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_U4_PCIE, fixup_u4_pcie); + +#ifdef CONFIG_PPC64 +int pmac_pci_probe_mode(struct pci_bus *bus) +{ + struct device_node *node = pci_bus_to_OF_node(bus); + + /* We need to use normal PCI probing for the AGP bus, + * since the device for the AGP bridge isn't in the tree. + * Same for the PCIe host on U4 and the HT host bridge. + */ + if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") || + of_device_is_compatible(node, "u4-pcie") || + of_device_is_compatible(node, "u3-ht"))) + return PCI_PROBE_NORMAL; + return PCI_PROBE_DEVTREE; +} +#endif /* CONFIG_PPC64 */ diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h index 8327cce..46d2193 100644 --- a/arch/powerpc/platforms/powermac/pmac.h +++ b/arch/powerpc/platforms/powermac/pmac.h @@ -39,4 +39,8 @@ extern void low_cpu_die(void) __attribute__((noreturn)); extern int pmac_nvram_init(void); extern void pmac_pic_init(void); +#ifdef CONFIG_PPC64 +extern int pmac_pci_probe_mode(struct pci_bus *bus); +#endif + #endif /* __PMAC_H__ */ diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 713d36d..efe172d 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c @@ -637,24 +637,6 @@ static int __init pmac_probe(void) return 1; } -#ifdef CONFIG_PPC64 -/* Move that to pci.c */ -static int pmac_pci_probe_mode(struct pci_bus *bus) -{ - struct device_node *node = pci_bus_to_OF_node(bus); - - /* We need to use normal PCI probing for the AGP bus, - * since the device for the AGP bridge isn't in the tree. - * Same for the PCIe host on U4 and the HT host bridge. - */ - if (bus->self == NULL && (of_device_is_compatible(node, "u3-agp") || - of_device_is_compatible(node, "u4-pcie") || - of_device_is_compatible(node, "u3-ht"))) - return PCI_PROBE_NORMAL; - return PCI_PROBE_DEVTREE; -} -#endif /* CONFIG_PPC64 */ - define_machine(powermac) { .name = "PowerMac", .probe = pmac_probe,
Signed-off-by: Daniel Axtens <dja@axtens.net> --- arch/powerpc/platforms/powermac/pci.c | 17 +++++++++++++++++ arch/powerpc/platforms/powermac/pmac.h | 4 ++++ arch/powerpc/platforms/powermac/setup.c | 18 ------------------ 3 files changed, 21 insertions(+), 18 deletions(-)