Avoid beyond bounds copy while caching ACL
[zen-stable.git] / drivers / staging / rtl8712 / rtl8712_io.c
blobc7346008def097dc55c8f6cf17e075bbbf558f68
1 /******************************************************************************
2 * rtl8712_io.c
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
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.
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.
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
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
27 ******************************************************************************/
29 #define _RTL8712_IO_C_
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"
37 u8 r8712_read8(struct _adapter *adapter, u32 addr)
39 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
40 struct intf_hdl *pintfhdl = &(pio_queue->intf);
41 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
42 u8 r_val;
44 _read8 = pintfhdl->io_ops._read8;
45 r_val = _read8(pintfhdl, addr);
46 return r_val;
49 u16 r8712_read16(struct _adapter *adapter, u32 addr)
51 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
52 struct intf_hdl *pintfhdl = &(pio_queue->intf);
53 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
54 u16 r_val;
56 _read16 = pintfhdl->io_ops._read16;
57 r_val = _read16(pintfhdl, addr);
58 return r_val;
61 u32 r8712_read32(struct _adapter *adapter, u32 addr)
63 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
64 struct intf_hdl *pintfhdl = &(pio_queue->intf);
65 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
66 u32 r_val;
68 _read32 = pintfhdl->io_ops._read32;
69 r_val = _read32(pintfhdl, addr);
70 return r_val;
73 void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
75 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
76 struct intf_hdl *pintfhdl = &(pio_queue->intf);
77 void (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
79 _write8 = pintfhdl->io_ops._write8;
80 _write8(pintfhdl, addr, val);
83 void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
85 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
86 struct intf_hdl *pintfhdl = &(pio_queue->intf);
88 void (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
89 _write16 = pintfhdl->io_ops._write16;
90 _write16(pintfhdl, addr, val);
93 void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
95 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
96 struct intf_hdl *pintfhdl = (struct intf_hdl *)(&(pio_queue->intf));
98 void (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
99 _write32 = pintfhdl->io_ops._write32;
100 _write32(pintfhdl, addr, val);
103 void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
105 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
106 struct intf_hdl *pintfhdl = &(pio_queue->intf);
108 void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
109 u8 *pmem);
110 if ((adapter->bDriverStopped == true) ||
111 (adapter->bSurpriseRemoved == true))
112 return;
113 _read_mem = pintfhdl->io_ops._read_mem;
114 _read_mem(pintfhdl, addr, cnt, pmem);
117 void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
119 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
120 struct intf_hdl *pintfhdl = &(pio_queue->intf);
121 void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
122 u8 *pmem);
124 _write_mem = pintfhdl->io_ops._write_mem;
125 _write_mem(pintfhdl, addr, cnt, pmem);
128 void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
130 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
131 struct intf_hdl *pintfhdl = &(pio_queue->intf);
133 u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
134 u8 *pmem);
135 if ((adapter->bDriverStopped == true) ||
136 (adapter->bSurpriseRemoved == true))
137 return;
138 _read_port = pintfhdl->io_ops._read_port;
139 _read_port(pintfhdl, addr, cnt, pmem);
142 void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
144 struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue;
145 struct intf_hdl *pintfhdl = &(pio_queue->intf);
147 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
148 u8 *pmem);
149 _write_port = pintfhdl->io_ops._write_port;
150 _write_port(pintfhdl, addr, cnt, pmem);