diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-11-04 12:35:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-06 16:48:53 -0500 |
commit | b0a1edabd31a18de3c6380022af0804592bded14 (patch) | |
tree | ab335eb7065f7461c49cb1651dca68f42350d5d1 /drivers/net/wireless/rt2x00/rt2800pci.h | |
parent | 7a345d3d2512769ca693d4844b215ae2cc267dce (diff) |
rt2800pci: convert to use struct rt2800_ops methods
Add chipset registers access abstraction layer and prepare for later
code unification.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2800pci.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.h | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h index 392f580cbb60..fecb71c05c1e 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ b/drivers/net/wireless/rt2x00/rt2800pci.h | |||
@@ -27,32 +27,60 @@ | |||
27 | #ifndef RT2800PCI_H | 27 | #ifndef RT2800PCI_H |
28 | #define RT2800PCI_H | 28 | #define RT2800PCI_H |
29 | 29 | ||
30 | struct rt2800_ops { | ||
31 | void (*register_read)(struct rt2x00_dev *rt2x00dev, | ||
32 | const unsigned int offset, u32 *value); | ||
33 | void (*register_write)(struct rt2x00_dev *rt2x00dev, | ||
34 | const unsigned int offset, u32 value); | ||
35 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, | ||
36 | const unsigned int offset, u32 value); | ||
37 | |||
38 | void (*register_multiread)(struct rt2x00_dev *rt2x00dev, | ||
39 | const unsigned int offset, | ||
40 | void *value, const u16 length); | ||
41 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | const void *value, const u16 length); | ||
44 | |||
45 | int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, | ||
46 | const unsigned int offset, | ||
47 | const struct rt2x00_field32 field, u32 *reg); | ||
48 | }; | ||
49 | |||
30 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | 50 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, |
31 | const unsigned int offset, | 51 | const unsigned int offset, |
32 | u32 *value) | 52 | u32 *value) |
33 | { | 53 | { |
34 | rt2x00pci_register_read(rt2x00dev, offset, value); | 54 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
55 | |||
56 | rt2800ops->register_read(rt2x00dev, offset, value); | ||
35 | } | 57 | } |
36 | 58 | ||
37 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | 59 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, |
38 | const unsigned int offset, | 60 | const unsigned int offset, |
39 | u32 value) | 61 | u32 value) |
40 | { | 62 | { |
41 | rt2x00pci_register_write(rt2x00dev, offset, value); | 63 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
64 | |||
65 | rt2800ops->register_write(rt2x00dev, offset, value); | ||
42 | } | 66 | } |
43 | 67 | ||
44 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | 68 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, |
45 | const unsigned int offset, | 69 | const unsigned int offset, |
46 | u32 value) | 70 | u32 value) |
47 | { | 71 | { |
48 | rt2x00pci_register_write(rt2x00dev, offset, value); | 72 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
73 | |||
74 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | ||
49 | } | 75 | } |
50 | 76 | ||
51 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | 77 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, |
52 | const unsigned int offset, | 78 | const unsigned int offset, |
53 | void *value, const u16 length) | 79 | void *value, const u16 length) |
54 | { | 80 | { |
55 | rt2x00pci_register_multiread(rt2x00dev, offset, value, length); | 81 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
82 | |||
83 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | ||
56 | } | 84 | } |
57 | 85 | ||
58 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | 86 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, |
@@ -60,7 +88,9 @@ static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | |||
60 | const void *value, | 88 | const void *value, |
61 | const u16 length) | 89 | const u16 length) |
62 | { | 90 | { |
63 | rt2x00pci_register_multiwrite(rt2x00dev, offset, value, length); | 91 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
92 | |||
93 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | ||
64 | } | 94 | } |
65 | 95 | ||
66 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | 96 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, |
@@ -68,7 +98,9 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | |||
68 | const struct rt2x00_field32 field, | 98 | const struct rt2x00_field32 field, |
69 | u32 *reg) | 99 | u32 *reg) |
70 | { | 100 | { |
71 | return rt2x00pci_regbusy_read(rt2x00dev, offset, field, reg); | 101 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; |
102 | |||
103 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | ||
72 | } | 104 | } |
73 | 105 | ||
74 | /* | 106 | /* |