mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
![Andreas Larsson](/assets/img/avatar_default.png)
This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.
The bug was introduced in a850a75544
, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADDRESS, and CONFIG_OF_ADDRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource there exists a sparc-specific implementation in
arch/sparc/arch/sparc/kernel/of_device_common.c
Solution suggested by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
77 lines
2.3 KiB
C
77 lines
2.3 KiB
C
#ifndef __OF_ADDRESS_H
|
|
#define __OF_ADDRESS_H
|
|
#include <linux/ioport.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/of.h>
|
|
|
|
#ifdef CONFIG_OF_ADDRESS
|
|
extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
|
|
extern bool of_can_translate_address(struct device_node *dev);
|
|
extern int of_address_to_resource(struct device_node *dev, int index,
|
|
struct resource *r);
|
|
extern struct device_node *of_find_matching_node_by_address(
|
|
struct device_node *from,
|
|
const struct of_device_id *matches,
|
|
u64 base_address);
|
|
extern void __iomem *of_iomap(struct device_node *device, int index);
|
|
|
|
/* Extract an address from a device, returns the region size and
|
|
* the address space flags too. The PCI version uses a BAR number
|
|
* instead of an absolute index
|
|
*/
|
|
extern const __be32 *of_get_address(struct device_node *dev, int index,
|
|
u64 *size, unsigned int *flags);
|
|
|
|
#ifndef pci_address_to_pio
|
|
static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
|
|
#define pci_address_to_pio pci_address_to_pio
|
|
#endif
|
|
|
|
#else /* CONFIG_OF_ADDRESS */
|
|
#ifndef of_address_to_resource
|
|
static inline int of_address_to_resource(struct device_node *dev, int index,
|
|
struct resource *r)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
#endif
|
|
static inline struct device_node *of_find_matching_node_by_address(
|
|
struct device_node *from,
|
|
const struct of_device_id *matches,
|
|
u64 base_address)
|
|
{
|
|
return NULL;
|
|
}
|
|
static inline void __iomem *of_iomap(struct device_node *device, int index)
|
|
{
|
|
return NULL;
|
|
}
|
|
static inline const __be32 *of_get_address(struct device_node *dev, int index,
|
|
u64 *size, unsigned int *flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif /* CONFIG_OF_ADDRESS */
|
|
|
|
|
|
#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
|
|
extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
|
|
u64 *size, unsigned int *flags);
|
|
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
|
|
struct resource *r);
|
|
#else /* CONFIG_OF_ADDRESS && CONFIG_PCI */
|
|
static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
|
|
struct resource *r)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline const __be32 *of_get_pci_address(struct device_node *dev,
|
|
int bar_no, u64 *size, unsigned int *flags)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
|
|
|
|
#endif /* __OF_ADDRESS_H */
|
|
|