* [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries()
@ 2007-03-06 15:06 Michael Ellerman
2007-03-06 15:06 ` [PATCH 2/2] Make pcibios_add_platform_entries() return errors Michael Ellerman
2007-03-06 18:01 ` [parisc-linux] [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() James Bottomley
0 siblings, 2 replies; 6+ messages in thread
From: Michael Ellerman @ 2007-03-06 15:06 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-mips, dev-etrax, linux-ia64, discuss, chris, linuxppc-dev,
linux-m68k, ink, gerg, sparclinux, uclinux-v850, linux-pci,
parisc-linux, kernel, rth
I'm not sure if this is going to fly, weak symbols work on the compilers I'm
using, but whether they work for all of the affected architectures I can't say.
I've cc'ed as many arch maintainers/lists as I could find.
But assuming they do, we can use a weak empty definition of
pcibios_add_platform_entries() to avoid having an empty definition on every
arch.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/ppc/kernel/pci.c | 6 ------
drivers/pci/pci-sysfs.c | 5 +++++
include/asm-alpha/pci.h | 5 -----
include/asm-arm/pci.h | 4 ----
include/asm-cris/pci.h | 4 ----
include/asm-frv/pci.h | 4 ----
include/asm-h8300/pci.h | 4 ----
include/asm-i386/pci.h | 4 ----
include/asm-ia64/pci.h | 4 ----
include/asm-m68k/pci.h | 4 ----
include/asm-m68knommu/pci.h | 4 ----
include/asm-mips/pci.h | 4 ----
include/asm-parisc/pci.h | 4 ----
include/asm-powerpc/pci.h | 2 --
include/asm-ppc/pci.h | 2 --
include/asm-sh/pci.h | 4 ----
include/asm-sh64/pci.h | 4 ----
include/asm-sparc/pci.h | 4 ----
include/asm-sparc64/pci.h | 4 ----
include/asm-v850/pci.h | 4 ----
include/asm-x86_64/pci.h | 4 ----
include/asm-xtensa/pci.h | 4 ----
include/linux/pci.h | 2 ++
23 files changed, 7 insertions(+), 83 deletions(-)
Index: msi-new/arch/ppc/kernel/pci.c
===================================================================
--- msi-new.orig/arch/ppc/kernel/pci.c
+++ msi-new/arch/ppc/kernel/pci.c
@@ -633,12 +633,6 @@ void pcibios_make_OF_bus_map(void)
{
}
-/* Add sysfs properties */
-void pcibios_add_platform_entries(struct pci_dev *pdev)
-{
-}
-
-
static int __init
pcibios_init(void)
{
Index: msi-new/drivers/pci/pci-sysfs.c
===================================================================
--- msi-new.orig/drivers/pci/pci-sysfs.c
+++ msi-new/drivers/pci/pci-sysfs.c
@@ -600,6 +600,11 @@ static struct bin_attribute pcie_config_
.write = pci_write_config,
};
+void __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
+{
+ return;
+}
+
int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
{
struct bin_attribute *rom_attr = NULL;
Index: msi-new/include/asm-alpha/pci.h
===================================================================
--- msi-new.orig/include/asm-alpha/pci.h
+++ msi-new/include/asm-alpha/pci.h
@@ -275,11 +275,6 @@ static inline int pci_proc_domain(struct
return hose->need_domain_info;
}
-static inline void
-pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
struct pci_dev *alpha_gendev_to_pci(struct device *dev);
#endif /* __KERNEL__ */
Index: msi-new/include/asm-arm/pci.h
===================================================================
--- msi-new.orig/include/asm-arm/pci.h
+++ msi-new/include/asm-arm/pci.h
@@ -76,10 +76,6 @@ pcibios_select_root(struct pci_dev *pdev
return root;
}
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
#endif
Index: msi-new/include/asm-cris/pci.h
===================================================================
--- msi-new.orig/include/asm-cris/pci.h
+++ msi-new/include/asm-cris/pci.h
@@ -89,10 +89,6 @@ extern int pci_mmap_page_range(struct pc
enum pci_mmap_state mmap_state, int write_combine);
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
/* implement the pci_ DMA API in terms of the generic device dma_ one */
Index: msi-new/include/asm-frv/pci.h
===================================================================
--- msi-new.orig/include/asm-frv/pci.h
+++ msi-new/include/asm-frv/pci.h
@@ -22,10 +22,6 @@ struct pci_dev;
#define pcibios_assign_all_busses() 0
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
extern void pcibios_set_master(struct pci_dev *dev);
extern void pcibios_penalize_isa_irq(int irq);
Index: msi-new/include/asm-h8300/pci.h
===================================================================
--- msi-new.orig/include/asm-h8300/pci.h
+++ msi-new/include/asm-h8300/pci.h
@@ -22,8 +22,4 @@ static inline void pcibios_penalize_isa_
#define PCI_DMA_BUS_IS_PHYS (1)
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* _ASM_H8300_PCI_H */
Index: msi-new/include/asm-i386/pci.h
===================================================================
--- msi-new.orig/include/asm-i386/pci.h
+++ msi-new/include/asm-i386/pci.h
@@ -94,10 +94,6 @@ extern int pci_mmap_page_range(struct pc
enum pci_mmap_state mmap_state, int write_combine);
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
Index: msi-new/include/asm-ia64/pci.h
===================================================================
--- msi-new.orig/include/asm-ia64/pci.h
+++ msi-new/include/asm-ia64/pci.h
@@ -142,10 +142,6 @@ static inline int pci_proc_domain(struct
return (pci_domain_nr(bus) != 0);
}
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
extern void pcibios_resource_to_bus(struct pci_dev *dev,
struct pci_bus_region *region, struct resource *res);
Index: msi-new/include/asm-m68k/pci.h
===================================================================
--- msi-new.orig/include/asm-m68k/pci.h
+++ msi-new/include/asm-m68k/pci.h
@@ -54,8 +54,4 @@ static inline void pcibios_penalize_isa_
*/
#define PCI_DMA_BUS_IS_PHYS (1)
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* _ASM_M68K_PCI_H */
Index: msi-new/include/asm-m68knommu/pci.h
===================================================================
--- msi-new.orig/include/asm-m68knommu/pci.h
+++ msi-new/include/asm-m68knommu/pci.h
@@ -30,10 +30,6 @@ static inline int pci_dma_supported(stru
*/
#define pci_dac_dma_supported(pci_dev, mask) (0)
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* CONFIG_COMEMPCI */
#endif /* M68KNOMMU_PCI_H */
Index: msi-new/include/asm-mips/pci.h
===================================================================
--- msi-new.orig/include/asm-mips/pci.h
+++ msi-new/include/asm-mips/pci.h
@@ -181,10 +181,6 @@ static inline int pci_proc_domain(struct
/* implement the pci_ DMA API in terms of the generic device dma_ one */
#include <asm-generic/pci-dma-compat.h>
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
/* Do platform specific device initialization at pci_enable_device() time */
extern int pcibios_plat_dev_init(struct pci_dev *dev);
Index: msi-new/include/asm-parisc/pci.h
===================================================================
--- msi-new.orig/include/asm-parisc/pci.h
+++ msi-new/include/asm-parisc/pci.h
@@ -284,10 +284,6 @@ pcibios_select_root(struct pci_dev *pdev
return root;
}
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
static inline void pcibios_penalize_isa_irq(int irq, int active)
{
/* We don't need to penalize isa irq's */
Index: msi-new/include/asm-powerpc/pci.h
===================================================================
--- msi-new.orig/include/asm-powerpc/pci.h
+++ msi-new/include/asm-powerpc/pci.h
@@ -237,8 +237,6 @@ extern void of_scan_bus(struct device_no
extern int pci_read_irq_line(struct pci_dev *dev);
-extern void pcibios_add_platform_entries(struct pci_dev *dev);
-
struct file;
extern pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long pfn,
Index: msi-new/include/asm-ppc/pci.h
===================================================================
--- msi-new.orig/include/asm-ppc/pci.h
+++ msi-new/include/asm-ppc/pci.h
@@ -145,8 +145,6 @@ pcibios_select_root(struct pci_dev *pdev
return root;
}
-extern void pcibios_add_platform_entries(struct pci_dev *dev);
-
struct file;
extern pgprot_t pci_phys_mem_access_prot(struct file *file,
unsigned long pfn,
Index: msi-new/include/asm-sh/pci.h
===================================================================
--- msi-new.orig/include/asm-sh/pci.h
+++ msi-new/include/asm-sh/pci.h
@@ -134,10 +134,6 @@ int pcibios_map_platform_irq(struct pci_
int pciauto_assign_resources(int busno, struct pci_channel *hose);
#endif
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
/* generic pci stuff */
Index: msi-new/include/asm-sh64/pci.h
===================================================================
--- msi-new.orig/include/asm-sh64/pci.h
+++ msi-new/include/asm-sh64/pci.h
@@ -104,10 +104,6 @@ extern void pcibios_fixup_irqs(void);
extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
#endif
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
/* generic pci stuff */
Index: msi-new/include/asm-sparc/pci.h
===================================================================
--- msi-new.orig/include/asm-sparc/pci.h
+++ msi-new/include/asm-sparc/pci.h
@@ -154,10 +154,6 @@ static inline void pci_dma_burst_advice(
}
#endif
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0)
static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
Index: msi-new/include/asm-sparc64/pci.h
===================================================================
--- msi-new.orig/include/asm-sparc64/pci.h
+++ msi-new/include/asm-sparc64/pci.h
@@ -303,10 +303,6 @@ pcibios_bus_to_resource(struct pci_dev *
extern struct resource *pcibios_select_root(struct pci_dev *, struct resource *);
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
{
return PCI_IRQ_NONE;
Index: msi-new/include/asm-v850/pci.h
===================================================================
--- msi-new.orig/include/asm-v850/pci.h
+++ msi-new/include/asm-v850/pci.h
@@ -116,8 +116,4 @@ static inline void pci_dma_burst_advice(
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr);
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __V850_PCI_H__ */
Index: msi-new/include/asm-x86_64/pci.h
===================================================================
--- msi-new.orig/include/asm-x86_64/pci.h
+++ msi-new/include/asm-x86_64/pci.h
@@ -135,10 +135,6 @@ static inline void pci_dma_burst_advice(
extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine);
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
/* generic pci stuff */
Index: msi-new/include/asm-xtensa/pci.h
===================================================================
--- msi-new.orig/include/asm-xtensa/pci.h
+++ msi-new/include/asm-xtensa/pci.h
@@ -74,10 +74,6 @@ int pci_mmap_page_range(struct pci_dev *
/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
#define HAVE_PCI_MMAP 1
-static inline void pcibios_add_platform_entries(struct pci_dev *dev)
-{
-}
-
#endif /* __KERNEL__ */
/* Implement the pci_ DMA API in terms of the generic device dma_ one */
Index: msi-new/include/linux/pci.h
===================================================================
--- msi-new.orig/include/linux/pci.h
+++ msi-new/include/linux/pci.h
@@ -857,5 +857,7 @@ extern int pci_pci_problems;
extern unsigned long pci_cardbus_io_size;
extern unsigned long pci_cardbus_mem_size;
+extern void pcibios_add_platform_entries(struct pci_dev *dev);
+
#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] Make pcibios_add_platform_entries() return errors
2007-03-06 15:06 [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() Michael Ellerman
@ 2007-03-06 15:06 ` Michael Ellerman
2007-03-06 18:05 ` [parisc-linux] " James Bottomley
2007-03-06 18:01 ` [parisc-linux] [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() James Bottomley
1 sibling, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2007-03-06 15:06 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-mips, dev-etrax, linux-ia64, discuss, chris, linuxppc-dev,
linux-m68k, ink, gerg, sparclinux, uclinux-v850, linux-pci,
parisc-linux, kernel, rth
Currently pcibios_add_platform_entries() returns void, but could fail,
so instead have it return an int and propagate errors up to
pci_create_sysfs_dev_files().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/pci_32.c | 4 ++--
arch/powerpc/kernel/pci_64.c | 4 ++--
drivers/pci/pci-sysfs.c | 9 ++++++---
include/linux/pci.h | 2 +-
4 files changed, 11 insertions(+), 8 deletions(-)
Index: msi-new/arch/powerpc/kernel/pci_32.c
===================================================================
--- msi-new.orig/arch/powerpc/kernel/pci_32.c
+++ msi-new/arch/powerpc/kernel/pci_32.c
@@ -1037,10 +1037,10 @@ void pcibios_make_OF_bus_map(void)
#endif /* CONFIG_PPC_OF */
/* Add sysfs properties */
-void pcibios_add_platform_entries(struct pci_dev *pdev)
+int pcibios_add_platform_entries(struct pci_dev *pdev)
{
#ifdef CONFIG_PPC_OF
- device_create_file(&pdev->dev, &dev_attr_devspec);
+ return device_create_file(&pdev->dev, &dev_attr_devspec);
#endif /* CONFIG_PPC_OF */
}
Index: msi-new/arch/powerpc/kernel/pci_64.c
===================================================================
--- msi-new.orig/arch/powerpc/kernel/pci_64.c
+++ msi-new/arch/powerpc/kernel/pci_64.c
@@ -863,9 +863,9 @@ static ssize_t pci_show_devspec(struct d
}
static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
-void pcibios_add_platform_entries(struct pci_dev *pdev)
+int pcibios_add_platform_entries(struct pci_dev *pdev)
{
- device_create_file(&pdev->dev, &dev_attr_devspec);
+ return device_create_file(&pdev->dev, &dev_attr_devspec);
}
#define ISA_SPACE_MASK 0x1
Index: msi-new/drivers/pci/pci-sysfs.c
===================================================================
--- msi-new.orig/drivers/pci/pci-sysfs.c
+++ msi-new/drivers/pci/pci-sysfs.c
@@ -600,9 +600,9 @@ static struct bin_attribute pcie_config_
.write = pci_write_config,
};
-void __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
+int __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
{
- return;
+ return 0;
}
int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
@@ -644,10 +644,13 @@ int __must_check pci_create_sysfs_dev_fi
}
}
/* add platform-specific attributes */
- pcibios_add_platform_entries(pdev);
+ if (pcibios_add_platform_entries(pdev))
+ goto err_rom_attr;
return 0;
+err_rom_attr:
+ sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr);
err_rom:
kfree(rom_attr);
err_bin_file:
Index: msi-new/include/linux/pci.h
===================================================================
--- msi-new.orig/include/linux/pci.h
+++ msi-new/include/linux/pci.h
@@ -857,7 +857,7 @@ extern int pci_pci_problems;
extern unsigned long pci_cardbus_io_size;
extern unsigned long pci_cardbus_mem_size;
-extern void pcibios_add_platform_entries(struct pci_dev *dev);
+extern int pcibios_add_platform_entries(struct pci_dev *dev);
#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [parisc-linux] [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries()
2007-03-06 15:06 [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() Michael Ellerman
2007-03-06 15:06 ` [PATCH 2/2] Make pcibios_add_platform_entries() return errors Michael Ellerman
@ 2007-03-06 18:01 ` James Bottomley
1 sibling, 0 replies; 6+ messages in thread
From: James Bottomley @ 2007-03-06 18:01 UTC (permalink / raw)
To: Michael Ellerman
Cc: discuss, dev-etrax, linux-ia64, chris, Greg Kroah-Hartman,
linux-m68k, uclinux-v850, linuxppc-dev, linux-mips, gerg,
sparclinux, ink, linux-pci, rth, kernel, parisc-linux
On Tue, 2007-03-06 at 16:06 +0100, Michael Ellerman wrote:
> I'm not sure if this is going to fly, weak symbols work on the compilers I'm
> using, but whether they work for all of the affected architectures I can't say.
> I've cc'ed as many arch maintainers/lists as I could find.
Well, for your use, PCI already uses weak symbols, so it must work on
every architecture that you want to do it on ...
James
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [parisc-linux] [PATCH 2/2] Make pcibios_add_platform_entries() return errors
2007-03-06 15:06 ` [PATCH 2/2] Make pcibios_add_platform_entries() return errors Michael Ellerman
@ 2007-03-06 18:05 ` James Bottomley
2007-03-07 8:55 ` Michael Ellerman
0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2007-03-06 18:05 UTC (permalink / raw)
To: Michael Ellerman
Cc: discuss, dev-etrax, linux-ia64, chris, Greg Kroah-Hartman,
linux-m68k, uclinux-v850, linuxppc-dev, linux-mips, gerg,
sparclinux, ink, linux-pci, rth, kernel, parisc-linux
On Tue, 2007-03-06 at 16:06 +0100, Michael Ellerman wrote:
> int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
> @@ -644,10 +644,13 @@ int __must_check pci_create_sysfs_dev_fi
> }
> }
> /* add platform-specific attributes */
> - pcibios_add_platform_entries(pdev);
> + if (pcibios_add_platform_entries(pdev))
> + goto err_rom_attr;
>
> return 0;
>
> +err_rom_attr:
> + sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr);
This file is only created if the rom resource has a non-zero length. If
you unconditionally call sysfs_remove_bin_file() it's going to spit
scary warnings and dump traces in this error leg if the rom resource
doesn't exist.
James
> err_rom:
> kfree(rom_attr);
> err_bin_file:
> Index: msi-new/include/linux/pci.h
> ===================================================================
> --- msi-new.orig/include/linux/pci.h
> +++ msi-new/include/linux/pci.h
> @@ -857,7 +857,7 @@ extern int pci_pci_problems;
> extern unsigned long pci_cardbus_io_size;
> extern unsigned long pci_cardbus_mem_size;
>
> -extern void pcibios_add_platform_entries(struct pci_dev *dev);
> +extern int pcibios_add_platform_entries(struct pci_dev *dev);
>
> #endif /* __KERNEL__ */
> #endif /* LINUX_PCI_H */
> _______________________________________________
> parisc-linux mailing list
> parisc-linux@lists.parisc-linux.org
> http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [parisc-linux] [PATCH 2/2] Make pcibios_add_platform_entries() return errors
2007-03-06 18:05 ` [parisc-linux] " James Bottomley
@ 2007-03-07 8:55 ` Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2007-03-07 8:55 UTC (permalink / raw)
To: James Bottomley
Cc: discuss, dev-etrax, linux-ia64, chris, Greg Kroah-Hartman,
linux-m68k, uclinux-v850, linuxppc-dev, linux-mips, gerg,
sparclinux, ink, linux-pci, rth, kernel, parisc-linux
[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]
On Tue, 2007-03-06 at 12:05 -0600, James Bottomley wrote:
> On Tue, 2007-03-06 at 16:06 +0100, Michael Ellerman wrote:
> > int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
> > @@ -644,10 +644,13 @@ int __must_check pci_create_sysfs_dev_fi
> > }
> > }
> > /* add platform-specific attributes */
> > - pcibios_add_platform_entries(pdev);
> > + if (pcibios_add_platform_entries(pdev))
> > + goto err_rom_attr;
> >
> > return 0;
> >
> > +err_rom_attr:
> > + sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr);
>
> This file is only created if the rom resource has a non-zero length. If
> you unconditionally call sysfs_remove_bin_file() it's going to spit
> scary warnings and dump traces in this error leg if the rom resource
> doesn't exist.
Ah crud, don't write patches during meetings. I'll send a fixed version.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] Make pcibios_add_platform_entries() return errors
@ 2007-04-17 7:18 Michael Ellerman
0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2007-04-17 7:18 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: James.Bottomley, linuxppc-dev, linux-pci
Currently pcibios_add_platform_entries() returns void, but could fail,
so instead have it return an int and propagate errors up to
pci_create_sysfs_dev_files().
Fixes:
arch/powerpc/kernel/pci_64.c: In function 'pcibios_add_platform_entries':
arch/powerpc/kernel/pci_64.c:878: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
arch/powerpc/kernel/pci_32.c: In function 'pcibios_add_platform_entries':
arch/powerpc/kernel/pci_32.c:1043: warning: ignoring return value of
'device_create_file', declared with attribute warn_unused_result
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/pci_32.c | 4 ++--
arch/powerpc/kernel/pci_64.c | 4 ++--
drivers/pci/pci-sysfs.c | 10 +++++++---
include/linux/pci.h | 2 +-
4 files changed, 12 insertions(+), 8 deletions(-)
Index: powerpc/arch/powerpc/kernel/pci_32.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/pci_32.c
+++ powerpc/arch/powerpc/kernel/pci_32.c
@@ -1037,10 +1037,10 @@ void pcibios_make_OF_bus_map(void)
#endif /* CONFIG_PPC_OF */
/* Add sysfs properties */
-void pcibios_add_platform_entries(struct pci_dev *pdev)
+int pcibios_add_platform_entries(struct pci_dev *pdev)
{
#ifdef CONFIG_PPC_OF
- device_create_file(&pdev->dev, &dev_attr_devspec);
+ return device_create_file(&pdev->dev, &dev_attr_devspec);
#endif /* CONFIG_PPC_OF */
}
Index: powerpc/arch/powerpc/kernel/pci_64.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/pci_64.c
+++ powerpc/arch/powerpc/kernel/pci_64.c
@@ -873,9 +873,9 @@ static ssize_t pci_show_devspec(struct d
}
static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
-void pcibios_add_platform_entries(struct pci_dev *pdev)
+int pcibios_add_platform_entries(struct pci_dev *pdev)
{
- device_create_file(&pdev->dev, &dev_attr_devspec);
+ return device_create_file(&pdev->dev, &dev_attr_devspec);
}
#define ISA_SPACE_MASK 0x1
Index: powerpc/drivers/pci/pci-sysfs.c
===================================================================
--- powerpc.orig/drivers/pci/pci-sysfs.c
+++ powerpc/drivers/pci/pci-sysfs.c
@@ -600,9 +600,9 @@ static struct bin_attribute pcie_config_
.write = pci_write_config,
};
-void __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
+int __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
{
- return;
+ return 0;
}
int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
@@ -644,10 +644,14 @@ int __must_check pci_create_sysfs_dev_fi
}
}
/* add platform-specific attributes */
- pcibios_add_platform_entries(pdev);
+ if (pcibios_add_platform_entries(pdev))
+ goto err_rom_file;
return 0;
+err_rom_file:
+ if (pci_resource_len(pdev, PCI_ROM_RESOURCE))
+ sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr);
err_rom:
kfree(rom_attr);
err_bin_file:
Index: powerpc/include/linux/pci.h
===================================================================
--- powerpc.orig/include/linux/pci.h
+++ powerpc/include/linux/pci.h
@@ -853,7 +853,7 @@ extern int pci_pci_problems;
extern unsigned long pci_cardbus_io_size;
extern unsigned long pci_cardbus_mem_size;
-extern void pcibios_add_platform_entries(struct pci_dev *dev);
+extern int pcibios_add_platform_entries(struct pci_dev *dev);
#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-04-17 7:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 15:06 [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() Michael Ellerman
2007-03-06 15:06 ` [PATCH 2/2] Make pcibios_add_platform_entries() return errors Michael Ellerman
2007-03-06 18:05 ` [parisc-linux] " James Bottomley
2007-03-07 8:55 ` Michael Ellerman
2007-03-06 18:01 ` [parisc-linux] [PATCH 1/2] Use a weak symbol for the empty version of pcibios_add_platform_entries() James Bottomley
-- strict thread matches above, loose matches on Subject: below --
2007-04-17 7:18 [PATCH 2/2] Make pcibios_add_platform_entries() return errors Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).