OSDN Git Service

staging: rtl8723bs: update to the latest driver
[android-x86/kernel.git] / drivers / staging / rtl8723bs / core / rtw_io.c
index 18db671..aa5777d 100644 (file)
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  * more details.
  *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
  ******************************************************************************/
 /*
 
@@ -41,114 +36,105 @@ jackson@realtek.com.tw
 #define _RTW_IO_C_
 
 #include <drv_types.h>
+#include <rtw_debug.h>
 
-#define rtw_le16_to_cpu(val)           val
+#define rtw_le16_to_cpu(val)           val
 #define rtw_le32_to_cpu(val)           val
 #define rtw_cpu_to_le16(val)           val
 #define rtw_cpu_to_le32(val)           val
 
-u8 _rtw_read8(_adapter *adapter, u32 addr)
+u8 _rtw_read8(struct adapter *adapter, u32 addr)
 {
        u8 r_val;
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
        u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
-       _func_enter_;
+
        _read8 = pintfhdl->io_ops._read8;
 
        r_val = _read8(pintfhdl, addr);
-       _func_exit_;
        return r_val;
 }
 
-u16 _rtw_read16(_adapter *adapter, u32 addr)
+u16 _rtw_read16(struct adapter *adapter, u32 addr)
 {
        u16 r_val;
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
-       u16     (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
-       _func_enter_;
+       u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
+
        _read16 = pintfhdl->io_ops._read16;
 
        r_val = _read16(pintfhdl, addr);
-       _func_exit_;
        return rtw_le16_to_cpu(r_val);
 }
 
-u32 _rtw_read32(_adapter *adapter, u32 addr)
+u32 _rtw_read32(struct adapter *adapter, u32 addr)
 {
        u32 r_val;
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
-       u32     (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
-       _func_enter_;
+       u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
+
        _read32 = pintfhdl->io_ops._read32;
 
        r_val = _read32(pintfhdl, addr);
-       _func_exit_;
        return rtw_le32_to_cpu(r_val);
 
 }
 
-int _rtw_write8(_adapter *adapter, u32 addr, u8 val)
+int _rtw_write8(struct adapter *adapter, u32 addr, u8 val)
 {
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
        int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
        int ret;
-       _func_enter_;
+
        _write8 = pintfhdl->io_ops._write8;
 
        ret = _write8(pintfhdl, addr, val);
-       _func_exit_;
 
        return RTW_STATUS_CODE(ret);
 }
-int _rtw_write16(_adapter *adapter, u32 addr, u16 val)
+int _rtw_write16(struct adapter *adapter, u32 addr, u16 val)
 {
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
        int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
        int ret;
-       _func_enter_;
+
        _write16 = pintfhdl->io_ops._write16;
 
-       val = rtw_cpu_to_le16(val);
        ret = _write16(pintfhdl, addr, val);
-       _func_exit_;
-
        return RTW_STATUS_CODE(ret);
 }
-int _rtw_write32(_adapter *adapter, u32 addr, u32 val)
+int _rtw_write32(struct adapter *adapter, u32 addr, u32 val)
 {
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
+       /* struct       io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue; */
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
        int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
        int ret;
-       _func_enter_;
+
        _write32 = pintfhdl->io_ops._write32;
 
-       val = rtw_cpu_to_le32(val);
        ret = _write32(pintfhdl, addr, val);
-       _func_exit_;
 
        return RTW_STATUS_CODE(ret);
 }
 
-u8 _rtw_sd_f0_read8(_adapter *adapter, u32 addr)
+u8 _rtw_sd_f0_read8(struct adapter *adapter, u32 addr)
 {
        u8 r_val = 0x00;
        struct io_priv *pio_priv = &adapter->iopriv;
        struct intf_hdl *pintfhdl = &(pio_priv->intf);
        u8 (*_sd_f0_read8)(struct intf_hdl *pintfhdl, u32 addr);
 
-       _func_enter_;
        _sd_f0_read8 = pintfhdl->io_ops._sd_f0_read8;
 
        if (_sd_f0_read8)
@@ -156,32 +142,26 @@ u8 _rtw_sd_f0_read8(_adapter *adapter, u32 addr)
        else
                DBG_871X_LEVEL(_drv_warning_, FUNC_ADPT_FMT" _sd_f0_read8 callback is NULL\n", FUNC_ADPT_ARG(adapter));
 
-       _func_exit_;
        return r_val;
 }
 
-u32 _rtw_write_port(_adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
+u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
 {
        u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
-       //struct        io_queue        *pio_queue = (struct io_queue *)adapter->pio_queue;
        struct io_priv *pio_priv = &adapter->iopriv;
        struct  intf_hdl                *pintfhdl = &(pio_priv->intf);
        u32 ret = _SUCCESS;
 
-       _func_enter_;
-
        _write_port = pintfhdl->io_ops._write_port;
 
        ret = _write_port(pintfhdl, addr, cnt, pmem);
 
-        _func_exit_;
-
        return ret;
 }
 
-int rtw_init_io_priv(_adapter *padapter, void (*set_intf_ops)(_adapter *padapter,struct _io_ops *pops))
+int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops))
 {
-       struct io_priv  *piopriv = &padapter->iopriv;
+       struct io_priv *piopriv = &padapter->iopriv;
        struct intf_hdl *pintf = &piopriv->intf;
 
        if (set_intf_ops == NULL)
@@ -205,11 +185,11 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
 {
        int ret = false;
        int value;
-       if( (value=atomic_inc_return(&dvobj->continual_io_error)) > MAX_CONTINUAL_IO_ERR) {
+       if ((value =atomic_inc_return(&dvobj->continual_io_error)) > MAX_CONTINUAL_IO_ERR) {
                DBG_871X("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
                ret = true;
        } else {
-               //DBG_871X("[dvobj:%p] continual_io_error:%d\n", dvobj, value);
+               /* DBG_871X("[dvobj:%p] continual_io_error:%d\n", dvobj, value); */
        }
        return ret;
 }