Skip to content

Commit f898f8d

Browse files
committed
Begin consolidation of of_device.h
This just moves the common stuff from the arch of_device.h files to linux/of_device.h. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Paul Mackerras <paulus@samba.org> Acked-by: David S. Miller <davem@davemloft.net>
1 parent f85ff30 commit f898f8d

5 files changed

Lines changed: 40 additions & 40 deletions

File tree

‎drivers/of/device.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include <linux/string.h>
22
#include <linux/kernel.h>
33
#include <linux/of.h>
4+
#include <linux/of_device.h>
45
#include <linux/init.h>
56
#include <linux/module.h>
67
#include <linux/mod_devicetable.h>
78
#include <linux/slab.h>
89

910
#include <asm/errno.h>
10-
#include <asm/of_device.h>
1111

1212
/**
1313
* of_match_node - Tell if an device_node has a matching of_match structure

‎include/asm-powerpc/of_device.h‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,27 @@
33
#ifdef __KERNEL__
44

55
#include <linux/device.h>
6-
#include <linux/mod_devicetable.h>
7-
#include <asm/prom.h>
8-
6+
#include <linux/of.h>
97

108
/*
119
* The of_device is a kind of "base class" that is a superset of
1210
* struct device for use by devices attached to an OF node and
13-
* probed using OF properties
11+
* probed using OF properties.
1412
*/
1513
struct of_device
1614
{
1715
struct device_node *node; /* to be obsoleted */
1816
u64 dma_mask; /* DMA mask */
1917
struct device dev; /* Generic device interface */
2018
};
21-
#define to_of_device(d) container_of(d, struct of_device, dev)
22-
23-
extern const struct of_device_id *of_match_node(
24-
const struct of_device_id *matches, const struct device_node *node);
25-
extern const struct of_device_id *of_match_device(
26-
const struct of_device_id *matches, const struct of_device *dev);
27-
28-
extern struct of_device *of_dev_get(struct of_device *dev);
29-
extern void of_dev_put(struct of_device *dev);
30-
31-
extern int of_device_register(struct of_device *ofdev);
32-
extern void of_device_unregister(struct of_device *ofdev);
33-
extern void of_release_dev(struct device *dev);
3419

3520
extern ssize_t of_device_get_modalias(struct of_device *ofdev,
3621
char *str, ssize_t len);
3722
extern int of_device_uevent(struct device *dev,
3823
char **envp, int num_envp, char *buffer, int buffer_size);
3924

25+
/* This is just here during the transition */
26+
#include <linux/of_device.h>
27+
4028
#endif /* __KERNEL__ */
4129
#endif /* _ASM_POWERPC_OF_DEVICE_H */

‎include/asm-sparc/of_device.h‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#ifdef __KERNEL__
44

55
#include <linux/device.h>
6+
#include <linux/of.h>
67
#include <linux/mod_devicetable.h>
78
#include <asm/openprom.h>
8-
#include <asm/prom.h>
99

1010
extern struct bus_type ebus_bus_type;
1111
extern struct bus_type sbus_bus_type;
@@ -30,19 +30,12 @@ struct of_device
3030
int portid;
3131
int clock_freq;
3232
};
33-
#define to_of_device(d) container_of(d, struct of_device, dev)
3433

3534
extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
3635
extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
3736

3837
extern struct of_device *of_find_device_by_node(struct device_node *);
3938

40-
extern const struct of_device_id *of_match_device(
41-
const struct of_device_id *matches, const struct of_device *dev);
42-
43-
extern struct of_device *of_dev_get(struct of_device *dev);
44-
extern void of_dev_put(struct of_device *dev);
45-
4639
/*
4740
* An of_platform_driver driver is attached to a basic of_device on
4841
* the ISA, EBUS, and SBUS busses on sparc64.
@@ -67,13 +60,13 @@ struct of_platform_driver
6760
extern int of_register_driver(struct of_platform_driver *drv,
6861
struct bus_type *bus);
6962
extern void of_unregister_driver(struct of_platform_driver *drv);
70-
extern int of_device_register(struct of_device *ofdev);
71-
extern void of_device_unregister(struct of_device *ofdev);
7263
extern struct of_device *of_platform_device_create(struct device_node *np,
7364
const char *bus_id,
7465
struct device *parent,
7566
struct bus_type *bus);
76-
extern void of_release_dev(struct device *dev);
67+
68+
/* This is just here during the transition */
69+
#include <linux/of_device.h>
7770

7871
#endif /* __KERNEL__ */
7972
#endif /* _ASM_SPARC_OF_DEVICE_H */

‎include/asm-sparc64/of_device.h‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#ifdef __KERNEL__
44

55
#include <linux/device.h>
6+
#include <linux/of.h>
67
#include <linux/mod_devicetable.h>
78
#include <asm/openprom.h>
8-
#include <asm/prom.h>
99

1010
extern struct bus_type isa_bus_type;
1111
extern struct bus_type ebus_bus_type;
@@ -31,19 +31,12 @@ struct of_device
3131
int portid;
3232
int clock_freq;
3333
};
34-
#define to_of_device(d) container_of(d, struct of_device, dev)
3534

3635
extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
3736
extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
3837

3938
extern struct of_device *of_find_device_by_node(struct device_node *);
4039

41-
extern const struct of_device_id *of_match_device(
42-
const struct of_device_id *matches, const struct of_device *dev);
43-
44-
extern struct of_device *of_dev_get(struct of_device *dev);
45-
extern void of_dev_put(struct of_device *dev);
46-
4740
/*
4841
* An of_platform_driver driver is attached to a basic of_device on
4942
* the ISA, EBUS, and SBUS busses on sparc64.
@@ -68,13 +61,13 @@ struct of_platform_driver
6861
extern int of_register_driver(struct of_platform_driver *drv,
6962
struct bus_type *bus);
7063
extern void of_unregister_driver(struct of_platform_driver *drv);
71-
extern int of_device_register(struct of_device *ofdev);
72-
extern void of_device_unregister(struct of_device *ofdev);
7364
extern struct of_device *of_platform_device_create(struct device_node *np,
7465
const char *bus_id,
7566
struct device *parent,
7667
struct bus_type *bus);
77-
extern void of_release_dev(struct device *dev);
68+
69+
/* This is just here during the transition */
70+
#include <linux/of_device.h>
7871

7972
#endif /* __KERNEL__ */
8073
#endif /* _ASM_SPARC64_OF_DEVICE_H */

‎include/linux/of_device.h‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef _LINUX_OF_DEVICE_H
2+
#define _LINUX_OF_DEVICE_H
3+
#ifdef __KERNEL__
4+
5+
#include <linux/device.h>
6+
#include <linux/of.h>
7+
#include <linux/mod_devicetable.h>
8+
9+
#include <asm/of_device.h>
10+
11+
#define to_of_device(d) container_of(d, struct of_device, dev)
12+
13+
extern const struct of_device_id *of_match_node(
14+
const struct of_device_id *matches, const struct device_node *node);
15+
extern const struct of_device_id *of_match_device(
16+
const struct of_device_id *matches, const struct of_device *dev);
17+
18+
extern struct of_device *of_dev_get(struct of_device *dev);
19+
extern void of_dev_put(struct of_device *dev);
20+
21+
extern int of_device_register(struct of_device *ofdev);
22+
extern void of_device_unregister(struct of_device *ofdev);
23+
extern void of_release_dev(struct device *dev);
24+
25+
#endif /* __KERNEL__ */
26+
#endif /* _LINUX_OF_DEVICE_H */

0 commit comments

Comments
 (0)