Message ID | 20181201204137.1786-1-okaya@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [v1,1/2] PCI: Stub out read/write/raw/find functions | expand |
On Sat, Dec 01, 2018 at 08:41:35PM +0000, Sinan Kaya wrote: > Need stub functions in order to be able to compile ACPI without PCI > support. > > Signed-off-by: Sinan Kaya <okaya@kernel.org> I can't tell where this series is since I only got the pieces that touch PCI and the version numbers and n/n numbers don't make much sense then, so apologies if I'm responding to an obsolete patch. > --- > include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 11c71c4ecf75..15407f469d41 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -682,10 +682,22 @@ struct pci_ops { > * ACPI needs to be able to access PCI config space before we've done a > * PCI bus scan and created pci_bus structures. > */ > +#ifdef CONFIG_PCI > int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, > int reg, int len, u32 *val); > int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, > int reg, int len, u32 val); > +#else > +static inline int raw_pci_read(unsigned int domain, unsigned int bus, > + unsigned int devfn, int reg, int len, u32 *val) > +{ > + *val = 0; > + return -EINVAL; Why do you return 0 here? If a PCI config access fails, you usually get ~0. > +} > +static inline int raw_pci_write(unsigned int domain, unsigned int bus, > + unsigned int devfn, int reg, int len, u32 val) > +{ return -EINVAL; } > +#endif > > #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > typedef u64 pci_bus_addr_t; > @@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev) > } > > #else /* CONFIG_PCI is not enabled */ > +static inline int pci_bus_read_config_byte(struct pci_bus *bus, > + unsigned int devfn, int where, u8 *val) > +{ return -EINVAL; } Should these set *val as well? To ~0 (or 0) to match above, I assume? > +static inline int pci_bus_read_config_word(struct pci_bus *bus, > + unsigned int devfn, int where, u16 *val) > +{ return -EINVAL; } > +static inline int pci_bus_read_config_dword(struct pci_bus *bus, > + unsigned int devfn, int where, u32 *val) > +{ return -EINVAL; } > +static inline int pci_bus_write_config_byte(struct pci_bus *bus, > + unsigned int devfn, int where, u8 val) > +{ return -EINVAL; } > +static inline int pci_bus_write_config_word(struct pci_bus *bus, > + unsigned int devfn, int where, u16 val) > +{ return -EINVAL; } > +static inline int pci_bus_write_config_dword(struct pci_bus *bus, > + unsigned int devfn, int where, u32 val) > +{ return -EINVAL; } > +static inline struct pci_bus *pci_find_bus(int domain, int busnr) > +{ return NULL; } > static inline void pci_set_flags(int flags) { } > static inline void pci_add_flags(int flags) { } > static inline void pci_clear_flags(int flags) { } > -- > 2.19.0 >
On Mon, Dec 17, 2018 at 8:27 PM Bjorn Helgaas <helgaas@kernel.org> wrote: > > On Sat, Dec 01, 2018 at 08:41:35PM +0000, Sinan Kaya wrote: > > Need stub functions in order to be able to compile ACPI without PCI > > support. > > > > Signed-off-by: Sinan Kaya <okaya@kernel.org> > > I can't tell where this series is since I only got the pieces that > touch PCI and the version numbers and n/n numbers don't make much > sense then, so apologies if I'm responding to an obsolete patch. Yes, this is an older version of the patch series for removing coupling between ACPI and PCI. > > > --- > > include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++ > > 1 file changed, 32 insertions(+) > > > > diff --git a/include/linux/pci.h b/include/linux/pci.h > > index 11c71c4ecf75..15407f469d41 100644 > > --- a/include/linux/pci.h > > +++ b/include/linux/pci.h > > @@ -682,10 +682,22 @@ struct pci_ops { > > * ACPI needs to be able to access PCI config space before we've done a > > * PCI bus scan and created pci_bus structures. > > */ > > +#ifdef CONFIG_PCI > > int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, > > int reg, int len, u32 *val); > > int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, > > int reg, int len, u32 val); > > +#else > > +static inline int raw_pci_read(unsigned int domain, unsigned int bus, > > + unsigned int devfn, int reg, int len, u32 *val) > > +{ > > + *val = 0; > > + return -EINVAL; > > Why do you return 0 here? If a PCI config access fails, you usually > get ~0. > > > +} > > +static inline int raw_pci_write(unsigned int domain, unsigned int bus, > > + unsigned int devfn, int reg, int len, u32 val) > > +{ return -EINVAL; } > > +#endif > > > > #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > > typedef u64 pci_bus_addr_t; > > @@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev) > > } > > > > #else /* CONFIG_PCI is not enabled */ > > +static inline int pci_bus_read_config_byte(struct pci_bus *bus, > > + unsigned int devfn, int where, u8 *val) > > +{ return -EINVAL; } > > Should these set *val as well? To ~0 (or 0) to match above, I assume? > > > +static inline int pci_bus_read_config_word(struct pci_bus *bus, > > + unsigned int devfn, int where, u16 *val) > > +{ return -EINVAL; } > > +static inline int pci_bus_read_config_dword(struct pci_bus *bus, > > + unsigned int devfn, int where, u32 *val) > > +{ return -EINVAL; } > > +static inline int pci_bus_write_config_byte(struct pci_bus *bus, > > + unsigned int devfn, int where, u8 val) > > +{ return -EINVAL; } > > +static inline int pci_bus_write_config_word(struct pci_bus *bus, > > + unsigned int devfn, int where, u16 val) > > +{ return -EINVAL; } > > +static inline int pci_bus_write_config_dword(struct pci_bus *bus, > > + unsigned int devfn, int where, u32 val) > > +{ return -EINVAL; } > > +static inline struct pci_bus *pci_find_bus(int domain, int busnr) > > +{ return NULL; } > > static inline void pci_set_flags(int flags) { } > > static inline void pci_add_flags(int flags) { } > > static inline void pci_clear_flags(int flags) { } > > -- > > 2.19.0 > >
diff --git a/include/linux/pci.h b/include/linux/pci.h index 11c71c4ecf75..15407f469d41 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -682,10 +682,22 @@ struct pci_ops { * ACPI needs to be able to access PCI config space before we've done a * PCI bus scan and created pci_bus structures. */ +#ifdef CONFIG_PCI int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 *val); int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 val); +#else +static inline int raw_pci_read(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 *val) +{ + *val = 0; + return -EINVAL; +} +static inline int raw_pci_write(unsigned int domain, unsigned int bus, + unsigned int devfn, int reg, int len, u32 val) +{ return -EINVAL; } +#endif #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT typedef u64 pci_bus_addr_t; @@ -1599,7 +1611,27 @@ pci_release_mem_regions(struct pci_dev *pdev) } #else /* CONFIG_PCI is not enabled */ +static inline int pci_bus_read_config_byte(struct pci_bus *bus, + unsigned int devfn, int where, u8 *val) +{ return -EINVAL; } +static inline int pci_bus_read_config_word(struct pci_bus *bus, + unsigned int devfn, int where, u16 *val) +{ return -EINVAL; } +static inline int pci_bus_read_config_dword(struct pci_bus *bus, + unsigned int devfn, int where, u32 *val) +{ return -EINVAL; } +static inline int pci_bus_write_config_byte(struct pci_bus *bus, + unsigned int devfn, int where, u8 val) +{ return -EINVAL; } +static inline int pci_bus_write_config_word(struct pci_bus *bus, + unsigned int devfn, int where, u16 val) +{ return -EINVAL; } +static inline int pci_bus_write_config_dword(struct pci_bus *bus, + unsigned int devfn, int where, u32 val) +{ return -EINVAL; } +static inline struct pci_bus *pci_find_bus(int domain, int busnr) +{ return NULL; } static inline void pci_set_flags(int flags) { } static inline void pci_add_flags(int flags) { } static inline void pci_clear_flags(int flags) { }
Need stub functions in order to be able to compile ACPI without PCI support. Signed-off-by: Sinan Kaya <okaya@kernel.org> --- include/linux/pci.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)