diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-11-04 12:35:32 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-06 16:48:55 -0500 |
commit | 7ef5cc92bac940419f022e11115a28daea53814f (patch) | |
tree | 99f2be71f1ccd7a0a6b00254e78bcfabe06935d3 /drivers/net/wireless/rt2x00 | |
parent | 473196bd9935f0efd4c5f1cda28229e7dcff564c (diff) |
rt2800: add rt2800lib.h
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')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.h | 99 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.h | 76 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.h | 75 |
5 files changed, 101 insertions, 151 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h new file mode 100644 index 000000000000..17e91fb1a77a --- /dev/null +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | Copyright (C) 2009 Bartlomiej Zolnierkiewicz | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the | ||
16 | Free Software Foundation, Inc., | ||
17 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef RT2800LIB_H | ||
21 | #define RT2800LIB_H | ||
22 | |||
23 | struct rt2800_ops { | ||
24 | void (*register_read)(struct rt2x00_dev *rt2x00dev, | ||
25 | const unsigned int offset, u32 *value); | ||
26 | void (*register_write)(struct rt2x00_dev *rt2x00dev, | ||
27 | const unsigned int offset, u32 value); | ||
28 | void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, | ||
29 | const unsigned int offset, u32 value); | ||
30 | |||
31 | void (*register_multiread)(struct rt2x00_dev *rt2x00dev, | ||
32 | const unsigned int offset, | ||
33 | void *value, const u32 length); | ||
34 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | ||
35 | const unsigned int offset, | ||
36 | const void *value, const u32 length); | ||
37 | |||
38 | int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, | ||
39 | const unsigned int offset, | ||
40 | const struct rt2x00_field32 field, u32 *reg); | ||
41 | }; | ||
42 | |||
43 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | ||
44 | const unsigned int offset, | ||
45 | u32 *value) | ||
46 | { | ||
47 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
48 | |||
49 | rt2800ops->register_read(rt2x00dev, offset, value); | ||
50 | } | ||
51 | |||
52 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | ||
53 | const unsigned int offset, | ||
54 | u32 value) | ||
55 | { | ||
56 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
57 | |||
58 | rt2800ops->register_write(rt2x00dev, offset, value); | ||
59 | } | ||
60 | |||
61 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | ||
62 | const unsigned int offset, | ||
63 | u32 value) | ||
64 | { | ||
65 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
66 | |||
67 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | ||
68 | } | ||
69 | |||
70 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
71 | const unsigned int offset, | ||
72 | void *value, const u32 length) | ||
73 | { | ||
74 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
75 | |||
76 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | ||
77 | } | ||
78 | |||
79 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
80 | const unsigned int offset, | ||
81 | const void *value, | ||
82 | const u32 length) | ||
83 | { | ||
84 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
85 | |||
86 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | ||
87 | } | ||
88 | |||
89 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
90 | const unsigned int offset, | ||
91 | const struct rt2x00_field32 field, | ||
92 | u32 *reg) | ||
93 | { | ||
94 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
95 | |||
96 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | ||
97 | } | ||
98 | |||
99 | #endif /* RT2800LIB_H */ | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index fde722caab94..9017ea64d011 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "rt2x00.h" | 37 | #include "rt2x00.h" |
38 | #include "rt2x00pci.h" | 38 | #include "rt2x00pci.h" |
39 | #include "rt2x00soc.h" | 39 | #include "rt2x00soc.h" |
40 | #include "rt2800lib.h" | ||
40 | #include "rt2800pci.h" | 41 | #include "rt2800pci.h" |
41 | 42 | ||
42 | #ifdef CONFIG_RT2800PCI_PCI_MODULE | 43 | #ifdef CONFIG_RT2800PCI_PCI_MODULE |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.h b/drivers/net/wireless/rt2x00/rt2800pci.h index 586eb81ad76a..856908815221 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ b/drivers/net/wireless/rt2x00/rt2800pci.h | |||
@@ -27,82 +27,6 @@ | |||
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 u32 length); | ||
41 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | const void *value, const u32 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 | |||
50 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | ||
51 | const unsigned int offset, | ||
52 | u32 *value) | ||
53 | { | ||
54 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
55 | |||
56 | rt2800ops->register_read(rt2x00dev, offset, value); | ||
57 | } | ||
58 | |||
59 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | ||
60 | const unsigned int offset, | ||
61 | u32 value) | ||
62 | { | ||
63 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
64 | |||
65 | rt2800ops->register_write(rt2x00dev, offset, value); | ||
66 | } | ||
67 | |||
68 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | ||
69 | const unsigned int offset, | ||
70 | u32 value) | ||
71 | { | ||
72 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
73 | |||
74 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | ||
75 | } | ||
76 | |||
77 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
78 | const unsigned int offset, | ||
79 | void *value, const u32 length) | ||
80 | { | ||
81 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
82 | |||
83 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | ||
84 | } | ||
85 | |||
86 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
87 | const unsigned int offset, | ||
88 | const void *value, | ||
89 | const u32 length) | ||
90 | { | ||
91 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
92 | |||
93 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | ||
94 | } | ||
95 | |||
96 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
97 | const unsigned int offset, | ||
98 | const struct rt2x00_field32 field, | ||
99 | u32 *reg) | ||
100 | { | ||
101 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
102 | |||
103 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | ||
104 | } | ||
105 | |||
106 | /* | 30 | /* |
107 | * RF chip defines. | 31 | * RF chip defines. |
108 | * | 32 | * |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a3ec97a4c744..a3e505034fce 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include "rt2x00.h" | 35 | #include "rt2x00.h" |
36 | #include "rt2x00usb.h" | 36 | #include "rt2x00usb.h" |
37 | #include "rt2800lib.h" | ||
37 | #include "rt2800usb.h" | 38 | #include "rt2800usb.h" |
38 | 39 | ||
39 | /* | 40 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.h b/drivers/net/wireless/rt2x00/rt2800usb.h index 0a525a722a74..7b1130a22c55 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.h +++ b/drivers/net/wireless/rt2x00/rt2800usb.h | |||
@@ -27,81 +27,6 @@ | |||
27 | #ifndef RT2800USB_H | 27 | #ifndef RT2800USB_H |
28 | #define RT2800USB_H | 28 | #define RT2800USB_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 u32 length); | ||
41 | void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, | ||
42 | const unsigned int offset, | ||
43 | const void *value, const u32 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 | |||
50 | static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, | ||
51 | const unsigned int offset, | ||
52 | u32 *value) | ||
53 | { | ||
54 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
55 | |||
56 | rt2800ops->register_read(rt2x00dev, offset, value); | ||
57 | } | ||
58 | |||
59 | static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, | ||
60 | const unsigned int offset, | ||
61 | u32 value) | ||
62 | { | ||
63 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
64 | |||
65 | rt2800ops->register_write(rt2x00dev, offset, value); | ||
66 | } | ||
67 | |||
68 | static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, | ||
69 | const unsigned int offset, | ||
70 | u32 value) | ||
71 | { | ||
72 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
73 | |||
74 | rt2800ops->register_write_lock(rt2x00dev, offset, value); | ||
75 | } | ||
76 | |||
77 | static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, | ||
78 | const unsigned int offset, | ||
79 | void *value, const u32 length) | ||
80 | { | ||
81 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
82 | |||
83 | rt2800ops->register_multiread(rt2x00dev, offset, value, length); | ||
84 | } | ||
85 | |||
86 | static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, | ||
87 | const unsigned int offset, | ||
88 | void *value, const u32 length) | ||
89 | { | ||
90 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
91 | |||
92 | rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); | ||
93 | } | ||
94 | |||
95 | static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, | ||
96 | const unsigned int offset, | ||
97 | struct rt2x00_field32 field, | ||
98 | u32 *reg) | ||
99 | { | ||
100 | const struct rt2800_ops *rt2800ops = rt2x00dev->priv; | ||
101 | |||
102 | return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); | ||
103 | } | ||
104 | |||
105 | /* | 30 | /* |
106 | * RF chip defines. | 31 | * RF chip defines. |
107 | * | 32 | * |