aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2010-07-11 06:31:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-12 16:05:37 -0400
commite796643eaf0889c346e6b69c5afe777c327b1919 (patch)
tree7cdac8397bc37d7c6daa85d975e88bb828e5fde4
parentf31c9a8c1380e20e95d06925f2e42baf61af4db7 (diff)
rt2x00: Move driver callback functions into the ops structure
All callback functions are gathered in rt2x00dev->ops except for the callback functions which are used in rt2800lib to acces rt2800pci/usb. Move the priv pointer from rt2x00dev to rt2x00dev->ops and rename it to drv to make it obvious that it is the driver callback structure. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.h18
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c30
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c30
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h6
4 files changed, 36 insertions, 48 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h
index cecbd3abc35b..091641e3c5e2 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -50,7 +50,7 @@ static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
50 const unsigned int offset, 50 const unsigned int offset,
51 u32 *value) 51 u32 *value)
52{ 52{
53 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 53 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
54 54
55 rt2800ops->register_read(rt2x00dev, offset, value); 55 rt2800ops->register_read(rt2x00dev, offset, value);
56} 56}
@@ -59,7 +59,7 @@ static inline void rt2800_register_read_lock(struct rt2x00_dev *rt2x00dev,
59 const unsigned int offset, 59 const unsigned int offset,
60 u32 *value) 60 u32 *value)
61{ 61{
62 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 62 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
63 63
64 rt2800ops->register_read_lock(rt2x00dev, offset, value); 64 rt2800ops->register_read_lock(rt2x00dev, offset, value);
65} 65}
@@ -68,7 +68,7 @@ static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev,
68 const unsigned int offset, 68 const unsigned int offset,
69 u32 value) 69 u32 value)
70{ 70{
71 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 71 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
72 72
73 rt2800ops->register_write(rt2x00dev, offset, value); 73 rt2800ops->register_write(rt2x00dev, offset, value);
74} 74}
@@ -77,7 +77,7 @@ static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev,
77 const unsigned int offset, 77 const unsigned int offset,
78 u32 value) 78 u32 value)
79{ 79{
80 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 80 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
81 81
82 rt2800ops->register_write_lock(rt2x00dev, offset, value); 82 rt2800ops->register_write_lock(rt2x00dev, offset, value);
83} 83}
@@ -86,7 +86,7 @@ static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev,
86 const unsigned int offset, 86 const unsigned int offset,
87 void *value, const u32 length) 87 void *value, const u32 length)
88{ 88{
89 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 89 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
90 90
91 rt2800ops->register_multiread(rt2x00dev, offset, value, length); 91 rt2800ops->register_multiread(rt2x00dev, offset, value, length);
92} 92}
@@ -96,7 +96,7 @@ static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev,
96 const void *value, 96 const void *value,
97 const u32 length) 97 const u32 length)
98{ 98{
99 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 99 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
100 100
101 rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); 101 rt2800ops->register_multiwrite(rt2x00dev, offset, value, length);
102} 102}
@@ -106,7 +106,7 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
106 const struct rt2x00_field32 field, 106 const struct rt2x00_field32 field,
107 u32 *reg) 107 u32 *reg)
108{ 108{
109 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 109 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
110 110
111 return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); 111 return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg);
112} 112}
@@ -114,14 +114,14 @@ static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev,
114static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev, 114static inline int rt2800_drv_write_firmware(struct rt2x00_dev *rt2x00dev,
115 const u8 *data, const size_t len) 115 const u8 *data, const size_t len)
116{ 116{
117 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 117 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
118 118
119 return rt2800ops->drv_write_firmware(rt2x00dev, data, len); 119 return rt2800ops->drv_write_firmware(rt2x00dev, data, len);
120} 120}
121 121
122static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev) 122static inline int rt2800_drv_init_registers(struct rt2x00_dev *rt2x00dev)
123{ 123{
124 const struct rt2800_ops *rt2800ops = rt2x00dev->priv; 124 const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
125 125
126 return rt2800ops->drv_init_registers(rt2x00dev); 126 return rt2800ops->drv_init_registers(rt2x00dev);
127} 127}
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 0fdd58b9dece..39b3846fa340 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -926,27 +926,10 @@ static int rt2800pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
926 return rt2800_validate_eeprom(rt2x00dev); 926 return rt2800_validate_eeprom(rt2x00dev);
927} 927}
928 928
929static const struct rt2800_ops rt2800pci_rt2800_ops = {
930 .register_read = rt2x00pci_register_read,
931 .register_read_lock = rt2x00pci_register_read, /* same for PCI */
932 .register_write = rt2x00pci_register_write,
933 .register_write_lock = rt2x00pci_register_write, /* same for PCI */
934
935 .register_multiread = rt2x00pci_register_multiread,
936 .register_multiwrite = rt2x00pci_register_multiwrite,
937
938 .regbusy_read = rt2x00pci_regbusy_read,
939
940 .drv_write_firmware = rt2800pci_write_firmware,
941 .drv_init_registers = rt2800pci_init_registers,
942};
943
944static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) 929static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
945{ 930{
946 int retval; 931 int retval;
947 932
948 rt2x00dev->priv = (void *)&rt2800pci_rt2800_ops;
949
950 /* 933 /*
951 * Allocate eeprom data. 934 * Allocate eeprom data.
952 */ 935 */
@@ -1018,6 +1001,18 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = {
1018 .ampdu_action = rt2800_ampdu_action, 1001 .ampdu_action = rt2800_ampdu_action,
1019}; 1002};
1020 1003
1004static const struct rt2800_ops rt2800pci_rt2800_ops = {
1005 .register_read = rt2x00pci_register_read,
1006 .register_read_lock = rt2x00pci_register_read, /* same for PCI */
1007 .register_write = rt2x00pci_register_write,
1008 .register_write_lock = rt2x00pci_register_write, /* same for PCI */
1009 .register_multiread = rt2x00pci_register_multiread,
1010 .register_multiwrite = rt2x00pci_register_multiwrite,
1011 .regbusy_read = rt2x00pci_regbusy_read,
1012 .drv_write_firmware = rt2800pci_write_firmware,
1013 .drv_init_registers = rt2800pci_init_registers,
1014};
1015
1021static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { 1016static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
1022 .irq_handler = rt2800pci_interrupt, 1017 .irq_handler = rt2800pci_interrupt,
1023 .irq_handler_thread = rt2800pci_interrupt_thread, 1018 .irq_handler_thread = rt2800pci_interrupt_thread,
@@ -1082,6 +1077,7 @@ static const struct rt2x00_ops rt2800pci_ops = {
1082 .tx = &rt2800pci_queue_tx, 1077 .tx = &rt2800pci_queue_tx,
1083 .bcn = &rt2800pci_queue_bcn, 1078 .bcn = &rt2800pci_queue_bcn,
1084 .lib = &rt2800pci_rt2x00_ops, 1079 .lib = &rt2800pci_rt2x00_ops,
1080 .drv = &rt2800pci_rt2800_ops,
1085 .hw = &rt2800pci_mac80211_ops, 1081 .hw = &rt2800pci_mac80211_ops,
1086#ifdef CONFIG_RT2X00_LIB_DEBUGFS 1082#ifdef CONFIG_RT2X00_LIB_DEBUGFS
1087 .debugfs = &rt2800_rt2x00debug, 1083 .debugfs = &rt2800_rt2x00debug,
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 7b8d51f58038..5a2dfe87c6b6 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -470,27 +470,10 @@ static int rt2800usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)
470 return rt2800_validate_eeprom(rt2x00dev); 470 return rt2800_validate_eeprom(rt2x00dev);
471} 471}
472 472
473static const struct rt2800_ops rt2800usb_rt2800_ops = {
474 .register_read = rt2x00usb_register_read,
475 .register_read_lock = rt2x00usb_register_read_lock,
476 .register_write = rt2x00usb_register_write,
477 .register_write_lock = rt2x00usb_register_write_lock,
478
479 .register_multiread = rt2x00usb_register_multiread,
480 .register_multiwrite = rt2x00usb_register_multiwrite,
481
482 .regbusy_read = rt2x00usb_regbusy_read,
483
484 .drv_write_firmware = rt2800usb_write_firmware,
485 .drv_init_registers = rt2800usb_init_registers,
486};
487
488static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) 473static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
489{ 474{
490 int retval; 475 int retval;
491 476
492 rt2x00dev->priv = (void *)&rt2800usb_rt2800_ops;
493
494 /* 477 /*
495 * Allocate eeprom data. 478 * Allocate eeprom data.
496 */ 479 */
@@ -556,6 +539,18 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = {
556 .ampdu_action = rt2800_ampdu_action, 539 .ampdu_action = rt2800_ampdu_action,
557}; 540};
558 541
542static const struct rt2800_ops rt2800usb_rt2800_ops = {
543 .register_read = rt2x00usb_register_read,
544 .register_read_lock = rt2x00usb_register_read_lock,
545 .register_write = rt2x00usb_register_write,
546 .register_write_lock = rt2x00usb_register_write_lock,
547 .register_multiread = rt2x00usb_register_multiread,
548 .register_multiwrite = rt2x00usb_register_multiwrite,
549 .regbusy_read = rt2x00usb_regbusy_read,
550 .drv_write_firmware = rt2800usb_write_firmware,
551 .drv_init_registers = rt2800usb_init_registers,
552};
553
559static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { 554static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
560 .probe_hw = rt2800usb_probe_hw, 555 .probe_hw = rt2800usb_probe_hw,
561 .get_firmware_name = rt2800usb_get_firmware_name, 556 .get_firmware_name = rt2800usb_get_firmware_name,
@@ -619,6 +614,7 @@ static const struct rt2x00_ops rt2800usb_ops = {
619 .tx = &rt2800usb_queue_tx, 614 .tx = &rt2800usb_queue_tx,
620 .bcn = &rt2800usb_queue_bcn, 615 .bcn = &rt2800usb_queue_bcn,
621 .lib = &rt2800usb_rt2x00_ops, 616 .lib = &rt2800usb_rt2x00_ops,
617 .drv = &rt2800usb_rt2800_ops,
622 .hw = &rt2800usb_mac80211_ops, 618 .hw = &rt2800usb_mac80211_ops,
623#ifdef CONFIG_RT2X00_LIB_DEBUGFS 619#ifdef CONFIG_RT2X00_LIB_DEBUGFS
624 .debugfs = &rt2800_rt2x00debug, 620 .debugfs = &rt2800_rt2x00debug,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 9dd0d171abf1..c21af38cc5af 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -621,6 +621,7 @@ struct rt2x00_ops {
621 const struct data_queue_desc *bcn; 621 const struct data_queue_desc *bcn;
622 const struct data_queue_desc *atim; 622 const struct data_queue_desc *atim;
623 const struct rt2x00lib_ops *lib; 623 const struct rt2x00lib_ops *lib;
624 const void *drv;
624 const struct ieee80211_ops *hw; 625 const struct ieee80211_ops *hw;
625#ifdef CONFIG_RT2X00_LIB_DEBUGFS 626#ifdef CONFIG_RT2X00_LIB_DEBUGFS
626 const struct rt2x00debug *debugfs; 627 const struct rt2x00debug *debugfs;
@@ -881,11 +882,6 @@ struct rt2x00_dev {
881 * and interrupt thread routine. 882 * and interrupt thread routine.
882 */ 883 */
883 u32 irqvalue[2]; 884 u32 irqvalue[2];
884
885 /*
886 * Driver specific data.
887 */
888 void *priv;
889}; 885};
890 886
891/* 887/*