]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/staging/rtl8712/rtl8712_io.c
staging: rtl8712: braces should be used on all arms
[mirror_ubuntu-zesty-kernel.git] / drivers / staging / rtl8712 / rtl8712_io.c
1 /******************************************************************************
2 * rtl8712_io.c
3 *
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
22 *
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
26 *
27 ******************************************************************************/
28
29 #define _RTL8712_IO_C_
30
31 #include "osdep_service.h"
32 #include "drv_types.h"
33 #include "rtl871x_io.h"
34 #include "osdep_intf.h"
35 #include "usb_ops.h"
36
37 u8 r8712_read8(struct _adapter *adapter, u32 addr)
38 {
39 struct io_queue *pio_queue = adapter->pio_queue;
40 struct intf_hdl *pintfhdl = &(pio_queue->intf);
41 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
42
43 _read8 = pintfhdl->io_ops._read8;
44 return _read8(pintfhdl, addr);
45 }
46
47 u16 r8712_read16(struct _adapter *adapter, u32 addr)
48 {
49 struct io_queue *pio_queue = adapter->pio_queue;
50 struct intf_hdl *pintfhdl = &(pio_queue->intf);
51 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
52
53 _read16 = pintfhdl->io_ops._read16;
54 return _read16(pintfhdl, addr);
55 }
56
57 u32 r8712_read32(struct _adapter *adapter, u32 addr)
58 {
59 struct io_queue *pio_queue = adapter->pio_queue;
60 struct intf_hdl *pintfhdl = &(pio_queue->intf);
61 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
62
63 _read32 = pintfhdl->io_ops._read32;
64 return _read32(pintfhdl, addr);
65 }
66
67 void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
68 {
69 struct io_queue *pio_queue = adapter->pio_queue;
70 struct intf_hdl *pintfhdl = &(pio_queue->intf);
71 void (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
72
73 _write8 = pintfhdl->io_ops._write8;
74 _write8(pintfhdl, addr, val);
75 }
76
77 void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
78 {
79 struct io_queue *pio_queue = adapter->pio_queue;
80 struct intf_hdl *pintfhdl = &(pio_queue->intf);
81 void (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
82
83 _write16 = pintfhdl->io_ops._write16;
84 _write16(pintfhdl, addr, val);
85 }
86
87 void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
88 {
89 struct io_queue *pio_queue = adapter->pio_queue;
90 struct intf_hdl *pintfhdl = &(pio_queue->intf);
91
92 void (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
93
94 _write32 = pintfhdl->io_ops._write32;
95 _write32(pintfhdl, addr, val);
96 }
97
98 void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
99 {
100 struct io_queue *pio_queue = adapter->pio_queue;
101 struct intf_hdl *pintfhdl = &(pio_queue->intf);
102
103 void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
104 u8 *pmem);
105 if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
106 return;
107 _read_mem = pintfhdl->io_ops._read_mem;
108 _read_mem(pintfhdl, addr, cnt, pmem);
109 }
110
111 void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
112 {
113 struct io_queue *pio_queue = adapter->pio_queue;
114 struct intf_hdl *pintfhdl = &(pio_queue->intf);
115 void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
116 u8 *pmem);
117
118 _write_mem = pintfhdl->io_ops._write_mem;
119 _write_mem(pintfhdl, addr, cnt, pmem);
120 }
121
122 void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
123 {
124 struct io_queue *pio_queue = adapter->pio_queue;
125 struct intf_hdl *pintfhdl = &(pio_queue->intf);
126
127 u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
128 u8 *pmem);
129 if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
130 return;
131 _read_port = pintfhdl->io_ops._read_port;
132 _read_port(pintfhdl, addr, cnt, pmem);
133 }
134
135 void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
136 {
137 struct io_queue *pio_queue = adapter->pio_queue;
138 struct intf_hdl *pintfhdl = &(pio_queue->intf);
139
140 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
141 u8 *pmem);
142 _write_port = pintfhdl->io_ops._write_port;
143 _write_port(pintfhdl, addr, cnt, pmem);
144 }