summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2014-08-18 07:31:14 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-08-18 07:31:14 +1000
commitd774151535f69197fa10a21aac2be523c5781f35 (patch)
tree791bae1e8f284aa40a10cbb01c01190323d5d316 /drivers
parent71d78a9b021b02f073b27c0b1848c7ae1aa64036 (diff)
parented7f92da59f24dd966555efef978fe14085b3318 (diff)
Merge remote-tracking branch 'staging/staging-next'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/android/ion/ion.c2
-rw-r--r--drivers/staging/android/ion/ion_carveout_heap.c1
-rw-r--r--drivers/staging/android/ion/ion_chunk_heap.c1
-rw-r--r--drivers/staging/android/ion/ion_dummy_driver.c4
-rw-r--r--drivers/staging/android/ion/ion_system_heap.c1
-rw-r--r--drivers/staging/android/sw_sync.c2
-rw-r--r--drivers/staging/android/uapi/binder.h2
-rw-r--r--drivers/staging/bcm/Bcmchar.c537
-rw-r--r--drivers/staging/bcm/vendorspecificextn.c19
-rw-r--r--drivers/staging/comedi/Kconfig11
-rw-r--r--drivers/staging/comedi/drivers/8255.c198
-rw-r--r--drivers/staging/comedi/drivers/8255.h31
-rw-r--r--drivers/staging/comedi/drivers/8255_pci.c29
-rw-r--r--drivers/staging/comedi/drivers/Makefile1
-rw-r--r--drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c158
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_1564.c20
-rw-r--r--drivers/staging/comedi/drivers/adv_pci_dio.c4
-rw-r--r--drivers/staging/comedi/drivers/aio_aio12_8.c3
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c121
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.h34
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200_common.c414
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200_pci.c162
-rw-r--r--drivers/staging/comedi/drivers/amplc_pc236_common.c2
-rw-r--r--drivers/staging/comedi/drivers/amplc_pci224.c661
-rw-r--r--drivers/staging/comedi/drivers/amplc_pci230.c162
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas.c10
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas64.c29
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidda.c27
-rw-r--r--drivers/staging/comedi/drivers/cb_pcimdas.c16
-rw-r--r--drivers/staging/comedi/drivers/cb_pcimdda.c3
-rw-r--r--drivers/staging/comedi/drivers/comedi_test.c8
-rw-r--r--drivers/staging/comedi/drivers/daqboard2000.c13
-rw-r--r--drivers/staging/comedi/drivers/das08.c3
-rw-r--r--drivers/staging/comedi/drivers/das16.c3
-rw-r--r--drivers/staging/comedi/drivers/das16m1.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_atmio16d.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_daq_dio24.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c18
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c12
-rw-r--r--drivers/staging/comedi/drivers/ni_usb6501.c425
-rw-r--r--drivers/staging/comedi/drivers/pcl724.c10
-rw-r--r--drivers/staging/comedi/drivers/pcm3724.c27
-rw-r--r--drivers/staging/dgap/dgap.c561
-rw-r--r--drivers/staging/dgap/dgap.h6
-rw-r--r--drivers/staging/dgnc/Makefile3
-rw-r--r--drivers/staging/dgnc/TODO5
-rw-r--r--drivers/staging/dgnc/dgnc_cls.c9
-rw-r--r--drivers/staging/dgnc/dgnc_driver.c304
-rw-r--r--drivers/staging/dgnc/dgnc_driver.h13
-rw-r--r--drivers/staging/dgnc/dgnc_neo.c17
-rw-r--r--drivers/staging/dgnc/dgnc_sysfs.c19
-rw-r--r--drivers/staging/dgnc/dgnc_tty.c17
-rw-r--r--drivers/staging/dgnc/dgnc_utils.c70
-rw-r--r--drivers/staging/dgnc/dgnc_utils.h7
-rw-r--r--drivers/staging/imx-drm/imx-drm-core.c5
-rw-r--r--drivers/staging/imx-drm/imx-tve.c2
-rw-r--r--drivers/staging/imx-drm/parallel-display.c2
-rw-r--r--drivers/staging/lustre/lnet/lnet/config.c59
-rw-r--r--drivers/staging/lustre/lustre/fid/fid_request.c6
-rw-r--r--drivers/staging/lustre/lustre/fld/fld_cache.c16
-rw-r--r--drivers/staging/lustre/lustre/fld/fld_internal.h2
-rw-r--r--drivers/staging/lustre/lustre/fld/fld_request.c9
-rw-r--r--drivers/staging/lustre/lustre/include/cl_object.h4
-rw-r--r--drivers/staging/lustre/lustre/include/lclient.h2
-rw-r--r--drivers/staging/lustre/lustre/include/linux/obd_class.h6
-rw-r--r--drivers/staging/lustre/lustre/include/lu_object.h6
-rw-r--r--drivers/staging/lustre/lustre/include/lustre/lustre_idl.h124
-rw-r--r--drivers/staging/lustre/lustre/include/lustre/lustre_user.h23
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_fid.h2
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_fld.h5
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_lib.h8
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_lite.h2
-rw-r--r--drivers/staging/lustre/lustre/include/md_object.h2
-rw-r--r--drivers/staging/lustre/lustre/include/obd.h50
-rw-r--r--drivers/staging/lustre/lustre/include/obd_cksum.h6
-rw-r--r--drivers/staging/lustre/lustre/include/obd_class.h24
-rw-r--r--drivers/staging/lustre/lustre/include/obd_ost.h2
-rw-r--r--drivers/staging/lustre/lustre/include/obd_support.h1
-rw-r--r--drivers/staging/lustre/lustre/lclient/lcommon_cl.c4
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lock.c50
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_request.c15
-rw-r--r--drivers/staging/lustre/lustre/libcfs/debug.c11
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c4
-rw-r--r--drivers/staging/lustre/lustre/llite/file.c48
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_internal.h10
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_lib.c2
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_mmap.c8
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_rmtacl.c2
-rw-r--r--drivers/staging/lustre/lustre/llite/lloop.c2
-rw-r--r--drivers/staging/lustre/lustre/llite/remote_perm.c2
-rw-r--r--drivers/staging/lustre/lustre/llite/vvp_io.c1
-rw-r--r--drivers/staging/lustre/lustre/lmv/lmv_fld.c2
-rw-r--r--drivers/staging/lustre/lustre/lmv/lmv_internal.h10
-rw-r--r--drivers/staging/lustre/lustre/lmv/lmv_obd.c16
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_cl_internal.h4
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_ea.c8
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_internal.h28
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_io.c8
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_lock.c24
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_merge.c14
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_obd.c44
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_offset.c29
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_pack.c4
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_page.c2
-rw-r--r--drivers/staging/lustre/lustre/lov/lov_request.c18
-rw-r--r--drivers/staging/lustre/lustre/lov/lovsub_dev.c2
-rw-r--r--drivers/staging/lustre/lustre/mdc/lproc_mdc.c10
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_internal.h4
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_lib.c48
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_locks.c71
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_reint.c8
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_request.c97
-rw-r--r--drivers/staging/lustre/lustre/mgc/mgc_request.c4
-rw-r--r--drivers/staging/lustre/lustre/obdclass/cl_io.c9
-rw-r--r--drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c8
-rw-r--r--drivers/staging/lustre/lustre/obdclass/llog_swab.c52
-rw-r--r--drivers/staging/lustre/lustre/obdclass/local_storage.c2
-rw-r--r--drivers/staging/lustre/lustre/obdclass/obdo.c12
-rw-r--r--drivers/staging/lustre/lustre/obdecho/echo.c21
-rw-r--r--drivers/staging/lustre/lustre/obdecho/echo_client.c58
-rw-r--r--drivers/staging/lustre/lustre/osc/lproc_osc.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_cache.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_cl_internal.h2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_internal.h6
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_io.c2
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_quota.c8
-rw-r--r--drivers/staging/lustre/lustre/osc/osc_request.c46
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/client.c14
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/connection.c2
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/import.c15
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/layout.c4
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/pack_generic.c6
-rw-r--r--drivers/staging/mt29f_spinand/mt29f_spinand.c26
-rw-r--r--drivers/staging/nokia_h4p/nokia_core.c2
-rw-r--r--drivers/staging/nokia_h4p/nokia_fw.c2
-rw-r--r--drivers/staging/ozwpan/ozcdev.c31
-rw-r--r--drivers/staging/ozwpan/ozeltbuf.c129
-rw-r--r--drivers/staging/ozwpan/ozeltbuf.h7
-rw-r--r--drivers/staging/ozwpan/ozhcd.c166
-rw-r--r--drivers/staging/ozwpan/ozmain.c4
-rw-r--r--drivers/staging/ozwpan/ozpd.c305
-rw-r--r--drivers/staging/ozwpan/ozpd.h9
-rw-r--r--drivers/staging/ozwpan/ozproto.c36
-rw-r--r--drivers/staging/ozwpan/ozproto.h8
-rw-r--r--drivers/staging/ozwpan/ozprotocol.h2
-rw-r--r--drivers/staging/ozwpan/ozusbsvc.c30
-rw-r--r--drivers/staging/ozwpan/ozusbsvc1.c12
-rw-r--r--drivers/staging/rtl8188eu/Makefile2
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_efuse.c2
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_iol.c164
-rw-r--r--drivers/staging/rtl8188eu/hal/HalHWImg8188E_BB.c474
-rw-r--r--drivers/staging/rtl8188eu/hal/HalHWImg8188E_MAC.c120
-rw-r--r--drivers/staging/rtl8188eu/hal/HalHWImg8188E_RF.c269
-rw-r--r--drivers/staging/rtl8188eu/hal/fw.c236
-rw-r--r--drivers/staging/rtl8188eu/hal/hal_intf.c10
-rw-r--r--drivers/staging/rtl8188eu/hal/odm_HWConfig.c36
-rw-r--r--drivers/staging/rtl8188eu/hal/odm_RegConfig8188E.c138
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c371
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c277
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188e_rf6052.c96
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c1
-rw-r--r--drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c25
-rw-r--r--drivers/staging/rtl8188eu/hal/usb_halinit.c39
-rw-r--r--drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h14
-rw-r--r--drivers/staging/rtl8188eu/include/HalHWImg8188E_BB.h44
-rw-r--r--drivers/staging/rtl8188eu/include/HalHWImg8188E_MAC.h30
-rw-r--r--drivers/staging/rtl8188eu/include/HalHWImg8188E_RF.h30
-rw-r--r--drivers/staging/rtl8188eu/include/drv_types.h7
-rw-r--r--drivers/staging/rtl8188eu/include/fw.h59
-rw-r--r--drivers/staging/rtl8188eu/include/hal_intf.h7
-rw-r--r--drivers/staging/rtl8188eu/include/odm_HWConfig.h6
-rw-r--r--drivers/staging/rtl8188eu/include/odm_RegConfig8188E.h43
-rw-r--r--drivers/staging/rtl8188eu/include/odm_precomp.h5
-rw-r--r--drivers/staging/rtl8188eu/include/phy.h3
-rw-r--r--drivers/staging/rtl8188eu/include/rtl8188e_hal.h48
-rw-r--r--drivers/staging/rtl8188eu/include/rtl8188e_rf.h1
-rw-r--r--drivers/staging/rtl8188eu/include/rtw_efuse.h1
-rw-r--r--drivers/staging/rtl8188eu/include/rtw_iol.h54
-rw-r--r--drivers/staging/rtl8188eu/os_dep/os_intfs.c7
-rw-r--r--drivers/staging/rtl8192ee/base.c76
-rw-r--r--drivers/staging/rtl8192ee/btcoexist/rtl_btc.c9
-rw-r--r--drivers/staging/rtl8192ee/cam.c75
-rw-r--r--drivers/staging/rtl8192ee/core.c154
-rw-r--r--drivers/staging/rtl8192ee/debug.c88
-rw-r--r--drivers/staging/rtl8192ee/debug.h20
-rw-r--r--drivers/staging/rtl8192ee/efuse.c29
-rw-r--r--drivers/staging/rtl8192ee/pci.c223
-rw-r--r--drivers/staging/rtl8192ee/ps.c61
-rw-r--r--drivers/staging/rtl8192ee/rc.c2
-rw-r--r--drivers/staging/rtl8192ee/regd.c12
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/dm.c46
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/fw.c128
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/hw.c180
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/led.c16
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/phy.c279
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/pwrseqcmd.c31
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/rf.c10
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/sw.c9
-rw-r--r--drivers/staging/rtl8192ee/rtl8192ee/trx.c26
-rw-r--r--drivers/staging/rtl8192u/Makefile3
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211.h4
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c504
-rw-r--r--drivers/staging/rtl8192u/r8192U_wx.c3
-rw-r--r--drivers/staging/rtl8192u/r819xU_phyreg.h189
-rw-r--r--drivers/staging/rtl8723au/core/rtw_efuse.c34
-rw-r--r--drivers/staging/rtl8821ae/pci.c6
-rw-r--r--drivers/staging/rts5208/Kconfig7
-rw-r--r--drivers/staging/rts5208/ms.c5
-rw-r--r--drivers/staging/rts5208/rtsx_chip.c6
-rw-r--r--drivers/staging/rts5208/rtsx_scsi.c7
-rw-r--r--drivers/staging/rts5208/sd.c11
-rw-r--r--drivers/staging/rts5208/trace.h8
-rw-r--r--drivers/staging/slicoss/slicoss.c2
-rw-r--r--drivers/staging/unisys/channels/channel.c12
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/channel.h43
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/controlframework.h2
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h4
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/diagchannel.h2
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/iochannel.h43
-rw-r--r--drivers/staging/unisys/common-spar/include/channels/vbuschannel.h1
-rw-r--r--drivers/staging/unisys/common-spar/include/controlvmcompletionstatus.h16
-rw-r--r--drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h30
-rw-r--r--drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h3
-rw-r--r--drivers/staging/unisys/include/commontypes.h72
-rw-r--r--drivers/staging/unisys/include/timskmod.h54
-rw-r--r--drivers/staging/unisys/include/uisqueue.h15
-rw-r--r--drivers/staging/unisys/include/uisutils.h2
-rw-r--r--drivers/staging/unisys/uislib/uislib.c19
-rw-r--r--drivers/staging/unisys/uislib/uisqueue.c6
-rw-r--r--drivers/staging/unisys/uislib/uisutils.c8
-rw-r--r--drivers/staging/unisys/virtpci/virtpci.c4
-rw-r--r--drivers/staging/unisys/visorchannel/visorchannel.h1
-rw-r--r--drivers/staging/unisys/visorchannel/visorchannel_funcs.c4
-rw-r--r--drivers/staging/unisys/visorchipset/file.c2
-rw-r--r--drivers/staging/unisys/visorchipset/visorchipset_main.c16
-rw-r--r--drivers/staging/vt6655/80211mgr.c41
-rw-r--r--drivers/staging/vt6655/80211mgr.h6
-rw-r--r--drivers/staging/vt6655/baseband.c92
-rw-r--r--drivers/staging/vt6655/baseband.h17
-rw-r--r--drivers/staging/vt6655/bssdb.c99
-rw-r--r--drivers/staging/vt6655/bssdb.h8
-rw-r--r--drivers/staging/vt6655/card.c290
-rw-r--r--drivers/staging/vt6655/card.h91
-rw-r--r--drivers/staging/vt6655/channel.c17
-rw-r--r--drivers/staging/vt6655/datarate.c15
-rw-r--r--drivers/staging/vt6655/desc.h11
-rw-r--r--drivers/staging/vt6655/device.h30
-rw-r--r--drivers/staging/vt6655/device_main.c399
-rw-r--r--drivers/staging/vt6655/dpc.c161
-rw-r--r--drivers/staging/vt6655/dpc.h2
-rw-r--r--drivers/staging/vt6655/hostap.c146
-rw-r--r--drivers/staging/vt6655/hostap.h4
-rw-r--r--drivers/staging/vt6655/ioctl.c84
-rw-r--r--drivers/staging/vt6655/ioctl.h2
-rw-r--r--drivers/staging/vt6655/iowpa.h4
-rw-r--r--drivers/staging/vt6655/iwctl.c162
-rw-r--r--drivers/staging/vt6655/key.c144
-rw-r--r--drivers/staging/vt6655/key.h8
-rw-r--r--drivers/staging/vt6655/mac.c65
-rw-r--r--drivers/staging/vt6655/mib.c54
-rw-r--r--drivers/staging/vt6655/power.c28
-rw-r--r--drivers/staging/vt6655/rf.c8
-rw-r--r--drivers/staging/vt6655/rf.h8
-rw-r--r--drivers/staging/vt6655/rxtx.c247
-rw-r--r--drivers/staging/vt6655/rxtx.h39
-rw-r--r--drivers/staging/vt6655/ttype.h27
-rw-r--r--drivers/staging/vt6655/upc.h39
-rw-r--r--drivers/staging/vt6655/wcmd.c143
-rw-r--r--drivers/staging/vt6655/wcmd.h3
-rw-r--r--drivers/staging/vt6655/wctl.c8
-rw-r--r--drivers/staging/vt6655/wctl.h6
-rw-r--r--drivers/staging/vt6655/wmgr.c366
-rw-r--r--drivers/staging/vt6655/wmgr.h2
-rw-r--r--drivers/staging/vt6655/wpa.c28
-rw-r--r--drivers/staging/vt6655/wpa2.c20
-rw-r--r--drivers/staging/vt6655/wpactl.c118
-rw-r--r--drivers/staging/vt6655/wpactl.h6
-rw-r--r--drivers/staging/vt6655/wroute.c14
-rw-r--r--drivers/staging/vt6655/wroute.h3
-rw-r--r--drivers/staging/vt6656/rxtx.c3
-rw-r--r--drivers/staging/vt6656/usbpipe.c5
-rw-r--r--drivers/staging/wlan-ng/prism2fw.c93
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.c19
283 files changed, 6067 insertions, 8602 deletions
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 270360912b2c..56604f41ec48 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -805,6 +805,7 @@ struct ion_client *ion_client_create(struct ion_device *dev,
client, &debug_client_fops);
if (!client->debug_root) {
char buf[256], *path;
+
path = dentry_path(dev->clients_debug_root, buf, 256);
pr_err("Failed to create client debugfs at %s/%s\n",
path, client->display_name);
@@ -1056,7 +1057,6 @@ static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, unsigned long offset)
static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
void *ptr)
{
- return;
}
static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf, size_t start,
diff --git a/drivers/staging/android/ion/ion_carveout_heap.c b/drivers/staging/android/ion/ion_carveout_heap.c
index dcb6f2196c87..9156d8238c97 100644
--- a/drivers/staging/android/ion/ion_carveout_heap.c
+++ b/drivers/staging/android/ion/ion_carveout_heap.c
@@ -133,7 +133,6 @@ static struct sg_table *ion_carveout_heap_map_dma(struct ion_heap *heap,
static void ion_carveout_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
{
- return;
}
static struct ion_heap_ops carveout_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_chunk_heap.c b/drivers/staging/android/ion/ion_chunk_heap.c
index 9c3e49aa204b..3e6ec2ee6802 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -126,7 +126,6 @@ static struct sg_table *ion_chunk_heap_map_dma(struct ion_heap *heap,
static void ion_chunk_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
{
- return;
}
static struct ion_heap_ops chunk_heap_ops = {
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c b/drivers/staging/android/ion/ion_dummy_driver.c
index 3a45e79fe444..f3ea1c31e533 100644
--- a/drivers/staging/android/ion/ion_dummy_driver.c
+++ b/drivers/staging/android/ion/ion_dummy_driver.c
@@ -68,7 +68,7 @@ static int __init ion_dummy_init(void)
int i, err;
idev = ion_device_create(NULL);
- heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
+ heaps = kcalloc(dummy_ion_pdata.nr, sizeof(struct ion_heap *),
GFP_KERNEL);
if (!heaps)
return -ENOMEM;
@@ -152,7 +152,5 @@ static void __exit ion_dummy_exit(void)
dummy_heaps[ION_HEAP_TYPE_CHUNK].size);
chunk_ptr = NULL;
}
-
- return;
}
__exitcall(ion_dummy_exit);
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
index 6b77c5195b4d..da2a63c0a9ba 100644
--- a/drivers/staging/android/ion/ion_system_heap.c
+++ b/drivers/staging/android/ion/ion_system_heap.c
@@ -205,7 +205,6 @@ static struct sg_table *ion_system_heap_map_dma(struct ion_heap *heap,
static void ion_system_heap_unmap_dma(struct ion_heap *heap,
struct ion_buffer *buffer)
{
- return;
}
static int ion_system_heap_shrink(struct ion_heap *heap, gfp_t gfp_mask,
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index a76db3ff87cb..863d4b17387a 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -97,6 +97,7 @@ static void sw_sync_pt_value_str(struct sync_pt *sync_pt,
char *str, int size)
{
struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+
snprintf(str, size, "%d", pt->value);
}
@@ -156,6 +157,7 @@ static int sw_sync_open(struct inode *inode, struct file *file)
static int sw_sync_release(struct inode *inode, struct file *file)
{
struct sw_sync_timeline *obj = file->private_data;
+
sync_timeline_destroy(&obj->obj);
return 0;
}
diff --git a/drivers/staging/android/uapi/binder.h b/drivers/staging/android/uapi/binder.h
index 904adb7600cf..dba4cef3a8d3 100644
--- a/drivers/staging/android/uapi/binder.h
+++ b/drivers/staging/android/uapi/binder.h
@@ -169,7 +169,7 @@ struct binder_ptr_cookie {
struct binder_handle_cookie {
__u32 handle;
binder_uintptr_t cookie;
-} __attribute__((packed));
+} __packed;
struct binder_pri_desc {
__s32 priority;
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index c1e01f7d64ba..8b23ec947fd0 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -2,45 +2,46 @@
#include "headers.h"
-static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter,
- PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite)
+static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *ad,
+ PUCHAR read_data,
+ struct bcm_nvm_readwrite *nvm_rw)
{
- INT Status = STATUS_FAILURE;
+ INT status = STATUS_FAILURE;
- down(&Adapter->NVMRdmWrmLock);
+ down(&ad->NVMRdmWrmLock);
- if ((Adapter->IdleMode == TRUE) || (Adapter->bShutStatus == TRUE) ||
- (Adapter->bPreparingForLowPowerMode == TRUE)) {
+ if ((ad->IdleMode == TRUE) || (ad->bShutStatus == TRUE) ||
+ (ad->bPreparingForLowPowerMode == TRUE)) {
- BCM_DEBUG_PRINT(Adapter,
+ BCM_DEBUG_PRINT(ad,
DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"Device is in Idle/Shutdown Mode\n");
- up(&Adapter->NVMRdmWrmLock);
- kfree(pReadData);
+ up(&ad->NVMRdmWrmLock);
+ kfree(read_data);
return -EACCES;
}
- Status = BeceemNVMRead(Adapter, (PUINT)pReadData,
- stNVMReadWrite->uiOffset,
- stNVMReadWrite->uiNumBytes);
- up(&Adapter->NVMRdmWrmLock);
+ status = BeceemNVMRead(ad, (PUINT)read_data,
+ nvm_rw->uiOffset,
+ nvm_rw->uiNumBytes);
+ up(&ad->NVMRdmWrmLock);
- if (Status != STATUS_SUCCESS) {
- kfree(pReadData);
- return Status;
+ if (status != STATUS_SUCCESS) {
+ kfree(read_data);
+ return status;
}
- if (copy_to_user(stNVMReadWrite->pBuffer, pReadData,
- stNVMReadWrite->uiNumBytes)) {
- kfree(pReadData);
+ if (copy_to_user(nvm_rw->pBuffer, read_data, nvm_rw->uiNumBytes)) {
+ kfree(read_data);
return -EFAULT;
}
return STATUS_SUCCESS;
}
-static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter,
- PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite)
+static int handle_flash2x_adapter(struct bcm_mini_adapter *ad,
+ PUCHAR read_data,
+ struct bcm_nvm_readwrite *nvm_rw)
{
/*
* New Requirement:-
@@ -57,33 +58,33 @@ static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter,
* if DSD sig is corrupted, DSD data won't be
* considered valid.
*/
- INT Status;
- ULONG ulDSDMagicNumInUsrBuff = 0;
+ INT status;
+ ULONG dsd_magic_num_in_usr_buff = 0;
- Status = BcmFlash2xCorruptSig(Adapter, Adapter->eActiveDSD);
- if (Status == STATUS_SUCCESS)
+ status = BcmFlash2xCorruptSig(ad, ad->eActiveDSD);
+ if (status == STATUS_SUCCESS)
return STATUS_SUCCESS;
- if (((stNVMReadWrite->uiOffset + stNVMReadWrite->uiNumBytes) !=
- Adapter->uiNVMDSDSize) ||
- (stNVMReadWrite->uiNumBytes < SIGNATURE_SIZE)) {
+ if (((nvm_rw->uiOffset + nvm_rw->uiNumBytes) !=
+ ad->uiNVMDSDSize) ||
+ (nvm_rw->uiNumBytes < SIGNATURE_SIZE)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"DSD Sig is present neither in Flash nor User provided Input..");
- up(&Adapter->NVMRdmWrmLock);
- kfree(pReadData);
- return Status;
+ up(&ad->NVMRdmWrmLock);
+ kfree(read_data);
+ return status;
}
- ulDSDMagicNumInUsrBuff =
- ntohl(*(PUINT)(pReadData + stNVMReadWrite->uiNumBytes -
+ dsd_magic_num_in_usr_buff =
+ ntohl(*(PUINT)(read_data + nvm_rw->uiNumBytes -
SIGNATURE_SIZE));
- if (ulDSDMagicNumInUsrBuff != DSD_IMAGE_MAGIC_NUMBER) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ if (dsd_magic_num_in_usr_buff != DSD_IMAGE_MAGIC_NUMBER) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"DSD Sig is present neither in Flash nor User provided Input..");
- up(&Adapter->NVMRdmWrmLock);
- kfree(pReadData);
- return Status;
+ up(&ad->NVMRdmWrmLock);
+ kfree(read_data);
+ return status;
}
return STATUS_SUCCESS;
@@ -103,27 +104,27 @@ static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter,
static int bcm_char_open(struct inode *inode, struct file *filp)
{
- struct bcm_mini_adapter *Adapter = NULL;
- struct bcm_tarang_data *pTarang = NULL;
+ struct bcm_mini_adapter *ad = NULL;
+ struct bcm_tarang_data *tarang = NULL;
- Adapter = GET_BCM_ADAPTER(gblpnetdev);
- pTarang = kzalloc(sizeof(struct bcm_tarang_data), GFP_KERNEL);
- if (!pTarang)
+ ad = GET_BCM_ADAPTER(gblpnetdev);
+ tarang = kzalloc(sizeof(struct bcm_tarang_data), GFP_KERNEL);
+ if (!tarang)
return -ENOMEM;
- pTarang->Adapter = Adapter;
- pTarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB);
+ tarang->Adapter = ad;
+ tarang->RxCntrlMsgBitMask = 0xFFFFFFFF & ~(1 << 0xB);
- down(&Adapter->RxAppControlQueuelock);
- pTarang->next = Adapter->pTarangs;
- Adapter->pTarangs = pTarang;
- up(&Adapter->RxAppControlQueuelock);
+ down(&ad->RxAppControlQueuelock);
+ tarang->next = ad->pTarangs;
+ ad->pTarangs = tarang;
+ up(&ad->RxAppControlQueuelock);
/* Store the Adapter structure */
- filp->private_data = pTarang;
+ filp->private_data = tarang;
/* Start Queuing the control response Packets */
- atomic_inc(&Adapter->ApplicationRunning);
+ atomic_inc(&ad->ApplicationRunning);
nonseekable_open(inode, filp);
return 0;
@@ -131,386 +132,388 @@ static int bcm_char_open(struct inode *inode, struct file *filp)
static int bcm_char_release(struct inode *inode, struct file *filp)
{
- struct bcm_tarang_data *pTarang, *tmp, *ptmp;
- struct bcm_mini_adapter *Adapter = NULL;
+ struct bcm_tarang_data *tarang, *tmp, *ptmp;
+ struct bcm_mini_adapter *ad = NULL;
struct sk_buff *pkt, *npkt;
- pTarang = (struct bcm_tarang_data *)filp->private_data;
+ tarang = (struct bcm_tarang_data *)filp->private_data;
- if (pTarang == NULL)
+ if (tarang == NULL)
return 0;
- Adapter = pTarang->Adapter;
+ ad = tarang->Adapter;
- down(&Adapter->RxAppControlQueuelock);
+ down(&ad->RxAppControlQueuelock);
- tmp = Adapter->pTarangs;
+ tmp = ad->pTarangs;
for (ptmp = NULL; tmp; ptmp = tmp, tmp = tmp->next) {
- if (tmp == pTarang)
+ if (tmp == tarang)
break;
}
if (tmp) {
if (!ptmp)
- Adapter->pTarangs = tmp->next;
+ ad->pTarangs = tmp->next;
else
ptmp->next = tmp->next;
} else {
- up(&Adapter->RxAppControlQueuelock);
+ up(&ad->RxAppControlQueuelock);
return 0;
}
- pkt = pTarang->RxAppControlHead;
+ pkt = tarang->RxAppControlHead;
while (pkt) {
npkt = pkt->next;
kfree_skb(pkt);
pkt = npkt;
}
- up(&Adapter->RxAppControlQueuelock);
+ up(&ad->RxAppControlQueuelock);
/* Stop Queuing the control response Packets */
- atomic_dec(&Adapter->ApplicationRunning);
+ atomic_dec(&ad->ApplicationRunning);
- kfree(pTarang);
+ kfree(tarang);
/* remove this filp from the asynchronously notified filp's */
filp->private_data = NULL;
return 0;
}
-static ssize_t bcm_char_read(struct file *filp, char __user *buf, size_t size,
+static ssize_t bcm_char_read(struct file *filp,
+ char __user *buf,
+ size_t size,
loff_t *f_pos)
{
- struct bcm_tarang_data *pTarang = filp->private_data;
- struct bcm_mini_adapter *Adapter = pTarang->Adapter;
- struct sk_buff *Packet = NULL;
- ssize_t PktLen = 0;
+ struct bcm_tarang_data *tarang = filp->private_data;
+ struct bcm_mini_adapter *ad = tarang->Adapter;
+ struct sk_buff *packet = NULL;
+ ssize_t pkt_len = 0;
int wait_ret_val = 0;
unsigned long ret = 0;
wait_ret_val = wait_event_interruptible(
- Adapter->process_read_wait_queue,
- (pTarang->RxAppControlHead ||
- Adapter->device_removed));
+ ad->process_read_wait_queue,
+ (tarang->RxAppControlHead ||
+ ad->device_removed));
if ((wait_ret_val == -ERESTARTSYS)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"Exiting as i've been asked to exit!!!\n");
return wait_ret_val;
}
- if (Adapter->device_removed) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ if (ad->device_removed) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"Device Removed... Killing the Apps...\n");
return -ENODEV;
}
- if (false == Adapter->fw_download_done)
+ if (false == ad->fw_download_done)
return -EACCES;
- down(&Adapter->RxAppControlQueuelock);
+ down(&ad->RxAppControlQueuelock);
- if (pTarang->RxAppControlHead) {
- Packet = pTarang->RxAppControlHead;
- DEQUEUEPACKET(pTarang->RxAppControlHead,
- pTarang->RxAppControlTail);
- pTarang->AppCtrlQueueLen--;
+ if (tarang->RxAppControlHead) {
+ packet = tarang->RxAppControlHead;
+ DEQUEUEPACKET(tarang->RxAppControlHead,
+ tarang->RxAppControlTail);
+ tarang->AppCtrlQueueLen--;
}
- up(&Adapter->RxAppControlQueuelock);
+ up(&ad->RxAppControlQueuelock);
- if (Packet) {
- PktLen = Packet->len;
- ret = copy_to_user(buf, Packet->data,
- min_t(size_t, PktLen, size));
+ if (packet) {
+ pkt_len = packet->len;
+ ret = copy_to_user(buf, packet->data,
+ min_t(size_t, pkt_len, size));
if (ret) {
- dev_kfree_skb(Packet);
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ dev_kfree_skb(packet);
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"Returning from copy to user failure\n");
return -EFAULT;
}
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"Read %zd Bytes From Adapter packet = %p by process %d!\n",
- PktLen, Packet, current->pid);
- dev_kfree_skb(Packet);
+ pkt_len, packet, current->pid);
+ dev_kfree_skb(packet);
}
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<\n");
- return PktLen;
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "<\n");
+ return pkt_len;
}
static int bcm_char_ioctl_reg_read_private(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *ad)
{
- struct bcm_rdm_buffer sRdmBuffer = {0};
- struct bcm_ioctl_buffer IoBuffer;
+ struct bcm_rdm_buffer rdm_buff = {0};
+ struct bcm_ioctl_buffer io_buff;
PCHAR temp_buff;
- INT Status = STATUS_FAILURE;
- UINT Bufflen;
+ INT status = STATUS_FAILURE;
+ UINT buff_len;
u16 temp_value;
int bytes;
/* Copy Ioctl Buffer structure */
- if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
+ if (copy_from_user(&io_buff, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
- if (IoBuffer.InputLength > sizeof(sRdmBuffer))
+ if (io_buff.InputLength > sizeof(rdm_buff))
return -EINVAL;
- if (copy_from_user(&sRdmBuffer, IoBuffer.InputBuffer,
- IoBuffer.InputLength))
+ if (copy_from_user(&rdm_buff, io_buff.InputBuffer,
+ io_buff.InputLength))
return -EFAULT;
- if (IoBuffer.OutputLength > USHRT_MAX ||
- IoBuffer.OutputLength == 0) {
+ if (io_buff.OutputLength > USHRT_MAX ||
+ io_buff.OutputLength == 0) {
return -EINVAL;
}
- Bufflen = IoBuffer.OutputLength;
- temp_value = 4 - (Bufflen % 4);
- Bufflen += temp_value % 4;
+ buff_len = io_buff.OutputLength;
+ temp_value = 4 - (buff_len % 4);
+ buff_len += temp_value % 4;
- temp_buff = kmalloc(Bufflen, GFP_KERNEL);
+ temp_buff = kmalloc(buff_len, GFP_KERNEL);
if (!temp_buff)
return -ENOMEM;
- bytes = rdmalt(Adapter, (UINT)sRdmBuffer.Register,
- (PUINT)temp_buff, Bufflen);
+ bytes = rdmalt(ad, (UINT)rdm_buff.Register,
+ (PUINT)temp_buff, buff_len);
if (bytes > 0) {
- Status = STATUS_SUCCESS;
- if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
+ status = STATUS_SUCCESS;
+ if (copy_to_user(io_buff.OutputBuffer, temp_buff, bytes)) {
kfree(temp_buff);
return -EFAULT;
}
} else {
- Status = bytes;
+ status = bytes;
}
kfree(temp_buff);
- return Status;
+ return status;
}
static int bcm_char_ioctl_reg_write_private(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *ad)
{
- struct bcm_wrm_buffer sWrmBuffer = {0};
- struct bcm_ioctl_buffer IoBuffer;
- UINT uiTempVar = 0;
- INT Status;
+ struct bcm_wrm_buffer wrm_buff = {0};
+ struct bcm_ioctl_buffer io_buff;
+ UINT tmp = 0;
+ INT status;
/* Copy Ioctl Buffer structure */
- if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
+ if (copy_from_user(&io_buff, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
- if (IoBuffer.InputLength > sizeof(sWrmBuffer))
+ if (io_buff.InputLength > sizeof(wrm_buff))
return -EINVAL;
/* Get WrmBuffer structure */
- if (copy_from_user(&sWrmBuffer, IoBuffer.InputBuffer,
- IoBuffer.InputLength))
+ if (copy_from_user(&wrm_buff, io_buff.InputBuffer,
+ io_buff.InputLength))
return -EFAULT;
- uiTempVar = sWrmBuffer.Register & EEPROM_REJECT_MASK;
- if (!((Adapter->pstargetparams->m_u32Customize) & VSG_MODE) &&
- ((uiTempVar == EEPROM_REJECT_REG_1) ||
- (uiTempVar == EEPROM_REJECT_REG_2) ||
- (uiTempVar == EEPROM_REJECT_REG_3) ||
- (uiTempVar == EEPROM_REJECT_REG_4))) {
+ tmp = wrm_buff.Register & EEPROM_REJECT_MASK;
+ if (!((ad->pstargetparams->m_u32Customize) & VSG_MODE) &&
+ ((tmp == EEPROM_REJECT_REG_1) ||
+ (tmp == EEPROM_REJECT_REG_2) ||
+ (tmp == EEPROM_REJECT_REG_3) ||
+ (tmp == EEPROM_REJECT_REG_4))) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"EEPROM Access Denied, not in VSG Mode\n");
return -EFAULT;
}
- Status = wrmalt(Adapter, (UINT)sWrmBuffer.Register,
- (PUINT)sWrmBuffer.Data, sizeof(ULONG));
+ status = wrmalt(ad, (UINT)wrm_buff.Register,
+ (PUINT)wrm_buff.Data, sizeof(ULONG));
- if (Status == STATUS_SUCCESS) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ if (status == STATUS_SUCCESS) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL, "WRM Done\n");
} else {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL, "WRM Failed\n");
- Status = -EFAULT;
+ status = -EFAULT;
}
- return Status;
+ return status;
}
static int bcm_char_ioctl_eeprom_reg_read(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *ad)
{
- struct bcm_rdm_buffer sRdmBuffer = {0};
- struct bcm_ioctl_buffer IoBuffer;
+ struct bcm_rdm_buffer rdm_buff = {0};
+ struct bcm_ioctl_buffer io_buff;
PCHAR temp_buff = NULL;
- UINT uiTempVar = 0;
- INT Status;
+ UINT tmp = 0;
+ INT status;
int bytes;
- if ((Adapter->IdleMode == TRUE) ||
- (Adapter->bShutStatus == TRUE) ||
- (Adapter->bPreparingForLowPowerMode == TRUE)) {
+ if ((ad->IdleMode == TRUE) ||
+ (ad->bShutStatus == TRUE) ||
+ (ad->bPreparingForLowPowerMode == TRUE)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"Device in Idle Mode, Blocking Rdms\n");
return -EACCES;
}
/* Copy Ioctl Buffer structure */
- if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
+ if (copy_from_user(&io_buff, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
- if (IoBuffer.InputLength > sizeof(sRdmBuffer))
+ if (io_buff.InputLength > sizeof(rdm_buff))
return -EINVAL;
- if (copy_from_user(&sRdmBuffer, IoBuffer.InputBuffer,
- IoBuffer.InputLength))
+ if (copy_from_user(&rdm_buff, io_buff.InputBuffer,
+ io_buff.InputLength))
return -EFAULT;
- if (IoBuffer.OutputLength > USHRT_MAX ||
- IoBuffer.OutputLength == 0) {
+ if (io_buff.OutputLength > USHRT_MAX ||
+ io_buff.OutputLength == 0) {
return -EINVAL;
}
- temp_buff = kmalloc(IoBuffer.OutputLength, GFP_KERNEL);
+ temp_buff = kmalloc(io_buff.OutputLength, GFP_KERNEL);
if (!temp_buff)
return STATUS_FAILURE;
- if ((((ULONG)sRdmBuffer.Register & 0x0F000000) != 0x0F000000) ||
- ((ULONG)sRdmBuffer.Register & 0x3)) {
+ if ((((ULONG)rdm_buff.Register & 0x0F000000) != 0x0F000000) ||
+ ((ULONG)rdm_buff.Register & 0x3)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"RDM Done On invalid Address : %x Access Denied.\n",
- (int)sRdmBuffer.Register);
+ (int)rdm_buff.Register);
kfree(temp_buff);
return -EINVAL;
}
- uiTempVar = sRdmBuffer.Register & EEPROM_REJECT_MASK;
- bytes = rdmaltWithLock(Adapter, (UINT)sRdmBuffer.Register,
- (PUINT)temp_buff, IoBuffer.OutputLength);
+ tmp = rdm_buff.Register & EEPROM_REJECT_MASK;
+ bytes = rdmaltWithLock(ad, (UINT)rdm_buff.Register,
+ (PUINT)temp_buff, io_buff.OutputLength);
if (bytes > 0) {
- Status = STATUS_SUCCESS;
- if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
+ status = STATUS_SUCCESS;
+ if (copy_to_user(io_buff.OutputBuffer, temp_buff, bytes)) {
kfree(temp_buff);
return -EFAULT;
}
} else {
- Status = bytes;
+ status = bytes;
}
kfree(temp_buff);
- return Status;
+ return status;
}
static int bcm_char_ioctl_eeprom_reg_write(void __user *argp,
- struct bcm_mini_adapter *Adapter,
+ struct bcm_mini_adapter *ad,
UINT cmd)
{
- struct bcm_wrm_buffer sWrmBuffer = {0};
- struct bcm_ioctl_buffer IoBuffer;
- UINT uiTempVar = 0;
- INT Status;
+ struct bcm_wrm_buffer wrm_buff = {0};
+ struct bcm_ioctl_buffer io_buff;
+ UINT tmp = 0;
+ INT status;
- if ((Adapter->IdleMode == TRUE) ||
- (Adapter->bShutStatus == TRUE) ||
- (Adapter->bPreparingForLowPowerMode == TRUE)) {
+ if ((ad->IdleMode == TRUE) ||
+ (ad->bShutStatus == TRUE) ||
+ (ad->bPreparingForLowPowerMode == TRUE)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"Device in Idle Mode, Blocking Wrms\n");
return -EACCES;
}
/* Copy Ioctl Buffer structure */
- if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
+ if (copy_from_user(&io_buff, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
- if (IoBuffer.InputLength > sizeof(sWrmBuffer))
+ if (io_buff.InputLength > sizeof(wrm_buff))
return -EINVAL;
/* Get WrmBuffer structure */
- if (copy_from_user(&sWrmBuffer, IoBuffer.InputBuffer,
- IoBuffer.InputLength))
+ if (copy_from_user(&wrm_buff, io_buff.InputBuffer,
+ io_buff.InputLength))
return -EFAULT;
- if ((((ULONG)sWrmBuffer.Register & 0x0F000000) != 0x0F000000) ||
- ((ULONG)sWrmBuffer.Register & 0x3)) {
+ if ((((ULONG)wrm_buff.Register & 0x0F000000) != 0x0F000000) ||
+ ((ULONG)wrm_buff.Register & 0x3)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"WRM Done On invalid Address : %x Access Denied.\n",
- (int)sWrmBuffer.Register);
+ (int)wrm_buff.Register);
return -EINVAL;
}
- uiTempVar = sWrmBuffer.Register & EEPROM_REJECT_MASK;
- if (!((Adapter->pstargetparams->m_u32Customize) & VSG_MODE) &&
- ((uiTempVar == EEPROM_REJECT_REG_1) ||
- (uiTempVar == EEPROM_REJECT_REG_2) ||
- (uiTempVar == EEPROM_REJECT_REG_3) ||
- (uiTempVar == EEPROM_REJECT_REG_4)) &&
+ tmp = wrm_buff.Register & EEPROM_REJECT_MASK;
+ if (!((ad->pstargetparams->m_u32Customize) & VSG_MODE) &&
+ ((tmp == EEPROM_REJECT_REG_1) ||
+ (tmp == EEPROM_REJECT_REG_2) ||
+ (tmp == EEPROM_REJECT_REG_3) ||
+ (tmp == EEPROM_REJECT_REG_4)) &&
(cmd == IOCTL_BCM_REGISTER_WRITE)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, 0, 0,
"EEPROM Access Denied, not in VSG Mode\n");
return -EFAULT;
}
- Status = wrmaltWithLock(Adapter, (UINT)sWrmBuffer.Register,
- (PUINT)sWrmBuffer.Data,
- sWrmBuffer.Length);
+ status = wrmaltWithLock(ad, (UINT)wrm_buff.Register,
+ (PUINT)wrm_buff.Data,
+ wrm_buff.Length);
- if (Status == STATUS_SUCCESS) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, OSAL_DBG,
+ if (status == STATUS_SUCCESS) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_PRINTK, OSAL_DBG,
DBG_LVL_ALL, "WRM Done\n");
} else {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL, "WRM Failed\n");
- Status = -EFAULT;
+ status = -EFAULT;
}
- return Status;
+ return status;
}
static int bcm_char_ioctl_gpio_set_request(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *ad)
{
struct bcm_gpio_info gpio_info = {0};
- struct bcm_ioctl_buffer IoBuffer;
- UCHAR ucResetValue[4];
+ struct bcm_ioctl_buffer io_buff;
+ UCHAR reset_val[4];
UINT value = 0;
- UINT uiBit = 0;
- UINT uiOperation = 0;
- INT Status;
+ UINT bit = 0;
+ UINT operation = 0;
+ INT status;
int bytes;
- if ((Adapter->IdleMode == TRUE) ||
- (Adapter->bShutStatus == TRUE) ||
- (Adapter->bPreparingForLowPowerMode == TRUE)) {
+ if ((ad->IdleMode == TRUE) ||
+ (ad->bShutStatus == TRUE) ||
+ (ad->bPreparingForLowPowerMode == TRUE)) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL,
"GPIO Can't be set/clear in Low power Mode");
return -EACCES;
}
- if (copy_from_user(&IoBuffer, argp, sizeof(struct bcm_ioctl_buffer)))
+ if (copy_from_user(&io_buff, argp, sizeof(struct bcm_ioctl_buffer)))
return -EFAULT;
- if (IoBuffer.InputLength > sizeof(gpio_info))
+ if (io_buff.InputLength > sizeof(gpio_info))
return -EINVAL;
- if (copy_from_user(&gpio_info, IoBuffer.InputBuffer,
- IoBuffer.InputLength))
+ if (copy_from_user(&gpio_info, io_buff.InputBuffer,
+ io_buff.InputLength))
return -EFAULT;
- uiBit = gpio_info.uiGpioNumber;
- uiOperation = gpio_info.uiGpioValue;
- value = (1<<uiBit);
+ bit = gpio_info.uiGpioNumber;
+ operation = gpio_info.uiGpioValue;
+ value = (1<<bit);
- if (IsReqGpioIsLedInNVM(Adapter, value) == false) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ if (IsReqGpioIsLedInNVM(ad, value) == false) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL,
"Sorry, Requested GPIO<0x%X> is not correspond to LED !!!",
value);
@@ -518,69 +521,69 @@ static int bcm_char_ioctl_gpio_set_request(void __user *argp,
}
/* Set - setting 1 */
- if (uiOperation) {
+ if (operation) {
/* Set the gpio output register */
- Status = wrmaltWithLock(Adapter,
+ status = wrmaltWithLock(ad,
BCM_GPIO_OUTPUT_SET_REG,
(PUINT)(&value), sizeof(UINT));
- if (Status == STATUS_SUCCESS) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+ if (status == STATUS_SUCCESS) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS,
OSAL_DBG, DBG_LVL_ALL,
"Set the GPIO bit\n");
} else {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS,
OSAL_DBG, DBG_LVL_ALL,
"Failed to set the %dth GPIO\n",
- uiBit);
- return Status;
+ bit);
+ return status;
}
} else {
/* Set the gpio output register */
- Status = wrmaltWithLock(Adapter,
+ status = wrmaltWithLock(ad,
BCM_GPIO_OUTPUT_CLR_REG,
(PUINT)(&value), sizeof(UINT));
- if (Status == STATUS_SUCCESS) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+ if (status == STATUS_SUCCESS) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS,
OSAL_DBG, DBG_LVL_ALL,
"Set the GPIO bit\n");
} else {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS,
OSAL_DBG, DBG_LVL_ALL,
"Failed to clear the %dth GPIO\n",
- uiBit);
- return Status;
+ bit);
+ return status;
}
}
- bytes = rdmaltWithLock(Adapter, (UINT)GPIO_MODE_REGISTER,
- (PUINT)ucResetValue, sizeof(UINT));
+ bytes = rdmaltWithLock(ad, (UINT)GPIO_MODE_REGISTER,
+ (PUINT)reset_val, sizeof(UINT));
if (bytes < 0) {
- Status = bytes;
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+ status = bytes;
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"GPIO_MODE_REGISTER read failed");
- return Status;
+ return status;
} else {
- Status = STATUS_SUCCESS;
+ status = STATUS_SUCCESS;
}
/* Set the gpio mode register to output */
- *(UINT *)ucResetValue |= (1<<uiBit);
- Status = wrmaltWithLock(Adapter, GPIO_MODE_REGISTER,
- (PUINT)ucResetValue, sizeof(UINT));
+ *(UINT *)reset_val |= (1<<bit);
+ status = wrmaltWithLock(ad, GPIO_MODE_REGISTER,
+ (PUINT)reset_val, sizeof(UINT));
- if (Status == STATUS_SUCCESS) {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ if (status == STATUS_SUCCESS) {
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL,
"Set the GPIO to output Mode\n");
} else {
- BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+ BCM_DEBUG_PRINT(ad, DBG_TYPE_OTHERS, OSAL_DBG,
DBG_LVL_ALL,
"Failed to put GPIO in Output Mode\n");
}
- return Status;
+ return status;
}
static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp,
@@ -635,7 +638,7 @@ static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp,
}
static int bcm_char_ioctl_gpio_status_request(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_gpio_info gpio_info = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -677,7 +680,7 @@ static int bcm_char_ioctl_gpio_status_request(void __user *argp,
}
static int bcm_char_ioctl_gpio_multi_request(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_gpio_multi_info gpio_multi_info[MAX_IDX];
struct bcm_gpio_multi_info *pgpio_multi_info =
@@ -784,7 +787,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user *argp,
}
static int bcm_char_ioctl_gpio_mode_request(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_gpio_multi_mode gpio_multi_mode[MAX_IDX];
struct bcm_gpio_multi_mode *pgpio_multi_mode =
@@ -877,7 +880,7 @@ static int bcm_char_ioctl_gpio_mode_request(void __user *argp,
}
static int bcm_char_ioctl_misc_request(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
PVOID pvBuffer = NULL;
@@ -959,7 +962,7 @@ static int bcm_char_ioctl_buffer_download_start(
}
static int bcm_char_ioctl_buffer_download(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_firmware_info *psFwInfo = NULL;
struct bcm_ioctl_buffer IoBuffer;
@@ -1044,7 +1047,7 @@ static int bcm_char_ioctl_buffer_download(void __user *argp,
}
static int bcm_char_ioctl_buffer_download_stop(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
INT Status;
int timeout = 0;
@@ -1151,7 +1154,7 @@ static int bcm_char_ioctl_qos_threshold(ULONG arg,
}
static int bcm_char_ioctl_switch_transfer_mode(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
UINT uiData = 0;
@@ -1190,7 +1193,7 @@ static int bcm_char_ioctl_get_driver_version(void __user *argp)
}
static int bcm_char_ioctl_get_current_status(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_link_state link_state;
struct bcm_ioctl_buffer IoBuffer;
@@ -1221,7 +1224,7 @@ static int bcm_char_ioctl_get_current_status(void __user *argp,
static int bcm_char_ioctl_set_mac_tracing(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
UINT tracing_flag;
@@ -1242,7 +1245,7 @@ static int bcm_char_ioctl_set_mac_tracing(void __user *argp,
}
static int bcm_char_ioctl_get_dsx_indication(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
ULONG ulSFId = 0;
@@ -1268,7 +1271,8 @@ static int bcm_char_ioctl_get_dsx_indication(void __user *argp,
}
static int bcm_char_ioctl_get_host_mibs(void __user *argp,
- struct bcm_mini_adapter *Adapter, struct bcm_tarang_data *pTarang)
+ struct bcm_mini_adapter *Adapter,
+ struct bcm_tarang_data *pTarang)
{
struct bcm_ioctl_buffer IoBuffer;
INT Status = STATUS_FAILURE;
@@ -1305,7 +1309,7 @@ static int bcm_char_ioctl_get_host_mibs(void __user *argp,
}
static int bcm_char_ioctl_bulk_wrm(void __user *argp,
- struct bcm_mini_adapter *Adapter, UINT cmd)
+ struct bcm_mini_adapter *Adapter, UINT cmd)
{
struct bcm_bulk_wrm_buffer *pBulkBuffer;
struct bcm_ioctl_buffer IoBuffer;
@@ -1376,7 +1380,7 @@ static int bcm_char_ioctl_bulk_wrm(void __user *argp,
}
static int bcm_char_ioctl_get_nvm_size(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
@@ -1393,7 +1397,7 @@ static int bcm_char_ioctl_get_nvm_size(void __user *argp,
}
static int bcm_char_ioctl_cal_init(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
UINT uiSectorSize = 0;
@@ -1440,7 +1444,7 @@ static int bcm_char_ioctl_cal_init(void __user *argp,
}
static int bcm_char_ioctl_set_debug(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
#ifdef DEBUG
struct bcm_ioctl_buffer IoBuffer;
@@ -1483,7 +1487,7 @@ static int bcm_char_ioctl_set_debug(void __user *argp,
}
static int bcm_char_ioctl_nvm_rw(void __user *argp,
- struct bcm_mini_adapter *Adapter, UINT cmd)
+ struct bcm_mini_adapter *Adapter, UINT cmd)
{
struct bcm_nvm_readwrite stNVMReadWrite;
struct timeval tv0, tv1;
@@ -1895,7 +1899,7 @@ BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
}
static int bcm_char_ioctl_set_active_section(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
enum bcm_flash2x_section_val eFlash2xSectionVal = 0;
INT Status = STATUS_FAILURE;
@@ -1950,7 +1954,7 @@ static int bcm_char_ioctl_set_active_section(void __user *argp,
}
static int bcm_char_ioctl_copy_section(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_flash2x_copy_section sCopySectStrut = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -2051,7 +2055,7 @@ static int bcm_char_ioctl_copy_section(void __user *argp,
}
static int bcm_char_ioctl_get_flash_cs_info(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
INT Status = STATUS_SUCCESS;
@@ -2093,7 +2097,7 @@ static int bcm_char_ioctl_get_flash_cs_info(void __user *argp,
}
static int bcm_char_ioctl_select_dsd(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_ioctl_buffer IoBuffer;
INT Status = STATUS_FAILURE;
@@ -2153,7 +2157,7 @@ static int bcm_char_ioctl_select_dsd(void __user *argp,
}
static int bcm_char_ioctl_nvm_raw_read(void __user *argp,
- struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
{
struct bcm_nvm_readwrite stNVMRead;
struct bcm_ioctl_buffer IoBuffer;
@@ -2255,7 +2259,8 @@ static int bcm_char_ioctl_nvm_raw_read(void __user *argp,
}
static int bcm_char_ioctl_cntrlmsg_mask(void __user *argp,
- struct bcm_mini_adapter *Adapter, struct bcm_tarang_data *pTarang)
+ struct bcm_mini_adapter *Adapter,
+ struct bcm_tarang_data *pTarang)
{
struct bcm_ioctl_buffer IoBuffer;
INT Status = STATUS_FAILURE;
diff --git a/drivers/staging/bcm/vendorspecificextn.c b/drivers/staging/bcm/vendorspecificextn.c
index 2c57a16788c0..1d9bef6e4273 100644
--- a/drivers/staging/bcm/vendorspecificextn.c
+++ b/drivers/staging/bcm/vendorspecificextn.c
@@ -11,7 +11,8 @@
* STATUS_SUCCESS/STATUS_FAILURE
*
*/
-INT vendorextnGetSectionInfo(PVOID pContext, struct bcm_flash2x_vendor_info *pVendorInfo)
+INT vendorextnGetSectionInfo(PVOID pContext,
+ struct bcm_flash2x_vendor_info *pVendorInfo)
{
return STATUS_FAILURE;
}
@@ -61,7 +62,8 @@ INT vendorextnExit(struct bcm_mini_adapter *Adapter)
* arg -input parameter sent by vendor
*
* Returns:
- * CONTINUE_COMMON_PATH in case it is not meant to be processed by vendor ioctls
+ * CONTINUE_COMMON_PATH in case it is not meant to be processed
+ * by vendor ioctls
* STATUS_SUCCESS/STATUS_FAILURE as per the IOCTL return value
*/
@@ -88,8 +90,8 @@ INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT cmd, ULONG arg)
* STATUS_SUCCESS/STATUS_FAILURE
*/
-INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
- UINT offset, UINT numOfBytes)
+INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer,
+ enum bcm_flash2x_section_val SectionVal, UINT offset, UINT numOfBytes)
{
return STATUS_FAILURE;
}
@@ -112,8 +114,9 @@ INT vendorextnReadSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_sect
* Returns:
* STATUS_SUCCESS/STATUS_FAILURE
*/
-INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
- UINT offset, UINT numOfBytes, bool bVerify)
+INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer,
+ enum bcm_flash2x_section_val SectionVal, UINT offset,
+ UINT numOfBytes, bool bVerify)
{
return STATUS_FAILURE;
}
@@ -135,8 +138,8 @@ INT vendorextnWriteSection(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_sec
* Returns:
* STATUS_SUCCESS/STATUS_FAILURE
*/
-INT vendorextnWriteSectionWithoutErase(PVOID pContext, PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
- UINT offset, UINT numOfBytes)
+INT vendorextnWriteSectionWithoutErase(PVOID pContext, PUCHAR pBuffer,
+ enum bcm_flash2x_section_val SectionVal, UINT offset, UINT numOfBytes)
{
return STATUS_FAILURE;
}
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 36f2c7159250..7d6cebc112dc 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -1209,6 +1209,17 @@ config COMEDI_DT9812
To compile this driver as a module, choose M here: the module will be
called dt9812.
+config COMEDI_NI_USB6501
+ tristate "NI USB-6501 support"
+ ---help---
+ Enable support for the National Instruments USB-6501 module.
+
+ The NI USB-6501 is a Full-Speed USB 2.0 (12 Mbit/s) device that
+ provides 24 digital I/O lines channels and one 32-bit counter.
+
+ To compile this driver as a module, choose M here: the module will be
+ called ni_usb6501.
+
config COMEDI_USBDUX
tristate "ITL USB-DUX-D support"
---help---
diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index a33a19622745..34d4d8b5f31e 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -79,49 +79,30 @@ I/O port base address can be found in the output of 'lspci -v'.
#include "comedi_fc.h"
#include "8255.h"
-#define _8255_SIZE 4
-
-#define _8255_DATA 0
-#define _8255_CR 3
-
-#define CR_C_LO_IO 0x01
-#define CR_B_IO 0x02
-#define CR_B_MODE 0x04
-#define CR_C_HI_IO 0x08
-#define CR_A_IO 0x10
-#define CR_A_MODE(a) ((a)<<5)
-#define CR_CW 0x80
-
struct subdev_8255_private {
- unsigned long iobase;
- int (*io)(int, int, int, unsigned long);
+ unsigned long regbase;
+ int (*io)(struct comedi_device *, int, int, int, unsigned long);
};
-static int subdev_8255_io(int dir, int port, int data, unsigned long iobase)
+static int subdev_8255_io(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long regbase)
{
if (dir) {
- outb(data, iobase + port);
+ outb(data, dev->iobase + regbase + port);
return 0;
}
- return inb(iobase + port);
+ return inb(dev->iobase + regbase + port);
}
-void subdev_8255_interrupt(struct comedi_device *dev,
- struct comedi_subdevice *s)
+static int subdev_8255_mmio(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long regbase)
{
- struct subdev_8255_private *spriv = s->private;
- unsigned long iobase = spriv->iobase;
- unsigned short d;
-
- d = spriv->io(0, _8255_DATA, 0, iobase);
- d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);
-
- comedi_buf_put(s, d);
- s->async->events |= COMEDI_CB_EOS;
-
- comedi_event(dev, s);
+ if (dir) {
+ writeb(data, dev->mmio + regbase + port);
+ return 0;
+ }
+ return readb(dev->mmio + regbase + port);
}
-EXPORT_SYMBOL_GPL(subdev_8255_interrupt);
static int subdev_8255_insn(struct comedi_device *dev,
struct comedi_subdevice *s,
@@ -129,25 +110,26 @@ static int subdev_8255_insn(struct comedi_device *dev,
unsigned int *data)
{
struct subdev_8255_private *spriv = s->private;
- unsigned long iobase = spriv->iobase;
+ unsigned long regbase = spriv->regbase;
unsigned int mask;
unsigned int v;
mask = comedi_dio_update_state(s, data);
if (mask) {
if (mask & 0xff)
- spriv->io(1, _8255_DATA, s->state & 0xff, iobase);
+ spriv->io(dev, 1, I8255_DATA_A_REG,
+ s->state & 0xff, regbase);
if (mask & 0xff00)
- spriv->io(1, _8255_DATA + 1, (s->state >> 8) & 0xff,
- iobase);
+ spriv->io(dev, 1, I8255_DATA_B_REG,
+ (s->state >> 8) & 0xff, regbase);
if (mask & 0xff0000)
- spriv->io(1, _8255_DATA + 2, (s->state >> 16) & 0xff,
- iobase);
+ spriv->io(dev, 1, I8255_DATA_C_REG,
+ (s->state >> 16) & 0xff, regbase);
}
- v = spriv->io(0, _8255_DATA, 0, iobase);
- v |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);
- v |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16);
+ v = spriv->io(dev, 0, I8255_DATA_A_REG, 0, regbase);
+ v |= (spriv->io(dev, 0, I8255_DATA_B_REG, 0, regbase) << 8);
+ v |= (spriv->io(dev, 0, I8255_DATA_C_REG, 0, regbase) << 16);
data[1] = v;
@@ -158,21 +140,21 @@ static void subdev_8255_do_config(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct subdev_8255_private *spriv = s->private;
- unsigned long iobase = spriv->iobase;
+ unsigned long regbase = spriv->regbase;
int config;
- config = CR_CW;
+ config = I8255_CTRL_CW;
/* 1 in io_bits indicates output, 1 in config indicates input */
if (!(s->io_bits & 0x0000ff))
- config |= CR_A_IO;
+ config |= I8255_CTRL_A_IO;
if (!(s->io_bits & 0x00ff00))
- config |= CR_B_IO;
+ config |= I8255_CTRL_B_IO;
if (!(s->io_bits & 0x0f0000))
- config |= CR_C_LO_IO;
+ config |= I8255_CTRL_C_LO_IO;
if (!(s->io_bits & 0xf00000))
- config |= CR_C_HI_IO;
+ config |= I8255_CTRL_C_HI_IO;
- spriv->io(1, _8255_CR, config, iobase);
+ spriv->io(dev, 1, I8255_CTRL_REG, config, regbase);
}
static int subdev_8255_insn_config(struct comedi_device *dev,
@@ -202,67 +184,12 @@ static int subdev_8255_insn_config(struct comedi_device *dev,
return insn->n;
}
-static int subdev_8255_cmdtest(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_cmd *cmd)
-{
- int err = 0;
-
- /* Step 1 : check if triggers are trivially valid */
-
- err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
- err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT);
- err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW);
- err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
- err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE);
-
- if (err)
- return 1;
-
- /* Step 2a : make sure trigger sources are unique */
- /* Step 2b : and mutually compatible */
-
- if (err)
- return 2;
-
- /* Step 3: check if arguments are trivially valid */
-
- err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
- err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
- err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0);
- err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);
- err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
-
- if (err)
- return 3;
-
- /* step 4 */
-
- if (err)
- return 4;
-
- return 0;
-}
-
-static int subdev_8255_cmd(struct comedi_device *dev,
- struct comedi_subdevice *s)
-{
- /* FIXME */
-
- return 0;
-}
-
-static int subdev_8255_cancel(struct comedi_device *dev,
- struct comedi_subdevice *s)
-{
- /* FIXME */
-
- return 0;
-}
-
-int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
- unsigned long iobase)
+static int __subdev_8255_init(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
+ unsigned long regbase,
+ bool is_mmio)
{
struct subdev_8255_private *spriv;
@@ -270,8 +197,13 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
if (!spriv)
return -ENOMEM;
- spriv->iobase = iobase;
- spriv->io = io ? io : subdev_8255_io;
+ if (io)
+ spriv->io = io;
+ else if (is_mmio)
+ spriv->io = subdev_8255_mmio;
+ else
+ spriv->io = subdev_8255_io;
+ spriv->regbase = regbase;
s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
@@ -285,27 +217,24 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
return 0;
}
-EXPORT_SYMBOL_GPL(subdev_8255_init);
-int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
- unsigned long iobase)
+int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
+ unsigned long regbase)
{
- int ret;
-
- ret = subdev_8255_init(dev, s, io, iobase);
- if (ret)
- return ret;
-
- s->len_chanlist = 1;
- s->do_cmdtest = subdev_8255_cmdtest;
- s->do_cmd = subdev_8255_cmd;
- s->cancel = subdev_8255_cancel;
-
- return 0;
+ return __subdev_8255_init(dev, s, io, regbase, false);
}
-EXPORT_SYMBOL_GPL(subdev_8255_init_irq);
+EXPORT_SYMBOL_GPL(subdev_8255_init);
+int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
+ unsigned long regbase)
+{
+ return __subdev_8255_init(dev, s, io, regbase, true);
+}
+EXPORT_SYMBOL_GPL(subdev_8255_mm_init);
/*
Start of the 8255 standalone device
@@ -316,8 +245,8 @@ static int dev_8255_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
- int ret;
unsigned long iobase;
+ int ret;
int i;
for (i = 0; i < COMEDI_NDEVCONFOPTS; i++) {
@@ -338,7 +267,14 @@ static int dev_8255_attach(struct comedi_device *dev,
s = &dev->subdevices[i];
iobase = it->options[i];
- ret = __comedi_request_region(dev, iobase, _8255_SIZE);
+ /*
+ * __comedi_request_region() does not set dev->iobase.
+ *
+ * For 8255 devices that are manually attached using
+ * comedi_config, the 'iobase' is the actual I/O port
+ * base address of the chip.
+ */
+ ret = __comedi_request_region(dev, iobase, I8255_SIZE);
if (ret) {
s->type = COMEDI_SUBD_UNUSED;
} else {
@@ -361,7 +297,7 @@ static void dev_8255_detach(struct comedi_device *dev)
s = &dev->subdevices[i];
if (s->type != COMEDI_SUBD_UNUSED) {
spriv = s->private;
- release_region(spriv->iobase, _8255_SIZE);
+ release_region(spriv->regbase, I8255_SIZE);
}
}
}
diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h
index 795d232a6c02..5985c8e0330f 100644
--- a/drivers/staging/comedi/drivers/8255.h
+++ b/drivers/staging/comedi/drivers/8255.h
@@ -21,13 +21,28 @@
#include "../comedidev.h"
-int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
- unsigned long iobase);
-int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
- int (*io)(int, int, int, unsigned long),
- unsigned long iobase);
-void subdev_8255_interrupt(struct comedi_device *dev,
- struct comedi_subdevice *s);
+#define I8255_SIZE 0x04
+
+#define I8255_DATA_A_REG 0x00
+#define I8255_DATA_B_REG 0x01
+#define I8255_DATA_C_REG 0x02
+#define I8255_CTRL_REG 0x03
+#define I8255_CTRL_C_LO_IO (1 << 0)
+#define I8255_CTRL_B_IO (1 << 1)
+#define I8255_CTRL_B_MODE (1 << 2)
+#define I8255_CTRL_C_HI_IO (1 << 3)
+#define I8255_CTRL_A_IO (1 << 4)
+#define I8255_CTRL_A_MODE(x) ((x) << 5)
+#define I8255_CTRL_CW (1 << 7)
+
+int subdev_8255_init(struct comedi_device *, struct comedi_subdevice *,
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
+ unsigned long regbase);
+
+int subdev_8255_mm_init(struct comedi_device *, struct comedi_subdevice *,
+ int (*io)(struct comedi_device *,
+ int, int, int, unsigned long),
+ unsigned long regbase);
#endif
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c
index f21e6567ac2f..8bcb1e0e6a71 100644
--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -190,24 +190,12 @@ static int pci_8255_mite_init(struct pci_dev *pcidev)
return 0;
}
-static int pci_8255_mmio(int dir, int port, int data, unsigned long iobase)
-{
- void __iomem *mmio_base = (void __iomem *)iobase;
-
- if (dir) {
- writeb(data, mmio_base + port);
- return 0;
- }
- return readb(mmio_base + port);
-}
-
static int pci_8255_auto_attach(struct comedi_device *dev,
unsigned long context)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct pci_8255_boardinfo *board = NULL;
struct comedi_subdevice *s;
- bool is_mmio;
int ret;
int i;
@@ -228,9 +216,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
return ret;
}
- is_mmio = (pci_resource_flags(pcidev, board->dio_badr) &
- IORESOURCE_MEM) != 0;
- if (is_mmio) {
+ if ((pci_resource_flags(pcidev, board->dio_badr) & IORESOURCE_MEM)) {
dev->mmio = pci_ioremap_bar(pcidev, board->dio_badr);
if (!dev->mmio)
return -ENOMEM;
@@ -248,16 +234,11 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
return ret;
for (i = 0; i < board->n_8255; i++) {
- unsigned long iobase;
-
s = &dev->subdevices[i];
- if (is_mmio) {
- iobase = (unsigned long)(dev->mmio + (i * 4));
- ret = subdev_8255_init(dev, s, pci_8255_mmio, iobase);
- } else {
- iobase = dev->iobase + (i * 4);
- ret = subdev_8255_init(dev, s, NULL, iobase);
- }
+ if (dev->mmio)
+ ret = subdev_8255_mm_init(dev, s, NULL, i * I8255_SIZE);
+ else
+ ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
if (ret)
return ret;
}
diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile
index 8873d4807a01..87ac79136084 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -125,6 +125,7 @@ obj-$(CONFIG_COMEDI_QUATECH_DAQP_CS) += quatech_daqp_cs.o
# Comedi USB drivers
obj-$(CONFIG_COMEDI_DT9812) += dt9812.o
+obj-$(CONFIG_COMEDI_NI_USB6501) += ni_usb6501.o
obj-$(CONFIG_COMEDI_USBDUX) += usbdux.o
obj-$(CONFIG_COMEDI_USBDUXFAST) += usbduxfast.o
obj-$(CONFIG_COMEDI_USBDUXSIGMA) += usbduxsigma.o
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 8a613ae0acba..198c6276e838 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -21,8 +21,6 @@
*
*/
-#define APCI1564_ADDRESS_RANGE 128
-
/* Digital Input IRQ Function Selection */
#define APCI1564_DI_INT_OR (0 << 1)
#define APCI1564_DI_INT_AND (1 << 1)
@@ -32,10 +30,10 @@
#define APCI1564_DI_INT_DISABLE 0xfffffffb
/* Digital Output Interrupt Enable Disable. */
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1
-#define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE 0xfffffffe
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE 0x2
-#define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE 0xfffffffd
+#define APCI1564_DO_VCC_INT_ENABLE 0x1
+#define APCI1564_DO_VCC_INT_DISABLE 0xfffffffe
+#define APCI1564_DO_CC_INT_ENABLE 0x2
+#define APCI1564_DO_CC_IN_DISABLE 0xfffffffd
/* TIMER COUNTER WATCHDOG DEFINES */
#define ADDIDATA_TIMER 0
@@ -76,55 +74,21 @@
#define APCI1564_TIMER_WARN_TIMEBASE_REG 0x64
/*
- * dev>iobase Register Map
- */
-#define APCI1564_TCW_REG(x) (0x00 + ((x) * 0x20))
-#define APCI1564_TCW_RELOAD_REG(x) (0x04 + ((x) * 0x20))
-#define APCI1564_TCW_TIMEBASE_REG(x) (0x08 + ((x) * 0x20))
-#define APCI1564_TCW_CTRL_REG(x) (0x0c + ((x) * 0x20))
-#define APCI1564_TCW_STATUS_REG(x) (0x10 + ((x) * 0x20))
-#define APCI1564_TCW_IRQ_REG(x) (0x14 + ((x) * 0x20))
-#define APCI1564_TCW_WARN_TIMEVAL_REG(x) (0x18 + ((x) * 0x20))
-#define APCI1564_TCW_WARN_TIMEBASE_REG(x) (0x1c + ((x) * 0x20))
-
-/*
- * Configures The Digital Output Subdevice.
- *
- * data[1] 0 = Disable VCC Interrupt, 1 = Enable VCC Interrupt
- * data[2] 0 = Disable CC Interrupt, 1 = Enable CC Interrupt
+ * dev->iobase Register Map
*/
-static int apci1564_do_config(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
-{
- struct apci1564_private *devpriv = dev->private;
- unsigned int ul_Command = 0;
-
- if ((data[0] != 0) && (data[0] != 1)) {
- dev_err(dev->class_dev, "Data should be 1 or 0\n");
- return -EINVAL;
- }
-
- if (data[1] == 1)
- ul_Command = ul_Command | 0x1;
- else
- ul_Command = ul_Command & 0xFFFFFFFE;
-
- if (data[2] == 1)
- ul_Command = ul_Command | 0x2;
- else
- ul_Command = ul_Command & 0xFFFFFFFD;
-
- outl(ul_Command, devpriv->amcc_iobase + APCI1564_DO_INT_CTRL_REG);
- devpriv->tsk_current = current;
- return insn->n;
-}
+#define APCI1564_COUNTER_REG(x) (0x00 + ((x) * 0x20))
+#define APCI1564_COUNTER_RELOAD_REG(x) (0x04 + ((x) * 0x20))
+#define APCI1564_COUNTER_TIMEBASE_REG(x) (0x08 + ((x) * 0x20))
+#define APCI1564_COUNTER_CTRL_REG(x) (0x0c + ((x) * 0x20))
+#define APCI1564_COUNTER_STATUS_REG(x) (0x10 + ((x) * 0x20))
+#define APCI1564_COUNTER_IRQ_REG(x) (0x14 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEVAL_REG(x) (0x18 + ((x) * 0x20))
+#define APCI1564_COUNTER_WARN_TIMEBASE_REG(x) (0x1c + ((x) * 0x20))
/*
- * Configures The Timer, Counter or Watchdog
+ * Configures The Timer or Counter
*
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
* data[1] 1 = Enable Interrupt, 0 = Disable Interrupt
* data[2] Time Unit
* data[3] Reload Value
@@ -141,14 +105,7 @@ static int apci1564_timer_config(struct comedi_device *dev,
unsigned int ul_Command1 = 0;
devpriv->tsk_current = current;
- if (data[0] == ADDIDATA_WATCHDOG) {
- devpriv->timer_select_mode = ADDIDATA_WATCHDOG;
-
- /* Disable the watchdog */
- outl(0x0, devpriv->amcc_iobase + APCI1564_WDOG_CTRL_REG);
- /* Loading the Reload value */
- outl(data[3], devpriv->amcc_iobase + APCI1564_WDOG_RELOAD_REG);
- } else if (data[0] == ADDIDATA_TIMER) {
+ if (data[0] == ADDIDATA_TIMER) {
/* First Stop The Timer */
ul_Command1 = inl(devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
@@ -162,14 +119,14 @@ static int apci1564_timer_config(struct comedi_device *dev,
outl(0x0, devpriv->amcc_iobase + APCI1564_DI_IRQ_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_DO_IRQ_REG);
outl(0x0, devpriv->amcc_iobase + APCI1564_WDOG_IRQ_REG);
- outl(0x0,
- dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER1));
- outl(0x0,
- dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER2));
- outl(0x0,
- dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER3));
- outl(0x0,
- dev->iobase + APCI1564_TCW_IRQ_REG(APCI1564_COUNTER4));
+ outl(0x0, dev->iobase +
+ APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER1));
+ outl(0x0, dev->iobase +
+ APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER2));
+ outl(0x0, dev->iobase +
+ APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER3));
+ outl(0x0, dev->iobase +
+ APCI1564_COUNTER_IRQ_REG(APCI1564_COUNTER4));
} else {
/* disable Timer interrupt */
outl(0x0, devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
@@ -190,13 +147,16 @@ static int apci1564_timer_config(struct comedi_device *dev,
devpriv->mode_select_register = data[5];
/* First Stop The Counter */
- ul_Command1 = inl(dev->iobase + APCI1564_TCW_CTRL_REG(data[5] - 1));
+ ul_Command1 = inl(dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(data[5] - 1));
ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
/* Stop The Timer */
- outl(ul_Command1, dev->iobase + APCI1564_TCW_CTRL_REG(data[5] - 1));
+ outl(ul_Command1, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(data[5] - 1));
/* Set the reload value */
- outl(data[3], dev->iobase + APCI1564_TCW_RELOAD_REG(data[5] - 1));
+ outl(data[3], dev->iobase +
+ APCI1564_COUNTER_RELOAD_REG(data[5] - 1));
/* Set the mode : */
/* - Disable the hardware */
@@ -209,26 +169,28 @@ static int apci1564_timer_config(struct comedi_device *dev,
ul_Command1 =
(ul_Command1 & 0xFFFC19E2UL) | 0x80000UL |
(unsigned int) ((unsigned int) data[4] << 16UL);
- outl(ul_Command1, dev->iobase + APCI1564_TCW_CTRL_REG(data[5] - 1));
+ outl(ul_Command1, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(data[5] - 1));
/* Enable or Disable Interrupt */
ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1);
- outl(ul_Command1, dev->iobase + APCI1564_TCW_CTRL_REG(data[5] - 1));
+ outl(ul_Command1, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(data[5] - 1));
/* Set the Up/Down selection */
ul_Command1 = (ul_Command1 & 0xFFFBF9FFUL) | (data[6] << 18);
- outl(ul_Command1, dev->iobase + APCI1564_TCW_CTRL_REG(data[5] - 1));
+ outl(ul_Command1, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(data[5] - 1));
} else {
dev_err(dev->class_dev, "Invalid subdevice.\n");
}
-
return insn->n;
}
/*
- * Start / Stop The Selected Timer, Counter or Watchdog
+ * Start / Stop The Selected Timer or Counter
*
- * data[0] Configure as: 0 = Timer, 1 = Counter, 2 = Watchdog
+ * data[0] Configure as: 0 = Timer, 1 = Counter
* data[1] 0 = Stop, 1 = Start, 2 = Trigger Clear (Only Counter)
*/
static int apci1564_timer_write(struct comedi_device *dev,
@@ -239,23 +201,6 @@ static int apci1564_timer_write(struct comedi_device *dev,
struct apci1564_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
- if (devpriv->timer_select_mode == ADDIDATA_WATCHDOG) {
- switch (data[1]) {
- case 0: /* stop the watchdog */
- /* disable the watchdog */
- outl(0x0, devpriv->amcc_iobase + APCI1564_WDOG_CTRL_REG);
- break;
- case 1: /* start the watchdog */
- outl(0x0001, devpriv->amcc_iobase + APCI1564_WDOG_CTRL_REG);
- break;
- case 2: /* Software trigger */
- outl(0x0201, devpriv->amcc_iobase + APCI1564_WDOG_CTRL_REG);
- break;
- default:
- dev_err(dev->class_dev, "Specified functionality does not exist.\n");
- return -EINVAL;
- }
- }
if (devpriv->timer_select_mode == ADDIDATA_TIMER) {
if (data[1] == 1) {
ul_Command1 = inl(devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
@@ -270,11 +215,10 @@ static int apci1564_timer_write(struct comedi_device *dev,
ul_Command1 = ul_Command1 & 0xFFFFF9FEUL;
outl(ul_Command1, devpriv->amcc_iobase + APCI1564_TIMER_CTRL_REG);
}
- }
- if (devpriv->timer_select_mode == ADDIDATA_COUNTER) {
+ } else if (devpriv->timer_select_mode == ADDIDATA_COUNTER) {
ul_Command1 =
inl(dev->iobase +
- APCI1564_TCW_CTRL_REG(devpriv->mode_select_register - 1));
+ APCI1564_COUNTER_CTRL_REG(devpriv->mode_select_register - 1));
if (data[1] == 1) {
/* Start the Counter subdevice */
ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL;
@@ -287,13 +231,15 @@ static int apci1564_timer_write(struct comedi_device *dev,
ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400;
}
outl(ul_Command1, dev->iobase +
- APCI1564_TCW_CTRL_REG(devpriv->mode_select_register - 1));
+ APCI1564_COUNTER_CTRL_REG(devpriv->mode_select_register - 1));
+ } else {
+ dev_err(dev->class_dev, "Invalid subdevice.\n");
}
return insn->n;
}
/*
- * Read The Selected Timer, Counter or Watchdog
+ * Read The Selected Timer or Counter
*/
static int apci1564_timer_read(struct comedi_device *dev,
struct comedi_subdevice *s,
@@ -303,11 +249,7 @@ static int apci1564_timer_read(struct comedi_device *dev,
struct apci1564_private *devpriv = dev->private;
unsigned int ul_Command1 = 0;
- if (devpriv->timer_select_mode == ADDIDATA_WATCHDOG) {
- /* Stores the status of the Watchdog */
- data[0] = inl(devpriv->amcc_iobase + APCI1564_WDOG_STATUS_REG) & 0x1;
- data[1] = inl(devpriv->amcc_iobase + APCI1564_WDOG_REG);
- } else if (devpriv->timer_select_mode == ADDIDATA_TIMER) {
+ if (devpriv->timer_select_mode == ADDIDATA_TIMER) {
/* Stores the status of the Timer */
data[0] = inl(devpriv->amcc_iobase + APCI1564_TIMER_STATUS_REG) & 0x1;
@@ -317,10 +259,10 @@ static int apci1564_timer_read(struct comedi_device *dev,
/* Read the Counter Actual Value. */
data[0] =
inl(dev->iobase +
- APCI1564_TCW_REG(devpriv->mode_select_register - 1));
+ APCI1564_COUNTER_REG(devpriv->mode_select_register - 1));
ul_Command1 =
inl(dev->iobase +
- APCI1564_TCW_STATUS_REG(devpriv->mode_select_register - 1));
+ APCI1564_COUNTER_STATUS_REG(devpriv->mode_select_register - 1));
/* Get the software trigger status */
data[1] = (unsigned char) ((ul_Command1 >> 1) & 1);
@@ -333,10 +275,8 @@ static int apci1564_timer_read(struct comedi_device *dev,
/* Get the overflow status */
data[4] = (unsigned char) ((ul_Command1 >> 0) & 1);
- } else if ((devpriv->timer_select_mode != ADDIDATA_TIMER)
- && (devpriv->timer_select_mode != ADDIDATA_WATCHDOG)
- && (devpriv->timer_select_mode != ADDIDATA_COUNTER)) {
- dev_err(dev->class_dev, "Invalid Subdevice!\n");
+ } else {
+ dev_err(dev->class_dev, "Invalid subdevice.\n");
}
return insn->n;
}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 543cb074213a..16c02c855a65 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -42,10 +42,10 @@ static int apci1564_reset(struct comedi_device *dev)
outl(0x0, devpriv->amcc_iobase + APCI1564_TIMER_RELOAD_REG);
/* Reset the counter registers */
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER2));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER3));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER4));
+ outl(0x0, dev->iobase + APCI1564_COUNTER_CTRL_REG(APCI1564_COUNTER1));
+ outl(0x0, dev->iobase + APCI1564_COUNTER_CTRL_REG(APCI1564_COUNTER2));
+ outl(0x0, dev->iobase + APCI1564_COUNTER_CTRL_REG(APCI1564_COUNTER3));
+ outl(0x0, dev->iobase + APCI1564_COUNTER_CTRL_REG(APCI1564_COUNTER4));
return 0;
}
@@ -94,17 +94,20 @@ static irqreturn_t apci1564_interrupt(int irq, void *d)
}
for (chan = 0; chan < 4; chan++) {
- status = inl(dev->iobase + APCI1564_TCW_IRQ_REG(chan));
+ status = inl(dev->iobase + APCI1564_COUNTER_IRQ_REG(chan));
if (status & 0x01) {
/* Disable Counter Interrupt */
- ctrl = inl(dev->iobase + APCI1564_TCW_CTRL_REG(chan));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(chan));
+ ctrl = inl(dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(chan));
+ outl(0x0, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(chan));
/* Send a signal to from kernel to user space */
send_sig(SIGIO, devpriv->tsk_current, 0);
/* Enable Counter Interrupt */
- outl(ctrl, dev->iobase + APCI1564_TCW_CTRL_REG(chan));
+ outl(ctrl, dev->iobase +
+ APCI1564_COUNTER_CTRL_REG(chan));
}
}
@@ -388,7 +391,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->n_chan = 32;
s->maxdata = 1;
s->range_table = &range_digital;
- s->insn_config = apci1564_do_config;
s->insn_bits = apci1564_do_insn_bits;
/* Change-Of-State (COS) interrupt subdevice */
diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c
index b8c7d9145a54..f3e2268d4fee 100644
--- a/drivers/staging/comedi/drivers/adv_pci_dio.c
+++ b/drivers/staging/comedi/drivers/adv_pci_dio.c
@@ -66,7 +66,6 @@ enum hw_io_access {
* subdevice) */
#define SIZE_8254 4 /* 8254 IO space length */
-#define SIZE_8255 4 /* 8255 IO space length */
#define PCIDIO_MAINREG 2 /* main I/O region for all Advantech cards? */
@@ -1132,9 +1131,8 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
for (j = 0; j < this_board->sdio[i].regs; j++) {
s = &dev->subdevices[subdev];
ret = subdev_8255_init(dev, s, NULL,
- dev->iobase +
this_board->sdio[i].addr +
- SIZE_8255 * j);
+ j * I8255_SIZE);
if (ret)
return ret;
subdev++;
diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c
index 324746b14931..848b95decabe 100644
--- a/drivers/staging/comedi/drivers/aio_aio12_8.c
+++ b/drivers/staging/comedi/drivers/aio_aio12_8.c
@@ -244,8 +244,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
s = &dev->subdevices[2];
/* 8255 Digital i/o subdevice */
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + AIO12_8_8255_BASE_REG);
+ ret = subdev_8255_init(dev, s, NULL, AIO12_8_8255_BASE_REG);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 17d2e20663cb..4fe118380218 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -202,100 +202,69 @@
*/
static const struct dio200_board dio200_isa_boards[] = {
{
- .name = "pc212e",
- .bustype = isa_bustype,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 6,
- .sdtype = {sd_8255, sd_8254, sd_8254, sd_8254, sd_8254,
- sd_intr},
- .sdinfo = {0x00, 0x08, 0x0C, 0x10, 0x14, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
+ .name = "pc212e",
+ .n_subdevs = 6,
+ .sdtype = {
+ sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, sd_intr
},
- },
- {
- .name = "pc214e",
- .bustype = isa_bustype,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 4,
- .sdtype = {sd_8255, sd_8255, sd_8254, sd_intr},
- .sdinfo = {0x00, 0x08, 0x10, 0x01},
+ .sdinfo = { 0x00, 0x08, 0x0c, 0x10, 0x14, 0x3f },
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ }, {
+ .name = "pc214e",
+ .n_subdevs = 4,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8254, sd_intr
},
- },
- {
- .name = "pc215e",
- .bustype = isa_bustype,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 5,
- .sdtype = {sd_8255, sd_8255, sd_8254, sd_8254, sd_intr},
- .sdinfo = {0x00, 0x08, 0x10, 0x14, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
+ .sdinfo = { 0x00, 0x08, 0x10, 0x01 },
+ }, {
+ .name = "pc215e",
+ .n_subdevs = 5,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8254, sd_8254, sd_intr
},
- },
- {
- .name = "pc218e",
- .bustype = isa_bustype,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 7,
- .sdtype = {sd_8254, sd_8254, sd_8255, sd_8254, sd_8254,
- sd_intr},
- .sdinfo = {0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
+ .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f },
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ }, {
+ .name = "pc218e",
+ .n_subdevs = 7,
+ .sdtype = {
+ sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, sd_intr
},
- },
- {
- .name = "pc272e",
- .bustype = isa_bustype,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 4,
- .sdtype = {sd_8255, sd_8255, sd_8255, sd_intr},
- .sdinfo = {0x00, 0x08, 0x10, 0x3F},
- .has_int_sce = true,
+ .sdinfo = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x3f },
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ }, {
+ .name = "pc272e",
+ .n_subdevs = 4,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8255, sd_intr
},
+ .sdinfo = { 0x00, 0x08, 0x10, 0x3f },
+ .has_int_sce = true,
},
};
static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
- const struct dio200_board *thisboard = comedi_board(dev);
- struct dio200_private *devpriv;
- unsigned int irq;
int ret;
- irq = it->options[1];
-
- devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
- if (!devpriv)
- return -ENOMEM;
-
- ret = comedi_request_region(dev, it->options[0], thisboard->mainsize);
+ ret = comedi_request_region(dev, it->options[0], 0x20);
if (ret)
return ret;
- return amplc_dio200_common_attach(dev, irq, 0);
-}
-
-static void dio200_detach(struct comedi_device *dev)
-{
- amplc_dio200_common_detach(dev);
- comedi_legacy_detach(dev);
+ return amplc_dio200_common_attach(dev, it->options[1], 0);
}
static struct comedi_driver amplc_dio200_driver = {
- .driver_name = "amplc_dio200",
- .module = THIS_MODULE,
- .attach = dio200_attach,
- .detach = dio200_detach,
- .board_name = &dio200_isa_boards[0].name,
- .offset = sizeof(struct dio200_board),
- .num_names = ARRAY_SIZE(dio200_isa_boards),
+ .driver_name = "amplc_dio200",
+ .module = THIS_MODULE,
+ .attach = dio200_attach,
+ .detach = comedi_legacy_detach,
+ .board_name = &dio200_isa_boards[0].name,
+ .offset = sizeof(struct dio200_board),
+ .num_names = ARRAY_SIZE(dio200_isa_boards),
};
module_comedi_driver(amplc_dio200_driver);
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h
index e0afe2cee2d6..d6d6a265c461 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.h
+++ b/drivers/staging/comedi/drivers/amplc_dio200.h
@@ -23,10 +23,6 @@
#ifndef AMPLC_DIO200_H_INCLUDED
#define AMPLC_DIO200_H_INCLUDED
-/* 200 series register area sizes */
-#define DIO200_IO_SIZE 0x20
-#define DIO200_PCIE_IO_SIZE 0x4000
-
/*
* Subdevice types.
*/
@@ -35,42 +31,20 @@ enum dio200_sdtype { sd_none, sd_intr, sd_8255, sd_8254, sd_timer };
#define DIO200_MAX_SUBDEVS 8
#define DIO200_MAX_ISNS 6
-/*
- * Board descriptions.
- */
-
-struct dio200_layout {
+struct dio200_board {
+ const char *name;
+ unsigned char mainbar;
unsigned short n_subdevs; /* number of subdevices */
unsigned char sdtype[DIO200_MAX_SUBDEVS]; /* enum dio200_sdtype */
unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */
bool has_int_sce:1; /* has interrupt enable/status reg */
bool has_clk_gat_sce:1; /* has clock/gate selection registers */
- bool has_enhancements:1; /* has enhanced features */
-};
-
-enum dio200_bustype { isa_bustype, pci_bustype };
-
-struct dio200_board {
- const char *name;
- struct dio200_layout layout;
- enum dio200_bustype bustype;
- unsigned char mainbar;
- unsigned char mainshift;
- unsigned int mainsize;
-};
-
-/*
- * Comedi device private data.
- */
-struct dio200_private {
- int intr_sd;
+ bool is_pcie:1; /* has enhanced features */
};
int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
unsigned long req_irq_flags);
-void amplc_dio200_common_detach(struct comedi_device *dev);
-
/* Used by initialization of PCIe boards. */
void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val);
diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index f0d709e0dafc..6cadf7e19c94 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -27,15 +27,7 @@
#include "amplc_dio200.h"
#include "comedi_fc.h"
#include "8253.h"
-
-/* 8255 control register bits */
-#define CR_C_LO_IO 0x01
-#define CR_B_IO 0x02
-#define CR_B_MODE 0x04
-#define CR_C_HI_IO 0x08
-#define CR_A_IO 0x10
-#define CR_A_MODE(a) ((a)<<5)
-#define CR_CW 0x80
+#include "8255.h" /* only for register defines */
/* 200 series registers */
#define DIO200_IO_SIZE 0x20
@@ -132,42 +124,26 @@ struct dio200_subdev_intr {
bool active:1;
};
-static inline const struct dio200_layout *
-dio200_board_layout(const struct dio200_board *board)
-{
- return &board->layout;
-}
-
-static inline const struct dio200_layout *
-dio200_dev_layout(struct comedi_device *dev)
-{
- return dio200_board_layout(comedi_board(dev));
-}
-
-/*
- * Read 8-bit register.
- */
static unsigned char dio200_read8(struct comedi_device *dev,
unsigned int offset)
{
- const struct dio200_board *thisboard = comedi_board(dev);
+ const struct dio200_board *board = comedi_board(dev);
- offset <<= thisboard->mainshift;
+ if (board->is_pcie)
+ offset <<= 3;
if (dev->mmio)
return readb(dev->mmio + offset);
return inb(dev->iobase + offset);
}
-/*
- * Write 8-bit register.
- */
-static void dio200_write8(struct comedi_device *dev, unsigned int offset,
- unsigned char val)
+static void dio200_write8(struct comedi_device *dev,
+ unsigned int offset, unsigned char val)
{
- const struct dio200_board *thisboard = comedi_board(dev);
+ const struct dio200_board *board = comedi_board(dev);
- offset <<= thisboard->mainshift;
+ if (board->is_pcie)
+ offset <<= 3;
if (dev->mmio)
writeb(val, dev->mmio + offset);
@@ -175,30 +151,26 @@ static void dio200_write8(struct comedi_device *dev, unsigned int offset,
outb(val, dev->iobase + offset);
}
-/*
- * Read 32-bit register.
- */
static unsigned int dio200_read32(struct comedi_device *dev,
unsigned int offset)
{
- const struct dio200_board *thisboard = comedi_board(dev);
+ const struct dio200_board *board = comedi_board(dev);
- offset <<= thisboard->mainshift;
+ if (board->is_pcie)
+ offset <<= 3;
if (dev->mmio)
return readl(dev->mmio + offset);
return inl(dev->iobase + offset);
}
-/*
- * Write 32-bit register.
- */
-static void dio200_write32(struct comedi_device *dev, unsigned int offset,
- unsigned int val)
+static void dio200_write32(struct comedi_device *dev,
+ unsigned int offset, unsigned int val)
{
- const struct dio200_board *thisboard = comedi_board(dev);
+ const struct dio200_board *board = comedi_board(dev);
- offset <<= thisboard->mainshift;
+ if (board->is_pcie)
+ offset <<= 3;
if (dev->mmio)
writel(val, dev->mmio + offset);
@@ -206,18 +178,15 @@ static void dio200_write32(struct comedi_device *dev, unsigned int offset,
outl(val, dev->iobase + offset);
}
-/*
- * 'insn_bits' function for an 'INTERRUPT' subdevice.
- */
-static int
-dio200_subdev_intr_insn_bits(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int dio200_subdev_intr_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_intr *subpriv = s->private;
- if (layout->has_int_sce) {
+ if (board->has_int_sce) {
/* Just read the interrupt status register. */
data[1] = dio200_read8(dev, subpriv->ofs) & subpriv->valid_isns;
} else {
@@ -228,32 +197,26 @@ dio200_subdev_intr_insn_bits(struct comedi_device *dev,
return insn->n;
}
-/*
- * Called to stop acquisition for an 'INTERRUPT' subdevice.
- */
static void dio200_stop_intr(struct comedi_device *dev,
struct comedi_subdevice *s)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_intr *subpriv = s->private;
subpriv->active = false;
subpriv->enabled_isns = 0;
- if (layout->has_int_sce)
+ if (board->has_int_sce)
dio200_write8(dev, subpriv->ofs, 0);
}
-/*
- * Called to start acquisition for an 'INTERRUPT' subdevice.
- */
static int dio200_start_intr(struct comedi_device *dev,
struct comedi_subdevice *s)
{
- unsigned int n;
- unsigned isn_bits;
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_intr *subpriv = s->private;
struct comedi_cmd *cmd = &s->async->cmd;
+ unsigned int n;
+ unsigned isn_bits;
int retval = 0;
if (cmd->stop_src == TRIG_COUNT && subpriv->stopcount == 0) {
@@ -271,7 +234,7 @@ static int dio200_start_intr(struct comedi_device *dev,
isn_bits &= subpriv->valid_isns;
/* Enable interrupt sources. */
subpriv->enabled_isns = isn_bits;
- if (layout->has_int_sce)
+ if (board->has_int_sce)
dio200_write8(dev, subpriv->ofs, isn_bits);
}
@@ -340,14 +303,10 @@ static void dio200_read_scan_intr(struct comedi_device *dev,
}
}
-/*
- * This is called from the interrupt service routine to handle a read
- * scan on an 'INTERRUPT' subdevice.
- */
static int dio200_handle_read_intr(struct comedi_device *dev,
struct comedi_subdevice *s)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_intr *subpriv = s->private;
unsigned triggered;
unsigned intstat;
@@ -359,7 +318,7 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
spin_lock_irqsave(&subpriv->spinlock, flags);
oldevents = s->async->events;
- if (layout->has_int_sce) {
+ if (board->has_int_sce) {
/*
* Collect interrupt sources that have triggered and disable
* them temporarily. Loop around until no extra interrupt
@@ -393,7 +352,7 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
* Reenable them NOW to minimize the time they are disabled.
*/
cur_enabled = subpriv->enabled_isns;
- if (layout->has_int_sce)
+ if (board->has_int_sce)
dio200_write8(dev, subpriv->ofs, cur_enabled);
if (subpriv->active) {
@@ -417,9 +376,6 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
return (triggered != 0);
}
-/*
- * 'cancel' function for an 'INTERRUPT' subdevice.
- */
static int dio200_subdev_intr_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
@@ -435,12 +391,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev,
return 0;
}
-/*
- * 'do_cmdtest' function for an 'INTERRUPT' subdevice.
- */
-static int
-dio200_subdev_intr_cmdtest(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_cmd *cmd)
+static int dio200_subdev_intr_cmdtest(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_cmd *cmd)
{
int err = 0;
@@ -493,9 +446,6 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev,
return 0;
}
-/*
- * 'do_cmd' function for an 'INTERRUPT' subdevice.
- */
static int dio200_subdev_intr_cmd(struct comedi_device *dev,
struct comedi_subdevice *s)
{
@@ -526,14 +476,12 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
return 0;
}
-/*
- * This function initializes an 'INTERRUPT' subdevice.
- */
-static int
-dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int offset, unsigned valid_isns)
+static int dio200_subdev_intr_init(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int offset,
+ unsigned valid_isns)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_intr *subpriv;
subpriv = comedi_alloc_spriv(s, sizeof(*subpriv));
@@ -544,13 +492,13 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
subpriv->valid_isns = valid_isns;
spin_lock_init(&subpriv->spinlock);
- if (layout->has_int_sce)
+ if (board->has_int_sce)
/* Disable interrupt sources. */
dio200_write8(dev, subpriv->ofs, 0);
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE | SDF_CMD_READ;
- if (layout->has_int_sce) {
+ if (board->has_int_sce) {
s->n_chan = DIO200_MAX_ISNS;
s->len_chanlist = DIO200_MAX_ISNS;
} else {
@@ -568,35 +516,23 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
return 0;
}
-/*
- * Interrupt service routine.
- */
static irqreturn_t dio200_interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
- struct dio200_private *devpriv = dev->private;
- struct comedi_subdevice *s;
+ struct comedi_subdevice *s = dev->read_subdev;
int handled;
if (!dev->attached)
return IRQ_NONE;
- if (devpriv->intr_sd >= 0) {
- s = &dev->subdevices[devpriv->intr_sd];
- handled = dio200_handle_read_intr(dev, s);
- } else {
- handled = 0;
- }
+ handled = dio200_handle_read_intr(dev, s);
return IRQ_RETVAL(handled);
}
-/*
- * Read an '8254' counter subdevice channel.
- */
-static unsigned int
-dio200_subdev_8254_read_chan(struct comedi_device *dev,
- struct comedi_subdevice *s, unsigned int chan)
+static unsigned int dio200_subdev_8254_read_chan(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chan)
{
struct dio200_subdev_8254 *subpriv = s->private;
unsigned int val;
@@ -610,13 +546,10 @@ dio200_subdev_8254_read_chan(struct comedi_device *dev,
return val;
}
-/*
- * Write an '8254' subdevice channel.
- */
-static void
-dio200_subdev_8254_write_chan(struct comedi_device *dev,
- struct comedi_subdevice *s, unsigned int chan,
- unsigned int count)
+static void dio200_subdev_8254_write_chan(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chan,
+ unsigned int count)
{
struct dio200_subdev_8254 *subpriv = s->private;
@@ -625,13 +558,10 @@ dio200_subdev_8254_write_chan(struct comedi_device *dev,
dio200_write8(dev, subpriv->ofs + chan, (count >> 8) & 0xff);
}
-/*
- * Set mode of an '8254' subdevice channel.
- */
-static void
-dio200_subdev_8254_set_mode(struct comedi_device *dev,
- struct comedi_subdevice *s, unsigned int chan,
- unsigned int mode)
+static void dio200_subdev_8254_set_mode(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chan,
+ unsigned int mode)
{
struct dio200_subdev_8254 *subpriv = s->private;
unsigned int byte;
@@ -642,12 +572,9 @@ dio200_subdev_8254_set_mode(struct comedi_device *dev,
dio200_write8(dev, subpriv->ofs + i8254_control_reg, byte);
}
-/*
- * Read status byte of an '8254' counter subdevice channel.
- */
-static unsigned int
-dio200_subdev_8254_status(struct comedi_device *dev,
- struct comedi_subdevice *s, unsigned int chan)
+static unsigned int dio200_subdev_8254_status(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int chan)
{
struct dio200_subdev_8254 *subpriv = s->private;
@@ -658,12 +585,10 @@ dio200_subdev_8254_status(struct comedi_device *dev,
return dio200_read8(dev, subpriv->ofs + chan);
}
-/*
- * Handle 'insn_read' for an '8254' counter subdevice.
- */
-static int
-dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int dio200_subdev_8254_read(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec);
@@ -678,12 +603,10 @@ dio200_subdev_8254_read(struct comedi_device *dev, struct comedi_subdevice *s,
return insn->n;
}
-/*
- * Handle 'insn_write' for an '8254' counter subdevice.
- */
-static int
-dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int dio200_subdev_8254_write(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct dio200_subdev_8254 *subpriv = s->private;
int chan = CR_CHAN(insn->chanspec);
@@ -698,24 +621,20 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s,
return insn->n;
}
-/*
- * Set gate source for an '8254' counter subdevice channel.
- */
-static int
-dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int counter_number,
- unsigned int gate_src)
+static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int counter_number,
+ unsigned int gate_src)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte;
- if (!layout->has_clk_gat_sce)
+ if (!board->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
- if (gate_src > (layout->has_enhancements ? 31 : 7))
+ if (gate_src > (board->is_pcie ? 31 : 7))
return -1;
subpriv->gate_src[counter_number] = gate_src;
@@ -725,18 +644,14 @@ dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
return 0;
}
-/*
- * Get gate source for an '8254' counter subdevice channel.
- */
-static int
-dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int counter_number)
+static int dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int counter_number)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_8254 *subpriv = s->private;
- if (!layout->has_clk_gat_sce)
+ if (!board->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -744,24 +659,20 @@ dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
return subpriv->gate_src[counter_number];
}
-/*
- * Set clock source for an '8254' counter subdevice channel.
- */
-static int
-dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int counter_number,
- unsigned int clock_src)
+static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int counter_number,
+ unsigned int clock_src)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte;
- if (!layout->has_clk_gat_sce)
+ if (!board->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
- if (clock_src > (layout->has_enhancements ? 31 : 7))
+ if (clock_src > (board->is_pcie ? 31 : 7))
return -1;
subpriv->clock_src[counter_number] = clock_src;
@@ -771,20 +682,16 @@ dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
return 0;
}
-/*
- * Get clock source for an '8254' counter subdevice channel.
- */
-static int
-dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
- struct comedi_subdevice *s,
- unsigned int counter_number,
- unsigned int *period_ns)
+static int dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int counter_number,
+ unsigned int *period_ns)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_8254 *subpriv = s->private;
unsigned clock_src;
- if (!layout->has_clk_gat_sce)
+ if (!board->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
@@ -794,12 +701,10 @@ dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
return clock_src;
}
-/*
- * Handle 'insn_config' for an '8254' counter subdevice.
- */
-static int
-dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+static int dio200_subdev_8254_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct dio200_subdev_8254 *subpriv = s->private;
int ret = 0;
@@ -851,14 +756,11 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
return ret < 0 ? ret : insn->n;
}
-/*
- * This function initializes an '8254' counter subdevice.
- */
-static int
-dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
- unsigned int offset)
+static int dio200_subdev_8254_init(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ unsigned int offset)
{
- const struct dio200_layout *layout = dio200_dev_layout(dev);
+ const struct dio200_board *board = comedi_board(dev);
struct dio200_subdev_8254 *subpriv;
unsigned int chan;
@@ -876,7 +778,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
spin_lock_init(&subpriv->spinlock);
subpriv->ofs = offset;
- if (layout->has_clk_gat_sce) {
+ if (board->has_clk_gat_sce) {
/* Derive CLK_SCE and GAT_SCE register offsets from
* 8254 offset. */
subpriv->clk_sce_ofs = DIO200_XCLK_SCE + (offset >> 3);
@@ -888,7 +790,7 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
for (chan = 0; chan < 3; chan++) {
dio200_subdev_8254_set_mode(dev, s, chan,
I8254_MODE0 | I8254_BINARY);
- if (layout->has_clk_gat_sce) {
+ if (board->has_clk_gat_sce) {
/* Gate source 0 is VCC (logic 1). */
dio200_subdev_8254_set_gate_src(dev, s, chan, 0);
/* Clock source 0 is the dedicated clock input. */
@@ -899,26 +801,23 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
return 0;
}
-/*
- * This function sets I/O directions for an '8255' DIO subdevice.
- */
static void dio200_subdev_8255_set_dir(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_8255 *subpriv = s->private;
int config;
- config = CR_CW;
+ config = I8255_CTRL_CW;
/* 1 in io_bits indicates output, 1 in config indicates input */
if (!(s->io_bits & 0x0000ff))
- config |= CR_A_IO;
+ config |= I8255_CTRL_A_IO;
if (!(s->io_bits & 0x00ff00))
- config |= CR_B_IO;
+ config |= I8255_CTRL_B_IO;
if (!(s->io_bits & 0x0f0000))
- config |= CR_C_LO_IO;
+ config |= I8255_CTRL_C_LO_IO;
if (!(s->io_bits & 0xf00000))
- config |= CR_C_HI_IO;
- dio200_write8(dev, subpriv->ofs + 3, config);
+ config |= I8255_CTRL_C_HI_IO;
+ dio200_write8(dev, subpriv->ofs + I8255_CTRL_REG, config);
}
static int dio200_subdev_8255_bits(struct comedi_device *dev,
@@ -933,27 +832,25 @@ static int dio200_subdev_8255_bits(struct comedi_device *dev,
mask = comedi_dio_update_state(s, data);
if (mask) {
if (mask & 0xff)
- dio200_write8(dev, subpriv->ofs, s->state & 0xff);
+ dio200_write8(dev, subpriv->ofs + I8255_DATA_A_REG,
+ s->state & 0xff);
if (mask & 0xff00)
- dio200_write8(dev, subpriv->ofs + 1,
+ dio200_write8(dev, subpriv->ofs + I8255_DATA_B_REG,
(s->state >> 8) & 0xff);
if (mask & 0xff0000)
- dio200_write8(dev, subpriv->ofs + 2,
+ dio200_write8(dev, subpriv->ofs + I8255_DATA_C_REG,
(s->state >> 16) & 0xff);
}
- val = dio200_read8(dev, subpriv->ofs);
- val |= dio200_read8(dev, subpriv->ofs + 1) << 8;
- val |= dio200_read8(dev, subpriv->ofs + 2) << 16;
+ val = dio200_read8(dev, subpriv->ofs + I8255_DATA_A_REG);
+ val |= dio200_read8(dev, subpriv->ofs + I8255_DATA_B_REG) << 8;
+ val |= dio200_read8(dev, subpriv->ofs + I8255_DATA_C_REG) << 16;
data[1] = val;
return insn->n;
}
-/*
- * Handle 'insn_config' for an '8255' DIO subdevice.
- */
static int dio200_subdev_8255_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -981,11 +878,6 @@ static int dio200_subdev_8255_config(struct comedi_device *dev,
return insn->n;
}
-/*
- * This function initializes an '8255' DIO subdevice.
- *
- * offset is the offset to the 8255 chip.
- */
static int dio200_subdev_8255_init(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int offset)
@@ -1009,9 +901,6 @@ static int dio200_subdev_8255_init(struct comedi_device *dev,
return 0;
}
-/*
- * Handle 'insn_read' for a timer subdevice.
- */
static int dio200_subdev_timer_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -1024,9 +913,6 @@ static int dio200_subdev_timer_read(struct comedi_device *dev,
return n;
}
-/*
- * Reset timer subdevice.
- */
static void dio200_subdev_timer_reset(struct comedi_device *dev,
struct comedi_subdevice *s)
{
@@ -1037,9 +923,6 @@ static void dio200_subdev_timer_reset(struct comedi_device *dev,
dio200_write32(dev, DIO200_TS_CONFIG, clock);
}
-/*
- * Get timer subdevice clock source and period.
- */
static void dio200_subdev_timer_get_clock_src(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int *src,
@@ -1053,9 +936,6 @@ static void dio200_subdev_timer_get_clock_src(struct comedi_device *dev,
ts_clock_period[clk] : 0;
}
-/*
- * Set timer subdevice clock source.
- */
static int dio200_subdev_timer_set_clock_src(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int src)
@@ -1066,9 +946,6 @@ static int dio200_subdev_timer_set_clock_src(struct comedi_device *dev,
return 0;
}
-/*
- * Handle 'insn_config' for a timer subdevice.
- */
static int dio200_subdev_timer_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -1095,23 +972,6 @@ static int dio200_subdev_timer_config(struct comedi_device *dev,
return ret < 0 ? ret : insn->n;
}
-/*
- * This function initializes a timer subdevice.
- *
- * Uses the timestamp timer registers. There is only one timestamp timer.
- */
-static int dio200_subdev_timer_init(struct comedi_device *dev,
- struct comedi_subdevice *s)
-{
- s->type = COMEDI_SUBD_TIMER;
- s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
- s->n_chan = 1;
- s->maxdata = 0xFFFFFFFF;
- s->insn_read = dio200_subdev_timer_read;
- s->insn_config = dio200_subdev_timer_config;
- return 0;
-}
-
void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val)
{
dio200_write8(dev, DIO200_ENHANCE, val);
@@ -1121,65 +981,60 @@ EXPORT_SYMBOL_GPL(amplc_dio200_set_enhance);
int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
unsigned long req_irq_flags)
{
- const struct dio200_board *thisboard = comedi_board(dev);
- struct dio200_private *devpriv = dev->private;
- const struct dio200_layout *layout = dio200_board_layout(thisboard);
+ const struct dio200_board *board = comedi_board(dev);
struct comedi_subdevice *s;
- int sdx;
unsigned int n;
int ret;
- devpriv->intr_sd = -1;
-
- ret = comedi_alloc_subdevices(dev, layout->n_subdevs);
+ ret = comedi_alloc_subdevices(dev, board->n_subdevs);
if (ret)
return ret;
for (n = 0; n < dev->n_subdevices; n++) {
s = &dev->subdevices[n];
- switch (layout->sdtype[n]) {
+ switch (board->sdtype[n]) {
case sd_8254:
/* counter subdevice (8254) */
ret = dio200_subdev_8254_init(dev, s,
- layout->sdinfo[n]);
+ board->sdinfo[n]);
if (ret < 0)
return ret;
break;
case sd_8255:
/* digital i/o subdevice (8255) */
ret = dio200_subdev_8255_init(dev, s,
- layout->sdinfo[n]);
+ board->sdinfo[n]);
if (ret < 0)
return ret;
break;
case sd_intr:
/* 'INTERRUPT' subdevice */
- if (irq) {
+ if (irq && !dev->read_subdev) {
ret = dio200_subdev_intr_init(dev, s,
DIO200_INT_SCE,
- layout->sdinfo[n]
- );
+ board->sdinfo[n]);
if (ret < 0)
return ret;
- devpriv->intr_sd = n;
+ dev->read_subdev = s;
} else {
s->type = COMEDI_SUBD_UNUSED;
}
break;
case sd_timer:
- ret = dio200_subdev_timer_init(dev, s);
- if (ret < 0)
- return ret;
+ s->type = COMEDI_SUBD_TIMER;
+ s->subdev_flags = SDF_READABLE | SDF_LSAMPL;
+ s->n_chan = 1;
+ s->maxdata = 0xffffffff;
+ s->insn_read = dio200_subdev_timer_read;
+ s->insn_config = dio200_subdev_timer_config;
break;
default:
s->type = COMEDI_SUBD_UNUSED;
break;
}
}
- sdx = devpriv->intr_sd;
- if (sdx >= 0 && sdx < dev->n_subdevices)
- dev->read_subdev = &dev->subdevices[sdx];
- if (irq) {
+
+ if (irq && dev->read_subdev) {
if (request_irq(irq, dio200_interrupt, req_irq_flags,
dev->board_name, dev) >= 0) {
dev->irq = irq;
@@ -1193,15 +1048,6 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq,
}
EXPORT_SYMBOL_GPL(amplc_dio200_common_attach);
-void amplc_dio200_common_detach(struct comedi_device *dev)
-{
- if (dev->irq) {
- free_irq(dev->irq, dev);
- dev->irq = 0;
- }
-}
-EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);
-
static int __init amplc_dio200_common_init(void)
{
return 0;
diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
index fbf05687347f..423b6249d4f1 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
@@ -242,80 +242,70 @@ enum dio200_pci_model {
static const struct dio200_board dio200_pci_boards[] = {
[pci215_model] = {
- .name = "pci215",
- .bustype = pci_bustype,
- .mainbar = 2,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 5,
- .sdtype = {sd_8255, sd_8255, sd_8254, sd_8254, sd_intr},
- .sdinfo = {0x00, 0x08, 0x10, 0x14, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
+ .name = "pci215",
+ .mainbar = 2,
+ .n_subdevs = 5,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8254, sd_8254, sd_intr
},
+ .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f },
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
},
[pci272_model] = {
- .name = "pci272",
- .bustype = pci_bustype,
- .mainbar = 2,
- .mainsize = DIO200_IO_SIZE,
- .layout = {
- .n_subdevs = 4,
- .sdtype = {sd_8255, sd_8255, sd_8255, sd_intr},
- .sdinfo = {0x00, 0x08, 0x10, 0x3F},
- .has_int_sce = true,
+ .name = "pci272",
+ .mainbar = 2,
+ .n_subdevs = 4,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8255, sd_intr
},
+ .sdinfo = { 0x00, 0x08, 0x10, 0x3f },
+ .has_int_sce = true,
},
[pcie215_model] = {
- .name = "pcie215",
- .bustype = pci_bustype,
- .mainbar = 1,
- .mainshift = 3,
- .mainsize = DIO200_PCIE_IO_SIZE,
- .layout = {
- .n_subdevs = 8,
- .sdtype = {sd_8255, sd_none, sd_8255, sd_none,
- sd_8254, sd_8254, sd_timer, sd_intr},
- .sdinfo = {0x00, 0x00, 0x08, 0x00,
- 0x10, 0x14, 0x00, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
- .has_enhancements = true,
+ .name = "pcie215",
+ .mainbar = 1,
+ .n_subdevs = 8,
+ .sdtype = {
+ sd_8255, sd_none, sd_8255, sd_none,
+ sd_8254, sd_8254, sd_timer, sd_intr
},
+ .sdinfo = {
+ 0x00, 0x00, 0x08, 0x00, 0x10, 0x14, 0x00, 0x3f
+ },
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ .is_pcie = true,
},
[pcie236_model] = {
- .name = "pcie236",
- .bustype = pci_bustype,
- .mainbar = 1,
- .mainshift = 3,
- .mainsize = DIO200_PCIE_IO_SIZE,
- .layout = {
- .n_subdevs = 8,
- .sdtype = {sd_8255, sd_none, sd_none, sd_none,
- sd_8254, sd_8254, sd_timer, sd_intr},
- .sdinfo = {0x00, 0x00, 0x00, 0x00,
- 0x10, 0x14, 0x00, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
- .has_enhancements = true,
+ .name = "pcie236",
+ .mainbar = 1,
+ .n_subdevs = 8,
+ .sdtype = {
+ sd_8255, sd_none, sd_none, sd_none,
+ sd_8254, sd_8254, sd_timer, sd_intr
+ },
+ .sdinfo = {
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x14, 0x00, 0x3f
},
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ .is_pcie = true,
},
[pcie296_model] = {
- .name = "pcie296",
- .bustype = pci_bustype,
- .mainbar = 1,
- .mainshift = 3,
- .mainsize = DIO200_PCIE_IO_SIZE,
- .layout = {
- .n_subdevs = 8,
- .sdtype = {sd_8255, sd_8255, sd_8255, sd_8255,
- sd_8254, sd_8254, sd_timer, sd_intr},
- .sdinfo = {0x00, 0x04, 0x08, 0x0C,
- 0x10, 0x14, 0x00, 0x3F},
- .has_int_sce = true,
- .has_clk_gat_sce = true,
- .has_enhancements = true,
+ .name = "pcie296",
+ .mainbar = 1,
+ .n_subdevs = 8,
+ .sdtype = {
+ sd_8255, sd_8255, sd_8255, sd_8255,
+ sd_8254, sd_8254, sd_timer, sd_intr
+ },
+ .sdinfo = {
+ 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x00, 0x3f
},
+ .has_int_sce = true,
+ .has_clk_gat_sce = true,
+ .is_pcie = true,
},
};
@@ -358,34 +348,25 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
unsigned long context_model)
{
struct pci_dev *pci_dev = comedi_to_pci_dev(dev);
- const struct dio200_board *thisboard = NULL;
- struct dio200_private *devpriv;
+ const struct dio200_board *board = NULL;
unsigned int bar;
int ret;
if (context_model < ARRAY_SIZE(dio200_pci_boards))
- thisboard = &dio200_pci_boards[context_model];
- if (!thisboard)
+ board = &dio200_pci_boards[context_model];
+ if (!board)
return -EINVAL;
- dev->board_ptr = thisboard;
- dev->board_name = thisboard->name;
+ dev->board_ptr = board;
+ dev->board_name = board->name;
dev_info(dev->class_dev, "%s: attach pci %s (%s)\n",
dev->driver->driver_name, pci_name(pci_dev), dev->board_name);
- devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
- if (!devpriv)
- return -ENOMEM;
-
ret = comedi_pci_enable(dev);
if (ret)
return ret;
- bar = thisboard->mainbar;
- if (pci_resource_len(pci_dev, bar) < thisboard->mainsize) {
- dev_err(dev->class_dev, "error! PCI region size too small!\n");
- return -EINVAL;
- }
+ bar = board->mainbar;
if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) {
dev->mmio = pci_ioremap_bar(pci_dev, bar);
if (!dev->mmio) {
@@ -396,33 +377,30 @@ static int dio200_pci_auto_attach(struct comedi_device *dev,
} else {
dev->iobase = pci_resource_start(pci_dev, bar);
}
- switch (context_model) {
- case pcie215_model:
- case pcie236_model:
- case pcie296_model:
+
+ if (board->is_pcie) {
ret = dio200_pcie_board_setup(dev);
if (ret < 0)
return ret;
- break;
- default:
- break;
}
+
return amplc_dio200_common_attach(dev, pci_dev->irq, IRQF_SHARED);
}
static void dio200_pci_detach(struct comedi_device *dev)
{
- amplc_dio200_common_detach(dev);
+ if (dev->irq)
+ free_irq(dev->irq, dev);
if (dev->mmio)
iounmap(dev->mmio);
comedi_pci_disable(dev);
}
static struct comedi_driver dio200_pci_comedi_driver = {
- .driver_name = "amplc_dio200_pci",
- .module = THIS_MODULE,
- .auto_attach = dio200_pci_auto_attach,
- .detach = dio200_pci_detach,
+ .driver_name = "amplc_dio200_pci",
+ .module = THIS_MODULE,
+ .auto_attach = dio200_pci_auto_attach,
+ .detach = dio200_pci_detach,
};
static const struct pci_device_id dio200_pci_table[] = {
@@ -443,10 +421,10 @@ static int dio200_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
}
static struct pci_driver dio200_pci_pci_driver = {
- .name = "amplc_dio200_pci",
- .id_table = dio200_pci_table,
- .probe = dio200_pci_probe,
- .remove = comedi_pci_auto_unconfig,
+ .name = "amplc_dio200_pci",
+ .id_table = dio200_pci_table,
+ .probe = dio200_pci_probe,
+ .remove = comedi_pci_auto_unconfig,
};
module_comedi_pci_driver(dio200_pci_comedi_driver, dio200_pci_pci_driver);
diff --git a/drivers/staging/comedi/drivers/amplc_pc236_common.c b/drivers/staging/comedi/drivers/amplc_pc236_common.c
index 18e237cca419..974b72392d0a 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236_common.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236_common.c
@@ -160,7 +160,7 @@ int amplc_pc236_common_attach(struct comedi_device *dev, unsigned long iobase,
s = &dev->subdevices[0];
/* digital i/o subdevice (8255) */
- ret = subdev_8255_init(dev, s, NULL, iobase);
+ ret = subdev_8255_init(dev, s, NULL, 0x00);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c
index 45aba1f950fc..0b056cfd0136 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -1,102 +1,106 @@
/*
- comedi/drivers/amplc_pci224.c
- Driver for Amplicon PCI224 and PCI234 AO boards.
-
- Copyright (C) 2005 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <ds@schleef.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ * comedi/drivers/amplc_pci224.c
+ * Driver for Amplicon PCI224 and PCI234 AO boards.
+ *
+ * Copyright (C) 2005 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <ds@schleef.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-*/
/*
-Driver: amplc_pci224
-Description: Amplicon PCI224, PCI234
-Author: Ian Abbott <abbotti@mev.co.uk>
-Devices: [Amplicon] PCI224 (amplc_pci224 or pci224),
- PCI234 (amplc_pci224 or pci234)
-Updated: Wed, 22 Oct 2008 12:25:08 +0100
-Status: works, but see caveats
-
-Supports:
-
- - ao_insn read/write
- - ao_do_cmd mode with the following sources:
-
- - start_src TRIG_INT TRIG_EXT
- - scan_begin_src TRIG_TIMER TRIG_EXT
- - convert_src TRIG_NOW
- - scan_end_src TRIG_COUNT
- - stop_src TRIG_COUNT TRIG_EXT TRIG_NONE
-
- The channel list must contain at least one channel with no repeated
- channels. The scan end count must equal the number of channels in
- the channel list.
-
- There is only one external trigger source so only one of start_src,
- scan_begin_src or stop_src may use TRIG_EXT.
-
-Configuration options - PCI224:
- [0] - PCI bus of device (optional).
- [1] - PCI slot of device (optional).
- If bus/slot is not specified, the first available PCI device
- will be used.
- [2] - Select available ranges according to jumper LK1. All channels
- are set to the same range:
- 0=Jumper position 1-2 (factory default), 4 software-selectable
- internal voltage references, giving 4 bipolar and 4 unipolar
- ranges:
- [-10V,+10V], [-5V,+5V], [-2.5V,+2.5V], [-1.25V,+1.25V],
- [0,+10V], [0,+5V], [0,+2.5V], [0,1.25V].
- 1=Jumper position 2-3, 1 external voltage reference, giving
- 1 bipolar and 1 unipolar range:
- [-Vext,+Vext], [0,+Vext].
-
-Configuration options - PCI234:
- [0] - PCI bus of device (optional).
- [1] - PCI slot of device (optional).
- If bus/slot is not specified, the first available PCI device
- will be used.
- [2] - Select internal or external voltage reference according to
- jumper LK1. This affects all channels:
- 0=Jumper position 1-2 (factory default), Vref=5V internal.
- 1=Jumper position 2-3, Vref=Vext external.
- [3] - Select channel 0 range according to jumper LK2:
- 0=Jumper position 2-3 (factory default), range [-2*Vref,+2*Vref]
- (10V bipolar when options[2]=0).
- 1=Jumper position 1-2, range [-Vref,+Vref]
- (5V bipolar when options[2]=0).
- [4] - Select channel 1 range according to jumper LK3: cf. options[3].
- [5] - Select channel 2 range according to jumper LK4: cf. options[3].
- [6] - Select channel 3 range according to jumper LK5: cf. options[3].
-
-Passing a zero for an option is the same as leaving it unspecified.
-
-Caveats:
-
- 1) All channels on the PCI224 share the same range. Any change to the
- range as a result of insn_write or a streaming command will affect
- the output voltages of all channels, including those not specified
- by the instruction or command.
-
- 2) For the analog output command, the first scan may be triggered
- falsely at the start of acquisition. This occurs when the DAC scan
- trigger source is switched from 'none' to 'timer' (scan_begin_src =
- TRIG_TIMER) or 'external' (scan_begin_src == TRIG_EXT) at the start
- of acquisition and the trigger source is at logic level 1 at the
- time of the switch. This is very likely for TRIG_TIMER. For
- TRIG_EXT, it depends on the state of the external line and whether
- the CR_INVERT flag has been set. The remaining scans are triggered
- correctly.
-*/
+ * Driver: amplc_pci224
+ * Description: Amplicon PCI224, PCI234
+ * Author: Ian Abbott <abbotti@mev.co.uk>
+ * Devices: [Amplicon] PCI224 (amplc_pci224), PCI234
+ * Updated: Thu, 31 Jul 2014 11:08:03 +0000
+ * Status: works, but see caveats
+ *
+ * Supports:
+ *
+ * - ao_insn read/write
+ * - ao_do_cmd mode with the following sources:
+ *
+ * - start_src TRIG_INT TRIG_EXT
+ * - scan_begin_src TRIG_TIMER TRIG_EXT
+ * - convert_src TRIG_NOW
+ * - scan_end_src TRIG_COUNT
+ * - stop_src TRIG_COUNT TRIG_EXT TRIG_NONE
+ *
+ * The channel list must contain at least one channel with no repeated
+ * channels. The scan end count must equal the number of channels in
+ * the channel list.
+ *
+ * There is only one external trigger source so only one of start_src,
+ * scan_begin_src or stop_src may use TRIG_EXT.
+ *
+ * Configuration options:
+ * none
+ *
+ * Manual configuration of PCI cards is not supported; they are configured
+ * automatically.
+ *
+ * Output range selection - PCI224:
+ *
+ * Output ranges on PCI224 are partly software-selectable and partly
+ * hardware-selectable according to jumper LK1. All channels are set
+ * to the same range:
+ *
+ * - LK1 position 1-2 (factory default) corresponds to the following
+ * comedi ranges:
+ *
+ * 0: [-10V,+10V]; 1: [-5V,+5V]; 2: [-2.5V,+2.5V], 3: [-1.25V,+1.25V],
+ * 4: [0,+10V], 5: [0,+5V], 6: [0,+2.5V], 7: [0,+1.25V]
+ *
+ * - LK1 position 2-3 corresponds to the following Comedi ranges, using
+ * an external voltage reference:
+ *
+ * 0: [-Vext,+Vext],
+ * 1: [0,+Vext]
+ *
+ * Output range selection - PCI234:
+ *
+ * Output ranges on PCI234 are hardware-selectable according to jumper
+ * LK1 which affects all channels, and jumpers LK2, LK3, LK4 and LK5
+ * which affect channels 0, 1, 2 and 3 individually. LK1 chooses between
+ * an internal 5V reference and an external voltage reference (Vext).
+ * LK2/3/4/5 choose (per channel) to double the reference or not according
+ * to the following table:
+ *
+ * LK1 position LK2/3/4/5 pos Comedi range
+ * ------------- ------------- --------------
+ * 2-3 (factory) 1-2 (factory) 0: [-10V,+10V]
+ * 2-3 (factory) 2-3 1: [-5V,+5V]
+ * 1-2 1-2 (factory) 2: [-2*Vext,+2*Vext]
+ * 1-2 2-3 3: [-Vext,+Vext]
+ *
+ * Caveats:
+ *
+ * 1) All channels on the PCI224 share the same range. Any change to the
+ * range as a result of insn_write or a streaming command will affect
+ * the output voltages of all channels, including those not specified
+ * by the instruction or command.
+ *
+ * 2) For the analog output command, the first scan may be triggered
+ * falsely at the start of acquisition. This occurs when the DAC scan
+ * trigger source is switched from 'none' to 'timer' (scan_begin_src =
+ * TRIG_TIMER) or 'external' (scan_begin_src == TRIG_EXT) at the start
+ * of acquisition and the trigger source is at logic level 1 at the
+ * time of the switch. This is very likely for TRIG_TIMER. For
+ * TRIG_EXT, it depends on the state of the external line and whether
+ * the CR_INVERT flag has been set. The remaining scans are triggered
+ * correctly.
+ */
#include <linux/module.h>
#include <linux/pci.h>
@@ -109,13 +113,6 @@ Caveats:
#include "8253.h"
/*
- * PCI IDs.
- */
-#define PCI_DEVICE_ID_AMPLICON_PCI224 0x0007
-#define PCI_DEVICE_ID_AMPLICON_PCI234 0x0008
-#define PCI_DEVICE_ID_INVALID 0xffff
-
-/*
* PCI224/234 i/o space 1 (PCIBAR2) registers.
*/
#define PCI224_Z2_CT0 0x14 /* 82C54 counter/timer 0 */
@@ -261,9 +258,17 @@ Caveats:
* Range tables.
*/
-/* The software selectable internal ranges for PCI224 (option[2] == 0). */
-static const struct comedi_lrange range_pci224_internal = {
- 8, {
+/*
+ * The ranges for PCI224.
+ *
+ * These are partly hardware-selectable by jumper LK1 and partly
+ * software-selectable.
+ *
+ * All channels share the same hardware range.
+ */
+static const struct comedi_lrange range_pci224 = {
+ 10, {
+ /* jumper LK1 in position 1-2 (factory default) */
BIP_RANGE(10),
BIP_RANGE(5),
BIP_RANGE(2.5),
@@ -271,11 +276,15 @@ static const struct comedi_lrange range_pci224_internal = {
UNI_RANGE(10),
UNI_RANGE(5),
UNI_RANGE(2.5),
- UNI_RANGE(1.25)
+ UNI_RANGE(1.25),
+ /* jumper LK1 in position 2-3 */
+ RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */
+ RANGE_ext(0, 1), /* unipolar [0,+Vext] */
}
};
-static const unsigned short hwrange_pci224_internal[8] = {
+static const unsigned short hwrange_pci224[10] = {
+ /* jumper LK1 in position 1-2 (factory default) */
PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_10,
PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_5,
PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_2_5,
@@ -284,86 +293,87 @@ static const unsigned short hwrange_pci224_internal[8] = {
PCI224_DACCON_POLAR_UNI | PCI224_DACCON_VREF_5,
PCI224_DACCON_POLAR_UNI | PCI224_DACCON_VREF_2_5,
PCI224_DACCON_POLAR_UNI | PCI224_DACCON_VREF_1_25,
-};
-
-/* The software selectable external ranges for PCI224 (option[2] == 1). */
-static const struct comedi_lrange range_pci224_external = {
- 2, {
- RANGE_ext(-1, 1), /* bipolar [-Vref,+Vref] */
- RANGE_ext(0, 1) /* unipolar [0,+Vref] */
- }
-};
-
-static const unsigned short hwrange_pci224_external[2] = {
+ /* jumper LK1 in position 2-3 */
PCI224_DACCON_POLAR_BI,
PCI224_DACCON_POLAR_UNI,
};
-/* The hardware selectable Vref*2 external range for PCI234
- * (option[2] == 1, option[3+n] == 0). */
-static const struct comedi_lrange range_pci234_ext2 = {
- 1, {
- RANGE_ext(-2, 2)
- }
+/* Used to check all channels set to the same range on PCI224. */
+static const unsigned char range_check_pci224[10] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
};
-/* The hardware selectable Vref external range for PCI234
- * (option[2] == 1, option[3+n] == 1). */
-static const struct comedi_lrange range_pci234_ext = {
- 1, {
- RANGE_ext(-1, 1)
+/*
+ * The ranges for PCI234.
+ *
+ * These are all hardware-selectable by jumper LK1 affecting all channels,
+ * and jumpers LK2, LK3, LK4 and LK5 affecting channels 0, 1, 2 and 3
+ * individually.
+ */
+static const struct comedi_lrange range_pci234 = {
+ 4, {
+ /* LK1: 1-2 (fact def), LK2/3/4/5: 2-3 (fac def) */
+ BIP_RANGE(10),
+ /* LK1: 1-2 (fact def), LK2/3/4/5: 1-2 */
+ BIP_RANGE(5),
+ /* LK1: 2-3, LK2/3/4/5: 2-3 (fac def) */
+ RANGE_ext(-2, 2), /* bipolar [-2*Vext,+2*Vext] */
+ /* LK1: 2-3, LK2/3/4/5: 1-2 */
+ RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */
}
};
-/* This serves for all the PCI234 ranges. */
-static const unsigned short hwrange_pci234[1] = {
- PCI224_DACCON_POLAR_BI, /* bipolar - hardware ignores it! */
+/* N.B. PCI234 ignores the polarity bit, but software uses it. */
+static const unsigned short hwrange_pci234[4] = {
+ PCI224_DACCON_POLAR_BI,
+ PCI224_DACCON_POLAR_BI,
+ PCI224_DACCON_POLAR_BI,
+ PCI224_DACCON_POLAR_BI,
+};
+
+/* Used to check all channels use same LK1 setting on PCI234. */
+static const unsigned char range_check_pci234[4] = {
+ 0, 0, 1, 1,
};
/*
* Board descriptions.
*/
-enum pci224_model { any_model, pci224_model, pci234_model };
+enum pci224_model { pci224_model, pci234_model };
struct pci224_board {
const char *name;
- unsigned short devid;
- enum pci224_model model;
unsigned int ao_chans;
unsigned int ao_bits;
+ const struct comedi_lrange *ao_range;
+ const unsigned short *ao_hwrange;
+ const unsigned char *ao_range_check;
};
static const struct pci224_board pci224_boards[] = {
- {
- .name = "pci224",
- .devid = PCI_DEVICE_ID_AMPLICON_PCI224,
- .model = pci224_model,
- .ao_chans = 16,
- .ao_bits = 12,
- },
- {
- .name = "pci234",
- .devid = PCI_DEVICE_ID_AMPLICON_PCI234,
- .model = pci234_model,
- .ao_chans = 4,
- .ao_bits = 16,
- },
- {
- .name = "amplc_pci224",
- .devid = PCI_DEVICE_ID_INVALID,
- .model = any_model, /* wildcard */
- },
+ [pci224_model] = {
+ .name = "pci224",
+ .ao_chans = 16,
+ .ao_bits = 12,
+ .ao_range = &range_pci224,
+ .ao_hwrange = &hwrange_pci224[0],
+ .ao_range_check = &range_check_pci224[0],
+ },
+ [pci234_model] = {
+ .name = "pci234",
+ .ao_chans = 4,
+ .ao_bits = 16,
+ .ao_range = &range_pci234,
+ .ao_hwrange = &hwrange_pci234[0],
+ .ao_range_check = &range_check_pci234[0],
+ },
};
-/* this structure is for data unique to this hardware driver. If
- several hardware drivers keep similar information in this structure,
- feel free to suggest moving the variable to the struct comedi_device struct. */
struct pci224_private {
- const unsigned short *hwrange;
unsigned long iobase1;
unsigned long state;
- spinlock_t ao_spinlock;
+ spinlock_t ao_spinlock; /* spinlock for AO command handling */
unsigned int *ao_readback;
unsigned short *ao_scan_vals;
unsigned char *ao_scan_order;
@@ -393,9 +403,9 @@ pci224_ao_set_data(struct comedi_device *dev, int chan, int range,
/* Enable the channel. */
outw(1 << chan, dev->iobase + PCI224_DACCEN);
/* Set range and reset FIFO. */
- devpriv->daccon = COMBINE(devpriv->daccon, devpriv->hwrange[range],
- (PCI224_DACCON_POLAR_MASK |
- PCI224_DACCON_VREF_MASK));
+ devpriv->daccon = COMBINE(devpriv->daccon, thisboard->ao_hwrange[range],
+ PCI224_DACCON_POLAR_MASK |
+ PCI224_DACCON_VREF_MASK);
outw(devpriv->daccon | PCI224_DACCON_FIFORESET,
dev->iobase + PCI224_DACCON);
/*
@@ -428,8 +438,10 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s,
chan = CR_CHAN(insn->chanspec);
range = CR_RANGE(insn->chanspec);
- /* Writing a list of values to an AO channel is probably not
- * very useful, but that's how the interface is defined. */
+ /*
+ * Writing a list of values to an AO channel is probably not
+ * very useful, but that's how the interface is defined.
+ */
for (i = 0; i < insn->n; i++)
pci224_ao_set_data(dev, chan, range, data[i]);
@@ -496,11 +508,10 @@ static void pci224_ao_stop(struct comedi_device *dev,
spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
/* Reconfigure DAC for insn_write usage. */
outw(0, dev->iobase + PCI224_DACCEN); /* Disable channels. */
- devpriv->daccon = COMBINE(devpriv->daccon,
- PCI224_DACCON_TRIG_SW |
- PCI224_DACCON_FIFOINTR_EMPTY,
- PCI224_DACCON_TRIG_MASK |
- PCI224_DACCON_FIFOINTR_MASK);
+ devpriv->daccon =
+ COMBINE(devpriv->daccon,
+ PCI224_DACCON_TRIG_SW | PCI224_DACCON_FIFOINTR_EMPTY,
+ PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK);
outw(devpriv->daccon | PCI224_DACCON_FIFORESET,
dev->iobase + PCI224_DACCON);
}
@@ -553,7 +564,6 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
/* Fixed number of scans. */
if (num_scans > devpriv->ao_stop_count)
num_scans = devpriv->ao_stop_count;
-
}
/* Determine how much room is in the FIFO (in samples). */
@@ -561,7 +571,8 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
switch (dacstat & PCI224_DACCON_FIFOFL_MASK) {
case PCI224_DACCON_FIFOFL_EMPTY:
room = PCI224_FIFO_ROOM_EMPTY;
- if (cmd->stop_src == TRIG_COUNT && devpriv->ao_stop_count == 0) {
+ if (cmd->stop_src == TRIG_COUNT &&
+ devpriv->ao_stop_count == 0) {
/* FIFO empty at end of counted acquisition. */
s->async->events |= COMEDI_CB_EOA;
cfc_handle_events(dev, s);
@@ -639,10 +650,9 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
trig = PCI224_DACCON_TRIG_EXTN;
else
trig = PCI224_DACCON_TRIG_EXTP;
-
}
- devpriv->daccon = COMBINE(devpriv->daccon, trig,
- PCI224_DACCON_TRIG_MASK);
+ devpriv->daccon =
+ COMBINE(devpriv->daccon, trig, PCI224_DACCON_TRIG_MASK);
outw(devpriv->daccon, dev->iobase + PCI224_DACCON);
}
@@ -668,13 +678,14 @@ static int pci224_ao_check_chanlist(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
- unsigned int range0 = CR_RANGE(cmd->chanlist[0]);
+ const struct pci224_board *thisboard = comedi_board(dev);
+ unsigned int range_check_0;
unsigned int chan_mask = 0;
int i;
+ range_check_0 = thisboard->ao_range_check[CR_RANGE(cmd->chanlist[0])];
for (i = 0; i < cmd->chanlist_len; i++) {
unsigned int chan = CR_CHAN(cmd->chanlist[i]);
- unsigned int range = CR_RANGE(cmd->chanlist[i]);
if (chan_mask & (1 << chan)) {
dev_dbg(dev->class_dev,
@@ -682,11 +693,12 @@ static int pci224_ao_check_chanlist(struct comedi_device *dev,
__func__);
return -EINVAL;
}
- chan_mask |= (1 << chan);
+ chan_mask |= 1 << chan;
- if (range != range0) {
+ if (thisboard->ao_range_check[CR_RANGE(cmd->chanlist[i])] !=
+ range_check_0) {
dev_dbg(dev->class_dev,
- "%s: entries in chanlist must all have the same range index\n",
+ "%s: entries in chanlist have incompatible ranges\n",
__func__);
return -EINVAL;
}
@@ -714,11 +726,11 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
err |= cfc_check_trigger_src(&cmd->start_src, TRIG_INT | TRIG_EXT);
err |= cfc_check_trigger_src(&cmd->scan_begin_src,
- TRIG_EXT | TRIG_TIMER);
+ TRIG_EXT | TRIG_TIMER);
err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_NOW);
err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= cfc_check_trigger_src(&cmd->stop_src,
- TRIG_COUNT | TRIG_EXT | TRIG_NONE);
+ TRIG_COUNT | TRIG_EXT | TRIG_NONE);
if (err)
return 1;
@@ -756,13 +768,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
break;
case TRIG_EXT:
/* Force to external trigger 0. */
- if ((cmd->start_arg & ~CR_FLAGS_MASK) != 0) {
- cmd->start_arg = COMBINE(cmd->start_arg, 0,
- ~CR_FLAGS_MASK);
+ if (cmd->start_arg & ~CR_FLAGS_MASK) {
+ cmd->start_arg =
+ COMBINE(cmd->start_arg, 0, ~CR_FLAGS_MASK);
err |= -EINVAL;
}
/* The only flag allowed is CR_EDGE, which is ignored. */
- if ((cmd->start_arg & CR_FLAGS_MASK & ~CR_EDGE) != 0) {
+ if (cmd->start_arg & CR_FLAGS_MASK & ~CR_EDGE) {
cmd->start_arg = COMBINE(cmd->start_arg, 0,
CR_FLAGS_MASK & ~CR_EDGE);
err |= -EINVAL;
@@ -782,17 +794,17 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
break;
case TRIG_EXT:
/* Force to external trigger 0. */
- if ((cmd->scan_begin_arg & ~CR_FLAGS_MASK) != 0) {
- cmd->scan_begin_arg = COMBINE(cmd->scan_begin_arg, 0,
- ~CR_FLAGS_MASK);
+ if (cmd->scan_begin_arg & ~CR_FLAGS_MASK) {
+ cmd->scan_begin_arg =
+ COMBINE(cmd->scan_begin_arg, 0, ~CR_FLAGS_MASK);
err |= -EINVAL;
}
/* Only allow flags CR_EDGE and CR_INVERT. Ignore CR_EDGE. */
- if ((cmd->scan_begin_arg & CR_FLAGS_MASK &
- ~(CR_EDGE | CR_INVERT)) != 0) {
- cmd->scan_begin_arg = COMBINE(cmd->scan_begin_arg, 0,
- CR_FLAGS_MASK &
- ~(CR_EDGE | CR_INVERT));
+ if (cmd->scan_begin_arg & CR_FLAGS_MASK &
+ ~(CR_EDGE | CR_INVERT)) {
+ cmd->scan_begin_arg =
+ COMBINE(cmd->scan_begin_arg, 0,
+ CR_FLAGS_MASK & ~(CR_EDGE | CR_INVERT));
err |= -EINVAL;
}
break;
@@ -807,15 +819,15 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
break;
case TRIG_EXT:
/* Force to external trigger 0. */
- if ((cmd->stop_arg & ~CR_FLAGS_MASK) != 0) {
- cmd->stop_arg = COMBINE(cmd->stop_arg, 0,
- ~CR_FLAGS_MASK);
+ if (cmd->stop_arg & ~CR_FLAGS_MASK) {
+ cmd->stop_arg =
+ COMBINE(cmd->stop_arg, 0, ~CR_FLAGS_MASK);
err |= -EINVAL;
}
/* The only flag allowed is CR_EDGE, which is ignored. */
- if ((cmd->stop_arg & CR_FLAGS_MASK & ~CR_EDGE) != 0) {
- cmd->stop_arg = COMBINE(cmd->stop_arg, 0,
- CR_FLAGS_MASK & ~CR_EDGE);
+ if (cmd->stop_arg & CR_FLAGS_MASK & ~CR_EDGE) {
+ cmd->stop_arg =
+ COMBINE(cmd->stop_arg, 0, CR_FLAGS_MASK & ~CR_EDGE);
}
break;
case TRIG_NONE:
@@ -880,6 +892,7 @@ static void pci224_ao_start_pacer(struct comedi_device *dev,
static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
+ const struct pci224_board *thisboard = comedi_board(dev);
struct pci224_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
int range;
@@ -903,7 +916,6 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
for (j = 0; j < cmd->chanlist_len; j++) {
if (CR_CHAN(cmd->chanlist[j]) < ch)
rank++;
-
}
devpriv->ao_scan_order[rank] = i;
}
@@ -922,14 +934,12 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
*
* N.B. DAC FIFO interrupts are currently disabled.
*/
- devpriv->daccon = COMBINE(devpriv->daccon,
- (devpriv->
- hwrange[range] | PCI224_DACCON_TRIG_NONE |
- PCI224_DACCON_FIFOINTR_NHALF),
- (PCI224_DACCON_POLAR_MASK |
- PCI224_DACCON_VREF_MASK |
- PCI224_DACCON_TRIG_MASK |
- PCI224_DACCON_FIFOINTR_MASK));
+ devpriv->daccon =
+ COMBINE(devpriv->daccon,
+ thisboard->ao_hwrange[range] | PCI224_DACCON_TRIG_NONE |
+ PCI224_DACCON_FIFOINTR_NHALF,
+ PCI224_DACCON_POLAR_MASK | PCI224_DACCON_VREF_MASK |
+ PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK);
outw(devpriv->daccon | PCI224_DACCON_FIFORESET,
dev->iobase + PCI224_DACCON);
@@ -975,7 +985,6 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
void *data, unsigned int num_bytes, unsigned int chan_index)
{
const struct pci224_board *thisboard = comedi_board(dev);
- struct pci224_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned short *array = data;
unsigned int length = num_bytes / sizeof(*array);
@@ -986,7 +995,7 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
/* The hardware expects 16-bit numbers. */
shift = 16 - thisboard->ao_bits;
/* Channels will be all bipolar or all unipolar. */
- if ((devpriv->hwrange[CR_RANGE(cmd->chanlist[0])] &
+ if ((thisboard->ao_hwrange[CR_RANGE(cmd->chanlist[0])] &
PCI224_DACCON_POLAR_MASK) == PCI224_DACCON_POLAR_UNI) {
/* Unipolar */
offset = 0;
@@ -997,7 +1006,6 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
/* Munge the data. */
for (i = 0; i < length; i++)
array[i] = (array[i] << shift) - offset;
-
}
/*
@@ -1025,7 +1033,7 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
devpriv->intr_running = 1;
devpriv->intr_cpuid = THISCPU;
spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
- if (valid_intstat != 0) {
+ if (valid_intstat) {
cmd = &s->async->cmd;
if (valid_intstat & PCI224_INTR_EXT) {
devpriv->intsce &= ~PCI224_INTR_EXT;
@@ -1033,11 +1041,9 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
pci224_ao_start(dev, s);
else if (cmd->stop_src == TRIG_EXT)
pci224_ao_stop(dev, s);
-
}
if (valid_intstat & PCI224_INTR_DAC)
pci224_ao_handle_fifo(dev, s);
-
}
/* Reenable interrupt sources. */
spin_lock_irqsave(&devpriv->ao_spinlock, flags);
@@ -1051,77 +1057,32 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
return IRQ_RETVAL(retval);
}
-/*
- * This function looks for a board matching the supplied PCI device.
- */
-static const struct pci224_board
-*pci224_find_pci_board(struct pci_dev *pci_dev)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(pci224_boards); i++)
- if (pci_dev->device == pci224_boards[i].devid)
- return &pci224_boards[i];
- return NULL;
-}
-
-/*
- * This function looks for a PCI device matching the requested board name,
- * bus and slot.
- */
-static struct pci_dev *pci224_find_pci_dev(struct comedi_device *dev,
- struct comedi_devconfig *it)
-{
- const struct pci224_board *thisboard = comedi_board(dev);
- struct pci_dev *pci_dev = NULL;
- int bus = it->options[0];
- int slot = it->options[1];
-
- for_each_pci_dev(pci_dev) {
- if (bus || slot) {
- if (bus != pci_dev->bus->number ||
- slot != PCI_SLOT(pci_dev->devfn))
- continue;
- }
- if (pci_dev->vendor != PCI_VENDOR_ID_AMPLICON)
- continue;
-
- if (thisboard->model == any_model) {
- /* Match any supported model. */
- const struct pci224_board *board_ptr;
-
- board_ptr = pci224_find_pci_board(pci_dev);
- if (board_ptr == NULL)
- continue;
- /* Change board_ptr to matched board. */
- dev->board_ptr = board_ptr;
- } else {
- /* Match specific model name. */
- if (thisboard->devid != pci_dev->device)
- continue;
- }
- return pci_dev;
- }
- dev_err(dev->class_dev,
- "No supported board found! (req. bus %d, slot %d)\n",
- bus, slot);
- return NULL;
-}
-
-/*
- * Common part of attach and auto_attach.
- */
-static int pci224_attach_common(struct comedi_device *dev,
- struct pci_dev *pci_dev, int *options)
+static int
+pci224_auto_attach(struct comedi_device *dev, unsigned long context_model)
{
- const struct pci224_board *thisboard = comedi_board(dev);
- struct pci224_private *devpriv = dev->private;
+ struct pci_dev *pci_dev = comedi_to_pci_dev(dev);
+ const struct pci224_board *thisboard = NULL;
+ struct pci224_private *devpriv;
struct comedi_subdevice *s;
unsigned int irq;
- unsigned n;
int ret;
- comedi_set_hw_dev(dev, &pci_dev->dev);
+ if (context_model < ARRAY_SIZE(pci224_boards))
+ thisboard = &pci224_boards[context_model];
+ if (!thisboard || !thisboard->name) {
+ dev_err(dev->class_dev,
+ "amplc_pci224: BUG! cannot determine board type!\n");
+ return -EINVAL;
+ }
+ dev->board_ptr = thisboard;
+ dev->board_name = thisboard->name;
+
+ dev_info(dev->class_dev, "amplc_pci224: attach pci %s - %s\n",
+ pci_name(pci_dev), dev->board_name);
+
+ devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
+ if (!devpriv)
+ return -ENOMEM;
ret = comedi_pci_enable(dev);
if (ret)
@@ -1162,9 +1123,8 @@ static int pci224_attach_common(struct comedi_device *dev,
outw(PCI224_DACCON_GLOBALRESET, dev->iobase + PCI224_DACCON);
outw(0, dev->iobase + PCI224_DACCEN);
outw(0, dev->iobase + PCI224_FIFOSIZ);
- devpriv->daccon = (PCI224_DACCON_TRIG_SW | PCI224_DACCON_POLAR_BI |
- PCI224_DACCON_FIFOENAB |
- PCI224_DACCON_FIFOINTR_EMPTY);
+ devpriv->daccon = PCI224_DACCON_TRIG_SW | PCI224_DACCON_POLAR_BI |
+ PCI224_DACCON_FIFOENAB | PCI224_DACCON_FIFOINTR_EMPTY;
outw(devpriv->daccon | PCI224_DACCON_FIFORESET,
dev->iobase + PCI224_DACCON);
@@ -1178,71 +1138,15 @@ static int pci224_attach_common(struct comedi_device *dev,
s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE;
s->n_chan = thisboard->ao_chans;
s->maxdata = (1 << thisboard->ao_bits) - 1;
- s->insn_write = &pci224_ao_insn_write;
- s->insn_read = &pci224_ao_insn_read;
+ s->range_table = thisboard->ao_range;
+ s->insn_write = pci224_ao_insn_write;
+ s->insn_read = pci224_ao_insn_read;
s->len_chanlist = s->n_chan;
-
dev->write_subdev = s;
- s->do_cmd = &pci224_ao_cmd;
- s->do_cmdtest = &pci224_ao_cmdtest;
- s->cancel = &pci224_ao_cancel;
- s->munge = &pci224_ao_munge;
-
- /* Sort out channel range options. */
- if (thisboard->model == pci234_model) {
- /* PCI234 range options. */
- const struct comedi_lrange **range_table_list;
-
- s->range_table_list = range_table_list =
- kmalloc(sizeof(struct comedi_lrange *) * s->n_chan,
- GFP_KERNEL);
- if (!s->range_table_list)
- return -ENOMEM;
-
- if (options) {
- for (n = 2; n < 3 + s->n_chan; n++) {
- if (options[n] < 0 || options[n] > 1) {
- dev_warn(dev->class_dev,
- "warning! bad options[%u]=%d\n",
- n, options[n]);
- }
- }
- }
- for (n = 0; n < s->n_chan; n++) {
- if (n < COMEDI_NDEVCONFOPTS - 3 && options &&
- options[3 + n] == 1) {
- if (options[2] == 1)
- range_table_list[n] = &range_pci234_ext;
- else
- range_table_list[n] = &range_bipolar5;
-
- } else {
- if (options && options[2] == 1) {
- range_table_list[n] =
- &range_pci234_ext2;
- } else {
- range_table_list[n] = &range_bipolar10;
- }
- }
- }
- devpriv->hwrange = hwrange_pci234;
- } else {
- /* PCI224 range options. */
- if (options && options[2] == 1) {
- s->range_table = &range_pci224_external;
- devpriv->hwrange = hwrange_pci224_external;
- } else {
- if (options && options[2] != 0) {
- dev_warn(dev->class_dev,
- "warning! bad options[2]=%d\n",
- options[2]);
- }
- s->range_table = &range_pci224_internal;
- devpriv->hwrange = hwrange_pci224_internal;
- }
- }
-
- dev->board_name = thisboard->name;
+ s->do_cmd = pci224_ao_cmd;
+ s->do_cmdtest = pci224_ao_cmdtest;
+ s->cancel = pci224_ao_cancel;
+ s->munge = pci224_ao_munge;
if (irq) {
ret = request_irq(irq, pci224_interrupt, IRQF_SHARED,
@@ -1258,80 +1162,23 @@ static int pci224_attach_common(struct comedi_device *dev,
return 0;
}
-static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
-{
- struct pci224_private *devpriv;
- struct pci_dev *pci_dev;
-
- dev_info(dev->class_dev, "attach\n");
-
- devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
- if (!devpriv)
- return -ENOMEM;
-
- pci_dev = pci224_find_pci_dev(dev, it);
- if (!pci_dev)
- return -EIO;
-
- return pci224_attach_common(dev, pci_dev, it->options);
-}
-
-static int
-pci224_auto_attach(struct comedi_device *dev, unsigned long context_unused)
-{
- struct pci_dev *pci_dev = comedi_to_pci_dev(dev);
- struct pci224_private *devpriv;
-
- dev_info(dev->class_dev, "attach pci %s\n", pci_name(pci_dev));
-
- devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
- if (!devpriv)
- return -ENOMEM;
-
- dev->board_ptr = pci224_find_pci_board(pci_dev);
- if (dev->board_ptr == NULL) {
- dev_err(dev->class_dev,
- "BUG! cannot determine board type!\n");
- return -EINVAL;
- }
- /*
- * Need to 'get' the PCI device to match the 'put' in pci224_detach().
- * TODO: Remove the pci_dev_get() and matching pci_dev_put() once
- * support for manual attachment of PCI devices via pci224_attach()
- * has been removed.
- */
- pci_dev_get(pci_dev);
- return pci224_attach_common(dev, pci_dev, NULL);
-}
-
static void pci224_detach(struct comedi_device *dev)
{
struct pci224_private *devpriv = dev->private;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (dev->subdevices) {
- struct comedi_subdevice *s;
-
- s = &dev->subdevices[0];
- /* AO subdevice */
- kfree(s->range_table_list);
- }
if (devpriv) {
kfree(devpriv->ao_readback);
kfree(devpriv->ao_scan_vals);
kfree(devpriv->ao_scan_order);
}
comedi_pci_disable(dev);
- if (pcidev)
- pci_dev_put(pcidev);
}
static struct comedi_driver amplc_pci224_driver = {
.driver_name = "amplc_pci224",
.module = THIS_MODULE,
- .attach = pci224_attach,
.detach = pci224_detach,
.auto_attach = pci224_auto_attach,
.board_name = &pci224_boards[0].name,
@@ -1347,8 +1194,8 @@ static int amplc_pci224_pci_probe(struct pci_dev *dev,
}
static const struct pci_device_id amplc_pci224_pci_table[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI224) },
- { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI234) },
+ { PCI_VDEVICE(AMPLICON, 0x0007), pci224_model },
+ { PCI_VDEVICE(AMPLICON, 0x0008), pci234_model },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, amplc_pci224_pci_table);
@@ -1362,5 +1209,5 @@ static struct pci_driver amplc_pci224_pci_driver = {
module_comedi_pci_driver(amplc_pci224_driver, amplc_pci224_pci_driver);
MODULE_AUTHOR("Comedi http://www.comedi.org");
-MODULE_DESCRIPTION("Comedi low-level driver");
+MODULE_DESCRIPTION("Comedi driver for Amplicon PCI224 and PCI234 AO boards");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
index 684275d76e8c..0fd212f5fa2a 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -513,8 +513,8 @@ struct pci230_private {
spinlock_t res_spinlock; /* Shared resources spin lock */
spinlock_t ai_stop_spinlock; /* Spin lock for stopping AI command */
spinlock_t ao_stop_spinlock; /* Spin lock for stopping AO command */
+ unsigned long daqio; /* PCI230's DAQ I/O space */
unsigned long state; /* State flags */
- unsigned long iobase1; /* PCI230's I/O space 1 */
unsigned int ao_readback[2]; /* Used for AO readback */
unsigned int ai_scan_count; /* Number of AI scans remaining */
unsigned int ai_scan_pos; /* Current position within AI scan */
@@ -579,7 +579,7 @@ static unsigned short pci230_ai_read(struct comedi_device *dev)
unsigned short data;
/* Read sample. */
- data = inw(dev->iobase + PCI230_ADCDATA);
+ data = inw(devpriv->daqio + PCI230_ADCDATA);
/*
* PCI230 is 12 bit - stored in upper bits of 16 bit register
* (lower four bits reserved for expansion). PCI230+ is 16 bit AI.
@@ -628,7 +628,7 @@ static inline void pci230_ao_write_nofifo(struct comedi_device *dev,
/* Write mangled datum to appropriate DACOUT register. */
outw(pci230_ao_mangle_datum(dev, datum),
- dev->iobase + (((chan) == 0) ? PCI230_DACOUT1 : PCI230_DACOUT2));
+ devpriv->daqio + ((chan) == 0) ? PCI230_DACOUT1 : PCI230_DACOUT2);
}
static inline void pci230_ao_write_fifo(struct comedi_device *dev,
@@ -641,7 +641,7 @@ static inline void pci230_ao_write_fifo(struct comedi_device *dev,
/* Write mangled datum to appropriate DACDATA register. */
outw(pci230_ao_mangle_datum(dev, datum),
- dev->iobase + PCI230P2_DACDATA);
+ devpriv->daqio + PCI230P2_DACDATA);
}
static int get_resources(struct comedi_device *dev, unsigned int res_mask,
@@ -770,29 +770,25 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct,
unsigned int mode, uint64_t ns,
unsigned int flags)
{
- struct pci230_private *devpriv = dev->private;
unsigned int clk_src;
unsigned int count;
/* Set mode. */
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, mode);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, mode);
/* Determine clock source and count. */
clk_src = pci230_choose_clk_count(ns, &count, flags);
/* Program clock source. */
- outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE);
+ outb(CLK_CONFIG(ct, clk_src), dev->iobase + PCI230_ZCLK_SCE);
/* Set initial count. */
if (count >= 65536)
count = 0;
- i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count);
+ i8254_write(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, count);
}
static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct)
{
- struct pci230_private *devpriv = dev->private;
-
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct,
- I8254_MODE1);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, I8254_MODE1);
/* Counter ct, 8254 mode 1, initial count not written. */
}
@@ -801,9 +797,10 @@ static int pci230_ai_eoc(struct comedi_device *dev,
struct comedi_insn *insn,
unsigned long context)
{
+ struct pci230_private *devpriv = dev->private;
unsigned int status;
- status = inw(dev->iobase + PCI230_ADCCON);
+ status = inw(devpriv->daqio + PCI230_ADCCON);
if ((status & PCI230_ADC_FIFO_EMPTY) == 0)
return 0;
return -EBUSY;
@@ -842,7 +839,7 @@ static int pci230_ai_rinsn(struct comedi_device *dev,
*/
adccon = PCI230_ADC_TRIG_Z2CT2 | PCI230_ADC_FIFO_EN;
/* Set Z2-CT2 output low to avoid any false triggers. */
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE0);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE0);
devpriv->ai_bipolar = pci230_ai_bipolar[range];
if (aref == AREF_DIFF) {
/* Differential. */
@@ -879,14 +876,14 @@ static int pci230_ai_rinsn(struct comedi_device *dev,
* Enable only this channel in the scan list - otherwise by default
* we'll get one sample from each channel.
*/
- outw(adcen, dev->iobase + PCI230_ADCEN);
+ outw(adcen, devpriv->daqio + PCI230_ADCEN);
/* Set gain for channel. */
- outw(devpriv->adcg, dev->iobase + PCI230_ADCG);
+ outw(devpriv->adcg, devpriv->daqio + PCI230_ADCG);
/* Specify uni/bip, se/diff, conversion source, and reset FIFO. */
devpriv->adccon = adccon;
- outw(adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON);
+ outw(adccon | PCI230_ADC_FIFO_RESET, devpriv->daqio + PCI230_ADCCON);
/* Convert n samples */
for (n = 0; n < insn->n; n++) {
@@ -894,10 +891,10 @@ static int pci230_ai_rinsn(struct comedi_device *dev,
* Trigger conversion by toggling Z2-CT2 output
* (finish with output high).
*/
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2,
- I8254_MODE0);
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2,
- I8254_MODE1);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0,
+ 2, I8254_MODE0);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0,
+ 2, I8254_MODE1);
/* wait for conversion to end */
ret = comedi_timeout(dev, s, insn, pci230_ai_eoc, 0);
@@ -932,7 +929,7 @@ static int pci230_ao_winsn(struct comedi_device *dev,
* 1 => bipolar +/-10V range scale
*/
devpriv->ao_bipolar = pci230_ao_bipolar[range];
- outw(range, dev->iobase + PCI230_DACCON);
+ outw(range, devpriv->daqio + PCI230_DACCON);
/*
* Writing a list of values to an AO channel is probably not
@@ -1160,7 +1157,7 @@ static void pci230_ao_stop(struct comedi_device *dev,
}
if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
}
spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
if (devpriv->hwver >= 2) {
@@ -1171,7 +1168,7 @@ static void pci230_ao_stop(struct comedi_device *dev,
devpriv->daccon &= PCI230_DAC_OR_MASK;
outw(devpriv->daccon | PCI230P2_DAC_FIFO_RESET |
PCI230P2_DAC_FIFO_UNDERRUN_CLEAR,
- dev->iobase + PCI230_DACCON);
+ devpriv->daqio + PCI230_DACCON);
}
/* Release resources. */
put_all_resources(dev, OWNER_AOCMD);
@@ -1227,7 +1224,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev,
int running;
/* Get DAC FIFO status. */
- dacstat = inw(dev->iobase + PCI230_DACCON);
+ dacstat = inw(devpriv->daqio + PCI230_DACCON);
/* Determine number of scans available in buffer. */
num_scans = comedi_buf_read_n_available(s) / cfc_bytes_per_scan(s);
if (cmd->stop_src == TRIG_COUNT) {
@@ -1295,11 +1292,11 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev,
~PCI230P2_DAC_INT_FIFO_MASK) |
PCI230P2_DAC_INT_FIFO_EMPTY;
outw(devpriv->daccon,
- dev->iobase + PCI230_DACCON);
+ devpriv->daqio + PCI230_DACCON);
}
}
/* Check if FIFO underrun occurred while writing to FIFO. */
- dacstat = inw(dev->iobase + PCI230_DACCON);
+ dacstat = inw(devpriv->daqio + PCI230_DACCON);
if (dacstat & PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) {
dev_err(dev->class_dev, "AO FIFO underrun\n");
events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR;
@@ -1338,7 +1335,7 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev,
} else {
/* Using DAC FIFO. */
/* Read DACSWTRIG register to trigger conversion. */
- inw(dev->iobase + PCI230P2_DACSWTRIG);
+ inw(devpriv->daqio + PCI230P2_DACSWTRIG);
spin_unlock_irqrestore(&devpriv->ao_stop_spinlock,
irqflags);
}
@@ -1405,7 +1402,7 @@ static void pci230_ao_start(struct comedi_device *dev,
devpriv->daccon =
(devpriv->daccon & ~PCI230P2_DAC_TRIG_MASK) |
scantrig;
- outw(devpriv->daccon, dev->iobase + PCI230_DACCON);
+ outw(devpriv->daccon, devpriv->daqio + PCI230_DACCON);
}
switch (cmd->scan_begin_src) {
case TRIG_TIMER:
@@ -1417,13 +1414,13 @@ static void pci230_ao_start(struct comedi_device *dev,
devpriv->int_en |= PCI230_INT_ZCLK_CT1;
devpriv->ier |= PCI230_INT_ZCLK_CT1;
outb(devpriv->ier,
- devpriv->iobase1 + PCI230_INT_SCE);
+ dev->iobase + PCI230_INT_SCE);
spin_unlock_irqrestore(&devpriv->isr_spinlock,
irqflags);
}
/* Set CT1 gate high to start counting. */
outb(GAT_CONFIG(1, GAT_VCC),
- devpriv->iobase1 + PCI230_ZGAT_SCE);
+ dev->iobase + PCI230_ZGAT_SCE);
break;
case TRIG_INT:
async->inttrig = pci230_ao_inttrig_scan_begin;
@@ -1434,7 +1431,7 @@ static void pci230_ao_start(struct comedi_device *dev,
spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
devpriv->int_en |= PCI230P2_INT_DAC;
devpriv->ier |= PCI230P2_INT_DAC;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
spin_unlock_irqrestore(&devpriv->isr_spinlock,
irqflags);
}
@@ -1494,7 +1491,7 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
dacen |= 1 << CR_CHAN(cmd->chanlist[i]);
/* Set channel scan list. */
- outw(dacen, dev->iobase + PCI230P2_DACEN);
+ outw(dacen, devpriv->daqio + PCI230P2_DACEN);
/*
* Enable DAC FIFO.
* Set DAC scan source to 'none'.
@@ -1509,7 +1506,7 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
/* Set DACCON. */
- outw(daccon, dev->iobase + PCI230_DACCON);
+ outw(daccon, devpriv->daqio + PCI230_DACCON);
/* Preserve most of DACCON apart from write-only, transient bits. */
devpriv->daccon = daccon & ~(PCI230P2_DAC_FIFO_RESET |
PCI230P2_DAC_FIFO_UNDERRUN_CLEAR);
@@ -1520,8 +1517,7 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* cmd->scan_begin_arg is sampling period in ns.
* Gate it off for now.
*/
- outb(GAT_CONFIG(1, GAT_GND),
- devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(GAT_CONFIG(1, GAT_GND), dev->iobase + PCI230_ZGAT_SCE);
pci230_ct_setup_ns_mode(dev, 1, I8254_MODE3,
cmd->scan_begin_arg,
cmd->flags);
@@ -1900,7 +1896,7 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev,
/* PCI230+/260+ programmable FIFO interrupt level. */
if (devpriv->adcfifothresh != wake) {
devpriv->adcfifothresh = wake;
- outw(wake, dev->iobase + PCI230P_ADCFFTH);
+ outw(wake, devpriv->daqio + PCI230P_ADCFFTH);
}
triglev = PCI230P_ADC_INT_FIFO_THRESH;
} else {
@@ -1910,7 +1906,7 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev,
adccon = (devpriv->adccon & ~PCI230_ADC_INT_FIFO_MASK) | triglev;
if (adccon != devpriv->adccon) {
devpriv->adccon = adccon;
- outw(adccon, dev->iobase + PCI230_ADCCON);
+ outw(adccon, devpriv->daqio + PCI230_ADCCON);
}
}
@@ -1932,10 +1928,10 @@ static int pci230_ai_inttrig_convert(struct comedi_device *dev,
* Trigger conversion by toggling Z2-CT2 output.
* Finish with output high.
*/
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2,
- I8254_MODE0);
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2,
- I8254_MODE1);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0,
+ 2, I8254_MODE0);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0,
+ 2, I8254_MODE1);
/*
* Delay. Should driver be responsible for this? An
* alternative would be to wait until conversion is complete,
@@ -1975,9 +1971,9 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev,
if (test_bit(AI_CMD_STARTED, &devpriv->state)) {
/* Trigger scan by waggling CT0 gate source. */
zgat = GAT_CONFIG(0, GAT_GND);
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
zgat = GAT_CONFIG(0, GAT_VCC);
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
}
spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags);
@@ -2018,7 +2014,7 @@ static void pci230_ai_stop(struct comedi_device *dev,
}
if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
}
spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
/*
@@ -2029,7 +2025,7 @@ static void pci230_ai_stop(struct comedi_device *dev,
(devpriv->adccon & (PCI230_ADC_IR_MASK | PCI230_ADC_IM_MASK)) |
PCI230_ADC_TRIG_NONE;
outw(devpriv->adccon | PCI230_ADC_FIFO_RESET,
- dev->iobase + PCI230_ADCCON);
+ devpriv->daqio + PCI230_ADCCON);
/* Release resources. */
put_all_resources(dev, OWNER_AICMD);
}
@@ -2054,7 +2050,7 @@ static void pci230_ai_start(struct comedi_device *dev,
spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
devpriv->int_en |= PCI230_INT_ADC;
devpriv->ier |= PCI230_INT_ADC;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
/*
@@ -2099,7 +2095,7 @@ static void pci230_ai_start(struct comedi_device *dev,
}
devpriv->adccon =
(devpriv->adccon & ~PCI230_ADC_TRIG_MASK) | conv;
- outw(devpriv->adccon, dev->iobase + PCI230_ADCCON);
+ outw(devpriv->adccon, devpriv->daqio + PCI230_ADCCON);
if (cmd->convert_src == TRIG_INT)
async->inttrig = pci230_ai_inttrig_convert;
@@ -2125,7 +2121,7 @@ static void pci230_ai_start(struct comedi_device *dev,
*/
zgat = GAT_CONFIG(2, GAT_VCC);
}
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
if (cmd->scan_begin_src != TRIG_FOLLOW) {
/* Set monostable CT0 trigger source. */
switch (cmd->scan_begin_src) {
@@ -2161,7 +2157,7 @@ static void pci230_ai_start(struct comedi_device *dev,
zgat = GAT_CONFIG(0, GAT_VCC);
break;
}
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
switch (cmd->scan_begin_src) {
case TRIG_TIMER:
/*
@@ -2169,8 +2165,8 @@ static void pci230_ai_start(struct comedi_device *dev,
* gated on to start counting.
*/
zgat = GAT_CONFIG(1, GAT_VCC);
- outb(zgat, devpriv->iobase1 +
- PCI230_ZGAT_SCE);
+ outb(zgat,
+ dev->iobase + PCI230_ZGAT_SCE);
break;
case TRIG_INT:
async->inttrig =
@@ -2233,7 +2229,7 @@ static void pci230_handle_ai(struct comedi_device *dev,
for (i = 0; i < todo; i++) {
if (fifoamount == 0) {
/* Read FIFO state. */
- status_fifo = inw(dev->iobase + PCI230_ADCCON);
+ status_fifo = inw(devpriv->daqio + PCI230_ADCCON);
if (status_fifo & PCI230_ADC_FIFO_FULL_LATCHED) {
/*
* Report error otherwise FIFO overruns will go
@@ -2252,8 +2248,8 @@ static void pci230_handle_ai(struct comedi_device *dev,
/* FIFO not empty. */
if (devpriv->hwver > 0) {
/* Read PCI230+/260+ ADC FIFO level. */
- fifoamount =
- inw(dev->iobase + PCI230P_ADCFFLEV);
+ fifoamount = inw(devpriv->daqio +
+ PCI230P_ADCFFLEV);
if (fifoamount == 0) {
/* Shouldn't happen. */
break;
@@ -2404,16 +2400,16 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}
/* Set channel scan list. */
- outw(adcen, dev->iobase + PCI230_ADCEN);
+ outw(adcen, devpriv->daqio + PCI230_ADCEN);
/* Set channel gains. */
- outw(devpriv->adcg, dev->iobase + PCI230_ADCG);
+ outw(devpriv->adcg, devpriv->daqio + PCI230_ADCG);
/*
* Set counter/timer 2 output high for use as the initial start
* conversion source.
*/
- i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE1);
+ i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, 2, I8254_MODE1);
/*
* Temporarily use CT2 output as conversion trigger source and
@@ -2429,7 +2425,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* PCI230/260, but that will be dealt with later.
*/
devpriv->adccon = adccon;
- outw(adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON);
+ outw(adccon | PCI230_ADC_FIFO_RESET, devpriv->daqio + PCI230_ADCCON);
/*
* Delay -
@@ -2443,7 +2439,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
usleep_range(25, 100);
/* Reset FIFO again. */
- outw(adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON);
+ outw(adccon | PCI230_ADC_FIFO_RESET, devpriv->daqio + PCI230_ADCCON);
if (cmd->convert_src == TRIG_TIMER) {
/*
@@ -2452,7 +2448,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* connector: PCI230 pin 21, PCI260 pin 18.
*/
zgat = GAT_CONFIG(2, GAT_GND);
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
/* Set counter/timer 2 to the specified conversion period. */
pci230_ct_setup_ns_mode(dev, 2, I8254_MODE3, cmd->convert_arg,
cmd->flags);
@@ -2470,7 +2466,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* source will be changed later.
*/
zgat = GAT_CONFIG(0, GAT_VCC);
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
pci230_ct_setup_ns_mode(dev, 0, I8254_MODE1,
((uint64_t)cmd->convert_arg *
cmd->scan_end_arg),
@@ -2483,7 +2479,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* Set up CT1 but gate it off for now.
*/
zgat = GAT_CONFIG(1, GAT_GND);
- outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
+ outb(zgat, dev->iobase + PCI230_ZGAT_SCE);
pci230_ct_setup_ns_mode(dev, 1, I8254_MODE3,
cmd->scan_begin_arg,
cmd->flags);
@@ -2516,7 +2512,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
unsigned long irqflags;
/* Read interrupt status/enable register. */
- status_int = inb(devpriv->iobase1 + PCI230_INT_STAT);
+ status_int = inb(dev->iobase + PCI230_INT_STAT);
if (status_int == PCI230_INT_DISABLE)
return IRQ_NONE;
@@ -2530,7 +2526,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
* handler).
*/
devpriv->ier = devpriv->int_en & ~status_int;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
devpriv->intr_running = 1;
devpriv->intr_cpuid = THISCPU;
spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
@@ -2565,7 +2561,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en;
- outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(devpriv->ier, dev->iobase + PCI230_INT_SCE);
}
devpriv->intr_running = 0;
spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
@@ -2665,8 +2661,6 @@ static int pci230_attach_common(struct comedi_device *dev,
const struct pci230_board *thisboard = comedi_board(dev);
struct pci230_private *devpriv = dev->private;
struct comedi_subdevice *s;
- unsigned long iobase1, iobase2;
- /* PCI230's I/O spaces 1 and 2 respectively. */
int rc;
comedi_set_hw_dev(dev, &pci_dev->dev);
@@ -2681,15 +2675,14 @@ static int pci230_attach_common(struct comedi_device *dev,
* Read base addresses of the PCI230's two I/O regions from PCI
* configuration register.
*/
- iobase1 = pci_resource_start(pci_dev, 2);
- iobase2 = pci_resource_start(pci_dev, 3);
+ dev->iobase = pci_resource_start(pci_dev, 2);
+ devpriv->daqio = pci_resource_start(pci_dev, 3);
dev_dbg(dev->class_dev,
"%s I/O region 1 0x%04lx I/O region 2 0x%04lx\n",
- dev->board_name, iobase1, iobase2);
- devpriv->iobase1 = iobase1;
- dev->iobase = iobase2;
+ dev->board_name, dev->iobase, devpriv->daqio);
/* Read bits of DACCON register - only the output range. */
- devpriv->daccon = inw(dev->iobase + PCI230_DACCON) & PCI230_DAC_OR_MASK;
+ devpriv->daccon = inw(devpriv->daqio + PCI230_DACCON) &
+ PCI230_DAC_OR_MASK;
/*
* Read hardware version register and set extended function register
* if they exist.
@@ -2697,7 +2690,7 @@ static int pci230_attach_common(struct comedi_device *dev,
if (pci_resource_len(pci_dev, 3) >= 32) {
unsigned short extfunc = 0;
- devpriv->hwver = inw(dev->iobase + PCI230P_HWVER);
+ devpriv->hwver = inw(devpriv->daqio + PCI230P_HWVER);
if (devpriv->hwver < thisboard->min_hwver) {
dev_err(dev->class_dev,
"%s - bad hardware version - got %u, need %u\n",
@@ -2722,7 +2715,7 @@ static int pci230_attach_common(struct comedi_device *dev,
extfunc |= PCI230P2_EXTFUNC_DACFIFO;
}
}
- outw(extfunc, dev->iobase + PCI230P_EXTFUNC);
+ outw(extfunc, devpriv->daqio + PCI230P_EXTFUNC);
if (extfunc & PCI230P2_EXTFUNC_DACFIFO) {
/*
* Temporarily enable DAC FIFO, reset it and disable
@@ -2730,23 +2723,23 @@ static int pci230_attach_common(struct comedi_device *dev,
*/
outw(devpriv->daccon | PCI230P2_DAC_FIFO_EN |
PCI230P2_DAC_FIFO_RESET,
- dev->iobase + PCI230_DACCON);
+ devpriv->daqio + PCI230_DACCON);
/* Clear DAC FIFO channel enable register. */
- outw(0, dev->iobase + PCI230P2_DACEN);
+ outw(0, devpriv->daqio + PCI230P2_DACEN);
/* Disable DAC FIFO. */
- outw(devpriv->daccon, dev->iobase + PCI230_DACCON);
+ outw(devpriv->daccon, devpriv->daqio + PCI230_DACCON);
}
}
/* Disable board's interrupts. */
- outb(0, devpriv->iobase1 + PCI230_INT_SCE);
+ outb(0, dev->iobase + PCI230_INT_SCE);
/* Set ADC to a reasonable state. */
devpriv->adcg = 0;
devpriv->adccon = PCI230_ADC_TRIG_NONE | PCI230_ADC_IM_SE |
PCI230_ADC_IR_BIP;
- outw(1 << 0, dev->iobase + PCI230_ADCEN);
- outw(devpriv->adcg, dev->iobase + PCI230_ADCG);
+ outw(1 << 0, devpriv->daqio + PCI230_ADCEN);
+ outw(devpriv->adcg, devpriv->daqio + PCI230_ADCG);
outw(devpriv->adccon | PCI230_ADC_FIFO_RESET,
- dev->iobase + PCI230_ADCCON);
+ devpriv->daqio + PCI230_ADCCON);
if (pci_dev->irq) {
rc = request_irq(pci_dev->irq, pci230_interrupt, IRQF_SHARED,
@@ -2801,8 +2794,7 @@ static int pci230_attach_common(struct comedi_device *dev,
s = &dev->subdevices[2];
/* digital i/o subdevice */
if (thisboard->have_dio) {
- rc = subdev_8255_init(dev, s, NULL,
- devpriv->iobase1 + PCI230_PPI_X_BASE);
+ rc = subdev_8255_init(dev, s, NULL, PCI230_PPI_X_BASE);
if (rc)
return rc;
} else {
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
index 4a7bd4e5dd72..f372b0306b38 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -342,7 +342,6 @@ struct cb_pcidas_private {
unsigned long s5933_config;
unsigned long control_status;
unsigned long adc_fifo;
- unsigned long pacer_counter_dio;
unsigned long ao_registers;
/* divisors of master clock for analog input pacing */
unsigned int divisor1;
@@ -942,7 +941,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev,
static void cb_pcidas_ai_load_counters(struct comedi_device *dev)
{
struct cb_pcidas_private *devpriv = dev->private;
- unsigned long timer_base = devpriv->pacer_counter_dio + ADC8254;
+ unsigned long timer_base = dev->iobase + ADC8254;
i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY);
i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY);
@@ -1194,7 +1193,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
static void cb_pcidas_ao_load_counters(struct comedi_device *dev)
{
struct cb_pcidas_private *devpriv = dev->private;
- unsigned long timer_base = devpriv->pacer_counter_dio + DAC8254;
+ unsigned long timer_base = dev->iobase + DAC8254;
i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY);
i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY);
@@ -1463,7 +1462,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
devpriv->s5933_config = pci_resource_start(pcidev, 0);
devpriv->control_status = pci_resource_start(pcidev, 1);
devpriv->adc_fifo = pci_resource_start(pcidev, 2);
- devpriv->pacer_counter_dio = pci_resource_start(pcidev, 3);
+ dev->iobase = pci_resource_start(pcidev, 3);
if (thisboard->ao_nchan)
devpriv->ao_registers = pci_resource_start(pcidev, 4);
@@ -1529,8 +1528,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
/* 8255 */
s = &dev->subdevices[2];
- ret = subdev_8255_init(dev, s, NULL,
- devpriv->pacer_counter_dio + DIO_8255);
+ ret = subdev_8255_init(dev, s, NULL, DIO_8255);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index fa12614cef2a..77b028452d93 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -3369,26 +3369,16 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}
-static int dio_callback(int dir, int port, int data, unsigned long arg)
+static int dio_callback_4020(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long iobase)
{
- void __iomem *iobase = (void __iomem *)arg;
-
- if (dir) {
- writeb(data, iobase + port);
- return 0;
- }
- return readb(iobase + port);
-}
-
-static int dio_callback_4020(int dir, int port, int data, unsigned long arg)
-{
- void __iomem *iobase = (void __iomem *)arg;
+ struct pcidas64_private *devpriv = dev->private;
if (dir) {
- writew(data, iobase + 2 * port);
+ writew(data, devpriv->main_iobase + iobase + 2 * port);
return 0;
}
- return readw(iobase + 2 * port);
+ return readw(devpriv->main_iobase + iobase + 2 * port);
}
static int di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
@@ -3751,7 +3741,6 @@ static int setup_subdevices(struct comedi_device *dev)
const struct pcidas64_board *thisboard = comedi_board(dev);
struct pcidas64_private *devpriv = dev->private;
struct comedi_subdevice *s;
- void __iomem *dio_8255_iobase;
int i;
int ret;
@@ -3840,13 +3829,11 @@ static int setup_subdevices(struct comedi_device *dev)
s = &dev->subdevices[4];
if (thisboard->has_8255) {
if (thisboard->layout == LAYOUT_4020) {
- dio_8255_iobase = devpriv->main_iobase + I8255_4020_REG;
ret = subdev_8255_init(dev, s, dio_callback_4020,
- (unsigned long)dio_8255_iobase);
+ I8255_4020_REG);
} else {
- dio_8255_iobase = dev->mmio + DIO_8255_OFFSET;
- ret = subdev_8255_init(dev, s, dio_callback,
- (unsigned long)dio_8255_iobase);
+ ret = subdev_8255_mm_init(dev, s, NULL,
+ DIO_8255_OFFSET);
}
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c
index 901dc5d1bb72..91ba90b5ceae 100644
--- a/drivers/staging/comedi/drivers/cb_pcidda.c
+++ b/drivers/staging/comedi/drivers/cb_pcidda.c
@@ -154,6 +154,7 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = {
};
struct cb_pcidda_private {
+ unsigned long daqio;
/* bits last written to da calibration register 1 */
unsigned int dac_cal1_bits;
/* current range settings for output channels */
@@ -164,13 +165,14 @@ struct cb_pcidda_private {
/* lowlevel read from eeprom */
static unsigned int cb_pcidda_serial_in(struct comedi_device *dev)
{
+ struct cb_pcidda_private *devpriv = dev->private;
unsigned int value = 0;
int i;
const int value_width = 16; /* number of bits wide values are */
for (i = 1; i <= value_width; i++) {
/* read bits most significant bit first */
- if (inw_p(dev->iobase + DACALIBRATION1) & SERIAL_OUT_BIT)
+ if (inw_p(devpriv->daqio + DACALIBRATION1) & SERIAL_OUT_BIT)
value |= 1 << (value_width - i);
}
@@ -190,7 +192,7 @@ static void cb_pcidda_serial_out(struct comedi_device *dev, unsigned int value,
devpriv->dac_cal1_bits |= SERIAL_IN_BIT;
else
devpriv->dac_cal1_bits &= ~SERIAL_IN_BIT;
- outw_p(devpriv->dac_cal1_bits, dev->iobase + DACALIBRATION1);
+ outw_p(devpriv->dac_cal1_bits, devpriv->daqio + DACALIBRATION1);
}
}
@@ -198,6 +200,7 @@ static void cb_pcidda_serial_out(struct comedi_device *dev, unsigned int value,
static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev,
unsigned int address)
{
+ struct cb_pcidda_private *devpriv = dev->private;
unsigned int i;
unsigned int cal2_bits;
unsigned int value;
@@ -213,7 +216,7 @@ static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev,
/* deactivate caldacs (one caldac for every two channels) */
for (i = 0; i < max_num_caldacs; i++)
cal2_bits |= DESELECT_CALDAC_BIT(i);
- outw_p(cal2_bits, dev->iobase + DACALIBRATION2);
+ outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2);
/* tell eeprom we want to read */
cb_pcidda_serial_out(dev, read_instruction, instruction_length);
@@ -224,7 +227,7 @@ static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev,
/* deactivate eeprom */
cal2_bits &= ~SELECT_EEPROM_BIT;
- outw_p(cal2_bits, dev->iobase + DACALIBRATION2);
+ outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2);
return value;
}
@@ -234,6 +237,7 @@ static void cb_pcidda_write_caldac(struct comedi_device *dev,
unsigned int caldac, unsigned int channel,
unsigned int value)
{
+ struct cb_pcidda_private *devpriv = dev->private;
unsigned int cal2_bits;
unsigned int i;
/* caldacs use 3 bit channel specification */
@@ -256,10 +260,10 @@ static void cb_pcidda_write_caldac(struct comedi_device *dev,
cal2_bits |= DESELECT_CALDAC_BIT(i);
/* activate the caldac we want */
cal2_bits &= ~DESELECT_CALDAC_BIT(caldac);
- outw_p(cal2_bits, dev->iobase + DACALIBRATION2);
+ outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2);
/* deactivate caldac */
cal2_bits |= DESELECT_CALDAC_BIT(caldac);
- outw_p(cal2_bits, dev->iobase + DACALIBRATION2);
+ outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2);
}
/* set caldacs to eeprom values for given channel and range */
@@ -324,9 +328,9 @@ static int cb_pcidda_ao_insn_write(struct comedi_device *dev,
if (range > 2)
ctrl |= CB_DDA_DA_CTRL_UNIP;
- outw(ctrl, dev->iobase + CB_DDA_DA_CTRL_REG);
+ outw(ctrl, devpriv->daqio + CB_DDA_DA_CTRL_REG);
- outw(data[0], dev->iobase + CB_DDA_DA_DATA_REG(channel));
+ outw(data[0], devpriv->daqio + CB_DDA_DA_DATA_REG(channel));
return insn->n;
}
@@ -338,7 +342,6 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
const struct cb_pcidda_board *thisboard = NULL;
struct cb_pcidda_private *devpriv;
struct comedi_subdevice *s;
- unsigned long iobase_8255;
int i;
int ret;
@@ -356,8 +359,8 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
ret = comedi_pci_enable(dev);
if (ret)
return ret;
- dev->iobase = pci_resource_start(pcidev, 3);
- iobase_8255 = pci_resource_start(pcidev, 2);
+ dev->iobase = pci_resource_start(pcidev, 2);
+ devpriv->daqio = pci_resource_start(pcidev, 3);
ret = comedi_alloc_subdevices(dev, 3);
if (ret)
@@ -375,7 +378,7 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
/* two 8255 digital io subdevices */
for (i = 0; i < 2; i++) {
s = &dev->subdevices[1 + i];
- ret = subdev_8255_init(dev, s, NULL, iobase_8255 + (i * 4));
+ ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
if (ret)
return ret;
}
diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c
index ccb9c72bc0c3..f1c0dafb98dd 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdas.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdas.c
@@ -77,6 +77,7 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details.
*/
struct cb_pcimdas_private {
/* base addresses */
+ unsigned long daqio;
unsigned long BADR3;
/* Used for AO readback */
@@ -143,7 +144,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev,
/* convert n samples */
for (n = 0; n < insn->n; n++) {
/* trigger conversion */
- outw(0, dev->iobase + 0);
+ outw(0, devpriv->daqio + 0);
/* wait for conversion to end */
ret = comedi_timeout(dev, s, insn, cb_pcimdas_ai_eoc, 0);
@@ -151,7 +152,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev,
return ret;
/* read data */
- data[n] = inw(dev->iobase + 0);
+ data[n] = inw(devpriv->daqio + 0);
}
/* return the number of samples read/written */
@@ -171,10 +172,10 @@ static int cb_pcimdas_ao_winsn(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
switch (chan) {
case 0:
- outw(data[i] & 0x0FFF, dev->iobase + DAC0_OFFSET);
+ outw(data[i] & 0x0FFF, devpriv->daqio + DAC0_OFFSET);
break;
case 1:
- outw(data[i] & 0x0FFF, dev->iobase + DAC1_OFFSET);
+ outw(data[i] & 0x0FFF, devpriv->daqio + DAC1_OFFSET);
break;
default:
return -1;
@@ -208,7 +209,6 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct cb_pcimdas_private *devpriv;
struct comedi_subdevice *s;
- unsigned long iobase_8255;
int ret;
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
@@ -219,9 +219,9 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
if (ret)
return ret;
- dev->iobase = pci_resource_start(pcidev, 2);
+ devpriv->daqio = pci_resource_start(pcidev, 2);
devpriv->BADR3 = pci_resource_start(pcidev, 3);
- iobase_8255 = pci_resource_start(pcidev, 4);
+ dev->iobase = pci_resource_start(pcidev, 4);
ret = comedi_alloc_subdevices(dev, 3);
if (ret)
@@ -252,7 +252,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[2];
/* digital i/o subdevice */
- ret = subdev_8255_init(dev, s, NULL, iobase_8255);
+ ret = subdev_8255_init(dev, s, NULL, 0x00);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c
index 4a2b200de01b..49b24d032436 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdda.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdda.c
@@ -182,8 +182,7 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[1];
/* digital i/o subdevice */
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + PCIMDDA_8255_BASE_REG);
+ ret = subdev_8255_init(dev, s, NULL, PCIMDDA_8255_BASE_REG);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index 845a67905ca6..7aa23db593bc 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -415,14 +415,14 @@ static int waveform_attach(struct comedi_device *dev,
for (i = 0; i < s->n_chan; i++)
devpriv->ao_loopbacks[i] = s->maxdata / 2;
- init_timer(&(devpriv->timer));
+ init_timer(&devpriv->timer);
devpriv->timer.function = waveform_ai_interrupt;
devpriv->timer.data = (unsigned long)dev;
dev_info(dev->class_dev,
- "%s: %i microvolt, %li microsecond waveform attached\n",
- dev->board_name,
- devpriv->uvolt_amplitude, devpriv->usec_period);
+ "%s: %i microvolt, %li microsecond waveform attached\n",
+ dev->board_name,
+ devpriv->uvolt_amplitude, devpriv->usec_period);
return 0;
}
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
index cd369cd40114..90fbb25e55ab 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -651,16 +651,15 @@ static void daqboard2000_initializeDac(struct comedi_device *dev)
daqboard2000_dacDisarm(dev);
}
-static int daqboard2000_8255_cb(int dir, int port, int data,
- unsigned long ioaddr)
+static int daqboard2000_8255_cb(struct comedi_device *dev,
+ int dir, int port, int data,
+ unsigned long iobase)
{
- void __iomem *mmio_base = (void __iomem *)ioaddr;
-
if (dir) {
- writew(data, mmio_base + port * 2);
+ writew(data, dev->mmio + iobase + port * 2);
return 0;
}
- return readw(mmio_base + port * 2);
+ return readw(dev->mmio + iobase + port * 2);
}
static const void *daqboard2000_find_boardinfo(struct comedi_device *dev,
@@ -744,7 +743,7 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
s = &dev->subdevices[2];
result = subdev_8255_init(dev, s, daqboard2000_8255_cb,
- (unsigned long)(dev->mmio + dioP2ExpansionIO8Bit));
+ dioP2ExpansionIO8Bit);
if (result)
return result;
diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c
index fcf916a80c8d..03b2c71df8f8 100644
--- a/drivers/staging/comedi/drivers/das08.c
+++ b/drivers/staging/comedi/drivers/das08.c
@@ -536,8 +536,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
s = &dev->subdevices[4];
/* 8255 */
if (thisboard->i8255_offset != 0) {
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + thisboard->i8255_offset);
+ ret = subdev_8255_init(dev, s, NULL, thisboard->i8255_offset);
if (ret)
return ret;
} else {
diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
index 057bc16f8ddc..a347bcdff29c 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -1191,8 +1191,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* 8255 Digital I/O subdevice */
if (board->has_8255) {
s = &dev->subdevices[4];
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + board->i8255_offset);
+ ret = subdev_8255_init(dev, s, NULL, board->i8255_offset);
if (ret)
return ret;
}
diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c
index 5b6998b54060..1bf5be8c0313 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -608,7 +608,7 @@ static int das16m1_attach(struct comedi_device *dev,
s = &dev->subdevices[3];
/* 8255 */
- ret = subdev_8255_init(dev, s, NULL, devpriv->extra_iobase);
+ ret = subdev_8255_init(dev, s, NULL, DAS16M1_82C55);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c
index 9c08da9508f4..f1acca6cd12f 100644
--- a/drivers/staging/comedi/drivers/ni_atmio16d.c
+++ b/drivers/staging/comedi/drivers/ni_atmio16d.c
@@ -722,7 +722,7 @@ static int atmio16d_attach(struct comedi_device *dev,
/* 8255 subdevice */
s = &dev->subdevices[3];
if (board->has_8255) {
- ret = subdev_8255_init(dev, s, NULL, dev->iobase);
+ ret = subdev_8255_init(dev, s, NULL, 0x00);
if (ret)
return ret;
} else {
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index 925e82c65b2d..8cfabdbaa30c 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -59,7 +59,7 @@ static int dio24_auto_attach(struct comedi_device *dev,
/* 8255 dio */
s = &dev->subdevices[0];
- ret = subdev_8255_init(dev, s, NULL, dev->iobase);
+ ret = subdev_8255_init(dev, s, NULL, 0x00);
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index 126d65cb39f2..c9c090e15e85 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1035,18 +1035,6 @@ static int labpc_ao_insn_read(struct comedi_device *dev,
return 1;
}
-static int labpc_8255_mmio(int dir, int port, int data, unsigned long arg)
-{
- struct comedi_device *dev = (struct comedi_device *)arg;
-
- if (dir) {
- writeb(data, dev->mmio + DIO_BASE_REG + port);
- return 0;
- }
-
- return readb(dev->mmio + DIO_BASE_REG + port);
-}
-
/* lowlevel write to eeprom/dac */
static void labpc_serial_out(struct comedi_device *dev, unsigned int value,
unsigned int value_width)
@@ -1403,11 +1391,9 @@ int labpc_common_attach(struct comedi_device *dev,
/* 8255 dio */
s = &dev->subdevices[2];
if (dev->mmio) {
- ret = subdev_8255_init(dev, s, labpc_8255_mmio,
- (unsigned long)dev);
+ ret = subdev_8255_mm_init(dev, s, NULL, DIO_BASE_REG);
} else {
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + DIO_BASE_REG);
+ ret = subdev_8255_init(dev, s, NULL, DIO_BASE_REG);
}
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 297c95d2e0a3..8b3ba40cb74c 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -4176,16 +4176,15 @@ static int ni_freq_out_insn_config(struct comedi_device *dev,
return insn->n;
}
-static int ni_8255_callback(int dir, int port, int data, unsigned long arg)
+static int ni_8255_callback(struct comedi_device *dev,
+ int dir, int port, int data, unsigned long iobase)
{
- struct comedi_device *dev = (struct comedi_device *)arg;
-
if (dir) {
- ni_writeb(dev, data, Port_A + 2 * port);
+ ni_writeb(dev, data, iobase + 2 * port);
return 0;
}
- return ni_readb(dev, Port_A + 2 * port);
+ return ni_readb(dev, iobase + 2 * port);
}
static int ni_get_pwm_config(struct comedi_device *dev, unsigned int *data)
@@ -5560,8 +5559,7 @@ static int ni_E_init(struct comedi_device *dev,
/* 8255 device */
s = &dev->subdevices[NI_8255_DIO_SUBDEV];
if (board->has_8255) {
- ret = subdev_8255_init(dev, s, ni_8255_callback,
- (unsigned long)dev);
+ ret = subdev_8255_init(dev, s, ni_8255_callback, Port_A);
if (ret)
return ret;
} else {
diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c b/drivers/staging/comedi/drivers/ni_usb6501.c
new file mode 100644
index 000000000000..6a4f965ab79e
--- /dev/null
+++ b/drivers/staging/comedi/drivers/ni_usb6501.c
@@ -0,0 +1,425 @@
+/*
+ * comedi/drivers/ni_usb6501.c
+ * Comedi driver for National Instruments USB-6501
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2014 Luca Ellero <luca.ellero@brickedbrain.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * Driver: ni_usb6501
+ * Description: National Instruments USB-6501 module
+ * Devices: [National Instruments] USB-6501 (ni_usb6501)
+ * Author: Luca Ellero <luca.ellero@brickedbrain.com>
+ * Updated: 5 Aug 2014
+ * Status: works
+ *
+ * This driver works, but counter device is not implemented yet.
+ *
+ * Configuration Options:
+ * none
+ */
+
+/*
+ * NI-6501 - USB PROTOCOL DESCRIPTION
+ *
+ * Every command is composed by two USB packets:
+ * - request (out)
+ * - response (in)
+ *
+ * Every packet is at least 12 bytes long, here is the meaning of
+ * every field (all values are hex):
+ *
+ * byte 0 is always 00
+ * byte 1 is always 01
+ * byte 2 is always 00
+ * byte 3 is the total packet length
+ *
+ * byte 4 is always 00
+ * byte 5 is is the total packet length - 4
+ * byte 6 is always 01
+ * byte 7 is the command
+ *
+ * byte 8 is 02 (request) or 00 (response)
+ * byte 9 is 00 (response) or 10 (port request) or 20 (counter request)
+ * byte 10 is always 00
+ * byte 11 is 00 (request) or 02 (response)
+ *
+ *
+ * CMD: 0xE READ_PORT
+ * REQ: 00 01 00 10 00 0C 01 0E 02 10 00 00 00 03 <PORT> 00
+ * RES: 00 01 00 10 00 0C 01 00 00 00 00 02 00 03 <BMAP> 00
+
+ * CMD: 0xF WRITE_PORT
+ * REQ: 00 01 00 14 00 10 01 0F 02 10 00 00 00 03 <PORT> 00 03 <BMAP> 00 00
+ * RES: 00 01 00 0C 00 08 01 00 00 00 00 02
+ *
+ * CMD: 0x12 SET_PORT_DIR (0 = input, 1 = output)
+ * REQ: 00 01 00 18 00 14 01 12 02 10 00 00
+ * 00 05 <PORT 0> <PORT 1> <PORT 2> 00 05 00 00 00 00 00
+ * RES: 00 01 00 0C 00 08 01 00 00 00 00 02
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/usb.h>
+
+#include "../comedidev.h"
+
+#define NI6501_TIMEOUT 1000
+
+/* Port request packets */
+static const u8 READ_PORT_REQUEST[] = {0x00, 0x01, 0x00, 0x10,
+ 0x00, 0x0C, 0x01, 0x0E,
+ 0x02, 0x10, 0x00, 0x00,
+ 0x00, 0x03, 0x00, 0x00};
+
+static const u8 WRITE_PORT_REQUEST[] = {0x00, 0x01, 0x00, 0x14,
+ 0x00, 0x10, 0x01, 0x0F,
+ 0x02, 0x10, 0x00, 0x00,
+ 0x00, 0x03, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00};
+
+static const u8 SET_PORT_DIR_REQUEST[] = {0x00, 0x01, 0x00, 0x18,
+ 0x00, 0x14, 0x01, 0x12,
+ 0x02, 0x10, 0x00, 0x00,
+ 0x00, 0x05, 0x00, 0x00,
+ 0x00, 0x00, 0x05, 0x00,
+ 0x00, 0x00, 0x00, 0x00};
+
+/* Response packets */
+static const u8 GENERIC_RESPONSE[] = {0x00, 0x01, 0x00, 0x0C,
+ 0x00, 0x08, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x02};
+
+static const u8 READ_PORT_RESPONSE[] = {0x00, 0x01, 0x00, 0x10,
+ 0x00, 0x0C, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x02,
+ 0x00, 0x03, 0x00, 0x00};
+
+enum commands {
+ READ_PORT,
+ WRITE_PORT,
+ SET_PORT_DIR
+};
+
+struct ni6501_private {
+ struct usb_endpoint_descriptor *ep_rx;
+ struct usb_endpoint_descriptor *ep_tx;
+ struct semaphore sem;
+ u8 *usb_rx_buf;
+ u8 *usb_tx_buf;
+};
+
+static int ni6501_send_command(struct comedi_device *dev, int command,
+ const u8 *port, u8 *bitmap)
+{
+ struct usb_device *usb = comedi_to_usb_dev(dev);
+ struct ni6501_private *devpriv = dev->private;
+ int request_size, response_size;
+ u8 *tx = devpriv->usb_tx_buf;
+ int ret;
+
+ if (!tx || !port)
+ return -EINVAL;
+
+ if (command != SET_PORT_DIR && !bitmap)
+ return -EINVAL;
+
+ down(&devpriv->sem);
+
+ switch (command) {
+ case READ_PORT:
+
+ request_size = sizeof(READ_PORT_REQUEST);
+ /* 4 additional bytes for READ_PORT request */
+ response_size = sizeof(GENERIC_RESPONSE) + 4;
+
+ memcpy(tx, READ_PORT_REQUEST, request_size);
+
+ tx[14] = port[0];
+
+ break;
+
+ case WRITE_PORT:
+
+ request_size = sizeof(WRITE_PORT_REQUEST);
+ response_size = sizeof(GENERIC_RESPONSE);
+
+ memcpy(tx, WRITE_PORT_REQUEST, request_size);
+
+ tx[14] = port[0];
+ tx[17] = bitmap[0];
+
+ break;
+
+ case SET_PORT_DIR:
+
+ request_size = sizeof(SET_PORT_DIR_REQUEST);
+ response_size = sizeof(GENERIC_RESPONSE);
+
+ memcpy(tx, SET_PORT_DIR_REQUEST, request_size);
+
+ tx[14] = port[0];
+ tx[15] = port[1];
+ tx[16] = port[2];
+
+ break;
+
+ default:
+ ret = -EINVAL;
+ goto end;
+ }
+
+ ret = usb_bulk_msg(usb,
+ usb_sndbulkpipe(usb,
+ devpriv->ep_tx->bEndpointAddress),
+ devpriv->usb_tx_buf,
+ request_size,
+ NULL,
+ NI6501_TIMEOUT);
+ if (ret)
+ goto end;
+
+ ret = usb_bulk_msg(usb,
+ usb_rcvbulkpipe(usb,
+ devpriv->ep_rx->bEndpointAddress),
+ devpriv->usb_rx_buf,
+ response_size,
+ NULL,
+ NI6501_TIMEOUT);
+ if (ret)
+ goto end;
+
+ /* Check if results are valid */
+
+ if (command == READ_PORT) {
+ bitmap[0] = devpriv->usb_rx_buf[14];
+ /* mask bitmap for comparing */
+ devpriv->usb_rx_buf[14] = 0x00;
+
+ if (memcmp(devpriv->usb_rx_buf, READ_PORT_RESPONSE,
+ sizeof(READ_PORT_RESPONSE))) {
+ ret = -EINVAL;
+ }
+ } else if (memcmp(devpriv->usb_rx_buf, GENERIC_RESPONSE,
+ sizeof(GENERIC_RESPONSE))) {
+ ret = -EINVAL;
+ }
+end:
+ up(&devpriv->sem);
+
+ return ret;
+}
+
+static int ni6501_dio_insn_config(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
+{
+ int ret;
+ u8 port[3];
+
+ ret = comedi_dio_insn_config(dev, s, insn, data, 0);
+ if (ret)
+ return ret;
+
+ port[0] = (s->io_bits) & 0xff;
+ port[1] = (s->io_bits >> 8) & 0xff;
+ port[2] = (s->io_bits >> 16) & 0xff;
+
+ ret = ni6501_send_command(dev, SET_PORT_DIR, port, NULL);
+ if (ret)
+ return ret;
+
+ return insn->n;
+}
+
+static int ni6501_dio_insn_bits(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned int *data)
+{
+ unsigned int mask;
+ int ret;
+ u8 port;
+ u8 bitmap;
+
+ mask = comedi_dio_update_state(s, data);
+
+ for (port = 0; port < 3; port++) {
+ if (mask & (0xFF << port * 8)) {
+ bitmap = (s->state >> port * 8) & 0xFF;
+ ret = ni6501_send_command(dev, WRITE_PORT,
+ &port, &bitmap);
+ if (ret)
+ return ret;
+ }
+ }
+
+ data[1] = 0;
+
+ for (port = 0; port < 3; port++) {
+ ret = ni6501_send_command(dev, READ_PORT, &port, &bitmap);
+ if (ret)
+ return ret;
+ data[1] |= bitmap << port * 8;
+ }
+
+ return insn->n;
+}
+
+static int ni6501_alloc_usb_buffers(struct comedi_device *dev)
+{
+ struct ni6501_private *devpriv = dev->private;
+ size_t size;
+
+ size = le16_to_cpu(devpriv->ep_rx->wMaxPacketSize);
+ devpriv->usb_rx_buf = kzalloc(size, GFP_KERNEL);
+ if (!devpriv->usb_rx_buf)
+ return -ENOMEM;
+
+ size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
+ devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
+ if (!devpriv->usb_tx_buf) {
+ kfree(devpriv->usb_rx_buf);
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
+static int ni6501_find_endpoints(struct comedi_device *dev)
+{
+ struct usb_interface *intf = comedi_to_usb_interface(dev);
+ struct ni6501_private *devpriv = dev->private;
+ struct usb_host_interface *iface_desc = intf->cur_altsetting;
+ struct usb_endpoint_descriptor *ep_desc;
+ int i;
+
+ if (iface_desc->desc.bNumEndpoints != 2) {
+ dev_err(dev->class_dev, "Wrong number of endpoints\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
+ ep_desc = &iface_desc->endpoint[i].desc;
+
+ if (usb_endpoint_is_bulk_in(ep_desc)) {
+ if (!devpriv->ep_rx)
+ devpriv->ep_rx = ep_desc;
+ continue;
+ }
+
+ if (usb_endpoint_is_bulk_out(ep_desc)) {
+ if (!devpriv->ep_tx)
+ devpriv->ep_tx = ep_desc;
+ continue;
+ }
+ }
+
+ if (!devpriv->ep_rx || !devpriv->ep_tx)
+ return -ENODEV;
+
+ return 0;
+}
+
+static int ni6501_auto_attach(struct comedi_device *dev,
+ unsigned long context)
+{
+ struct usb_interface *intf = comedi_to_usb_interface(dev);
+ struct ni6501_private *devpriv;
+ struct comedi_subdevice *s;
+ int ret;
+
+ devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
+ if (!devpriv)
+ return -ENOMEM;
+
+ ret = ni6501_find_endpoints(dev);
+ if (ret)
+ return ret;
+
+ ret = ni6501_alloc_usb_buffers(dev);
+ if (ret)
+ return ret;
+
+ sema_init(&devpriv->sem, 1);
+ usb_set_intfdata(intf, devpriv);
+
+ ret = comedi_alloc_subdevices(dev, 1);
+ if (ret)
+ return ret;
+
+ /* Digital Input/Output subdevice */
+ s = &dev->subdevices[0];
+ s->type = COMEDI_SUBD_DIO;
+ s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
+ s->n_chan = 24;
+ s->maxdata = 1;
+ s->range_table = &range_digital;
+ s->insn_bits = ni6501_dio_insn_bits;
+ s->insn_config = ni6501_dio_insn_config;
+
+ return 0;
+}
+
+static void ni6501_detach(struct comedi_device *dev)
+{
+ struct usb_interface *intf = comedi_to_usb_interface(dev);
+ struct ni6501_private *devpriv = dev->private;
+
+ if (!devpriv)
+ return;
+
+ down(&devpriv->sem);
+
+ usb_set_intfdata(intf, NULL);
+
+ kfree(devpriv->usb_rx_buf);
+ kfree(devpriv->usb_tx_buf);
+
+ up(&devpriv->sem);
+}
+
+static struct comedi_driver ni6501_driver = {
+ .module = THIS_MODULE,
+ .driver_name = "ni6501",
+ .auto_attach = ni6501_auto_attach,
+ .detach = ni6501_detach,
+};
+
+static int ni6501_usb_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
+{
+ return comedi_usb_auto_config(intf, &ni6501_driver, id->driver_info);
+}
+
+static const struct usb_device_id ni6501_usb_table[] = {
+ { USB_DEVICE(0x3923, 0x718a) },
+ { }
+};
+MODULE_DEVICE_TABLE(usb, ni6501_usb_table);
+
+static struct usb_driver ni6501_usb_driver = {
+ .name = "ni6501",
+ .id_table = ni6501_usb_table,
+ .probe = ni6501_usb_probe,
+ .disconnect = comedi_usb_auto_unconfig,
+};
+module_comedi_usb_driver(ni6501_driver, ni6501_usb_driver);
+
+MODULE_AUTHOR("Luca Ellero");
+MODULE_DESCRIPTION("Comedi driver for National Instruments USB-6501");
+MODULE_LICENSE("GPL");
diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c
index c7f8eb1cf8de..84c768fefffb 100644
--- a/drivers/staging/comedi/drivers/pcl724.c
+++ b/drivers/staging/comedi/drivers/pcl724.c
@@ -32,8 +32,6 @@
#include "8255.h"
-#define SIZE_8255 4
-
struct pcl724_board {
const char *name;
unsigned int io_range;
@@ -81,10 +79,11 @@ static const struct pcl724_board boardtypes[] = {
},
};
-static int pcl724_8255mapped_io(int dir, int port, int data,
+static int pcl724_8255mapped_io(struct comedi_device *dev,
+ int dir, int port, int data,
unsigned long iobase)
{
- int movport = SIZE_8255 * (iobase >> 12);
+ int movport = I8255_SIZE * (iobase >> 12);
iobase &= 0x0fff;
@@ -132,8 +131,7 @@ static int pcl724_attach(struct comedi_device *dev,
ret = subdev_8255_init(dev, s, pcl724_8255mapped_io,
iobase);
} else {
- iobase = dev->iobase + (i * SIZE_8255);
- ret = subdev_8255_init(dev, s, NULL, iobase);
+ ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
}
if (ret)
return ret;
diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c
index 6e0d78f6095b..6176dfa24801 100644
--- a/drivers/staging/comedi/drivers/pcm3724.c
+++ b/drivers/staging/comedi/drivers/pcm3724.c
@@ -33,8 +33,6 @@ Copy/pasted/hacked from pcm724.c
#include "8255.h"
-#define SIZE_8255 4
-
#define BUF_C0 0x1
#define BUF_B0 0x2
#define BUF_A0 0x4
@@ -49,16 +47,6 @@ Copy/pasted/hacked from pcm724.c
#define GATE_B1 0x10
#define GATE_C1 0x8
-/* from 8255.c */
-#define CR_CW 0x80
-#define _8255_CR 3
-#define CR_B_IO 0x02
-#define CR_B_MODE 0x04
-#define CR_C_IO 0x09
-#define CR_A_IO 0x10
-#define CR_A_MODE(a) ((a)<<5)
-#define CR_CW 0x80
-
/* used to track configured dios */
struct priv_pcm3724 {
int dio_1;
@@ -98,26 +86,26 @@ static void do_3724_config(struct comedi_device *dev,
int buffer_config;
unsigned long port_8255_cfg;
- config = CR_CW;
+ config = I8255_CTRL_CW;
buffer_config = 0;
/* 1 in io_bits indicates output, 1 in config indicates input */
if (!(s->io_bits & 0x0000ff))
- config |= CR_A_IO;
+ config |= I8255_CTRL_A_IO;
if (!(s->io_bits & 0x00ff00))
- config |= CR_B_IO;
+ config |= I8255_CTRL_B_IO;
if (!(s->io_bits & 0xff0000))
- config |= CR_C_IO;
+ config |= I8255_CTRL_C_HI_IO | I8255_CTRL_C_LO_IO;
buffer_config = compute_buffer(0, 0, s_dio1);
buffer_config = compute_buffer(buffer_config, 1, s_dio2);
if (s == s_dio1)
- port_8255_cfg = dev->iobase + _8255_CR;
+ port_8255_cfg = dev->iobase + I8255_CTRL_REG;
else
- port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR;
+ port_8255_cfg = dev->iobase + I8255_SIZE + I8255_CTRL_REG;
outb(buffer_config, dev->iobase + 8); /* update buffer register */
@@ -211,8 +199,7 @@ static int pcm3724_attach(struct comedi_device *dev,
for (i = 0; i < dev->n_subdevices; i++) {
s = &dev->subdevices[i];
- ret = subdev_8255_init(dev, s, NULL,
- dev->iobase + SIZE_8255 * i);
+ ret = subdev_8255_init(dev, s, NULL, i * I8255_SIZE);
if (ret)
return ret;
s->insn_config = subdev_3724_insn_config;
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 06c55cb57090..45f20b4a0c14 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -41,6 +41,8 @@
*/
#undef DIGI_CONCENTRATORS_SUPPORTED
+#define pr_fmt(fmt) "dgap: " fmt
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
@@ -153,17 +155,10 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
static int dgap_gettok(char **in);
static char *dgap_getword(char **in);
static int dgap_checknode(struct cnode *p);
-static void dgap_err(char *s);
/*
* Function prototypes from dgap_sysfs.h
*/
-struct board_t;
-struct channel_t;
-struct un_t;
-struct pci_driver;
-struct class_device;
-
static void dgap_create_ports_sysfiles(struct board_t *bd);
static void dgap_remove_ports_sysfiles(struct board_t *bd);
@@ -201,6 +196,7 @@ static int dgap_test_fep(struct board_t *brd);
static int dgap_tty_register_ports(struct board_t *brd);
static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
struct board_t *brd);
+static void dgap_cleanup_nodes(void);
static void dgap_cleanup_module(void);
@@ -404,10 +400,7 @@ struct toklist {
char *string;
};
-static struct toklist dgap_tlist[] = {
- { BEGIN, "config_begin" },
- { END, "config_end" },
- { BOARD, "board" },
+static struct toklist dgap_brdtype[] = {
{ PCX, "Digi_AccelePort_C/X_PCI" },
{ PEPC, "Digi_AccelePort_EPC/X_PCI" },
{ PPCM, "Digi_AccelePort_Xem_PCI" },
@@ -416,6 +409,13 @@ static struct toklist dgap_tlist[] = {
{ APORT8_920P, "Digi_AccelePort_8r_920_PCI" },
{ PAPORT4, "Digi_AccelePort_4r_PCI(EIA-232/RS-422)" },
{ PAPORT8, "Digi_AccelePort_8r_PCI(EIA-232/RS-422)" },
+ { 0, NULL }
+};
+
+static struct toklist dgap_tlist[] = {
+ { BEGIN, "config_begin" },
+ { END, "config_end" },
+ { BOARD, "board" },
{ IO, "io" },
{ PCIINFO, "pciinfo" },
{ LINE, "line" },
@@ -619,6 +619,7 @@ unregister_tty:
free_flipbuf:
dgap_free_flipbuf(brd);
cleanup_brd:
+ dgap_cleanup_nodes();
dgap_release_remap(brd);
kfree(brd);
@@ -659,6 +660,8 @@ static void dgap_cleanup_module(void)
dgap_cleanup_board(dgap_board[i]);
}
+ dgap_cleanup_nodes();
+
if (dgap_numboards)
pci_unregister_driver(&dgap_driver);
}
@@ -875,7 +878,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
ret = request_firmware(&fw, fw_info[card_type].conf_name,
&pdev->dev);
if (ret) {
- pr_err("dgap: config file %s not found\n",
+ dev_err(&pdev->dev, "config file %s not found\n",
fw_info[card_type].conf_name);
return ret;
}
@@ -920,7 +923,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
dgap_find_config(PAPORT4, brd->pci_bus, brd->pci_slot);
if (!brd->bd_config) {
- pr_err("dgap: No valid configuration found\n");
+ dev_err(&pdev->dev, "No valid configuration found\n");
return -EINVAL;
}
@@ -928,7 +931,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
ret = request_firmware(&fw, fw_info[card_type].bios_name,
&pdev->dev);
if (ret) {
- pr_err("dgap: bios file %s not found\n",
+ dev_err(&pdev->dev, "bios file %s not found\n",
fw_info[card_type].bios_name);
return ret;
}
@@ -945,7 +948,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
ret = request_firmware(&fw, fw_info[card_type].fep_name,
&pdev->dev);
if (ret) {
- pr_err("dgap: fep file %s not found\n",
+ dev_err(&pdev->dev, "dgap: fep file %s not found\n",
fw_info[card_type].fep_name);
return ret;
}
@@ -974,7 +977,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type,
ret = request_firmware(&fw, fw_info[card_type].con_name,
&pdev->dev);
if (ret) {
- pr_err("dgap: conc file %s not found\n",
+ dev_err(&pdev->dev, "conc file %s not found\n",
fw_info[card_type].con_name);
return ret;
}
@@ -1316,11 +1319,9 @@ static int dgap_tty_register(struct board_t *brd)
if (rc < 0)
goto unregister_serial_drv;
- brd->dgap_major_serial_registered = TRUE;
dgap_boards_by_major[brd->serial_driver->major] = brd;
brd->dgap_serial_major = brd->serial_driver->major;
- brd->dgap_major_transparent_print_registered = TRUE;
dgap_boards_by_major[brd->print_driver->major] = brd;
brd->dgap_transparent_print_major = brd->print_driver->major;
@@ -1378,19 +1379,17 @@ static int dgap_tty_init(struct board_t *brd)
brd->nasync = brd->maxports;
if (true_count != brd->nasync) {
- if ((brd->type == PPCM) && (true_count == 64)) {
- pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
- brd->name, brd->nasync, true_count);
- pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
- pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
- } else if ((brd->type == PPCM) && (true_count == 0)) {
- pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
- brd->name, brd->nasync, true_count);
- pr_warn("dgap: Please make SURE the EBI cable running from the card\n");
- pr_warn("dgap: to each EM module is plugged into EBI IN!\n");
- } else
- pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
- brd->name, brd->nasync, true_count);
+ dev_warn(&brd->pdev->dev,
+ "%s configured for %d ports, has %d ports.\n",
+ brd->name, brd->nasync, true_count);
+
+ if ((brd->type == PPCM) &&
+ (true_count == 64 || true_count == 0)) {
+ dev_warn(&brd->pdev->dev,
+ "Please make SURE the EBI cable running from the card\n");
+ dev_warn(&brd->pdev->dev,
+ "to each EM module is plugged into EBI IN!\n");
+ }
brd->nasync = true_count;
@@ -1540,35 +1539,29 @@ static void dgap_cleanup_tty(struct board_t *brd)
struct device *dev;
int i;
- if (brd->dgap_major_serial_registered) {
- dgap_boards_by_major[brd->serial_driver->major] = NULL;
- brd->dgap_serial_major = 0;
- for (i = 0; i < brd->nasync; i++) {
- tty_port_destroy(&brd->serial_ports[i]);
- dev = brd->channels[i]->ch_tun.un_sysfs;
- dgap_remove_tty_sysfs(dev);
- tty_unregister_device(brd->serial_driver, i);
- }
- tty_unregister_driver(brd->serial_driver);
- put_tty_driver(brd->serial_driver);
- kfree(brd->serial_ports);
- brd->dgap_major_serial_registered = FALSE;
- }
-
- if (brd->dgap_major_transparent_print_registered) {
- dgap_boards_by_major[brd->print_driver->major] = NULL;
- brd->dgap_transparent_print_major = 0;
- for (i = 0; i < brd->nasync; i++) {
- tty_port_destroy(&brd->printer_ports[i]);
- dev = brd->channels[i]->ch_pun.un_sysfs;
- dgap_remove_tty_sysfs(dev);
- tty_unregister_device(brd->print_driver, i);
- }
- tty_unregister_driver(brd->print_driver);
- put_tty_driver(brd->print_driver);
- kfree(brd->printer_ports);
- brd->dgap_major_transparent_print_registered = FALSE;
+ dgap_boards_by_major[brd->serial_driver->major] = NULL;
+ brd->dgap_serial_major = 0;
+ for (i = 0; i < brd->nasync; i++) {
+ tty_port_destroy(&brd->serial_ports[i]);
+ dev = brd->channels[i]->ch_tun.un_sysfs;
+ dgap_remove_tty_sysfs(dev);
+ tty_unregister_device(brd->serial_driver, i);
+ }
+ tty_unregister_driver(brd->serial_driver);
+ put_tty_driver(brd->serial_driver);
+ kfree(brd->serial_ports);
+
+ dgap_boards_by_major[brd->print_driver->major] = NULL;
+ brd->dgap_transparent_print_major = 0;
+ for (i = 0; i < brd->nasync; i++) {
+ tty_port_destroy(&brd->printer_ports[i]);
+ dev = brd->channels[i]->ch_pun.un_sysfs;
+ dgap_remove_tty_sysfs(dev);
+ tty_unregister_device(brd->print_driver, i);
}
+ tty_unregister_driver(brd->print_driver);
+ put_tty_driver(brd->print_driver);
+ kfree(brd->printer_ports);
}
/*=======================================================================
@@ -4215,7 +4208,7 @@ static int dgap_test_bios(struct board_t *brd)
/* Gave up on board after too long of time taken */
err1 = readw(addr + SEQUENCE);
err2 = readw(addr + ERROR);
- pr_warn("dgap: %s failed diagnostics. Error #(%x,%x).\n",
+ dev_warn(&brd->pdev->dev, "%s failed diagnostics. Error #(%x,%x).\n",
brd->name, err1, err2);
brd->state = BOARD_FAILED;
brd->dpastatus = BD_NOBIOS;
@@ -4310,8 +4303,9 @@ static int dgap_test_fep(struct board_t *brd)
/* Gave up on board after too long of time taken */
err1 = readw(addr + SEQUENCE);
err2 = readw(addr + ERROR);
- pr_warn("dgap: FEPOS for %s not functioning. Error #(%x,%x).\n",
- brd->name, err1, err2);
+ dev_warn(&brd->pdev->dev,
+ "FEPOS for %s not functioning. Error #(%x,%x).\n",
+ brd->name, err1, err2);
brd->state = BOARD_FAILED;
brd->dpastatus = BD_NOFEP;
@@ -4343,7 +4337,8 @@ static void dgap_do_reset_board(struct board_t *brd)
}
if (i > 1000) {
- pr_warn("dgap: Board not resetting... Failing board.\n");
+ dev_warn(&brd->pdev->dev,
+ "dgap: Board not resetting... Failing board.\n");
brd->state = BOARD_FAILED;
brd->dpastatus = BD_NOFEP;
return;
@@ -4358,8 +4353,9 @@ static void dgap_do_reset_board(struct board_t *brd)
check2 = readl(brd->re_map_membase + HIGHMEM);
if ((check1 != 0xa55a3cc3) || (check2 != 0x5aa5c33c)) {
- pr_warn("dgap: No memory at %p for board.\n",
- brd->re_map_membase);
+ dev_warn(&brd->pdev->dev,
+ "No memory at %p for board.\n",
+ brd->re_map_membase);
brd->state = BOARD_FAILED;
brd->dpastatus = BD_NOFEP;
return;
@@ -6323,6 +6319,54 @@ static void dgap_remove_tty_sysfs(struct device *c)
sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);
}
+static void dgap_cleanup_nodes(void)
+{
+ struct cnode *p;
+
+ p = &dgap_head;
+
+ while (p) {
+ struct cnode *tmp = p->next;
+
+ if (p->type == NULLNODE) {
+ p = tmp;
+ continue;
+ }
+
+ switch (p->type) {
+ case BNODE:
+ kfree(p->u.board.portstr);
+ kfree(p->u.board.addrstr);
+ kfree(p->u.board.pcibusstr);
+ kfree(p->u.board.pcislotstr);
+ kfree(p->u.board.method);
+ break;
+ case CNODE:
+ kfree(p->u.conc.id);
+ kfree(p->u.conc.connect);
+ break;
+ case MNODE:
+ kfree(p->u.module.id);
+ break;
+ case TNODE:
+ kfree(p->u.ttyname);
+ break;
+ case CUNODE:
+ kfree(p->u.cuname);
+ break;
+ case LNODE:
+ kfree(p->u.line.cable);
+ break;
+ case PNODE:
+ kfree(p->u.printname);
+ break;
+ }
+
+ kfree(p->u.board.status);
+ kfree(p);
+ p = tmp;
+ }
+}
/*
* Parse a configuration file read into memory as a string.
*/
@@ -6343,21 +6387,25 @@ static int dgap_parsefile(char **in)
/* file must start with a BEGIN */
while ((rc = dgap_gettok(in)) != BEGIN) {
if (rc == 0) {
- dgap_err("unexpected EOF");
+ pr_err("unexpected EOF");
return -1;
}
}
for (; ;) {
+ int board_type = 0;
+ int conc_type = 0;
+ int module_type = 0;
+
rc = dgap_gettok(in);
if (rc == 0) {
- dgap_err("unexpected EOF");
+ pr_err("unexpected EOF");
return -1;
}
switch (rc) {
case BEGIN: /* should only be 1 begin */
- dgap_err("unexpected config_begin\n");
+ pr_err("unexpected config_begin\n");
return -1;
case END:
@@ -6368,10 +6416,9 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
+
p = p->next;
p->type = BNODE;
@@ -6379,103 +6426,30 @@ static int dgap_parsefile(char **in)
line = conc = NULL;
brd = p;
linecnt = -1;
- break;
- case APORT2_920P: /* AccelePort_4 */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_2r_920 string");
+ board_type = dgap_gettok(in);
+ if (board_type == 0) {
+ pr_err("board !!type not specified");
return -1;
}
- p->u.board.type = APORT2_920P;
- p->u.board.v_type = 1;
- break;
- case APORT4_920P: /* AccelePort_4 */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_4r_920 string");
- return -1;
- }
- p->u.board.type = APORT4_920P;
- p->u.board.v_type = 1;
- break;
+ p->u.board.type = board_type;
- case APORT8_920P: /* AccelePort_8 */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_8r_920 string");
- return -1;
- }
- p->u.board.type = APORT8_920P;
- p->u.board.v_type = 1;
- break;
-
- case PAPORT4: /* AccelePort_4 PCI */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_4r(PCI) string");
- return -1;
- }
- p->u.board.type = PAPORT4;
- p->u.board.v_type = 1;
- break;
-
- case PAPORT8: /* AccelePort_8 PCI */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_8r string");
- return -1;
- }
- p->u.board.type = PAPORT8;
- p->u.board.v_type = 1;
- break;
-
- case PCX: /* PCI C/X */
- if (p->type != BNODE) {
- dgap_err("unexpected Digi_C/X_(PCI) string");
- return -1;
- }
- p->u.board.type = PCX;
- p->u.board.v_type = 1;
- p->u.board.conc1 = 0;
- p->u.board.conc2 = 0;
- p->u.board.module1 = 0;
- p->u.board.module2 = 0;
- break;
-
- case PEPC: /* PCI EPC/X */
- if (p->type != BNODE) {
- dgap_err("unexpected \"Digi_EPC/X_(PCI)\" string");
- return -1;
- }
- p->u.board.type = PEPC;
- p->u.board.v_type = 1;
- p->u.board.conc1 = 0;
- p->u.board.conc2 = 0;
- p->u.board.module1 = 0;
- p->u.board.module2 = 0;
- break;
-
- case PPCM: /* PCI/Xem */
- if (p->type != BNODE) {
- dgap_err("unexpected PCI/Xem string");
- return -1;
- }
- p->u.board.type = PPCM;
- p->u.board.v_type = 1;
- p->u.board.conc1 = 0;
- p->u.board.conc2 = 0;
break;
case IO: /* i/o port */
if (p->type != BNODE) {
- dgap_err("IO port only vaild for boards");
+ pr_err("IO port only vaild for boards");
return -1;
}
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.portstr = kstrdup(s, GFP_KERNEL);
if (kstrtol(s, 0, &p->u.board.port)) {
- dgap_err("bad number for IO port");
+ pr_err("bad number for IO port");
return -1;
}
p->u.board.v_port = 1;
@@ -6483,17 +6457,17 @@ static int dgap_parsefile(char **in)
case MEM: /* memory address */
if (p->type != BNODE) {
- dgap_err("memory address only vaild for boards");
+ pr_err("memory address only vaild for boards");
return -1;
}
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.addrstr = kstrdup(s, GFP_KERNEL);
if (kstrtoul(s, 0, &p->u.board.addr)) {
- dgap_err("bad number for memory address");
+ pr_err("bad number for memory address");
return -1;
}
p->u.board.v_addr = 1;
@@ -6501,28 +6475,28 @@ static int dgap_parsefile(char **in)
case PCIINFO: /* pci information */
if (p->type != BNODE) {
- dgap_err("memory address only vaild for boards");
+ pr_err("memory address only vaild for boards");
return -1;
}
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.pcibusstr = kstrdup(s, GFP_KERNEL);
if (kstrtoul(s, 0, &p->u.board.pcibus)) {
- dgap_err("bad number for pci bus");
+ pr_err("bad number for pci bus");
return -1;
}
p->u.board.v_pcibus = 1;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.pcislotstr = kstrdup(s, GFP_KERNEL);
if (kstrtoul(s, 0, &p->u.board.pcislot)) {
- dgap_err("bad number for pci slot");
+ pr_err("bad number for pci slot");
return -1;
}
p->u.board.v_pcislot = 1;
@@ -6530,12 +6504,12 @@ static int dgap_parsefile(char **in)
case METHOD:
if (p->type != BNODE) {
- dgap_err("install method only vaild for boards");
+ pr_err("install method only vaild for boards");
return -1;
}
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.method = kstrdup(s, GFP_KERNEL);
@@ -6544,12 +6518,12 @@ static int dgap_parsefile(char **in)
case STATUS:
if (p->type != BNODE) {
- dgap_err("config status only vaild for boards");
+ pr_err("config status only vaild for boards");
return -1;
}
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.board.status = kstrdup(s, GFP_KERNEL);
@@ -6559,38 +6533,38 @@ static int dgap_parsefile(char **in)
if (p->type == BNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.board.nport)) {
- dgap_err("bad number for number of ports");
+ pr_err("bad number for number of ports");
return -1;
}
p->u.board.v_nport = 1;
} else if (p->type == CNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.conc.nport)) {
- dgap_err("bad number for number of ports");
+ pr_err("bad number for number of ports");
return -1;
}
p->u.conc.v_nport = 1;
} else if (p->type == MNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.module.nport)) {
- dgap_err("bad number for number of ports");
+ pr_err("bad number for number of ports");
return -1;
}
p->u.module.v_nport = 1;
} else {
- dgap_err("nports only valid for concentrators or modules");
+ pr_err("nports only valid for concentrators or modules");
return -1;
}
break;
@@ -6598,7 +6572,7 @@ static int dgap_parsefile(char **in)
case ID: /* letter ID used in tty name */
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
@@ -6611,7 +6585,7 @@ static int dgap_parsefile(char **in)
p->u.module.id = kstrdup(s, GFP_KERNEL);
p->u.module.v_id = 1;
} else {
- dgap_err("id only valid for concentrators or modules");
+ pr_err("id only valid for concentrators or modules");
return -1;
}
break;
@@ -6620,38 +6594,38 @@ static int dgap_parsefile(char **in)
if (p->type == BNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.board.start)) {
- dgap_err("bad number for start of tty count");
+ pr_err("bad number for start of tty count");
return -1;
}
p->u.board.v_start = 1;
} else if (p->type == CNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.conc.start)) {
- dgap_err("bad number for start of tty count");
+ pr_err("bad number for start of tty count");
return -1;
}
p->u.conc.v_start = 1;
} else if (p->type == MNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.module.start)) {
- dgap_err("bad number for start of tty count");
+ pr_err("bad number for start of tty count");
return -1;
}
p->u.module.v_start = 1;
} else {
- dgap_err("start only valid for concentrators or modules");
+ pr_err("start only valid for concentrators or modules");
return -1;
}
break;
@@ -6661,24 +6635,21 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = TNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpeced end of file");
+ pr_err("unexpeced end of file");
return -1;
}
p->u.ttyname = kstrdup(s, GFP_KERNEL);
- if (!p->u.ttyname) {
- dgap_err("out of memory");
+ if (!p->u.ttyname)
return -1;
- }
+
break;
case CU: /* cu name prefix */
@@ -6686,44 +6657,39 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = CUNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpeced end of file");
+ pr_err("unexpeced end of file");
return -1;
}
p->u.cuname = kstrdup(s, GFP_KERNEL);
- if (!p->u.cuname) {
- dgap_err("out of memory");
+ if (!p->u.cuname)
return -1;
- }
+
break;
case LINE: /* line information */
if (dgap_checknode(p))
return -1;
if (!brd) {
- dgap_err("must specify board before line info");
+ pr_err("must specify board before line info");
return -1;
}
switch (brd->u.board.type) {
case PPCM:
- dgap_err("line not vaild for PC/em");
+ pr_err("line not vaild for PC/em");
return -1;
}
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = LNODE;
@@ -6736,15 +6702,13 @@ static int dgap_parsefile(char **in)
if (dgap_checknode(p))
return -1;
if (!line) {
- dgap_err("must specify line info before concentrator");
+ pr_err("must specify line info before concentrator");
return -1;
}
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = CNODE;
@@ -6755,31 +6719,22 @@ static int dgap_parsefile(char **in)
else
brd->u.board.conc1++;
- break;
-
- case CX: /* c/x type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
+ conc_type = dgap_gettok(in);
+ if (conc_type == 0 || conc_type != CX ||
+ conc_type != EPC) {
+ pr_err("failed to set a type of concentratros");
return -1;
}
- p->u.conc.type = CX;
- p->u.conc.v_type = 1;
- break;
- case EPC: /* epc type concentrator */
- if (p->type != CNODE) {
- dgap_err("cx only valid for concentrators");
- return -1;
- }
- p->u.conc.type = EPC;
- p->u.conc.v_type = 1;
+ p->u.conc.type = conc_type;
+
break;
case MOD: /* EBI module */
if (dgap_checknode(p))
return -1;
if (!brd) {
- dgap_err("must specify board info before EBI modules");
+ pr_err("must specify board info before EBI modules");
return -1;
}
switch (brd->u.board.type) {
@@ -6788,16 +6743,15 @@ static int dgap_parsefile(char **in)
break;
default:
if (!conc) {
- dgap_err("must specify concentrator info before EBI module");
+ pr_err("must specify concentrator info before EBI module");
return -1;
}
}
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
+
p = p->next;
p->type = MNODE;
@@ -6806,31 +6760,22 @@ static int dgap_parsefile(char **in)
else
brd->u.board.module1++;
- break;
-
- case PORTS: /* ports type EBI module */
- if (p->type != MNODE) {
- dgap_err("ports only valid for EBI modules");
+ module_type = dgap_gettok(in);
+ if (module_type == 0 || module_type != PORTS ||
+ module_type != MODEM) {
+ pr_err("failed to set a type of module");
return -1;
}
- p->u.module.type = PORTS;
- p->u.module.v_type = 1;
- break;
- case MODEM: /* ports type EBI module */
- if (p->type != MNODE) {
- dgap_err("modem only valid for modem modules");
- return -1;
- }
- p->u.module.type = MODEM;
- p->u.module.v_type = 1;
+ p->u.module.type = module_type;
+
break;
case CABLE:
if (p->type == LNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.line.cable = kstrdup(s, GFP_KERNEL);
@@ -6842,27 +6787,27 @@ static int dgap_parsefile(char **in)
if (p->type == LNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.line.speed)) {
- dgap_err("bad number for line speed");
+ pr_err("bad number for line speed");
return -1;
}
p->u.line.v_speed = 1;
} else if (p->type == CNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.conc.speed)) {
- dgap_err("bad number for line speed");
+ pr_err("bad number for line speed");
return -1;
}
p->u.conc.v_speed = 1;
} else {
- dgap_err("speed valid only for lines or concentrators.");
+ pr_err("speed valid only for lines or concentrators.");
return -1;
}
break;
@@ -6871,7 +6816,7 @@ static int dgap_parsefile(char **in)
if (p->type == CNODE) {
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
p->u.conc.connect = kstrdup(s, GFP_KERNEL);
@@ -6883,24 +6828,21 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = PNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpeced end of file");
+ pr_err("unexpeced end of file");
return -1;
}
p->u.printname = kstrdup(s, GFP_KERNEL);
- if (!p->u.printname) {
- dgap_err("out of memory");
+ if (!p->u.printname)
return -1;
- }
+
break;
case CMAJOR: /* major number */
@@ -6908,21 +6850,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = JNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.majornumber)) {
- dgap_err("bad number for major number");
+ pr_err("bad number for major number");
return -1;
}
break;
@@ -6932,21 +6872,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = ANODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.altpin)) {
- dgap_err("bad number for altpin");
+ pr_err("bad number for altpin");
return -1;
}
break;
@@ -6956,19 +6894,18 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
+
p = p->next;
p->type = INTRNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.useintr)) {
- dgap_err("bad number for useintr");
+ pr_err("bad number for useintr");
return -1;
}
break;
@@ -6978,21 +6915,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = TSNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.ttysize)) {
- dgap_err("bad number for ttysize");
+ pr_err("bad number for ttysize");
return -1;
}
break;
@@ -7002,21 +6937,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = CSNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.chsize)) {
- dgap_err("bad number for chsize");
+ pr_err("bad number for chsize");
return -1;
}
break;
@@ -7026,21 +6959,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = BSNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.bssize)) {
- dgap_err("bad number for bssize");
+ pr_err("bad number for bssize");
return -1;
}
break;
@@ -7050,21 +6981,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = USNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.unsize)) {
- dgap_err("bad number for schedsize");
+ pr_err("bad number for schedsize");
return -1;
}
break;
@@ -7074,21 +7003,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = FSNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.f2size)) {
- dgap_err("bad number for f2200size");
+ pr_err("bad number for f2200size");
return -1;
}
break;
@@ -7098,21 +7025,19 @@ static int dgap_parsefile(char **in)
return -1;
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
- if (!p->next) {
- dgap_err("out of memory");
+ if (!p->next)
return -1;
- }
p = p->next;
p->type = VSNODE;
s = dgap_getword(in);
if (!s) {
- dgap_err("unexpected end of file");
+ pr_err("unexpected end of file");
return -1;
}
if (kstrtol(s, 0, &p->u.vpixsize)) {
- dgap_err("bad number for vpixsize");
+ pr_err("bad number for vpixsize");
return -1;
}
break;
@@ -7165,12 +7090,10 @@ static int dgap_gettok(char **in)
if (strstr(dgap_cword, "board")) {
w = dgap_getword(in);
snprintf(dgap_cword, MAXCWORD, "%s", w);
- for (t = dgap_tlist; t->token != 0; t++) {
+ for (t = dgap_brdtype; t->token != 0; t++) {
if (!strcmp(w, t->string))
return t->token;
}
- dgap_err("board !!type not specified");
- return 1;
} else {
while ((w = dgap_getword(in))) {
snprintf(dgap_cword, MAXCWORD, "%s", w);
@@ -7179,8 +7102,9 @@ static int dgap_gettok(char **in)
return t->token;
}
}
- return 0;
}
+
+ return 0;
}
/*
@@ -7213,66 +7137,41 @@ static char *dgap_getword(char **in)
}
/*
- * print an error message, giving the line number in the file where
- * the error occurred.
- */
-static void dgap_err(char *s)
-{
- pr_err("dgap: parse: %s\n", s);
-}
-
-/*
* dgap_checknode: see if all the necessary info has been supplied for a node
* before creating the next node.
*/
static int dgap_checknode(struct cnode *p)
{
switch (p->type) {
- case BNODE:
- if (p->u.board.v_type == 0) {
- dgap_err("board type !not specified");
- return 1;
- }
-
- return 0;
-
case LNODE:
if (p->u.line.v_speed == 0) {
- dgap_err("line speed not specified");
+ pr_err("line speed not specified");
return 1;
}
return 0;
case CNODE:
- if (p->u.conc.v_type == 0) {
- dgap_err("concentrator type not specified");
- return 1;
- }
if (p->u.conc.v_speed == 0) {
- dgap_err("concentrator line speed not specified");
+ pr_err("concentrator line speed not specified");
return 1;
}
if (p->u.conc.v_nport == 0) {
- dgap_err("number of ports on concentrator not specified");
+ pr_err("number of ports on concentrator not specified");
return 1;
}
if (p->u.conc.v_id == 0) {
- dgap_err("concentrator id letter not specified");
+ pr_err("concentrator id letter not specified");
return 1;
}
return 0;
case MNODE:
- if (p->u.module.v_type == 0) {
- dgap_err("EBI module type not specified");
- return 1;
- }
if (p->u.module.v_nport == 0) {
- dgap_err("number of ports on EBI module not specified");
+ pr_err("number of ports on EBI module not specified");
return 1;
}
if (p->u.module.v_id == 0) {
- dgap_err("EBI module id letter not specified");
+ pr_err("EBI module id letter not specified");
return 1;
}
return 0;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index 9728d59c94d1..52e1d649dedf 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -586,9 +586,6 @@ struct board_t {
struct tty_port *printer_ports;
char print_name[200];
- u32 dgap_major_serial_registered;
- u32 dgap_major_transparent_print_registered;
-
u32 dgap_serial_major;
u32 dgap_transparent_print_major;
@@ -1175,7 +1172,6 @@ struct cnode {
char *id; /* tty id */
long start; /* start of tty counting */
char *method; /* Install method */
- char v_type;
char v_port;
char v_addr;
char v_pcibus;
@@ -1210,7 +1206,6 @@ struct cnode {
char *id;
char *idstr;
long start;
- char v_type;
char v_connect;
char v_speed;
char v_nport;
@@ -1224,7 +1219,6 @@ struct cnode {
char *id;
char *idstr;
long start;
- char v_type;
char v_nport;
char v_id;
char v_start;
diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
index 733434f63700..b69f7b6b1143 100644
--- a/drivers/staging/dgnc/Makefile
+++ b/drivers/staging/dgnc/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_DGNC) += dgnc.o
dgnc-objs := dgnc_cls.o dgnc_driver.o\
dgnc_mgmt.o dgnc_neo.o\
- dgnc_tty.o dgnc_sysfs.o
+ dgnc_tty.o dgnc_sysfs.o\
+ dgnc_utils.o
diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index 1ff2d1874aa2..d2828c7936c8 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,9 +1,4 @@
-* remove kzalloc casts
* checkpatch fixes
-* sparse fixes
-* fix use of sizeof(). Example replace sizeof(struct board_t)
- with sizeof(*brd) and remove sizeof(char)
-* change name of board_t to dgnc_board
* split two assignments into the two assignments on two lines;
don't use two equals signs
* remove unecessary comments
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index cfa8384c0077..fe099c651d32 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -390,6 +390,7 @@ static inline void cls_clear_break(struct channel_t *ch, int force)
if (ch->ch_flags & CH_BREAK_SENDING) {
if (time_after(jiffies, ch->ch_stop_sending_break) || force) {
uchar temp = readb(&ch->ch_cls_uart->lcr);
+
writeb((temp & ~UART_LCR_SBC), &ch->ch_cls_uart->lcr);
ch->ch_flags &= ~(CH_BREAK_SENDING);
ch->ch_stop_sending_break = 0;
@@ -866,6 +867,7 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
static void cls_disable_receiver(struct channel_t *ch)
{
uchar tmp = readb(&ch->ch_cls_uart->ier);
+
tmp &= ~(UART_IER_RDI);
writeb(tmp, &ch->ch_cls_uart->ier);
}
@@ -874,6 +876,7 @@ static void cls_disable_receiver(struct channel_t *ch)
static void cls_enable_receiver(struct channel_t *ch)
{
uchar tmp = readb(&ch->ch_cls_uart->ier);
+
tmp |= (UART_IER_RDI);
writeb(tmp, &ch->ch_cls_uart->ier);
}
@@ -920,6 +923,7 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & error_mask) {
uchar discard;
+
linestatus = 0;
discard = readb(&ch->ch_cls_uart->txrx);
continue;
@@ -1134,8 +1138,6 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
-
- return;
}
@@ -1157,6 +1159,7 @@ static void cls_parse_modem(struct channel_t *ch, uchar signals)
DGNC_LOCK(ch->ch_lock, lock_flags);
if (ch->ch_digi.digi_flags & DIGI_ALTPIN) {
uchar mswap = signals;
+
if (mswap & UART_MSR_DDCD) {
msignals &= ~UART_MSR_DDCD;
msignals |= UART_MSR_DDSR;
@@ -1356,6 +1359,7 @@ static void cls_send_break(struct channel_t *ch, int msecs)
/* Turn break off, and unset some variables */
if (ch->ch_flags & CH_BREAK_SENDING) {
uchar temp = readb(&ch->ch_cls_uart->lcr);
+
writeb((temp & ~UART_LCR_SBC), &ch->ch_cls_uart->lcr);
ch->ch_flags &= ~(CH_BREAK_SENDING);
ch->ch_stop_sending_break = 0;
@@ -1375,6 +1379,7 @@ static void cls_send_break(struct channel_t *ch, int msecs)
/* Tell the UART to start sending the break */
if (!(ch->ch_flags & CH_BREAK_SENDING)) {
uchar temp = readb(&ch->ch_cls_uart->lcr);
+
writeb((temp | UART_LCR_SBC), &ch->ch_cls_uart->lcr);
ch->ch_flags |= (CH_BREAK_SENDING);
DPR_IOCTL((
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index 764613b2f4b4..a9f1a8c09725 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -57,7 +57,7 @@ MODULE_SUPPORTED_DEVICE("dgnc");
*/
PARM_INT(debug, 0x00, 0644, "Driver debugging level");
PARM_INT(rawreadok, 1, 0644, "Bypass flip buffers on input");
-PARM_INT(trcbuf_size, 0x100000, 0644, "Debugging trace buffer size.");
+PARM_INT(trcbuf_size, 0x100000, 0644, "Debugging trace buffer size.");
/**************************************************************************
*
@@ -70,26 +70,15 @@ static void dgnc_init_globals(void);
static int dgnc_found_board(struct pci_dev *pdev, int id);
static void dgnc_cleanup_board(struct dgnc_board *brd);
static void dgnc_poll_handler(ulong dummy);
-static int dgnc_init_pci(void);
static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static void dgnc_remove_one(struct pci_dev *dev);
-static int dgnc_probe1(struct pci_dev *pdev, int card_type);
static void dgnc_do_remap(struct dgnc_board *brd);
-/* Driver load/unload functions */
-int dgnc_init_module(void);
-void dgnc_cleanup_module(void);
-
-module_init(dgnc_init_module);
-module_exit(dgnc_cleanup_module);
-
-
/*
* File operations permitted on Control/Management major.
*/
static const struct file_operations dgnc_BoardFops = {
.owner = THIS_MODULE,
- .unlocked_ioctl = dgnc_mgmt_ioctl,
+ .unlocked_ioctl = dgnc_mgmt_ioctl,
.open = dgnc_mgmt_open,
.release = dgnc_mgmt_close
};
@@ -101,23 +90,18 @@ static const struct file_operations dgnc_BoardFops = {
uint dgnc_NumBoards;
struct dgnc_board *dgnc_Board[MAXBOARDS];
DEFINE_SPINLOCK(dgnc_global_lock);
-int dgnc_driver_state = DRIVER_INITIALIZED;
-ulong dgnc_poll_counter;
uint dgnc_Major;
int dgnc_poll_tick = 20; /* Poll interval - 20 ms */
/*
* Static vars.
*/
-static uint dgnc_Major_Control_Registered = FALSE;
-static uint dgnc_driver_start = FALSE;
-
static struct class *dgnc_class;
/*
* Poller stuff
*/
-static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
+static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
static ulong dgnc_poll_time; /* Time of next poll */
static uint dgnc_poll_stop; /* Used to tell poller to stop */
static struct timer_list dgnc_poll_timer;
@@ -176,7 +160,6 @@ static struct pci_driver dgnc_driver = {
.name = "dgnc",
.probe = dgnc_init_one,
.id_table = dgnc_pci_tbl,
- .remove = dgnc_remove_one,
};
@@ -186,12 +169,6 @@ char *dgnc_state_text[] = {
"Board READY",
};
-char *dgnc_driver_state_text[] = {
- "Driver Initialized",
- "Driver Ready."
-};
-
-
/************************************************************************
*
@@ -199,13 +176,47 @@ char *dgnc_driver_state_text[] = {
*
************************************************************************/
+/*
+ * dgnc_cleanup_module()
+ *
+ * Module unload. This is where it all ends.
+ */
+static void dgnc_cleanup_module(void)
+{
+ int i;
+ ulong lock_flags;
+
+ DGNC_LOCK(dgnc_poll_lock, lock_flags);
+ dgnc_poll_stop = 1;
+ DGNC_UNLOCK(dgnc_poll_lock, lock_flags);
+
+ /* Turn off poller right away. */
+ del_timer_sync(&dgnc_poll_timer);
+
+ dgnc_remove_driver_sysfiles(&dgnc_driver);
+
+ device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+ class_destroy(dgnc_class);
+ unregister_chrdev(dgnc_Major, "dgnc");
+
+ for (i = 0; i < dgnc_NumBoards; ++i) {
+ dgnc_remove_ports_sysfiles(dgnc_Board[i]);
+ dgnc_tty_uninit(dgnc_Board[i]);
+ dgnc_cleanup_board(dgnc_Board[i]);
+ }
+
+ dgnc_tty_post_uninit();
+
+ if (dgnc_NumBoards)
+ pci_unregister_driver(&dgnc_driver);
+}
/*
* init_module()
*
* Module load. This is where it all starts.
*/
-int dgnc_init_module(void)
+static int __init dgnc_init_module(void)
{
int rc = 0;
@@ -222,7 +233,7 @@ int dgnc_init_module(void)
/*
* Find and configure all the cards
*/
- rc = dgnc_init_pci();
+ rc = pci_register_driver(&dgnc_driver);
/*
* If something went wrong in the scan, bail out of driver.
@@ -243,6 +254,8 @@ int dgnc_init_module(void)
return rc;
}
+module_init(dgnc_init_module);
+module_exit(dgnc_cleanup_module);
/*
* Start of driver.
@@ -252,77 +265,54 @@ static int dgnc_start(void)
int rc = 0;
unsigned long flags;
- if (dgnc_driver_start == FALSE) {
-
- dgnc_driver_start = TRUE;
-
- /* make sure that the globals are init'd before we do anything else */
- dgnc_init_globals();
-
- dgnc_NumBoards = 0;
+ /* make sure that the globals are init'd before we do anything else */
+ dgnc_init_globals();
- APR(("For the tools package or updated drivers please visit http://www.digi.com\n"));
+ APR(("For the tools package or updated drivers please visit http://www.digi.com\n"));
- /*
- * Register our base character device into the kernel.
- * This allows the download daemon to connect to the downld device
- * before any of the boards are init'ed.
- */
- if (!dgnc_Major_Control_Registered) {
- /*
- * Register management/dpa devices
- */
- rc = register_chrdev(0, "dgnc", &dgnc_BoardFops);
- if (rc <= 0) {
- APR(("Can't register dgnc driver device (%d)\n", rc));
- rc = -ENXIO;
- return rc;
- }
- dgnc_Major = rc;
-
- dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
- device_create(dgnc_class, NULL,
- MKDEV(dgnc_Major, 0),
- NULL, "dgnc_mgmt");
- dgnc_Major_Control_Registered = TRUE;
- }
+ /*
+ * Register our base character device into the kernel.
+ * This allows the download daemon to connect to the downld device
+ * before any of the boards are init'ed.
+ *
+ * Register management/dpa devices
+ */
+ rc = register_chrdev(0, "dgnc", &dgnc_BoardFops);
+ if (rc <= 0) {
+ APR(("Can't register dgnc driver device (%d)\n", rc));
+ return -ENXIO;
+ }
+ dgnc_Major = rc;
- /*
- * Init any global tty stuff.
- */
- rc = dgnc_tty_preinit();
+ dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
+ device_create(dgnc_class, NULL,
+ MKDEV(dgnc_Major, 0),
+ NULL, "dgnc_mgmt");
- if (rc < 0) {
- APR(("tty preinit - not enough memory (%d)\n", rc));
- return rc;
- }
+ /*
+ * Init any global tty stuff.
+ */
+ rc = dgnc_tty_preinit();
- /* Start the poller */
- DGNC_LOCK(dgnc_poll_lock, flags);
- init_timer(&dgnc_poll_timer);
- dgnc_poll_timer.function = dgnc_poll_handler;
- dgnc_poll_timer.data = 0;
- dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
- dgnc_poll_timer.expires = dgnc_poll_time;
- DGNC_UNLOCK(dgnc_poll_lock, flags);
+ if (rc < 0) {
+ APR(("tty preinit - not enough memory (%d)\n", rc));
+ return rc;
+ }
- add_timer(&dgnc_poll_timer);
+ /* Start the poller */
+ DGNC_LOCK(dgnc_poll_lock, flags);
+ init_timer(&dgnc_poll_timer);
+ dgnc_poll_timer.function = dgnc_poll_handler;
+ dgnc_poll_timer.data = 0;
+ dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
+ dgnc_poll_timer.expires = dgnc_poll_time;
+ DGNC_UNLOCK(dgnc_poll_lock, flags);
- dgnc_driver_state = DRIVER_READY;
- }
+ add_timer(&dgnc_poll_timer);
return rc;
}
-/*
- * Register pci driver, and return how many boards we have.
- */
-static int dgnc_init_pci(void)
-{
- return pci_register_driver(&dgnc_driver);
-}
-
-
/* returns count (>= 0), or negative on error */
static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
@@ -334,7 +324,7 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (rc < 0) {
rc = -EIO;
} else {
- rc = dgnc_probe1(pdev, ent->driver_data);
+ rc = dgnc_found_board(pdev, ent->driver_data);
if (rc == 0) {
dgnc_NumBoards++;
DPR_INIT(("Incrementing numboards to %d\n", dgnc_NumBoards));
@@ -343,55 +333,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
return rc;
}
-static int dgnc_probe1(struct pci_dev *pdev, int card_type)
-{
- return dgnc_found_board(pdev, card_type);
-}
-
-
-static void dgnc_remove_one(struct pci_dev *dev)
-{
- /* Do Nothing */
-}
-
-/*
- * dgnc_cleanup_module()
- *
- * Module unload. This is where it all ends.
- */
-void dgnc_cleanup_module(void)
-{
- int i;
- ulong lock_flags;
-
- DGNC_LOCK(dgnc_poll_lock, lock_flags);
- dgnc_poll_stop = 1;
- DGNC_UNLOCK(dgnc_poll_lock, lock_flags);
-
- /* Turn off poller right away. */
- del_timer_sync(&dgnc_poll_timer);
-
- dgnc_remove_driver_sysfiles(&dgnc_driver);
-
- if (dgnc_Major_Control_Registered) {
- device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
- class_destroy(dgnc_class);
- unregister_chrdev(dgnc_Major, "dgnc");
- }
-
- for (i = 0; i < dgnc_NumBoards; ++i) {
- dgnc_remove_ports_sysfiles(dgnc_Board[i]);
- dgnc_tty_uninit(dgnc_Board[i]);
- dgnc_cleanup_board(dgnc_Board[i]);
- }
-
- dgnc_tty_post_uninit();
-
- if (dgnc_NumBoards)
- pci_unregister_driver(&dgnc_driver);
-}
-
-
/*
* dgnc_cleanup_board()
*
@@ -781,16 +722,6 @@ static void dgnc_poll_handler(ulong dummy)
int i;
unsigned long new_time;
- dgnc_poll_counter++;
-
- /*
- * Do not start the board state machine until
- * driver tells us its up and running, and has
- * everything it needs.
- */
- if (dgnc_driver_state != DRIVER_READY)
- goto schedule_poller;
-
/* Go thru each board, kicking off a tasklet for each if needed */
for (i = 0; i < dgnc_NumBoards; i++) {
brd = dgnc_Board[i];
@@ -809,8 +740,6 @@ static void dgnc_poll_handler(ulong dummy)
DGNC_UNLOCK(brd->bd_lock, lock_flags);
}
-schedule_poller:
-
/*
* Schedule ourself back at the nominal wakeup interval.
*/
@@ -846,6 +775,7 @@ static void dgnc_init_globals(void)
dgnc_rawreadok = rawreadok;
dgnc_trcbuf_size = trcbuf_size;
dgnc_debug = debug;
+ dgnc_NumBoards = 0;
for (i = 0; i < MAXBOARDS; i++)
dgnc_Board[i] = NULL;
@@ -853,77 +783,3 @@ static void dgnc_init_globals(void)
init_timer(&dgnc_poll_timer);
}
-
-/************************************************************************
- *
- * Utility functions
- *
- ************************************************************************/
-
-/*
- * dgnc_ms_sleep()
- *
- * Put the driver to sleep for x ms's
- *
- * Returns 0 if timed out, !0 (showing signal) if interrupted by a signal.
- */
-int dgnc_ms_sleep(ulong ms)
-{
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout((ms * HZ) / 1000);
- return signal_pending(current);
-}
-
-
-
-/*
- * dgnc_ioctl_name() : Returns a text version of each ioctl value.
- */
-char *dgnc_ioctl_name(int cmd)
-{
- switch (cmd) {
-
- case TCGETA: return "TCGETA";
- case TCGETS: return "TCGETS";
- case TCSETA: return "TCSETA";
- case TCSETS: return "TCSETS";
- case TCSETAW: return "TCSETAW";
- case TCSETSW: return "TCSETSW";
- case TCSETAF: return "TCSETAF";
- case TCSETSF: return "TCSETSF";
- case TCSBRK: return "TCSBRK";
- case TCXONC: return "TCXONC";
- case TCFLSH: return "TCFLSH";
- case TIOCGSID: return "TIOCGSID";
-
- case TIOCGETD: return "TIOCGETD";
- case TIOCSETD: return "TIOCSETD";
- case TIOCGWINSZ: return "TIOCGWINSZ";
- case TIOCSWINSZ: return "TIOCSWINSZ";
-
- case TIOCMGET: return "TIOCMGET";
- case TIOCMSET: return "TIOCMSET";
- case TIOCMBIS: return "TIOCMBIS";
- case TIOCMBIC: return "TIOCMBIC";
-
- /* from digi.h */
- case DIGI_SETA: return "DIGI_SETA";
- case DIGI_SETAW: return "DIGI_SETAW";
- case DIGI_SETAF: return "DIGI_SETAF";
- case DIGI_SETFLOW: return "DIGI_SETFLOW";
- case DIGI_SETAFLOW: return "DIGI_SETAFLOW";
- case DIGI_GETFLOW: return "DIGI_GETFLOW";
- case DIGI_GETAFLOW: return "DIGI_GETAFLOW";
- case DIGI_GETA: return "DIGI_GETA";
- case DIGI_GEDELAY: return "DIGI_GEDELAY";
- case DIGI_SEDELAY: return "DIGI_SEDELAY";
- case DIGI_GETCUSTOMBAUD: return "DIGI_GETCUSTOMBAUD";
- case DIGI_SETCUSTOMBAUD: return "DIGI_SETCUSTOMBAUD";
- case TIOCMODG: return "TIOCMODG";
- case TIOCMODS: return "TIOCMODS";
- case TIOCSDTR: return "TIOCSDTR";
- case TIOCCDTR: return "TIOCCDTR";
-
- default: return "unknown";
- }
-}
diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h
index 58b5aa7b68ed..d16d76128f93 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -481,20 +481,9 @@ struct channel_t {
wait_queue_head_t ch_sniff_wait;
};
-
-/*************************************************************************
- *
- * Prototypes for non-static functions used in more than one module
- *
- *************************************************************************/
-
-extern int dgnc_ms_sleep(ulong ms);
-extern char *dgnc_ioctl_name(int cmd);
-
/*
* Our Global Variables.
*/
-extern int dgnc_driver_state; /* The state of the driver */
extern uint dgnc_Major; /* Our driver/mgmt major */
extern int dgnc_debug; /* Debug variable */
extern int dgnc_rawreadok; /* Set if user wants rawreads */
@@ -503,8 +492,6 @@ extern int dgnc_trcbuf_size; /* Size of the ringbuffer */
extern spinlock_t dgnc_global_lock; /* Driver global spinlock */
extern uint dgnc_NumBoards; /* Total number of boards */
extern struct dgnc_board *dgnc_Board[MAXBOARDS]; /* Array of board structs */
-extern ulong dgnc_poll_counter; /* Times the poller has run */
extern char *dgnc_state_text[]; /* Array of state text */
-extern char *dgnc_driver_state_text[];/* Array of driver state text */
#endif
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 68ff1161e677..86a1cd79daee 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -34,7 +34,7 @@
#include <linux/sched.h> /* For jiffies, task states */
#include <linux/interrupt.h> /* For tasklet and interrupt structs/defines */
#include <linux/delay.h> /* For udelay */
-#include <asm/io.h> /* For read[bwl]/write[bwl] */
+#include <linux/io.h> /* For read[bwl]/write[bwl] */
#include <linux/serial.h> /* For struct async_serial */
#include <linux/serial_reg.h> /* For the various UART offsets */
@@ -397,6 +397,7 @@ static inline void neo_clear_break(struct channel_t *ch, int force)
if (time_after_eq(jiffies, ch->ch_stop_sending_break)
|| force) {
uchar temp = readb(&ch->ch_neo_uart->lcr);
+
writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
neo_pci_posting_flush(ch->ch_bd);
ch->ch_flags &= ~(CH_BREAK_SENDING);
@@ -1138,6 +1139,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
static void neo_disable_receiver(struct channel_t *ch)
{
uchar tmp = readb(&ch->ch_neo_uart->ier);
+
tmp &= ~(UART_IER_RDI);
writeb(tmp, &ch->ch_neo_uart->ier);
neo_pci_posting_flush(ch->ch_bd);
@@ -1152,6 +1154,7 @@ static void neo_disable_receiver(struct channel_t *ch)
static void neo_enable_receiver(struct channel_t *ch)
{
uchar tmp = readb(&ch->ch_neo_uart->ier);
+
tmp |= (UART_IER_RDI);
writeb(tmp, &ch->ch_neo_uart->ier);
neo_pci_posting_flush(ch->ch_bd);
@@ -1324,6 +1327,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
*/
if (linestatus & error_mask) {
uchar discard;
+
linestatus = 0;
memcpy_fromio(&discard, &ch->ch_neo_uart->txrxburst, 1);
continue;
@@ -1636,7 +1640,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
static void neo_parse_modem(struct channel_t *ch, uchar signals)
{
- volatile uchar msignals = signals;
+ uchar msignals = signals;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return;
@@ -1800,9 +1804,8 @@ static uint neo_get_uart_bytes_left(struct channel_t *ch)
/* Determine whether the Transmitter is empty or not */
if (!(lsr & UART_LSR_TEMT)) {
- if (ch->ch_flags & CH_TX_FIFO_EMPTY) {
+ if (ch->ch_flags & CH_TX_FIFO_EMPTY)
tasklet_schedule(&ch->ch_bd->helper_tasklet);
- }
left = 1;
} else {
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
@@ -1822,6 +1825,7 @@ static void neo_send_break(struct channel_t *ch, int msecs)
if (msecs == 0) {
if (ch->ch_flags & CH_BREAK_SENDING) {
uchar temp = readb(&ch->ch_neo_uart->lcr);
+
writeb((temp & ~UART_LCR_SBC), &ch->ch_neo_uart->lcr);
neo_pci_posting_flush(ch->ch_bd);
ch->ch_flags &= ~(CH_BREAK_SENDING);
@@ -1841,6 +1845,7 @@ static void neo_send_break(struct channel_t *ch, int msecs)
/* Tell the UART to start sending the break */
if (!(ch->ch_flags & CH_BREAK_SENDING)) {
uchar temp = readb(&ch->ch_neo_uart->lcr);
+
writeb((temp | UART_LCR_SBC), &ch->ch_neo_uart->lcr);
neo_pci_posting_flush(ch->ch_bd);
ch->ch_flags |= (CH_BREAK_SENDING);
@@ -1929,8 +1934,8 @@ static void neo_vpd(struct dgnc_board *brd)
if (((brd->vpd[0x08] != 0x82) /* long resource name tag */
&& (brd->vpd[0x10] != 0x82)) /* long resource name tag (PCI-66 files)*/
- || (brd->vpd[0x7F] != 0x78)) /* small resource end tag */
- {
+ || (brd->vpd[0x7F] != 0x78)) { /* small resource end tag */
+
memset(brd->vpd, '\0', NEO_VPD_IMAGESIZE);
} else {
/* Search for the serial number */
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index 3f321bb2b79d..60d247b72b9b 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -63,21 +63,6 @@ static ssize_t dgnc_driver_maxboards_show(struct device_driver *ddp, char *buf)
}
static DRIVER_ATTR(maxboards, S_IRUSR, dgnc_driver_maxboards_show, NULL);
-
-static ssize_t dgnc_driver_pollcounter_show(struct device_driver *ddp, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%ld\n", dgnc_poll_counter);
-}
-static DRIVER_ATTR(pollcounter, S_IRUSR, dgnc_driver_pollcounter_show, NULL);
-
-
-static ssize_t dgnc_driver_state_show(struct device_driver *ddp, char *buf)
-{
- return snprintf(buf, PAGE_SIZE, "%s\n", dgnc_driver_state_text[dgnc_driver_state]);
-}
-static DRIVER_ATTR(state, S_IRUSR, dgnc_driver_state_show, NULL);
-
-
static ssize_t dgnc_driver_debug_show(struct device_driver *ddp, char *buf)
{
return snprintf(buf, PAGE_SIZE, "0x%x\n", dgnc_debug);
@@ -128,8 +113,6 @@ void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
rc |= driver_create_file(driverfs, &driver_attr_debug);
rc |= driver_create_file(driverfs, &driver_attr_rawreadok);
rc |= driver_create_file(driverfs, &driver_attr_pollrate);
- rc |= driver_create_file(driverfs, &driver_attr_pollcounter);
- rc |= driver_create_file(driverfs, &driver_attr_state);
if (rc) {
printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");
}
@@ -145,8 +128,6 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
driver_remove_file(driverfs, &driver_attr_debug);
driver_remove_file(driverfs, &driver_attr_rawreadok);
driver_remove_file(driverfs, &driver_attr_pollrate);
- driver_remove_file(driverfs, &driver_attr_pollcounter);
- driver_remove_file(driverfs, &driver_attr_state);
}
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index c712b431f969..281491a75e76 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -57,6 +57,7 @@
#include "dgnc_cls.h"
#include "dpacompat.h"
#include "dgnc_sysfs.h"
+#include "dgnc_utils.h"
#define init_MUTEX(sem) sema_init(sem, 1)
#define DECLARE_MUTEX(name) \
@@ -471,13 +472,18 @@ void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int
int nbuf;
int i;
int tmpbuflen;
- char tmpbuf[TMPBUFLEN];
- char *p = tmpbuf;
+ char *tmpbuf;
+ char *p;
int too_much_data;
+ tmpbuf = kzalloc(TMPBUFLEN, GFP_KERNEL);
+ if (!tmpbuf)
+ return;
+ p = tmpbuf;
+
/* Leave if sniff not open */
if (!(ch->ch_sniff_flags & SNIFF_OPEN))
- return;
+ goto exit;
do_gettimeofday(&tv);
@@ -524,7 +530,7 @@ void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int
* function was probably called by the interrupt/timer routines!
*/
if (n == 0)
- return;
+ goto exit;
/*
* Copy as much data as will fit.
@@ -569,6 +575,9 @@ void dgnc_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int
}
} while (too_much_data);
+
+exit:
+ kfree(tmpbuf);
}
diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c
new file mode 100644
index 000000000000..61efc13ec160
--- /dev/null
+++ b/drivers/staging/dgnc/dgnc_utils.c
@@ -0,0 +1,70 @@
+#include <linux/tty.h>
+#include <linux/sched.h>
+#include "dgnc_utils.h"
+#include "digi.h"
+
+/*
+ * dgnc_ms_sleep()
+ *
+ * Put the driver to sleep for x ms's
+ *
+ * Returns 0 if timed out, !0 (showing signal) if interrupted by a signal.
+ */
+int dgnc_ms_sleep(ulong ms)
+{
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout((ms * HZ) / 1000);
+ return signal_pending(current);
+}
+
+/*
+ * dgnc_ioctl_name() : Returns a text version of each ioctl value.
+ */
+char *dgnc_ioctl_name(int cmd)
+{
+ switch (cmd) {
+
+ case TCGETA: return "TCGETA";
+ case TCGETS: return "TCGETS";
+ case TCSETA: return "TCSETA";
+ case TCSETS: return "TCSETS";
+ case TCSETAW: return "TCSETAW";
+ case TCSETSW: return "TCSETSW";
+ case TCSETAF: return "TCSETAF";
+ case TCSETSF: return "TCSETSF";
+ case TCSBRK: return "TCSBRK";
+ case TCXONC: return "TCXONC";
+ case TCFLSH: return "TCFLSH";
+ case TIOCGSID: return "TIOCGSID";
+
+ case TIOCGETD: return "TIOCGETD";
+ case TIOCSETD: return "TIOCSETD";
+ case TIOCGWINSZ: return "TIOCGWINSZ";
+ case TIOCSWINSZ: return "TIOCSWINSZ";
+
+ case TIOCMGET: return "TIOCMGET";
+ case TIOCMSET: return "TIOCMSET";
+ case TIOCMBIS: return "TIOCMBIS";
+ case TIOCMBIC: return "TIOCMBIC";
+
+ /* from digi.h */
+ case DIGI_SETA: return "DIGI_SETA";
+ case DIGI_SETAW: return "DIGI_SETAW";
+ case DIGI_SETAF: return "DIGI_SETAF";
+ case DIGI_SETFLOW: return "DIGI_SETFLOW";
+ case DIGI_SETAFLOW: return "DIGI_SETAFLOW";
+ case DIGI_GETFLOW: return "DIGI_GETFLOW";
+ case DIGI_GETAFLOW: return "DIGI_GETAFLOW";
+ case DIGI_GETA: return "DIGI_GETA";
+ case DIGI_GEDELAY: return "DIGI_GEDELAY";
+ case DIGI_SEDELAY: return "DIGI_SEDELAY";
+ case DIGI_GETCUSTOMBAUD: return "DIGI_GETCUSTOMBAUD";
+ case DIGI_SETCUSTOMBAUD: return "DIGI_SETCUSTOMBAUD";
+ case TIOCMODG: return "TIOCMODG";
+ case TIOCMODS: return "TIOCMODS";
+ case TIOCSDTR: return "TIOCSDTR";
+ case TIOCCDTR: return "TIOCCDTR";
+
+ default: return "unknown";
+ }
+}
diff --git a/drivers/staging/dgnc/dgnc_utils.h b/drivers/staging/dgnc/dgnc_utils.h
new file mode 100644
index 000000000000..cebf60163a26
--- /dev/null
+++ b/drivers/staging/dgnc/dgnc_utils.h
@@ -0,0 +1,7 @@
+#ifndef __DGNC_UTILS_H
+#define __DGNC_UTILS_H
+
+int dgnc_ms_sleep(ulong ms);
+char *dgnc_ioctl_name(int cmd);
+
+#endif
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 6b22106534d8..4289cc8963e4 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -427,6 +427,7 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm,
for (i = 0; i < MAX_CRTC; i++) {
struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[i];
+
if (imx_drm_crtc && imx_drm_crtc->port == port)
return drm_crtc_mask(imx_drm_crtc->crtc);
}
@@ -438,6 +439,7 @@ static struct device_node *imx_drm_of_get_next_endpoint(
const struct device_node *parent, struct device_node *prev)
{
struct device_node *node = of_graph_get_next_endpoint(parent, prev);
+
of_node_put(prev);
return node;
}
@@ -471,8 +473,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
crtc_mask |= mask;
}
- if (ep)
- of_node_put(ep);
+ of_node_put(ep);
if (i == 0)
return -ENOENT;
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index c628fcdc22ae..31fe7cfe5d35 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -133,6 +133,7 @@ static void tve_lock(void *__tve)
__acquires(&tve->lock)
{
struct imx_tve *tve = __tve;
+
spin_lock(&tve->lock);
}
@@ -140,6 +141,7 @@ static void tve_unlock(void *__tve)
__releases(&tve->lock)
{
struct imx_tve *tve = __tve;
+
spin_unlock(&tve->lock);
}
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c
index 4ca61afdf622..1998846ff21d 100644
--- a/drivers/staging/imx-drm/parallel-display.c
+++ b/drivers/staging/imx-drm/parallel-display.c
@@ -70,6 +70,7 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
if (imxpd->mode_valid) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
+
if (!mode)
return -EINVAL;
drm_mode_copy(mode, &imxpd->mode);
@@ -80,6 +81,7 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
if (np) {
struct drm_display_mode *mode = drm_mode_create(connector->dev);
+
if (!mode)
return -EINVAL;
of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE);
diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
index 7c8b9476bfbb..af171e25a5ec 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -47,7 +47,7 @@ static int lnet_tbnob; /* track text buf allocation */
#define LNET_MAX_TEXTBUF_NOB (64<<10) /* bound allocation */
#define LNET_SINGLE_TEXTBUF_NOB (4<<10)
-void
+static void
lnet_syntax(char *name, char *str, int offset, int width)
{
static char dots[LNET_SINGLE_TEXTBUF_NOB];
@@ -64,7 +64,7 @@ lnet_syntax(char *name, char *str, int offset, int width)
(width < 1) ? 0 : width - 1, dashes);
}
-int
+static int
lnet_issep(char c)
{
switch (c) {
@@ -77,7 +77,7 @@ lnet_issep(char c)
}
}
-int
+static int
lnet_net_unique(__u32 net, struct list_head *nilist)
{
struct list_head *tmp;
@@ -108,7 +108,7 @@ lnet_ni_free(struct lnet_ni *ni)
LIBCFS_FREE(ni, sizeof(*ni));
}
-lnet_ni_t *
+static lnet_ni_t *
lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist)
{
struct lnet_tx_queue *tq;
@@ -365,7 +365,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
return -EINVAL;
}
-lnet_text_buf_t *
+static lnet_text_buf_t *
lnet_new_text_buf(int str_len)
{
lnet_text_buf_t *ltb;
@@ -394,14 +394,14 @@ lnet_new_text_buf(int str_len)
return ltb;
}
-void
+static void
lnet_free_text_buf(lnet_text_buf_t *ltb)
{
lnet_tbnob -= ltb->ltb_size;
LIBCFS_FREE(ltb, ltb->ltb_size);
}
-void
+static void
lnet_free_text_bufs(struct list_head *tbs)
{
lnet_text_buf_t *ltb;
@@ -414,22 +414,7 @@ lnet_free_text_bufs(struct list_head *tbs)
}
}
-void
-lnet_print_text_bufs(struct list_head *tbs)
-{
- struct list_head *tmp;
- lnet_text_buf_t *ltb;
-
- list_for_each(tmp, tbs) {
- ltb = list_entry(tmp, lnet_text_buf_t, ltb_list);
-
- CDEBUG(D_WARNING, "%s\n", ltb->ltb_text);
- }
-
- CDEBUG(D_WARNING, "%d allocated\n", lnet_tbnob);
-}
-
-int
+static int
lnet_str2tbs_sep(struct list_head *tbs, char *str)
{
struct list_head pending;
@@ -487,7 +472,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
return 0;
}
-int
+static int
lnet_expand1tb(struct list_head *list,
char *str, char *sep1, char *sep2,
char *item, int itemlen)
@@ -512,7 +497,7 @@ lnet_expand1tb(struct list_head *list,
return 0;
}
-int
+static int
lnet_str2tbs_expand(struct list_head *tbs, char *str)
{
char num[16];
@@ -592,7 +577,7 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
return -1;
}
-int
+static int
lnet_parse_hops(char *str, unsigned int *hops)
{
int len = strlen(str);
@@ -605,7 +590,7 @@ lnet_parse_hops(char *str, unsigned int *hops)
#define LNET_PRIORITY_SEPARATOR (':')
-int
+static int
lnet_parse_priority(char *str, unsigned int *priority, char **token)
{
int nob;
@@ -635,7 +620,7 @@ lnet_parse_priority(char *str, unsigned int *priority, char **token)
return 0;
}
-int
+static int
lnet_parse_route(char *str, int *im_a_router)
{
/* static scratch buffer OK (single threaded) */
@@ -778,7 +763,7 @@ lnet_parse_route(char *str, int *im_a_router)
return myrc;
}
-int
+static int
lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
{
lnet_text_buf_t *ltb;
@@ -819,7 +804,7 @@ lnet_parse_routes(char *routes, int *im_a_router)
return rc;
}
-int
+static int
lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
{
LIST_HEAD(list);
@@ -838,7 +823,7 @@ lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
return rc;
}
-int
+static int
lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
{
static char tokens[LNET_SINGLE_TEXTBUF_NOB];
@@ -895,7 +880,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
return 1;
}
-__u32
+static __u32
lnet_netspec2net(char *netspec)
{
char *bracket = strchr(netspec, '(');
@@ -912,7 +897,7 @@ lnet_netspec2net(char *netspec)
return net;
}
-int
+static int
lnet_splitnets(char *source, struct list_head *nets)
{
int offset = 0;
@@ -992,7 +977,7 @@ lnet_splitnets(char *source, struct list_head *nets)
}
}
-int
+static int
lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
{
static char networks[LNET_SINGLE_TEXTBUF_NOB];
@@ -1112,13 +1097,13 @@ lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip)
return count;
}
-void
+static void
lnet_ipaddr_free_enumeration(__u32 *ipaddrs, int nip)
{
LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs));
}
-int
+static int
lnet_ipaddr_enumerate(__u32 **ipaddrsp)
{
int up;
@@ -1187,7 +1172,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
int
lnet_parse_ip2nets(char **networksp, char *ip2nets)
{
- __u32 *ipaddrs;
+ __u32 *ipaddrs = NULL;
int nip = lnet_ipaddr_enumerate(&ipaddrs);
int rc;
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
index 992d07591b08..46c11ca85a69 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -187,7 +187,7 @@ static int seq_client_alloc_meta(const struct lu_env *env,
/* Allocate new sequence for client. */
static int seq_client_alloc_seq(const struct lu_env *env,
- struct lu_client_seq *seq, seqno_t *seqnr)
+ struct lu_client_seq *seq, u64 *seqnr)
{
int rc;
@@ -249,7 +249,7 @@ static void seq_fid_alloc_fini(struct lu_client_seq *seq)
* Allocate the whole seq to the caller.
**/
int seq_client_get_seq(const struct lu_env *env,
- struct lu_client_seq *seq, seqno_t *seqnr)
+ struct lu_client_seq *seq, u64 *seqnr)
{
wait_queue_t link;
int rc;
@@ -313,7 +313,7 @@ int seq_client_alloc_fid(const struct lu_env *env,
seq->lcs_fid.f_oid = seq->lcs_width;
while (1) {
- seqno_t seqnr;
+ u64 seqnr;
if (!fid_is_zero(&seq->lcs_fid) &&
fid_oid(&seq->lcs_fid) < seq->lcs_width) {
diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c
index 759a233a7028..f5a340af499e 100644
--- a/drivers/staging/lustre/lustre/fld/fld_cache.c
+++ b/drivers/staging/lustre/lustre/fld/fld_cache.c
@@ -263,8 +263,8 @@ void fld_cache_punch_hole(struct fld_cache *cache,
struct fld_cache_entry *f_new)
{
const struct lu_seq_range *range = &f_new->fce_range;
- const seqno_t new_start = range->lsr_start;
- const seqno_t new_end = range->lsr_end;
+ const u64 new_start = range->lsr_start;
+ const u64 new_end = range->lsr_end;
struct fld_cache_entry *fldt;
OBD_ALLOC_GFP(fldt, sizeof(*fldt), GFP_ATOMIC);
@@ -302,9 +302,9 @@ static void fld_cache_overlap_handle(struct fld_cache *cache,
struct fld_cache_entry *f_new)
{
const struct lu_seq_range *range = &f_new->fce_range;
- const seqno_t new_start = range->lsr_start;
- const seqno_t new_end = range->lsr_end;
- const mdsno_t mdt = range->lsr_index;
+ const u64 new_start = range->lsr_start;
+ const u64 new_end = range->lsr_end;
+ const u32 mdt = range->lsr_index;
/* this is overlap case, these case are checking overlapping with
* prev range only. fixup will handle overlapping with next range. */
@@ -386,8 +386,8 @@ int fld_cache_insert_nolock(struct fld_cache *cache,
struct fld_cache_entry *n;
struct list_head *head;
struct list_head *prev = NULL;
- const seqno_t new_start = f_new->fce_range.lsr_start;
- const seqno_t new_end = f_new->fce_range.lsr_end;
+ const u64 new_start = f_new->fce_range.lsr_start;
+ const u64 new_end = f_new->fce_range.lsr_end;
__u32 new_flags = f_new->fce_range.lsr_flags;
/*
@@ -516,7 +516,7 @@ struct fld_cache_entry
* lookup \a seq sequence for range in fld cache.
*/
int fld_cache_lookup(struct fld_cache *cache,
- const seqno_t seq, struct lu_seq_range *range)
+ const u64 seq, struct lu_seq_range *range)
{
struct fld_cache_entry *flde;
struct fld_cache_entry *prev = NULL;
diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h
index 5da0c1da0d39..8806b6096953 100644
--- a/drivers/staging/lustre/lustre/fld/fld_internal.h
+++ b/drivers/staging/lustre/lustre/fld/fld_internal.h
@@ -167,7 +167,7 @@ void fld_cache_delete(struct fld_cache *cache,
void fld_cache_delete_nolock(struct fld_cache *cache,
const struct lu_seq_range *range);
int fld_cache_lookup(struct fld_cache *cache,
- const seqno_t seq, struct lu_seq_range *range);
+ const u64 seq, struct lu_seq_range *range);
struct fld_cache_entry*
fld_cache_entry_lookup(struct fld_cache *cache, struct lu_seq_range *range);
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index 8e512f9c3db0..4539a0284a78 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -110,15 +110,14 @@ static void fld_exit_request(struct client_obd *cli)
client_obd_list_unlock(&cli->cl_loi_list_lock);
}
-static int fld_rrb_hash(struct lu_client_fld *fld,
- seqno_t seq)
+static int fld_rrb_hash(struct lu_client_fld *fld, u64 seq)
{
LASSERT(fld->lcf_count > 0);
return do_div(seq, fld->lcf_count);
}
static struct lu_fld_target *
-fld_rrb_scan(struct lu_client_fld *fld, seqno_t seq)
+fld_rrb_scan(struct lu_client_fld *fld, u64 seq)
{
struct lu_fld_target *target;
int hash;
@@ -173,7 +172,7 @@ struct lu_fld_hash fld_hash[] = {
};
static struct lu_fld_target *
-fld_client_get_target(struct lu_client_fld *fld, seqno_t seq)
+fld_client_get_target(struct lu_client_fld *fld, u64 seq)
{
struct lu_fld_target *target;
@@ -453,7 +452,7 @@ out_req:
return rc;
}
-int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
+int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
__u32 flags, const struct lu_env *env)
{
struct lu_seq_range res = { 0 };
diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h
index e51cd690f907..41858e43d732 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2508,7 +2508,7 @@ struct cl_req_operations {
void (*cro_attr_set)(const struct lu_env *env,
const struct cl_req_slice *slice,
const struct cl_object *obj,
- struct cl_req_attr *attr, obd_valid flags);
+ struct cl_req_attr *attr, u64 flags);
/**
* Called top-to-bottom from cl_req_completion() to notify layers that
* transfer completed. Has to free all state allocated by
@@ -3182,7 +3182,7 @@ void cl_req_page_add (const struct lu_env *env, struct cl_req *req,
void cl_req_page_done (const struct lu_env *env, struct cl_page *page);
int cl_req_prep (const struct lu_env *env, struct cl_req *req);
void cl_req_attr_set (const struct lu_env *env, struct cl_req *req,
- struct cl_req_attr *attr, obd_valid flags);
+ struct cl_req_attr *attr, u64 flags);
void cl_req_completion(const struct lu_env *env, struct cl_req *req, int ioret);
/** \defgroup cl_sync_io cl_sync_io
diff --git a/drivers/staging/lustre/lustre/include/lclient.h b/drivers/staging/lustre/lustre/include/lclient.h
index 386a36c00f57..fa45c94b814a 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -350,7 +350,7 @@ void ccc_req_completion(const struct lu_env *env,
const struct cl_req_slice *slice, int ioret);
void ccc_req_attr_set(const struct lu_env *env,const struct cl_req_slice *slice,
const struct cl_object *obj,
- struct cl_req_attr *oa, obd_valid flags);
+ struct cl_req_attr *oa, u64 flags);
struct lu_device *ccc2lu_dev (struct ccc_device *vdv);
struct lu_object *ccc2lu (struct ccc_object *vob);
diff --git a/drivers/staging/lustre/lustre/include/linux/obd_class.h b/drivers/staging/lustre/lustre/include/linux/obd_class.h
index 021ead6639fc..99c5bd1fd0ae 100644
--- a/drivers/staging/lustre/lustre/include/linux/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/linux/obd_class.h
@@ -49,9 +49,9 @@
/* obdo.c */
void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid);
-void la_from_obdo(struct lu_attr *la, struct obdo *dst, obd_flag valid);
-void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
+void la_from_obdo(struct lu_attr *la, struct obdo *dst, u32 valid);
+void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid);
+void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid);
#define ll_inode_flags(inode) (inode->i_flags)
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h
index d5c368bab5bd..a6ce42a93d43 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -404,11 +404,11 @@ struct lu_attr {
/** size in bytes */
__u64 la_size;
/** modification time in seconds since Epoch */
- obd_time la_mtime;
+ s64 la_mtime;
/** access time in seconds since Epoch */
- obd_time la_atime;
+ s64 la_atime;
/** change time in seconds since Epoch */
- obd_time la_ctime;
+ s64 la_ctime;
/** 512-byte blocks allocated to object */
__u64 la_blocks;
/** permission bits and file type */
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 757146273724..570f54f794f2 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -165,22 +165,6 @@
#define LUSTRE_LOG_VERSION 0x00050000
#define LUSTRE_MGS_VERSION 0x00060000
-typedef __u32 mdsno_t;
-typedef __u64 seqno_t;
-typedef __u64 obd_id;
-typedef __u64 obd_seq;
-typedef __s64 obd_time;
-typedef __u64 obd_size;
-typedef __u64 obd_off;
-typedef __u64 obd_blocks;
-typedef __u64 obd_valid;
-typedef __u32 obd_blksize;
-typedef __u32 obd_mode;
-typedef __u32 obd_uid;
-typedef __u32 obd_gid;
-typedef __u32 obd_flag;
-typedef __u32 obd_count;
-
/**
* Describes a range of sequence, lsr_start is included but lsr_end is
* not in the range.
@@ -413,7 +397,7 @@ static inline void fid_zero(struct lu_fid *fid)
memset(fid, 0, sizeof(*fid));
}
-static inline obd_id fid_ver_oid(const struct lu_fid *fid)
+static inline __u64 fid_ver_oid(const struct lu_fid *fid)
{
return ((__u64)fid_ver(fid) << 32 | fid_oid(fid));
}
@@ -477,7 +461,7 @@ enum dot_lustre_oid {
FID_OID_DOT_LUSTRE_OBF = 2UL,
};
-static inline int fid_seq_is_mdt0(obd_seq seq)
+static inline int fid_seq_is_mdt0(__u64 seq)
{
return (seq == FID_SEQ_OST_MDT0);
}
@@ -487,7 +471,7 @@ static inline int fid_seq_is_mdt(const __u64 seq)
return seq == FID_SEQ_OST_MDT0 || seq >= FID_SEQ_NORMAL;
};
-static inline int fid_seq_is_echo(obd_seq seq)
+static inline int fid_seq_is_echo(__u64 seq)
{
return (seq == FID_SEQ_ECHO);
}
@@ -497,7 +481,7 @@ static inline int fid_is_echo(const struct lu_fid *fid)
return fid_seq_is_echo(fid_seq(fid));
}
-static inline int fid_seq_is_llog(obd_seq seq)
+static inline int fid_seq_is_llog(__u64 seq)
{
return (seq == FID_SEQ_LLOG);
}
@@ -597,13 +581,13 @@ static inline int fid_is_norm(const struct lu_fid *fid)
}
/* convert an OST objid into an IDIF FID SEQ number */
-static inline obd_seq fid_idif_seq(obd_id id, __u32 ost_idx)
+static inline __u64 fid_idif_seq(__u64 id, __u32 ost_idx)
{
return FID_SEQ_IDIF | (ost_idx << 16) | ((id >> 32) & 0xffff);
}
/* convert a packed IDIF FID into an OST objid */
-static inline obd_id fid_idif_id(obd_seq seq, __u32 oid, __u32 ver)
+static inline __u64 fid_idif_id(__u64 seq, __u32 oid, __u32 ver)
{
return ((__u64)ver << 48) | ((seq & 0xffff) << 32) | oid;
}
@@ -615,7 +599,7 @@ static inline __u32 fid_idif_ost_idx(const struct lu_fid *fid)
}
/* extract OST sequence (group) from a wire ost_id (id/seq) pair */
-static inline obd_seq ostid_seq(const struct ost_id *ostid)
+static inline __u64 ostid_seq(const struct ost_id *ostid)
{
if (fid_seq_is_mdt0(ostid->oi.oi_seq))
return FID_SEQ_OST_MDT0;
@@ -630,7 +614,7 @@ static inline obd_seq ostid_seq(const struct ost_id *ostid)
}
/* extract OST objid from a wire ost_id (id/seq) pair */
-static inline obd_id ostid_id(const struct ost_id *ostid)
+static inline __u64 ostid_id(const struct ost_id *ostid)
{
if (fid_seq_is_mdt0(ostid_seq(ostid)))
return ostid->oi.oi_id & IDIF_OID_MASK;
@@ -1857,9 +1841,9 @@ extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr);
struct ost_lvb_v1 {
__u64 lvb_size;
- obd_time lvb_mtime;
- obd_time lvb_atime;
- obd_time lvb_ctime;
+ __s64 lvb_mtime;
+ __s64 lvb_atime;
+ __s64 lvb_ctime;
__u64 lvb_blocks;
};
@@ -1867,9 +1851,9 @@ extern void lustre_swab_ost_lvb_v1(struct ost_lvb_v1 *lvb);
struct ost_lvb {
__u64 lvb_size;
- obd_time lvb_mtime;
- obd_time lvb_atime;
- obd_time lvb_ctime;
+ __s64 lvb_mtime;
+ __s64 lvb_atime;
+ __s64 lvb_ctime;
__u64 lvb_blocks;
__u32 lvb_mtime_ns;
__u32 lvb_atime_ns;
@@ -2250,9 +2234,9 @@ struct mdt_body {
struct lustre_handle handle;
__u64 valid;
__u64 size; /* Offset, in the case of MDS_READPAGE */
- obd_time mtime;
- obd_time atime;
- obd_time ctime;
+ __s64 mtime;
+ __s64 atime;
+ __s64 ctime;
__u64 blocks; /* XID, in the case of MDS_READPAGE */
__u64 ioepoch;
__u64 t_state; /* transient file state defined in
@@ -2335,9 +2319,9 @@ struct mdt_rec_setattr {
__u32 sa_gid;
__u64 sa_size;
__u64 sa_blocks;
- obd_time sa_mtime;
- obd_time sa_atime;
- obd_time sa_ctime;
+ __s64 sa_mtime;
+ __s64 sa_atime;
+ __s64 sa_ctime;
__u32 sa_attr_flags;
__u32 sa_mode;
__u32 sa_bias; /* some operation flags */
@@ -2466,7 +2450,7 @@ struct mdt_rec_create {
struct lu_fid cr_fid1;
struct lu_fid cr_fid2;
struct lustre_handle cr_old_handle; /* handle in case of open replay */
- obd_time cr_time;
+ __s64 cr_time;
__u64 cr_rdev;
__u64 cr_ioepoch;
__u64 cr_padding_1; /* rr_blocks */
@@ -2506,7 +2490,7 @@ struct mdt_rec_link {
__u32 lk_suppgid2_h;
struct lu_fid lk_fid1;
struct lu_fid lk_fid2;
- obd_time lk_time;
+ __s64 lk_time;
__u64 lk_padding_1; /* rr_atime */
__u64 lk_padding_2; /* rr_ctime */
__u64 lk_padding_3; /* rr_size */
@@ -2533,7 +2517,7 @@ struct mdt_rec_unlink {
__u32 ul_suppgid2_h;
struct lu_fid ul_fid1;
struct lu_fid ul_fid2;
- obd_time ul_time;
+ __s64 ul_time;
__u64 ul_padding_2; /* rr_atime */
__u64 ul_padding_3; /* rr_ctime */
__u64 ul_padding_4; /* rr_size */
@@ -2560,7 +2544,7 @@ struct mdt_rec_rename {
__u32 rn_suppgid2_h;
struct lu_fid rn_fid1;
struct lu_fid rn_fid2;
- obd_time rn_time;
+ __s64 rn_time;
__u64 rn_padding_1; /* rr_atime */
__u64 rn_padding_2; /* rr_ctime */
__u64 rn_padding_3; /* rr_size */
@@ -2590,7 +2574,7 @@ struct mdt_rec_setxattr {
__u32 sx_padding_2;
__u32 sx_padding_3;
__u64 sx_valid;
- obd_time sx_time;
+ __s64 sx_time;
__u64 sx_padding_5; /* rr_ctime */
__u64 sx_padding_6; /* rr_size */
__u64 sx_padding_7; /* rr_blocks */
@@ -2623,9 +2607,9 @@ struct mdt_rec_reint {
__u32 rr_suppgid2_h;
struct lu_fid rr_fid1;
struct lu_fid rr_fid2;
- obd_time rr_mtime;
- obd_time rr_atime;
- obd_time rr_ctime;
+ __s64 rr_mtime;
+ __s64 rr_atime;
+ __s64 rr_ctime;
__u64 rr_size;
__u64 rr_blocks;
__u32 rr_bias;
@@ -2979,8 +2963,8 @@ struct cfg_marker {
__u32 cm_flags;
__u32 cm_vers; /* lustre release version number */
__u32 cm_padding; /* 64 bit align */
- obd_time cm_createtime; /*when this record was first created */
- obd_time cm_canceltime; /*when this record is no longer valid*/
+ __s64 cm_createtime; /*when this record was first created */
+ __s64 cm_canceltime; /*when this record is no longer valid*/
char cm_tgtname[MTI_NAME_MAXLEN];
char cm_comment[MTI_NAME_MAXLEN];
};
@@ -3084,16 +3068,16 @@ struct llog_logid_rec {
struct llog_unlink_rec {
struct llog_rec_hdr lur_hdr;
- obd_id lur_oid;
- obd_count lur_oseq;
- obd_count lur_count;
+ __u64 lur_oid;
+ __u32 lur_oseq;
+ __u32 lur_count;
struct llog_rec_tail lur_tail;
} __attribute__((packed));
struct llog_unlink64_rec {
struct llog_rec_hdr lur_hdr;
struct lu_fid lur_fid;
- obd_count lur_count; /* to destroy the lost precreated */
+ __u32 lur_count; /* to destroy the lost precreated */
__u32 lur_padding1;
__u64 lur_padding2;
__u64 lur_padding3;
@@ -3238,7 +3222,7 @@ enum llog_flag {
struct llog_log_hdr {
struct llog_rec_hdr llh_hdr;
- obd_time llh_timestamp;
+ __s64 llh_timestamp;
__u32 llh_count;
__u32 llh_bitmap_offset;
__u32 llh_size;
@@ -3296,25 +3280,25 @@ struct llogd_conn_body {
/* Note: 64-bit types are 64-bit aligned in structure */
struct obdo {
- obd_valid o_valid; /* hot fields in this obdo */
- struct ost_id o_oi;
- obd_id o_parent_seq;
- obd_size o_size; /* o_size-o_blocks == ost_lvb */
- obd_time o_mtime;
- obd_time o_atime;
- obd_time o_ctime;
- obd_blocks o_blocks; /* brw: cli sent cached bytes */
- obd_size o_grant;
+ __u64 o_valid; /* hot fields in this obdo */
+ struct ost_id o_oi;
+ __u64 o_parent_seq;
+ __u64 o_size; /* o_size-o_blocks == ost_lvb */
+ __s64 o_mtime;
+ __s64 o_atime;
+ __s64 o_ctime;
+ __u64 o_blocks; /* brw: cli sent cached bytes */
+ __u64 o_grant;
/* 32-bit fields start here: keep an even number of them via padding */
- obd_blksize o_blksize; /* optimal IO blocksize */
- obd_mode o_mode; /* brw: cli sent cache remain */
- obd_uid o_uid;
- obd_gid o_gid;
- obd_flag o_flags;
- obd_count o_nlink; /* brw: checksum */
- obd_count o_parent_oid;
- obd_count o_misc; /* brw: o_dropped */
+ __u32 o_blksize; /* optimal IO blocksize */
+ __u32 o_mode; /* brw: cli sent cache remain */
+ __u32 o_uid;
+ __u32 o_gid;
+ __u32 o_flags;
+ __u32 o_nlink; /* brw: checksum */
+ __u32 o_parent_oid;
+ __u32 o_misc; /* brw: o_dropped */
__u64 o_ioepoch; /* epoch in ost writes */
__u32 o_stripe_idx; /* holds stripe idx */
@@ -3363,7 +3347,7 @@ static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd,
struct obdo *lobdo,
const struct obdo *wobdo)
{
- obd_flag local_flags = 0;
+ __u32 local_flags = 0;
if (lobdo->o_valid & OBD_MD_FLFLAGS)
local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
@@ -3401,7 +3385,7 @@ struct ll_fiemap_info_key {
};
extern void lustre_swab_ost_body (struct ost_body *b);
-extern void lustre_swab_ost_last_id(obd_id *id);
+extern void lustre_swab_ost_last_id(__u64 *id);
extern void lustre_swab_fiemap(struct ll_user_fiemap *fiemap);
extern void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum);
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
index a69b27a78042..4c1b3cba77ba 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h
@@ -997,12 +997,25 @@ static inline void *hur_data(struct hsm_user_request *hur)
return &(hur->hur_user_item[hur->hur_request.hr_itemcount]);
}
-/** Compute the current length of the provided hsm_user_request. */
-static inline int hur_len(struct hsm_user_request *hur)
+/**
+ * Compute the current length of the provided hsm_user_request. This returns -1
+ * instead of an errno because ssize_t is defined to be only [ -1, SSIZE_MAX ]
+ *
+ * return -1 on bounds check error.
+ */
+static inline ssize_t hur_len(struct hsm_user_request *hur)
{
- return offsetof(struct hsm_user_request,
- hur_user_item[hur->hur_request.hr_itemcount]) +
- hur->hur_request.hr_data_len;
+ __u64 size;
+
+ /* can't overflow a __u64 since hr_itemcount is only __u32 */
+ size = offsetof(struct hsm_user_request, hur_user_item[0]) +
+ (__u64)hur->hur_request.hr_itemcount *
+ sizeof(hur->hur_user_item[0]) + hur->hur_request.hr_data_len;
+
+ if (size != (ssize_t)size)
+ return -1;
+
+ return size;
}
/****** HSM RPCs to copytool *****/
diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h
index ffb00f171240..2d6fbb4b1b39 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fid.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fid.h
@@ -469,7 +469,7 @@ void seq_client_flush(struct lu_client_seq *seq);
int seq_client_alloc_fid(const struct lu_env *env, struct lu_client_seq *seq,
struct lu_fid *fid);
int seq_client_get_seq(const struct lu_env *env, struct lu_client_seq *seq,
- seqno_t *seqnr);
+ u64 *seqnr);
int seq_site_fini(const struct lu_env *env, struct seq_server_site *ss);
/* Fids common stuff */
int fid_is_local(const struct lu_env *env,
diff --git a/drivers/staging/lustre/lustre/include/lustre_fld.h b/drivers/staging/lustre/lustre/include/lustre_fld.h
index ce6330f9bb50..64c504849a22 100644
--- a/drivers/staging/lustre/lustre/include/lustre_fld.h
+++ b/drivers/staging/lustre/lustre/include/lustre_fld.h
@@ -137,15 +137,14 @@ void fld_client_fini(struct lu_client_fld *fld);
void fld_client_flush(struct lu_client_fld *fld);
-int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
+int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,
__u32 flags, const struct lu_env *env);
int fld_client_create(struct lu_client_fld *fld,
struct lu_seq_range *range,
const struct lu_env *env);
-int fld_client_delete(struct lu_client_fld *fld,
- seqno_t seq,
+int fld_client_delete(struct lu_client_fld *fld, u64 seq,
const struct lu_env *env);
int fld_client_add_target(struct lu_client_fld *fld,
diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h
index de493fabab46..6ab895864998 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lib.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lib.h
@@ -65,8 +65,8 @@ struct l_wait_info;
int target_pack_pool_reply(struct ptlrpc_request *req);
int do_set_info_async(struct obd_import *imp,
int opcode, int version,
- obd_count keylen, void *key,
- obd_count vallen, void *val,
+ u32 keylen, void *key,
+ u32 vallen, void *val,
struct ptlrpc_request_set *set);
#define OBD_RECOVERY_MAX_TIME (obd_timeout * 18) /* b13079 */
@@ -133,8 +133,8 @@ struct obd_ioctl_data {
struct obdo ioc_obdo1;
struct obdo ioc_obdo2;
- obd_size ioc_count;
- obd_off ioc_offset;
+ u64 ioc_count;
+ u64 ioc_offset;
__u32 ioc_dev;
__u32 ioc_command;
diff --git a/drivers/staging/lustre/lustre/include/lustre_lite.h b/drivers/staging/lustre/lustre/include/lustre_lite.h
index eee900638720..c10c0d388b66 100644
--- a/drivers/staging/lustre/lustre/include/lustre_lite.h
+++ b/drivers/staging/lustre/lustre/include/lustre_lite.h
@@ -60,7 +60,7 @@
struct lustre_rw_params {
int lrp_lock_mode;
ldlm_policy_data_t lrp_policy;
- obd_flag lrp_brw_flags;
+ u32 lrp_brw_flags;
int lrp_ast_flags;
};
diff --git a/drivers/staging/lustre/lustre/include/md_object.h b/drivers/staging/lustre/lustre/include/md_object.h
index 2e5d55030a63..bd5f6186bf31 100644
--- a/drivers/staging/lustre/lustre/include/md_object.h
+++ b/drivers/staging/lustre/lustre/include/md_object.h
@@ -451,7 +451,7 @@ struct seq_server_site {
/**
* mds number of this site.
*/
- mdsno_t ss_node_id;
+ u32 ss_node_id;
/**
* Fid location database
*/
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 489bdd399627..808cb0e04037 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -252,10 +252,10 @@ struct obd_type {
};
struct brw_page {
- obd_off off;
+ u64 off;
struct page *pg;
int count;
- obd_flag flag;
+ u32 flag;
};
/* llog contexts */
@@ -442,7 +442,7 @@ struct client_obd {
struct obd_id_info {
__u32 idx;
- obd_id *data;
+ u64 *data;
};
struct echo_client_obd {
@@ -1057,9 +1057,9 @@ struct md_op_data {
struct lu_fid op_fid2; /* operation fid2 (usually child) */
struct lu_fid op_fid3; /* 2 extra fids to find conflicting */
struct lu_fid op_fid4; /* to the operation locks. */
- mdsno_t op_mds; /* what mds server open will go to */
+ u32 op_mds; /* what mds server open will go to */
struct lustre_handle op_handle;
- obd_time op_mod_time;
+ s64 op_mod_time;
const char *op_name;
int op_namelen;
__u32 op_mode;
@@ -1138,14 +1138,13 @@ struct obd_ops {
__u32 keylen, void *key,
__u32 vallen, void *val,
struct ptlrpc_request_set *set);
- int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
+ int (*o_attach)(struct obd_device *dev, u32 len, void *data);
int (*o_detach)(struct obd_device *dev);
int (*o_setup) (struct obd_device *dev, struct lustre_cfg *cfg);
int (*o_precleanup)(struct obd_device *dev,
enum obd_cleanup_stage cleanup_stage);
int (*o_cleanup)(struct obd_device *dev);
- int (*o_process_config)(struct obd_device *dev, obd_count len,
- void *data);
+ int (*o_process_config)(struct obd_device *dev, u32 len, void *data);
int (*o_postrecov)(struct obd_device *dev);
int (*o_add_conn)(struct obd_import *imp, struct obd_uuid *uuid,
int priority);
@@ -1186,8 +1185,7 @@ struct obd_ops {
struct lov_stripe_md *mem_src);
int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
struct lov_mds_md *disk_src, int disk_len);
- int (*o_preallocate)(struct lustre_handle *, obd_count *req,
- obd_id *ids);
+ int (*o_preallocate)(struct lustre_handle *, u32 *req, u64 *ids);
/* FIXME: add fid capability support for create & destroy! */
int (*o_precreate)(struct obd_export *exp);
int (*o_create)(const struct lu_env *env, struct obd_export *exp,
@@ -1210,27 +1208,27 @@ struct obd_ops {
int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo,
struct ptlrpc_request_set *set);
int (*o_brw)(int rw, struct obd_export *exp, struct obd_info *oinfo,
- obd_count oa_bufs, struct brw_page *pgarr,
+ u32 oa_bufs, struct brw_page *pgarr,
struct obd_trans_info *oti);
int (*o_merge_lvb)(struct obd_export *exp, struct lov_stripe_md *lsm,
struct ost_lvb *lvb, int kms_only);
int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm,
- obd_off size, int shrink);
+ u64 size, int shrink);
int (*o_punch)(const struct lu_env *, struct obd_export *exp,
struct obd_info *oinfo, struct obd_trans_info *oti,
struct ptlrpc_request_set *rqset);
int (*o_sync)(const struct lu_env *env, struct obd_export *exp,
- struct obd_info *oinfo, obd_size start, obd_size end,
+ struct obd_info *oinfo, u64 start, u64 end,
struct ptlrpc_request_set *set);
int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst,
- struct lov_stripe_md *src, obd_size start,
- obd_size end, struct obd_trans_info *oti);
+ struct lov_stripe_md *src, u64 start,
+ u64 end, struct obd_trans_info *oti);
int (*o_copy)(struct lustre_handle *dstconn, struct lov_stripe_md *dst,
struct lustre_handle *srconn, struct lov_stripe_md *src,
- obd_size start, obd_size end, struct obd_trans_info *);
+ u64 start, u64 end, struct obd_trans_info *);
int (*o_iterate)(struct lustre_handle *conn,
- int (*)(obd_id, obd_seq, void *),
- obd_id *startid, obd_seq seq, void *data);
+ int (*)(u64, u64, void *),
+ u64 *startid, u64 seq, void *data);
int (*o_preprw)(const struct lu_env *env, int cmd,
struct obd_export *exp, struct obdo *oa, int objcount,
struct obd_ioobj *obj, struct niobuf_remote *remote,
@@ -1256,7 +1254,7 @@ struct obd_ops {
int (*o_init_export)(struct obd_export *exp);
int (*o_destroy_export)(struct obd_export *exp);
int (*o_extent_calc)(struct obd_export *, struct lov_stripe_md *,
- int cmd, obd_off *);
+ int cmd, u64 *);
/* llog related obd_methods */
int (*o_llog_init)(struct obd_device *obd, struct obd_llog_group *grp,
@@ -1385,12 +1383,12 @@ struct md_ops {
struct ptlrpc_request **);
int (*m_setxattr)(struct obd_export *, const struct lu_fid *,
- struct obd_capa *, obd_valid, const char *,
+ struct obd_capa *, u64, const char *,
const char *, int, int, int, __u32,
struct ptlrpc_request **);
int (*m_getxattr)(struct obd_export *, const struct lu_fid *,
- struct obd_capa *, obd_valid, const char *,
+ struct obd_capa *, u64, const char *,
const char *, int, int, int,
struct ptlrpc_request **);
@@ -1444,10 +1442,10 @@ struct lsm_operations {
void (*lsm_free)(struct lov_stripe_md *);
int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa,
struct obd_export *md_exp);
- void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *,
- obd_off *);
- void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, obd_off *,
- obd_off *);
+ void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, u64 *,
+ u64 *);
+ void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, u64 *,
+ u64 *);
int (*lsm_lmm_verify) (struct lov_mds_md *lmm, int lmm_bytes,
__u16 *stripe_count);
int (*lsm_unpackmd) (struct lov_obd *lov, struct lov_stripe_md *lsm,
@@ -1498,7 +1496,7 @@ static inline struct md_open_data *obd_mod_alloc(void)
} \
})
-void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid);
+void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid);
void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent);
/* return 1 if client should be resend request */
diff --git a/drivers/staging/lustre/lustre/include/obd_cksum.h b/drivers/staging/lustre/lustre/include/obd_cksum.h
index 662a78062963..3a63462aa943 100644
--- a/drivers/staging/lustre/lustre/include/obd_cksum.h
+++ b/drivers/staging/lustre/lustre/include/obd_cksum.h
@@ -64,10 +64,10 @@ static inline unsigned char cksum_obd2cfs(cksum_type_t cksum_type)
* because that is supported by all clients since 1.8
*
* In case multiple algorithms are supported the best one is used. */
-static inline obd_flag cksum_type_pack(cksum_type_t cksum_type)
+static inline u32 cksum_type_pack(cksum_type_t cksum_type)
{
unsigned int performance = 0, tmp;
- obd_flag flag = OBD_FL_CKSUM_ADLER;
+ u32 flag = OBD_FL_CKSUM_ADLER;
if (cksum_type & OBD_CKSUM_CRC32) {
tmp = cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32));
@@ -98,7 +98,7 @@ static inline obd_flag cksum_type_pack(cksum_type_t cksum_type)
return flag;
}
-static inline cksum_type_t cksum_type_unpack(obd_flag o_flags)
+static inline cksum_type_t cksum_type_unpack(u32 o_flags)
{
switch (o_flags & OBD_FL_CKSUM_ALL) {
case OBD_FL_CKSUM_CRC32C:
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 1d401c9e5e8c..3597226f070c 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -308,12 +308,12 @@ static inline enum obd_option exp_flags_from_obd(struct obd_device *obd)
}
-void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid);
+void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid);
void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj);
void obdo_from_iattr(struct obdo *oa, struct iattr *attr,
unsigned int ia_valid);
-void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid);
-void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, obd_flag valid);
+void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid);
+void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid);
void obdo_from_md(struct obdo *oa, struct md_op_data *op_data,
unsigned int valid);
@@ -510,8 +510,8 @@ static inline int obd_get_info(const struct lu_env *env,
}
static inline int obd_set_info_async(const struct lu_env *env,
- struct obd_export *exp, obd_count keylen,
- void *key, obd_count vallen, void *val,
+ struct obd_export *exp, u32 keylen,
+ void *key, u32 vallen, void *val,
struct ptlrpc_request_set *set)
{
int rc;
@@ -1123,7 +1123,7 @@ static inline int obd_destroy_export(struct obd_export *exp)
static inline int obd_extent_calc(struct obd_export *exp,
struct lov_stripe_md *md,
- int cmd, obd_off *offset)
+ int cmd, u64 *offset)
{
int rc;
@@ -1239,7 +1239,7 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
}
static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
- obd_size start, obd_size end)
+ u64 start, u64 end)
{
struct ptlrpc_request_set *set = NULL;
int rc;
@@ -1259,7 +1259,7 @@ static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
}
static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
- struct obd_info *oinfo, obd_size start, obd_size end,
+ struct obd_info *oinfo, u64 start, u64 end,
struct ptlrpc_request_set *set)
{
int rc;
@@ -1306,7 +1306,7 @@ static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
}
static inline int obd_brw(int cmd, struct obd_export *exp,
- struct obd_info *oinfo, obd_count oa_bufs,
+ struct obd_info *oinfo, u32 oa_bufs,
struct brw_page *pg, struct obd_trans_info *oti)
{
int rc;
@@ -1371,7 +1371,7 @@ static inline int obd_merge_lvb(struct obd_export *exp,
}
static inline int obd_adjust_kms(struct obd_export *exp,
- struct lov_stripe_md *lsm, obd_off size,
+ struct lov_stripe_md *lsm, u64 size,
int shrink)
{
int rc;
@@ -1962,7 +1962,7 @@ static inline int md_free_lustre_md(struct obd_export *exp,
static inline int md_setxattr(struct obd_export *exp,
const struct lu_fid *fid, struct obd_capa *oc,
- obd_valid valid, const char *name,
+ u64 valid, const char *name,
const char *input, int input_size,
int output_size, int flags, __u32 suppgid,
struct ptlrpc_request **request)
@@ -1976,7 +1976,7 @@ static inline int md_setxattr(struct obd_export *exp,
static inline int md_getxattr(struct obd_export *exp,
const struct lu_fid *fid, struct obd_capa *oc,
- obd_valid valid, const char *name,
+ u64 valid, const char *name,
const char *input, int input_size,
int output_size, int flags,
struct ptlrpc_request **request)
diff --git a/drivers/staging/lustre/lustre/include/obd_ost.h b/drivers/staging/lustre/lustre/include/obd_ost.h
index 60de42972ec9..a679bb15671b 100644
--- a/drivers/staging/lustre/lustre/include/obd_ost.h
+++ b/drivers/staging/lustre/lustre/include/obd_ost.h
@@ -49,7 +49,7 @@ struct osc_brw_async_args {
struct obdo *aa_oa;
int aa_requested_nob;
int aa_nio_count;
- obd_count aa_page_count;
+ u32 aa_page_count;
int aa_resends;
struct brw_page **aa_ppga;
struct client_obd *aa_cli;
diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h
index 92c89925ff67..874606a45cc1 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -402,6 +402,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
#define OBD_FAIL_TGT_LAST_REPLAY 0x710
#define OBD_FAIL_TGT_CLIENT_ADD 0x711
#define OBD_FAIL_TGT_RCVG_FLAG 0x712
+#define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713
#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800
#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 94f759d0b5ad..24d26ab35346 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -895,11 +895,11 @@ void ccc_req_completion(const struct lu_env *env,
void ccc_req_attr_set(const struct lu_env *env,
const struct cl_req_slice *slice,
const struct cl_object *obj,
- struct cl_req_attr *attr, obd_valid flags)
+ struct cl_req_attr *attr, u64 flags)
{
struct inode *inode;
struct obdo *oa;
- obd_flag valid_flags;
+ u32 valid_flags;
oa = attr->cra_oa;
inode = ccc_object_inode(obj);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index d022666fb705..3143222d162f 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -613,50 +613,12 @@ EXPORT_SYMBOL(__ldlm_handle2lock);
*/
void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
{
- struct obd_export *exp = lock->l_export ?: lock->l_conn_export;
-
- /* INODEBITS_INTEROP: If the other side does not support
- * inodebits, reply with a plain lock descriptor. */
- if ((lock->l_resource->lr_type == LDLM_IBITS) &&
- (exp && !(exp_connect_flags(exp) & OBD_CONNECT_IBITS))) {
- /* Make sure all the right bits are set in this lock we
- are going to pass to client */
- LASSERTF(lock->l_policy_data.l_inodebits.bits ==
- (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE |
- MDS_INODELOCK_LAYOUT),
- "Inappropriate inode lock bits during conversion %llu\n",
- lock->l_policy_data.l_inodebits.bits);
-
- ldlm_res2desc(lock->l_resource, &desc->l_resource);
- desc->l_resource.lr_type = LDLM_PLAIN;
-
- /* Convert "new" lock mode to something old client can
- understand */
- if ((lock->l_req_mode == LCK_CR) ||
- (lock->l_req_mode == LCK_CW))
- desc->l_req_mode = LCK_PR;
- else
- desc->l_req_mode = lock->l_req_mode;
- if ((lock->l_granted_mode == LCK_CR) ||
- (lock->l_granted_mode == LCK_CW)) {
- desc->l_granted_mode = LCK_PR;
- } else {
- /* We never grant PW/EX locks to clients */
- LASSERT((lock->l_granted_mode != LCK_PW) &&
- (lock->l_granted_mode != LCK_EX));
- desc->l_granted_mode = lock->l_granted_mode;
- }
-
- /* We do not copy policy here, because there is no
- policy for plain locks */
- } else {
- ldlm_res2desc(lock->l_resource, &desc->l_resource);
- desc->l_req_mode = lock->l_req_mode;
- desc->l_granted_mode = lock->l_granted_mode;
- ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
- &lock->l_policy_data,
- &desc->l_policy_data);
- }
+ ldlm_res2desc(lock->l_resource, &desc->l_resource);
+ desc->l_req_mode = lock->l_req_mode;
+ desc->l_granted_mode = lock->l_granted_mode;
+ ldlm_convert_policy_to_wire(lock->l_resource->lr_type,
+ &lock->l_policy_data,
+ &desc->l_policy_data);
}
EXPORT_SYMBOL(ldlm_lock2desc);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index 8867dc175325..37b86082eb73 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -876,21 +876,8 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
/* for the local lock, add the reference */
ldlm_lock_addref_internal(lock, einfo->ei_mode);
ldlm_lock2handle(lock, lockh);
- if (policy != NULL) {
- /* INODEBITS_INTEROP: If the server does not support
- * inodebits, we will request a plain lock in the
- * descriptor (ldlm_lock2desc() below) but use an
- * inodebits lock internally with both bits set.
- */
- if (einfo->ei_type == LDLM_IBITS &&
- !(exp_connect_flags(exp) &
- OBD_CONNECT_IBITS))
- lock->l_policy_data.l_inodebits.bits =
- MDS_INODELOCK_LOOKUP |
- MDS_INODELOCK_UPDATE;
- else
+ if (policy != NULL)
lock->l_policy_data = *policy;
- }
if (einfo->ei_type == LDLM_EXTENT)
lock->l_req_extent = policy->l_extent;
diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c
index 6b584698d3ae..5a5b7fcb2630 100644
--- a/drivers/staging/lustre/lustre/libcfs/debug.c
+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
@@ -314,9 +314,8 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)
if (!isspace(str[n-1]))
break;
matched = n;
-
- if ((t = sscanf(str, "%i%n", &m, &matched)) >= 1 &&
- matched == n) {
+ t = sscanf(str, "%i%n", &m, &matched);
+ if (t >= 1 && matched == n) {
/* don't print warning for lctl set_param debug=0 or -1 */
if (m != 0 && m != -1)
CWARN("You are trying to use a numerical value for the "
@@ -344,7 +343,7 @@ void libcfs_debug_dumplog_internal(void *arg)
snprintf(debug_file_name, sizeof(debug_file_name) - 1,
"%s.%ld.%ld", libcfs_debug_file_path_arr,
get_seconds(), (long_ptr_t)arg);
- printk(KERN_ALERT "LustreError: dumping log to %s\n",
+ pr_alert("LustreError: dumping log to %s\n",
debug_file_name);
cfs_tracefile_dump_all_pages(debug_file_name);
libcfs_run_debug_log_upcall(debug_file_name);
@@ -376,7 +375,7 @@ void libcfs_debug_dumplog(void)
(void *)(long)current_pid(),
"libcfs_debug_dumper");
if (IS_ERR(dumper))
- printk(KERN_ERR "LustreError: cannot start log dump thread:"
+ pr_err("LustreError: cannot start log dump thread:"
" %ld\n", PTR_ERR(dumper));
else
schedule();
@@ -453,7 +452,7 @@ int libcfs_debug_mark_buffer(const char *text)
void libcfs_debug_set_level(unsigned int debug_level)
{
- printk(KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
+ pr_warn("Lustre: Setting portals debug level to %08x\n",
debug_level);
libcfs_debug = debug_level;
}
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index efa2faf080d7..de5892c5e7d6 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1787,7 +1787,7 @@ out_quotactl:
return ll_fid2path(inode, (void *)arg);
case LL_IOC_HSM_REQUEST: {
struct hsm_user_request *hur;
- int totalsize;
+ ssize_t totalsize;
OBD_ALLOC_PTR(hur);
if (hur == NULL)
@@ -1802,6 +1802,8 @@ out_quotactl:
/* Compute the whole struct size */
totalsize = hur_len(hur);
OBD_FREE_PTR(hur);
+ if (totalsize < 0)
+ return -E2BIG;
/* Final size will be more than double totalsize */
if (totalsize >= MDS_MAXREQSIZE / 3)
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index fd1b75a3a569..6ffbe7cbe895 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1248,8 +1248,7 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
return result;
}
-static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
- obd_count ost_idx)
+static int ll_lov_recreate(struct inode *inode, struct ost_id *oi, u32 ost_idx)
{
struct obd_export *exp = ll_i2dtexp(inode);
struct obd_trans_info oti = { 0 };
@@ -1314,7 +1313,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
{
struct lu_fid fid;
struct ost_id oi;
- obd_count ost_idx;
+ u32 ost_idx;
if (!capable(CFS_CAP_SYS_ADMIN))
return -EPERM;
@@ -1702,37 +1701,38 @@ out:
return rc;
}
-int ll_fid2path(struct inode *inode, void *arg)
+int ll_fid2path(struct inode *inode, void __user *arg)
{
- struct obd_export *exp = ll_i2mdexp(inode);
- struct getinfo_fid2path *gfout, *gfin;
- int outsize, rc;
+ struct obd_export *exp = ll_i2mdexp(inode);
+ const struct getinfo_fid2path __user *gfin = arg;
+ struct getinfo_fid2path *gfout;
+ u32 pathlen;
+ size_t outsize;
+ int rc;
if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
!(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
return -EPERM;
- /* Need to get the buflen */
- OBD_ALLOC_PTR(gfin);
- if (gfin == NULL)
- return -ENOMEM;
- if (copy_from_user(gfin, arg, sizeof(*gfin))) {
- OBD_FREE_PTR(gfin);
+ /* Only need to get the buflen */
+ if (get_user(pathlen, &gfin->gf_pathlen))
return -EFAULT;
- }
- outsize = sizeof(*gfout) + gfin->gf_pathlen;
+ if (pathlen > PATH_MAX)
+ return -EINVAL;
+
+ outsize = sizeof(*gfout) + pathlen;
+
OBD_ALLOC(gfout, outsize);
- if (gfout == NULL) {
- OBD_FREE_PTR(gfin);
+ if (gfout == NULL)
return -ENOMEM;
- }
- memcpy(gfout, gfin, sizeof(*gfout));
- OBD_FREE_PTR(gfin);
+
+ if (copy_from_user(gfout, arg, sizeof(*gfout)))
+ GOTO(gf_free, rc = -EFAULT);
/* Call mdc_iocontrol */
rc = obd_iocontrol(OBD_IOC_FID2PATH, exp, outsize, gfout, NULL);
- if (rc)
+ if (rc != 0)
GOTO(gf_free, rc);
if (copy_to_user(arg, gfout, outsize))
@@ -2116,10 +2116,14 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
ATTR_MTIME | ATTR_MTIME_SET |
ATTR_ATIME | ATTR_ATIME_SET;
+ mutex_lock(&inode->i_mutex);
+
rc = ll_setattr_raw(file->f_dentry, attr, true);
if (rc == -ENODATA)
rc = 0;
+ mutex_unlock(&inode->i_mutex);
+
out:
if (hss != NULL)
OBD_FREE_PTR(hss);
@@ -2888,7 +2892,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
ll_lookup_finish_locks(&oit, dentry);
} else if (!ll_have_md_lock(dentry->d_inode, &ibits, LCK_MINMODE)) {
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
- obd_valid valid = OBD_MD_FLGETATTR;
+ u64 valid = OBD_MD_FLGETATTR;
struct md_op_data *op_data;
int ealen = 0;
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 634ffa645e06..acfb078c1bb0 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -775,7 +775,7 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp,
int *lmm_size, struct ptlrpc_request **request);
int ll_fsync(struct file *file, loff_t start, loff_t end, int data);
int ll_merge_lvb(const struct lu_env *env, struct inode *inode);
-int ll_fid2path(struct inode *inode, void *arg);
+int ll_fid2path(struct inode *inode, void __user *arg);
int ll_data_version(struct inode *inode, __u64 *data_version, int extent_lock);
int ll_hsm_release(struct inode *inode);
@@ -894,6 +894,10 @@ struct vvp_io {
* fault API used bitflags for return code.
*/
unsigned int ft_flags;
+ /**
+ * check that flags are from filemap_fault
+ */
+ bool ft_flags_valid;
} fault;
} fault;
} u;
@@ -1124,7 +1128,7 @@ struct eacl_entry {
ext_acl_xattr_header *ee_acl;
};
-obd_valid rce_ops2valid(int ops);
+u64 rce_ops2valid(int ops);
struct rmtacl_ctl_entry *rct_search(struct rmtacl_ctl_table *rct, pid_t key);
int rct_add(struct rmtacl_ctl_table *rct, pid_t key, int ops);
int rct_del(struct rmtacl_ctl_table *rct, pid_t key);
@@ -1140,7 +1144,7 @@ void et_search_free(struct eacl_table *et, pid_t key);
void et_init(struct eacl_table *et);
void et_fini(struct eacl_table *et);
#else
-static inline obd_valid rce_ops2valid(int ops)
+static inline u64 rce_ops2valid(int ops)
{
return 0;
}
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 0367f5a2cfe4..ff375d37cc56 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -162,7 +162,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
struct obd_uuid *uuid;
struct md_op_data *op_data;
struct lustre_md lmd;
- obd_valid valid;
+ u64 valid;
int size, err, checksum;
obd = class_name2obd(md);
diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c
index 7dae610f5c86..59166481e1a2 100644
--- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
+++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
@@ -310,10 +310,16 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
vio->u.fault.ft_vma = vma;
vio->u.fault.ft_vmpage = NULL;
vio->u.fault.fault.ft_vmf = vmf;
+ vio->u.fault.fault.ft_flags = 0;
+ vio->u.fault.fault.ft_flags_valid = 0;
result = cl_io_loop(env, io);
- fault_ret = vio->u.fault.fault.ft_flags;
+ /* ft_flags are only valid if we reached
+ * the call to filemap_fault */
+ if (vio->u.fault.fault.ft_flags_valid)
+ fault_ret = vio->u.fault.fault.ft_flags;
+
vmpage = vio->u.fault.ft_vmpage;
if (result != 0 && vmpage != NULL) {
page_cache_release(vmpage);
diff --git a/drivers/staging/lustre/lustre/llite/llite_rmtacl.c b/drivers/staging/lustre/lustre/llite/llite_rmtacl.c
index be0c3eff108c..df6671748c12 100644
--- a/drivers/staging/lustre/lustre/llite/llite_rmtacl.c
+++ b/drivers/staging/lustre/lustre/llite/llite_rmtacl.c
@@ -58,7 +58,7 @@ static inline __u32 ee_hashfunc(uid_t id)
return id & (EE_HASHES - 1);
}
-obd_valid rce_ops2valid(int ops)
+u64 rce_ops2valid(int ops)
{
switch (ops) {
case RMT_LSETFACL:
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index 808663898b73..3c29c3870360 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -192,7 +192,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
pgoff_t offset;
int ret;
int rw;
- obd_count page_count = 0;
+ u32 page_count = 0;
struct bio_vec bvec;
struct bvec_iter iter;
struct bio *bio;
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index f61fefc9baf0..3a9c8e8f3f47 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -100,7 +100,7 @@ void free_rmtperm_hash(struct hlist_head *hash)
struct ll_remote_perm *lrp;
struct hlist_node *next;
- if(!hash)
+ if (!hash)
return;
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++)
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index a4117d6a3866..fd248745cbff 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -615,6 +615,7 @@ static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
struct vm_fault *vmf = cfio->fault.ft_vmf;
cfio->fault.ft_flags = filemap_fault(cfio->ft_vma, vmf);
+ cfio->fault.ft_flags_valid = 1;
if (vmf->page) {
CDEBUG(D_PAGE,
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_fld.c b/drivers/staging/lustre/lustre/lmv/lmv_fld.c
index 8289bcc5f8e1..e8421f04beda 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_fld.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_fld.c
@@ -53,7 +53,7 @@
int lmv_fld_lookup(struct lmv_obd *lmv,
const struct lu_fid *fid,
- mdsno_t *mds)
+ u32 *mds)
{
int rc;
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
index eb18a5900e13..80e6604f420d 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h
+++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h
@@ -70,10 +70,8 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
int lmv_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *,
void *, int);
-int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid,
- mdsno_t *mds);
-int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
- mdsno_t mds);
+int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds);
+int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds);
int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
struct md_op_data *op_data);
@@ -111,7 +109,7 @@ static inline int lmv_get_easize(struct lmv_obd *lmv)
}
static inline struct lmv_tgt_desc *
-lmv_get_target(struct lmv_obd *lmv, mdsno_t mds)
+lmv_get_target(struct lmv_obd *lmv, u32 mds)
{
int count = lmv->desc.ld_tgt_count;
int i;
@@ -130,7 +128,7 @@ lmv_get_target(struct lmv_obd *lmv, mdsno_t mds)
static inline struct lmv_tgt_desc *
lmv_find_target(struct lmv_obd *lmv, const struct lu_fid *fid)
{
- mdsno_t mds = 0;
+ u32 mds = 0;
int rc;
if (lmv->desc.ld_tgt_count > 1) {
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index a66b3e000d57..a48818a890eb 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1201,8 +1201,7 @@ static int lmv_choose_mds(struct lmv_obd *lmv, struct md_op_data *op_data,
* This is _inode_ placement policy function (not name).
*/
static int lmv_placement_policy(struct obd_device *obd,
- struct md_op_data *op_data,
- mdsno_t *mds)
+ struct md_op_data *op_data, u32 *mds)
{
struct lmv_obd *lmv = &obd->u.lmv;
@@ -1241,8 +1240,7 @@ static int lmv_placement_policy(struct obd_device *obd,
return 0;
}
-int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
- mdsno_t mds)
+int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds)
{
struct lmv_tgt_desc *tgt;
int rc;
@@ -1279,7 +1277,7 @@ int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
{
struct obd_device *obd = class_exp2obd(exp);
struct lmv_obd *lmv = &obd->u.lmv;
- mdsno_t mds = 0;
+ u32 mds = 0;
int rc;
LASSERT(op_data != NULL);
@@ -1379,7 +1377,7 @@ static int lmv_cleanup(struct obd_device *obd)
return 0;
}
-static int lmv_process_config(struct obd_device *obd, obd_count len, void *buf)
+static int lmv_process_config(struct obd_device *obd, u32 len, void *buf)
{
struct lustre_cfg *lcfg = buf;
struct obd_uuid obd_uuid;
@@ -1480,7 +1478,7 @@ static int lmv_getstatus(struct obd_export *exp,
}
static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *name,
+ struct obd_capa *oc, u64 valid, const char *name,
const char *input, int input_size, int output_size,
int flags, struct ptlrpc_request **request)
{
@@ -1504,7 +1502,7 @@ static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
}
static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *name,
+ struct obd_capa *oc, u64 valid, const char *name,
const char *input, int input_size, int output_size,
int flags, __u32 suppgid,
struct ptlrpc_request **request)
@@ -2371,7 +2369,7 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,
}
int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set)
{
struct lmv_tgt_desc *tgt;
diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
index 99ade92c5e64..314ce8525aed 100644
--- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h
@@ -515,12 +515,12 @@ struct lov_io {
* starting position within a file, for the current io loop iteration
* (stripe), used by ci_io_loop().
*/
- obd_off lis_pos;
+ u64 lis_pos;
/**
* end position with in a file, for the current stripe io. This is
* exclusive (i.e., next offset after last byte affected by io).
*/
- obd_off lis_endpos;
+ u64 lis_endpos;
int lis_mem_frozen;
int lis_stripe_count;
diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c
index 2401ca872507..9e21e5efcdb6 100644
--- a/drivers/staging/lustre/lustre/lov/lov_ea.c
+++ b/drivers/staging/lustre/lustre/lov/lov_ea.c
@@ -143,18 +143,18 @@ static void lsm_unpackmd_common(struct lov_stripe_md *lsm,
static void
lsm_stripe_by_index_plain(struct lov_stripe_md *lsm, int *stripeno,
- obd_off *lov_off, obd_off *swidth)
+ u64 *lov_off, u64 *swidth)
{
if (swidth)
- *swidth = (obd_off)lsm->lsm_stripe_size * lsm->lsm_stripe_count;
+ *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count;
}
static void
lsm_stripe_by_offset_plain(struct lov_stripe_md *lsm, int *stripeno,
- obd_off *lov_off, obd_off *swidth)
+ u64 *lov_off, u64 *swidth)
{
if (swidth)
- *swidth = (obd_off)lsm->lsm_stripe_size * lsm->lsm_stripe_count;
+ *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count;
}
static int lsm_destroy_plain(struct lov_stripe_md *lsm, struct obdo *oa,
diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h
index 017961a5cc3e..1b96fac4889d 100644
--- a/drivers/staging/lustre/lustre/lov/lov_internal.h
+++ b/drivers/staging/lustre/lustre/lov/lov_internal.h
@@ -90,8 +90,8 @@ struct lov_request {
int rq_rc;
int rq_buflen; /* length of sub_md */
- obd_count rq_oabufs;
- obd_count rq_pgaidx;
+ u32 rq_oabufs;
+ u32 rq_pgaidx;
};
struct lov_request_set {
@@ -109,7 +109,7 @@ struct lov_request_set {
struct llog_cookie *set_cookies;
int set_cookie_sent;
struct obd_trans_info *set_oti;
- obd_count set_oabufs;
+ u32 set_oabufs;
struct brw_page *set_pga;
struct lov_lock_handles *set_lockh;
struct list_head set_list;
@@ -166,26 +166,26 @@ static inline void lov_llh_put(struct lov_lock_handles *llh)
(char *)((lv)->lov_tgts[index]->ltd_uuid.uuid)
/* lov_merge.c */
-void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid,
+void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid,
struct lov_stripe_md *lsm, int stripeno, int *set);
int lov_merge_lvb(struct obd_export *exp, struct lov_stripe_md *lsm,
struct ost_lvb *lvb, int kms_only);
int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
- obd_off size, int shrink);
+ u64 size, int shrink);
int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
struct ost_lvb *lvb, __u64 *kms_place);
/* lov_offset.c */
-obd_size lov_stripe_size(struct lov_stripe_md *lsm, obd_size ost_size,
+u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size,
int stripeno);
-int lov_stripe_offset(struct lov_stripe_md *lsm, obd_off lov_off,
- int stripeno, obd_off *obd_off);
-obd_off lov_size_to_stripe(struct lov_stripe_md *lsm, obd_off file_size,
+int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off,
+ int stripeno, u64 *u64);
+u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size,
int stripeno);
int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno,
- obd_off start, obd_off end,
- obd_off *obd_start, obd_off *obd_end);
-int lov_stripe_number(struct lov_stripe_md *lsm, obd_off lov_off);
+ u64 start, u64 end,
+ u64 *obd_start, u64 *obd_end);
+int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off);
/* lov_qos.c */
#define LOV_USES_ASSIGNED_STRIPE 0
@@ -214,7 +214,7 @@ int lov_prep_create_set(struct obd_export *exp, struct obd_info *oifo,
int cb_create_update(void *cookie, int rc);
int lov_fini_create_set(struct lov_request_set *set, struct lov_stripe_md **ea);
int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo,
- obd_count oa_bufs, struct brw_page *pga,
+ u32 oa_bufs, struct brw_page *pga,
struct obd_trans_info *oti,
struct lov_request_set **reqset);
int lov_fini_brw_set(struct lov_request_set *set);
@@ -239,7 +239,7 @@ int lov_prep_punch_set(struct obd_export *exp, struct obd_info *oinfo,
struct lov_request_set **reqset);
int lov_fini_punch_set(struct lov_request_set *set);
int lov_prep_sync_set(struct obd_export *exp, struct obd_info *obd_info,
- obd_off start, obd_off end,
+ u64 start, u64 end,
struct lov_request_set **reqset);
int lov_fini_sync_set(struct lov_request_set *set);
int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo,
diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c
index ce074c54a003..f1f6db3f664a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -366,7 +366,7 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
wake_up_all(&lov->lo_waitq);
}
-static obd_off lov_offset_mod(obd_off val, int delta)
+static u64 lov_offset_mod(u64 val, int delta)
{
if (val != OBD_OBJECT_EOF)
val += delta;
@@ -379,9 +379,9 @@ static int lov_io_iter_init(const struct lu_env *env,
struct lov_io *lio = cl2lov_io(env, ios);
struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;
struct lov_io_sub *sub;
- obd_off endpos;
- obd_off start;
- obd_off end;
+ u64 endpos;
+ u64 start;
+ u64 end;
int stripe;
int rc = 0;
diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c
index 08ac3745f0da..49e694222ac8 100644
--- a/drivers/staging/lustre/lustre/lov/lov_lock.c
+++ b/drivers/staging/lustre/lustre/lov/lov_lock.c
@@ -290,10 +290,10 @@ static int lov_lock_sub_init(const struct lu_env *env,
int result = 0;
int i;
int nr;
- obd_off start;
- obd_off end;
- obd_off file_start;
- obd_off file_end;
+ u64 start;
+ u64 end;
+ u64 file_start;
+ u64 file_end;
struct lov_object *loo = cl2lov(lck->lls_cl.cls_obj);
struct lov_layout_raid0 *r0 = lov_r0(loo);
@@ -860,10 +860,10 @@ static int lock_lock_multi_match()
struct lov_layout_raid0 *r0 = lov_r0(loo);
struct lov_lock_sub *sub;
struct cl_object *subobj;
- obd_off fstart;
- obd_off fend;
- obd_off start;
- obd_off end;
+ u64 fstart;
+ u64 fend;
+ u64 start;
+ u64 end;
int i;
fstart = cl_offset(need->cld_obj, need->cld_start);
@@ -900,8 +900,8 @@ static int lov_lock_stripe_is_matching(const struct lu_env *env,
const struct cl_lock_descr *descr)
{
struct lov_stripe_md *lsm = lov->lo_lsm;
- obd_off start;
- obd_off end;
+ u64 start;
+ u64 end;
int result;
if (lov_r0(lov)->lo_nr == 1)
@@ -919,8 +919,8 @@ static int lov_lock_stripe_is_matching(const struct lu_env *env,
stripe == lov_stripe_number(lsm, end);
if (result) {
struct cl_lock_descr *subd = &lov_env_info(env)->lti_ldescr;
- obd_off sub_start;
- obd_off sub_end;
+ u64 sub_start;
+ u64 sub_end;
subd->cld_obj = NULL; /* don't need sub object at all */
subd->cld_mode = descr->cld_mode;
diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c
index 85144b8da96d..15ebb5d8b713 100644
--- a/drivers/staging/lustre/lustre/lov/lov_merge.c
+++ b/drivers/staging/lustre/lustre/lov/lov_merge.c
@@ -52,9 +52,9 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
__u64 size = 0;
__u64 kms = 0;
__u64 blocks = 0;
- obd_time current_mtime = lvb->lvb_mtime;
- obd_time current_atime = lvb->lvb_atime;
- obd_time current_ctime = lvb->lvb_ctime;
+ s64 current_mtime = lvb->lvb_mtime;
+ s64 current_atime = lvb->lvb_atime;
+ s64 current_ctime = lvb->lvb_ctime;
int i;
int rc = 0;
@@ -66,7 +66,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm,
lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
for (i = 0; i < lsm->lsm_stripe_count; i++) {
struct lov_oinfo *loi = lsm->lsm_oinfo[i];
- obd_size lov_size, tmpsize;
+ u64 lov_size, tmpsize;
if (OST_LVB_IS_ERR(loi->loi_lvb.lvb_blocks)) {
rc = OST_LVB_GET_ERR(loi->loi_lvb.lvb_blocks);
@@ -138,7 +138,7 @@ int lov_merge_lvb(struct obd_export *exp,
/* Must be called under the lov_stripe_lock() */
int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
- obd_off size, int shrink)
+ u64 size, int shrink)
{
struct lov_oinfo *loi;
int stripe = 0;
@@ -173,7 +173,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm,
return 0;
}
-void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid,
+void lov_merge_attrs(struct obdo *tgt, struct obdo *src, u64 valid,
struct lov_stripe_md *lsm, int stripeno, int *set)
{
valid &= src->o_valid;
@@ -181,7 +181,7 @@ void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid,
if (*set) {
if (valid & OBD_MD_FLSIZE) {
/* this handles sparse files properly */
- obd_size lov_size;
+ u64 lov_size;
lov_size = lov_stripe_size(lsm, src->o_size, stripeno);
if (lov_size > tgt->o_size)
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index e4f4fe3f71c7..cb778df86d09 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1442,7 +1442,7 @@ static int lov_sync_interpret(struct ptlrpc_request_set *rqset,
}
static int lov_sync(const struct lu_env *env, struct obd_export *exp,
- struct obd_info *oinfo, obd_off start, obd_off end,
+ struct obd_info *oinfo, u64 start, u64 end,
struct ptlrpc_request_set *rqset)
{
struct lov_request_set *set = NULL;
@@ -1497,7 +1497,7 @@ static int lov_sync(const struct lu_env *env, struct obd_export *exp,
}
static int lov_brw_check(struct lov_obd *lov, struct obd_info *lov_oinfo,
- obd_count oa_bufs, struct brw_page *pga)
+ u32 oa_bufs, struct brw_page *pga)
{
struct obd_info oinfo = { { { 0 } } };
int i, rc = 0;
@@ -1509,7 +1509,7 @@ static int lov_brw_check(struct lov_obd *lov, struct obd_info *lov_oinfo,
for (i = 0; i < oa_bufs; i++) {
int stripe = lov_stripe_number(lov_oinfo->oi_md, pga[i].off);
int ost = lov_oinfo->oi_md->lsm_oinfo[stripe]->loi_ost_idx;
- obd_off start, end;
+ u64 start, end;
if (!lov_stripe_intersects(lov_oinfo->oi_md, i, pga[i].off,
pga[i].off + pga[i].count - 1,
@@ -1530,7 +1530,7 @@ static int lov_brw_check(struct lov_obd *lov, struct obd_info *lov_oinfo,
}
static int lov_brw(int cmd, struct obd_export *exp, struct obd_info *oinfo,
- obd_count oa_bufs, struct brw_page *pga,
+ u32 oa_bufs, struct brw_page *pga,
struct obd_trans_info *oti)
{
struct lov_request_set *set;
@@ -2080,13 +2080,13 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
* \param fm_end logical end of mapping
* \param start_stripe starting stripe will be returned in this
*/
-obd_size fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap,
- struct lov_stripe_md *lsm, obd_size fm_start,
- obd_size fm_end, int *start_stripe)
+u64 fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap,
+ struct lov_stripe_md *lsm, u64 fm_start,
+ u64 fm_end, int *start_stripe)
{
- obd_size local_end = fiemap->fm_extents[0].fe_logical;
- obd_off lun_start, lun_end;
- obd_size fm_end_offset;
+ u64 local_end = fiemap->fm_extents[0].fe_logical;
+ u64 lun_start, lun_end;
+ u64 fm_end_offset;
int stripe_no = -1, i;
if (fiemap->fm_extent_count == 0 ||
@@ -2137,12 +2137,12 @@ obd_size fiemap_calc_fm_end_offset(struct ll_user_fiemap *fiemap,
*
* \retval last_stripe return the last stripe of the mapping
*/
-int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, obd_size fm_start,
- obd_size fm_end, int start_stripe,
+int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 fm_start,
+ u64 fm_end, int start_stripe,
int *stripe_count)
{
int last_stripe;
- obd_off obd_start, obd_end;
+ u64 obd_start, obd_end;
int i, j;
if (fm_end - fm_start > lsm->lsm_stripe_size * lsm->lsm_stripe_count) {
@@ -2206,8 +2206,8 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key,
int count_local;
unsigned int get_num_extents = 0;
int ost_index = 0, actual_start_stripe, start_stripe;
- obd_size fm_start, fm_end, fm_length, fm_end_offset;
- obd_size curr_loc;
+ u64 fm_start, fm_end, fm_length, fm_end_offset;
+ u64 curr_loc;
int current_extent = 0, rc = 0, i;
int ost_eof = 0; /* EOF for object */
int ost_done = 0; /* done with required mapping for this OST? */
@@ -2256,9 +2256,9 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key,
/* Check each stripe */
for (cur_stripe = start_stripe, i = 0; i < stripe_count;
i++, cur_stripe = (cur_stripe + 1) % lsm->lsm_stripe_count) {
- obd_size req_fm_len; /* Stores length of required mapping */
- obd_size len_mapped_single_call;
- obd_off lun_start, lun_end, obd_object_end;
+ u64 req_fm_len; /* Stores length of required mapping */
+ u64 len_mapped_single_call;
+ u64 lun_start, lun_end, obd_object_end;
unsigned int ext_count;
cur_stripe_wrap = cur_stripe;
@@ -2467,7 +2467,7 @@ static int lov_get_info(const struct lu_env *env, struct obd_export *exp,
GOTO(out, rc = -ENXIO);
} else if (KEY_IS(KEY_LAST_ID)) {
struct obd_id_info *info = val;
- __u32 size = sizeof(obd_id);
+ __u32 size = sizeof(u64);
struct lov_tgt_desc *tgt;
LASSERT(*vallen == sizeof(struct obd_id_info));
@@ -2513,12 +2513,12 @@ out:
}
static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set)
{
struct obd_device *obddev = class_exp2obd(exp);
struct lov_obd *lov = &obddev->u.lov;
- obd_count count;
+ u32 count;
int i, rc = 0, err;
struct lov_tgt_desc *tgt;
unsigned incr, check_uuid,
@@ -2538,7 +2538,7 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
if (KEY_IS(KEY_NEXT_ID)) {
count = vallen / sizeof(struct obd_id_info);
- vallen = sizeof(obd_id);
+ vallen = sizeof(u64);
incr = sizeof(struct obd_id_info);
do_inactive = 1;
next_id = 1;
diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c
index 8e1c3bacc0a0..9c8c77c05a8a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_offset.c
+++ b/drivers/staging/lustre/lustre/lov/lov_offset.c
@@ -43,13 +43,13 @@
#include "lov_internal.h"
/* compute object size given "stripeno" and the ost size */
-obd_size lov_stripe_size(struct lov_stripe_md *lsm, obd_size ost_size,
+u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size,
int stripeno)
{
unsigned long ssize = lsm->lsm_stripe_size;
unsigned long stripe_size;
- obd_off swidth;
- obd_size lov_size;
+ u64 swidth;
+ u64 lov_size;
int magic = lsm->lsm_magic;
if (ost_size == 0)
@@ -116,11 +116,11 @@ obd_size lov_stripe_size(struct lov_stripe_md *lsm, obd_size ost_size,
* was moved forward to the start of the stripe in question; 0 when it
* falls in the stripe and no shifting was done; > 0 when the offset
* was outside the stripe and was pulled back to its final byte. */
-int lov_stripe_offset(struct lov_stripe_md *lsm, obd_off lov_off,
- int stripeno, obd_off *obdoff)
+int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off,
+ int stripeno, u64 *obdoff)
{
unsigned long ssize = lsm->lsm_stripe_size;
- obd_off stripe_off, this_stripe, swidth;
+ u64 stripe_off, this_stripe, swidth;
int magic = lsm->lsm_magic;
int ret = 0;
@@ -137,7 +137,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, obd_off lov_off,
/* lov_do_div64(a, b) returns a % b, and a = a / b */
stripe_off = lov_do_div64(lov_off, swidth);
- this_stripe = (obd_off)stripeno * ssize;
+ this_stripe = (u64)stripeno * ssize;
if (stripe_off < this_stripe) {
stripe_off = 0;
ret = -1;
@@ -173,11 +173,11 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, obd_off lov_off,
* | 0 | 1 | 2 | 0 | 1 | 2 |
* ---------------------------------------------------------------------
*/
-obd_off lov_size_to_stripe(struct lov_stripe_md *lsm, obd_off file_size,
- int stripeno)
+u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size,
+ int stripeno)
{
unsigned long ssize = lsm->lsm_stripe_size;
- obd_off stripe_off, this_stripe, swidth;
+ u64 stripe_off, this_stripe, swidth;
int magic = lsm->lsm_magic;
if (file_size == OBD_OBJECT_EOF)
@@ -190,7 +190,7 @@ obd_off lov_size_to_stripe(struct lov_stripe_md *lsm, obd_off file_size,
/* lov_do_div64(a, b) returns a % b, and a = a / b */
stripe_off = lov_do_div64(file_size, swidth);
- this_stripe = (obd_off)stripeno * ssize;
+ this_stripe = (u64)stripeno * ssize;
if (stripe_off < this_stripe) {
/* Move to end of previous stripe, or zero */
if (file_size > 0) {
@@ -215,8 +215,7 @@ obd_off lov_size_to_stripe(struct lov_stripe_md *lsm, obd_off file_size,
* that is contained within the lov extent. this returns true if the given
* stripe does intersect with the lov extent. */
int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno,
- obd_off start, obd_off end,
- obd_off *obd_start, obd_off *obd_end)
+ u64 start, u64 end, u64 *obd_start, u64 *obd_end)
{
int start_side, end_side;
@@ -247,10 +246,10 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno,
}
/* compute which stripe number "lov_off" will be written into */
-int lov_stripe_number(struct lov_stripe_md *lsm, obd_off lov_off)
+int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off)
{
unsigned long ssize = lsm->lsm_stripe_size;
- obd_off stripe_off, swidth;
+ u64 stripe_off, swidth;
int magic = lsm->lsm_magic;
LASSERT(lsm_op_find(magic) != NULL);
diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c
index a5b190f32c0f..20e587052a29 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -125,7 +125,7 @@ void lov_dump_lmm(int level, void *lmm)
*
* XXX In the future, this will be enhanced to get the EA size from the
* underlying OSC device(s) to get their EA sizes so we can stack
- * LOVs properly. For now lov_mds_md_size() just assumes one obd_id
+ * LOVs properly. For now lov_mds_md_size() just assumes one u64
* per stripe.
*/
int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
@@ -538,7 +538,7 @@ int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
int rc;
struct obd_export *oexp;
struct lov_obd *lov = &exp->exp_obd->u.lov;
- obd_id last_id = 0;
+ u64 last_id = 0;
struct lov_user_ost_data_v1 *lmm_objects;
if (lump->lmm_magic == LOV_USER_MAGIC_V3)
diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c
index 674e61781c20..24f4e2047fed 100644
--- a/drivers/staging/lustre/lustre/lov/lov_page.c
+++ b/drivers/staging/lustre/lustre/lov/lov_page.c
@@ -165,7 +165,7 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
struct lov_io_sub *sub;
struct lov_page *lpg = cl_object_page_slice(obj, page);
loff_t offset;
- obd_off suboff;
+ u64 suboff;
int stripe;
int rc;
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c
index e4bb02a54b0d..174a5fe4a149 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -375,7 +375,7 @@ int lov_prep_enqueue_set(struct obd_export *exp, struct obd_info *oinfo,
for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
struct lov_oinfo *loi;
struct lov_request *req;
- obd_off start, end;
+ u64 start, end;
loi = oinfo->oi_md->lsm_oinfo[i];
if (!lov_stripe_intersects(oinfo->oi_md, i,
@@ -481,7 +481,7 @@ int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo,
for (i = 0; i < lsm->lsm_stripe_count; i++) {
struct lov_oinfo *loi;
struct lov_request *req;
- obd_off start, end;
+ u64 start, end;
loi = lsm->lsm_oinfo[i];
if (!lov_stripe_intersects(lsm, i, policy->l_extent.start,
@@ -696,14 +696,14 @@ int lov_fini_brw_set(struct lov_request_set *set)
}
int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo,
- obd_count oa_bufs, struct brw_page *pga,
+ u32 oa_bufs, struct brw_page *pga,
struct obd_trans_info *oti,
struct lov_request_set **reqset)
{
struct {
- obd_count index;
- obd_count count;
- obd_count off;
+ u32 index;
+ u32 count;
+ u32 off;
} *info = NULL;
struct lov_request_set *set;
struct lov_obd *lov = &exp->exp_obd->u.lov;
@@ -1167,7 +1167,7 @@ int lov_prep_punch_set(struct obd_export *exp, struct obd_info *oinfo,
for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
struct lov_oinfo *loi = oinfo->oi_md->lsm_oinfo[i];
struct lov_request *req;
- obd_off rs, re;
+ u64 rs, re;
if (!lov_stripe_intersects(oinfo->oi_md, i,
oinfo->oi_policy.l_extent.start,
@@ -1246,7 +1246,7 @@ static int cb_sync_update(void *cookie, int rc)
}
int lov_prep_sync_set(struct obd_export *exp, struct obd_info *oinfo,
- obd_off start, obd_off end,
+ u64 start, u64 end,
struct lov_request_set **reqset)
{
struct lov_request_set *set;
@@ -1264,7 +1264,7 @@ int lov_prep_sync_set(struct obd_export *exp, struct obd_info *oinfo,
for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
struct lov_oinfo *loi = oinfo->oi_md->lsm_oinfo[i];
struct lov_request *req;
- obd_off rs, re;
+ u64 rs, re;
if (!lov_check_and_wait_active(lov, loi->loi_ost_idx)) {
CDEBUG(D_HA, "lov idx %d inactive\n", loi->loi_ost_idx);
diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c
index 52fb6c162ad7..42336f13a76f 100644
--- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c
+++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c
@@ -67,7 +67,7 @@ static void lovsub_req_completion(const struct lu_env *env,
static void lovsub_req_attr_set(const struct lu_env *env,
const struct cl_req_slice *slice,
const struct cl_object *obj,
- struct cl_req_attr *attr, obd_valid flags)
+ struct cl_req_attr *attr, u64 flags)
{
struct lovsub_object *subobj;
diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
index d1d891b91663..16341c818358 100644
--- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
+++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c
@@ -56,7 +56,8 @@ static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
size_t count,
loff_t *off)
{
- struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
+ struct obd_device *dev =
+ ((struct seq_file *)file->private_data)->private;
struct client_obd *cli = &dev->u.cli;
int val, rc;
@@ -84,7 +85,8 @@ static int mdc_kuc_open(struct inode *inode, struct file *file)
static ssize_t mdc_kuc_write(struct file *file, const char *buffer,
size_t count, loff_t *off)
{
- struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
+ struct obd_device *obd =
+ ((struct seq_file *)file->private_data)->private;
struct kuc_hdr *lh;
struct hsm_action_list *hal;
struct hsm_action_item *hai;
@@ -209,6 +211,6 @@ static struct lprocfs_vars lprocfs_mdc_module_vars[] = {
void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
{
- lvars->module_vars = lprocfs_mdc_module_vars;
- lvars->obd_vars = lprocfs_mdc_obd_vars;
+ lvars->module_vars = lprocfs_mdc_module_vars;
+ lvars->obd_vars = lprocfs_mdc_obd_vars;
}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h
index e8235559e27f..81780c943a08 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h
+++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h
@@ -40,7 +40,7 @@
#include "../include/lustre_mdc.h"
#include "../include/lustre_mds.h"
-#if defined (CONFIG_PROC_FS)
+#if defined CONFIG_PROC_FS
void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
#else
static inline void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars)
@@ -108,7 +108,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
struct md_op_data *op_data);
-int mdc_open(struct obd_export *exp, obd_id ino, int type, int flags,
+int mdc_open(struct obd_export *exp, u64 ino, int type, int flags,
struct lov_mds_md *lmm, int lmm_size, struct lustre_handle *fh,
struct ptlrpc_request **);
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index f54dd90c7e50..e8732cc30ce2 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -42,7 +42,7 @@
static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
{
- LASSERT (b != NULL);
+ LASSERT(b != NULL);
b->suppgid = suppgid;
b->uid = from_kuid(&init_user_ns, current_uid());
@@ -52,7 +52,8 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
b->capability = cfs_curproc_cap_pack();
}
-void mdc_pack_capa(struct ptlrpc_request *req, const struct req_msg_field *field,
+void mdc_pack_capa(struct ptlrpc_request *req,
+ const struct req_msg_field *field,
struct obd_capa *oc)
{
struct req_capsule *pill = &req->rq_pill;
@@ -256,7 +257,8 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
set_mrc_cr_flags(rec, cr_flags);
}
-static inline __u64 attr_pack(unsigned int ia_valid) {
+static inline __u64 attr_pack(unsigned int ia_valid)
+{
__u64 sa_valid = 0;
if (ia_valid & ATTR_MODE)
@@ -316,7 +318,8 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
rec->sa_atime = LTIME_S(op_data->op_attr.ia_atime);
rec->sa_mtime = LTIME_S(op_data->op_attr.ia_mtime);
rec->sa_ctime = LTIME_S(op_data->op_attr.ia_ctime);
- rec->sa_attr_flags = ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
+ rec->sa_attr_flags =
+ ((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags;
if ((op_data->op_attr.ia_valid & ATTR_GID) &&
in_group_p(op_data->op_attr.ia_gid))
rec->sa_suppgid =
@@ -342,7 +345,8 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
struct mdt_ioepoch *epoch;
struct lov_user_md *lum = NULL;
- CLASSERT(sizeof(struct mdt_rec_reint) ==sizeof(struct mdt_rec_setattr));
+ CLASSERT(sizeof(struct mdt_rec_reint) ==
+ sizeof(struct mdt_rec_setattr));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
mdc_setattr_pack_rec(rec, op_data);
@@ -382,18 +386,18 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT(rec != NULL);
- rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
+ rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
REINT_RMENTRY : REINT_UNLINK;
- rec->ul_fsuid = op_data->op_fsuid;
- rec->ul_fsgid = op_data->op_fsgid;
- rec->ul_cap = op_data->op_cap;
- rec->ul_mode = op_data->op_mode;
- rec->ul_suppgid1= op_data->op_suppgids[0];
- rec->ul_suppgid2= -1;
- rec->ul_fid1 = op_data->op_fid1;
- rec->ul_fid2 = op_data->op_fid2;
- rec->ul_time = op_data->op_mod_time;
- rec->ul_bias = op_data->op_bias;
+ rec->ul_fsuid = op_data->op_fsuid;
+ rec->ul_fsgid = op_data->op_fsgid;
+ rec->ul_cap = op_data->op_cap;
+ rec->ul_mode = op_data->op_mode;
+ rec->ul_suppgid1 = op_data->op_suppgids[0];
+ rec->ul_suppgid2 = -1;
+ rec->ul_fid1 = op_data->op_fid1;
+ rec->ul_fid2 = op_data->op_fid2;
+ rec->ul_time = op_data->op_mod_time;
+ rec->ul_bias = op_data->op_bias;
mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
@@ -409,12 +413,12 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
- LASSERT (rec != NULL);
+ LASSERT(rec != NULL);
rec->lk_opcode = REINT_LINK;
- rec->lk_fsuid = op_data->op_fsuid;//current->fsuid;
- rec->lk_fsgid = op_data->op_fsgid;//current->fsgid;
- rec->lk_cap = op_data->op_cap;//current->cap_effective;
+ rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */
+ rec->lk_fsgid = op_data->op_fsgid; /* current->fsgid; */
+ rec->lk_cap = op_data->op_cap; /* current->cap_effective; */
rec->lk_suppgid1 = op_data->op_suppgids[0];
rec->lk_suppgid2 = op_data->op_suppgids[1];
rec->lk_fid1 = op_data->op_fid1;
@@ -486,6 +490,7 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags,
if (op_data->op_name) {
char *tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+
LOGL0(op_data->op_name, op_data->op_namelen, tmp);
}
@@ -551,7 +556,8 @@ int mdc_enter_request(struct client_obd *cli)
list_add_tail(&mcw.mcw_entry, &cli->cl_cache_waiters);
init_waitqueue_head(&mcw.mcw_waitq);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- rc = l_wait_event(mcw.mcw_waitq, mdc_req_avail(cli, &mcw), &lwi);
+ rc = l_wait_event(mcw.mcw_waitq, mdc_req_avail(cli, &mcw),
+ &lwi);
if (rc) {
client_obd_list_lock(&cli->cl_loi_list_lock);
if (list_empty(&mcw.mcw_entry))
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 71219b90e22b..9c3e53385602 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -134,12 +134,12 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
if (lock->l_resource->lr_lvb_inode &&
lock->l_resource->lr_lvb_inode != data) {
struct inode *old_inode = lock->l_resource->lr_lvb_inode;
+
LASSERTF(old_inode->i_state & I_FREEING,
- "Found existing inode %p/%lu/%u state %lu in lock: "
- "setting data to %p/%lu/%u\n", old_inode,
- old_inode->i_ino, old_inode->i_generation,
- old_inode->i_state,
- new_inode, new_inode->i_ino, new_inode->i_generation);
+ "Found existing inode %p/%lu/%u state %lu in lock: setting data to %p/%lu/%u\n",
+ old_inode, old_inode->i_ino, old_inode->i_generation,
+ old_inode->i_state, new_inode, new_inode->i_ino,
+ new_inode->i_generation);
}
lock->l_resource->lr_lvb_inode = new_inode;
if (bits)
@@ -218,7 +218,7 @@ int mdc_find_cbdata(struct obd_export *exp,
struct ldlm_res_id res_id;
int rc = 0;
- fid_build_reg_res_name((struct lu_fid*)fid, &res_id);
+ fid_build_reg_res_name((struct lu_fid *)fid, &res_id);
rc = ldlm_resource_iterate(class_exp2obd(exp)->obd_namespace, &res_id,
it, data);
if (rc == LDLM_ITER_STOP)
@@ -450,12 +450,12 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
}
static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
- struct lookup_intent *it,
- struct md_op_data *op_data)
+ struct lookup_intent *it,
+ struct md_op_data *op_data)
{
struct ptlrpc_request *req;
struct obd_device *obddev = class_exp2obd(exp);
- obd_valid valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
+ u64 valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA |
OBD_MD_FLMDSCAPA | OBD_MD_MEA |
(client_is_remote(exp) ?
@@ -621,7 +621,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
* function without doing so, and try to replay a failed create
* (bug 3440) */
if (it->it_op & IT_OPEN && req->rq_replay &&
- (!it_disposition(it, DISP_OPEN_OPEN) ||intent->it_status != 0))
+ (!it_disposition(it, DISP_OPEN_OPEN) || intent->it_status != 0))
mdc_clear_replay_flag(req, intent->it_status);
DEBUG_REQ(D_RPCTRACE, req, "op: %d disposition: %x, status: %d",
@@ -633,7 +633,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
body = req_capsule_server_get(pill, &RMF_MDT_BODY);
if (body == NULL) {
- CERROR ("Can't swab mdt_body\n");
+ CERROR("Can't swab mdt_body\n");
return -EPROTO;
}
@@ -678,6 +678,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
*/
if ((it->it_op & IT_OPEN) && req->rq_replay) {
void *lmm;
+
if (req_capsule_get_size(pill, &RMF_EADATA,
RCL_CLIENT) <
body->eadatasize)
@@ -777,25 +778,29 @@ static int mdc_finish_enqueue(struct obd_export *exp,
int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
struct lookup_intent *it, struct md_op_data *op_data,
struct lustre_handle *lockh, void *lmm, int lmmsize,
- struct ptlrpc_request **reqp, __u64 extra_lock_flags)
+ struct ptlrpc_request **reqp, u64 extra_lock_flags)
{
- struct obd_device *obddev = class_exp2obd(exp);
- struct ptlrpc_request *req = NULL;
- __u64 flags, saved_flags = extra_lock_flags;
- int rc;
- struct ldlm_res_id res_id;
- static const ldlm_policy_data_t lookup_policy =
- { .l_inodebits = { MDS_INODELOCK_LOOKUP } };
- static const ldlm_policy_data_t update_policy =
- { .l_inodebits = { MDS_INODELOCK_UPDATE } };
- static const ldlm_policy_data_t layout_policy =
- { .l_inodebits = { MDS_INODELOCK_LAYOUT } };
+ static const ldlm_policy_data_t lookup_policy = {
+ .l_inodebits = { MDS_INODELOCK_LOOKUP }
+ };
+ static const ldlm_policy_data_t update_policy = {
+ .l_inodebits = { MDS_INODELOCK_UPDATE }
+ };
+ static const ldlm_policy_data_t layout_policy = {
+ .l_inodebits = { MDS_INODELOCK_LAYOUT }
+ };
static const ldlm_policy_data_t getxattr_policy = {
- .l_inodebits = { MDS_INODELOCK_XATTR } };
+ .l_inodebits = { MDS_INODELOCK_XATTR }
+ };
ldlm_policy_data_t const *policy = &lookup_policy;
- int generation, resends = 0;
- struct ldlm_reply *lockrep;
- enum lvb_type lvb_type = 0;
+ struct obd_device *obddev = class_exp2obd(exp);
+ struct ptlrpc_request *req;
+ u64 flags, saved_flags = extra_lock_flags;
+ struct ldlm_res_id res_id;
+ int generation, resends = 0;
+ struct ldlm_reply *lockrep;
+ enum lvb_type lvb_type = LVB_T_NONE;
+ int rc;
LASSERTF(!it || einfo->ei_type == LDLM_IBITS, "lock type %d\n",
einfo->ei_type);
@@ -939,7 +944,12 @@ resend:
memset(lockh, 0, sizeof(*lockh));
}
ptlrpc_req_finished(req);
+
+ it->d.lustre.it_lock_handle = 0;
+ it->d.lustre.it_lock_mode = 0;
+ it->d.lustre.it_data = NULL;
}
+
return rc;
}
@@ -1029,6 +1039,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
lock = ldlm_handle2lock(lockh);
if (lock) {
ldlm_policy_data_t policy = lock->l_policy_data;
+
LDLM_DEBUG(lock, "matching against this");
LASSERTF(fid_res_name_eq(&mdt_body->fid1,
@@ -1039,14 +1050,16 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
memcpy(&old_lock, lockh, sizeof(*lockh));
if (ldlm_lock_match(NULL, LDLM_FL_BLOCK_GRANTED, NULL,
- LDLM_IBITS, &policy, LCK_NL, &old_lock, 0)) {
+ LDLM_IBITS, &policy, LCK_NL,
+ &old_lock, 0)) {
ldlm_lock_decref_and_cancel(lockh,
it->d.lustre.it_lock_mode);
memcpy(lockh, &old_lock, sizeof(old_lock));
it->d.lustre.it_lock_handle = lockh->cookie;
}
}
- CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
+ CDEBUG(D_DENTRY,
+ "D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
op_data->op_namelen, op_data->op_name, ldlm_it2str(it->it_op),
it->d.lustre.it_status, it->d.lustre.it_disposition, rc);
return rc;
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
index c5420a42bc33..01af30ac1a52 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
@@ -71,7 +71,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
__u64 bits)
{
struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
- ldlm_policy_data_t policy = {{0}};
+ ldlm_policy_data_t policy = {};
struct ldlm_res_id res_id;
struct ldlm_resource *res;
int count;
@@ -152,14 +152,12 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
ptlrpc_request_set_replen(req);
if (mod && (op_data->op_flags & MF_EPOCH_OPEN) &&
- req->rq_import->imp_replayable)
- {
+ req->rq_import->imp_replayable) {
LASSERT(*mod == NULL);
*mod = obd_mod_alloc();
if (*mod == NULL) {
- DEBUG_REQ(D_ERROR, req, "Can't allocate "
- "md_open_data");
+ DEBUG_REQ(D_ERROR, req, "Can't allocate md_open_data");
} else {
req->rq_replay = 1;
req->rq_cb_data = *mod;
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 4a1cc4eb73d5..fce8567aba38 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -203,6 +203,7 @@ static int mdc_getattr_common(struct obd_export *exp,
if (body->valid & OBD_MD_FLMDSCAPA) {
struct lustre_capa *capa;
+
capa = req_capsule_server_get(pill, &RMF_CAPA1);
if (capa == NULL)
return -EPROTO;
@@ -283,6 +284,7 @@ int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
if (op_data->op_name) {
char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
+
LASSERT(strnlen(op_data->op_name, op_data->op_namelen) ==
op_data->op_namelen);
memcpy(name, op_data->op_name, op_data->op_namelen);
@@ -326,9 +328,10 @@ static int mdc_is_subdir(struct obd_export *exp,
return rc;
}
-static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
+static int mdc_xattr_common(struct obd_export *exp,
+ const struct req_format *fmt,
const struct lu_fid *fid,
- struct obd_capa *oc, int opcode, obd_valid valid,
+ struct obd_capa *oc, int opcode, u64 valid,
const char *xattr_name, const char *input,
int input_size, int output_size, int flags,
__u32 suppgid, struct ptlrpc_request **request)
@@ -437,7 +440,7 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
}
int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *xattr_name,
+ struct obd_capa *oc, u64 valid, const char *xattr_name,
const char *input, int input_size, int output_size,
int flags, __u32 suppgid, struct ptlrpc_request **request)
{
@@ -448,7 +451,7 @@ int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
}
int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid,
- struct obd_capa *oc, obd_valid valid, const char *xattr_name,
+ struct obd_capa *oc, u64 valid, const char *xattr_name,
const char *input, int input_size, int output_size,
int flags, struct ptlrpc_request **request)
{
@@ -514,14 +517,14 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
struct lov_mds_md *lmm;
if (!S_ISREG(md->body->mode)) {
- CDEBUG(D_INFO, "OBD_MD_FLEASIZE set, should be a "
- "regular file, but is not\n");
+ CDEBUG(D_INFO,
+ "OBD_MD_FLEASIZE set, should be a regular file, but is not\n");
GOTO(out, rc = -EPROTO);
}
if (md->body->eadatasize == 0) {
- CDEBUG(D_INFO, "OBD_MD_FLEASIZE set, "
- "but eadatasize 0\n");
+ CDEBUG(D_INFO,
+ "OBD_MD_FLEASIZE set, but eadatasize 0\n");
GOTO(out, rc = -EPROTO);
}
lmmsize = md->body->eadatasize;
@@ -534,8 +537,8 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
GOTO(out, rc);
if (rc < sizeof(*md->lsm)) {
- CDEBUG(D_INFO, "lsm size too small: "
- "rc < sizeof (*md->lsm) (%d < %d)\n",
+ CDEBUG(D_INFO,
+ "lsm size too small: rc < sizeof (*md->lsm) (%d < %d)\n",
rc, (int)sizeof(*md->lsm));
GOTO(out, rc = -EPROTO);
}
@@ -544,15 +547,15 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
int lmvsize;
struct lov_mds_md *lmv;
- if(!S_ISDIR(md->body->mode)) {
- CDEBUG(D_INFO, "OBD_MD_FLDIREA set, should be a "
- "directory, but is not\n");
+ if (!S_ISDIR(md->body->mode)) {
+ CDEBUG(D_INFO,
+ "OBD_MD_FLDIREA set, should be a directory, but is not\n");
GOTO(out, rc = -EPROTO);
}
if (md->body->eadatasize == 0) {
- CDEBUG(D_INFO, "OBD_MD_FLDIREA is set, "
- "but eadatasize 0\n");
+ CDEBUG(D_INFO,
+ "OBD_MD_FLDIREA is set, but eadatasize 0\n");
return -EPROTO;
}
if (md->body->valid & OBD_MD_MEA) {
@@ -568,8 +571,8 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
GOTO(out, rc);
if (rc < sizeof(*md->mea)) {
- CDEBUG(D_INFO, "size too small: "
- "rc < sizeof(*md->mea) (%d < %d)\n",
+ CDEBUG(D_INFO,
+ "size too small: rc < sizeof(*md->mea) (%d < %d)\n",
rc, (int)sizeof(*md->mea));
GOTO(out, rc = -EPROTO);
}
@@ -584,8 +587,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
lustre_swab_mdt_remote_perm);
if (!md->remote_perm)
GOTO(out, rc = -EPROTO);
- }
- else if (md->body->valid & OBD_MD_FLACL) {
+ } else if (md->body->valid & OBD_MD_FLACL) {
/* for ACL, it's possible that FLACL is set but aclsize is zero.
* only when aclsize != 0 there's an actual segment for ACL
* in reply buffer.
@@ -695,6 +697,7 @@ void mdc_replay_open(struct ptlrpc_request *req)
void mdc_commit_open(struct ptlrpc_request *req)
{
struct md_open_data *mod = req->rq_cb_data;
+
if (mod == NULL)
return;
@@ -774,8 +777,8 @@ int mdc_set_open_replay_data(struct obd_export *exp,
rec->cr_old_handle.cookie = body->handle.cookie;
open_req->rq_replay_cb = mdc_replay_open;
if (!fid_is_sane(&body->fid1)) {
- DEBUG_REQ(D_ERROR, open_req, "Saving replay request with "
- "insane fid");
+ DEBUG_REQ(D_ERROR, open_req,
+ "Saving replay request with insane fid");
LBUG();
}
@@ -897,7 +900,8 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
mod->mod_open_req->rq_replay = 0;
spin_unlock(&mod->mod_open_req->rq_lock);
} else {
- CDEBUG(D_HA, "couldn't find open req; expecting close error\n");
+ CDEBUG(D_HA,
+ "couldn't find open req; expecting close error\n");
}
mdc_close_pack(req, op_data);
@@ -923,8 +927,8 @@ int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
rc = lustre_msg_get_status(req->rq_repmsg);
if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR) {
- DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR, err "
- "= %d", rc);
+ DEBUG_REQ(D_ERROR, req,
+ "type == PTL_RPC_MSG_ERR, err = %d", rc);
if (rc > 0)
rc = -rc;
}
@@ -1084,7 +1088,8 @@ restart_bulk:
CERROR("too many resend retries, returning error\n");
return -EIO;
}
- lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends), NULL, NULL, NULL);
+ lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends),
+ NULL, NULL, NULL);
l_wait_event(waitq, 0, &lwi);
goto restart_bulk;
@@ -1534,7 +1539,7 @@ static int changelog_kkuc_cb(const struct lu_env *env, struct llog_handle *llh,
memcpy(lh + 1, &rec->cr, len - sizeof(*lh));
rc = libcfs_kkuc_msg_put(cs->cs_fp, lh);
- CDEBUG(D_CHANGELOG, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len,rc);
+ CDEBUG(D_CHANGELOG, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len, rc);
return rc;
}
@@ -1702,7 +1707,7 @@ static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp,
if (oqc) {
*oqctl = *oqc;
} else if (!rc) {
- CERROR ("Can't unpack obd_quotactl\n");
+ CERROR("Can't unpack obd_quotactl\n");
rc = -EPROTO;
}
} else if (!rc) {
@@ -1788,8 +1793,11 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
GOTO(out, rc);
case OBD_IOC_CHANGELOG_CLEAR: {
struct ioc_changelog *icc = karg;
- struct changelog_setinfo cs =
- {.cs_recno = icc->icc_recno, .cs_id = icc->icc_id};
+ struct changelog_setinfo cs = {
+ .cs_recno = icc->icc_recno,
+ .cs_id = icc->icc_id
+ };
+
rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR),
KEY_CHANGELOG_CLEAR, sizeof(cs), &cs,
NULL);
@@ -1918,7 +1926,7 @@ out:
}
int mdc_get_info_rpc(struct obd_export *exp,
- obd_count keylen, void *key,
+ u32 keylen, void *key,
int vallen, void *val)
{
struct obd_import *imp = class_exp2cliimp(exp);
@@ -2049,8 +2057,8 @@ static int mdc_hsm_copytool_send(int len, void *val)
return -EPROTO;
}
- CDEBUG(D_HSM, " Received message mg=%x t=%d m=%d l=%d actions=%d "
- "on %s\n",
+ CDEBUG(D_HSM,
+ "Received message mg=%x t=%d m=%d l=%d actions=%d on %s\n",
lh->kuc_magic, lh->kuc_transport, lh->kuc_msgtype,
lh->kuc_msglen, hal->hal_count, hal->hal_fsname);
@@ -2093,8 +2101,8 @@ static int mdc_kuc_reregister(struct obd_import *imp)
int mdc_set_info_async(const struct lu_env *env,
struct obd_export *exp,
- obd_count keylen, void *key,
- obd_count vallen, void *val,
+ u32 keylen, void *key,
+ u32 vallen, void *val,
struct ptlrpc_request_set *set)
{
struct obd_import *imp = class_exp2cliimp(exp);
@@ -2384,8 +2392,10 @@ int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
return seq_client_alloc_fid(NULL, seq, fid);
}
-struct obd_uuid *mdc_get_uuid(struct obd_export *exp) {
+struct obd_uuid *mdc_get_uuid(struct obd_export *exp)
+{
struct client_obd *cli = &exp->exp_obd->u.cli;
+
return &cli->cl_target_uuid;
}
@@ -2426,14 +2436,14 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
struct lprocfs_static_vars lvars = { NULL };
int rc;
- OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+ OBD_ALLOC(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
if (!cli->cl_rpc_lock)
return -ENOMEM;
mdc_init_rpc_lock(cli->cl_rpc_lock);
ptlrpcd_addref();
- OBD_ALLOC(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+ OBD_ALLOC(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
if (!cli->cl_close_lock)
GOTO(err_rpc_lock, rc = -ENOMEM);
mdc_init_rpc_lock(cli->cl_close_lock);
@@ -2459,9 +2469,9 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
return rc;
err_close_lock:
- OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+ OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
err_rpc_lock:
- OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+ OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
ptlrpcd_decref();
return rc;
}
@@ -2523,8 +2533,8 @@ static int mdc_cleanup(struct obd_device *obd)
{
struct client_obd *cli = &obd->u.cli;
- OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
- OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
+ OBD_FREE(cli->cl_rpc_lock, sizeof(*cli->cl_rpc_lock));
+ OBD_FREE(cli->cl_close_lock, sizeof(*cli->cl_close_lock));
ptlrpcd_decref();
@@ -2563,7 +2573,7 @@ static int mdc_llog_finish(struct obd_device *obd, int count)
return 0;
}
-static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf)
+static int mdc_process_config(struct obd_device *obd, u32 len, void *buf)
{
struct lustre_cfg *lcfg = buf;
struct lprocfs_static_vars lvars = { NULL };
@@ -2578,7 +2588,7 @@ static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf)
rc = 0;
break;
}
- return(rc);
+ return rc;
}
@@ -2738,6 +2748,7 @@ int __init mdc_init(void)
{
int rc;
struct lprocfs_static_vars lvars = { NULL };
+
lprocfs_mdc_init_vars(&lvars);
rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index f520591d5784..aeaa2bfd7f82 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -1100,7 +1100,7 @@ static int mgc_target_register(struct obd_export *exp,
}
int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set)
{
int rc = -EINVAL;
@@ -1844,7 +1844,7 @@ int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
* LCFG_LOG_START gets the config log from the MGS, processes it to start
* any services, and adds it to the list logs to watch (follow).
*/
-static int mgc_process_config(struct obd_device *obd, obd_count len, void *buf)
+static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)
{
struct lustre_cfg *lcfg = buf;
struct config_llog_instance *cfg = NULL;
diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c
index 6870ee823736..c0e06040b811 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_io.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c
@@ -1452,12 +1452,13 @@ struct cl_req *cl_req_alloc(const struct lu_env *env, struct cl_page *page,
if (req != NULL) {
int result;
+ req->crq_type = crt;
+ INIT_LIST_HEAD(&req->crq_pages);
+ INIT_LIST_HEAD(&req->crq_layers);
+
OBD_ALLOC(req->crq_o, nr_objects * sizeof(req->crq_o[0]));
if (req->crq_o != NULL) {
req->crq_nrobjs = nr_objects;
- req->crq_type = crt;
- INIT_LIST_HEAD(&req->crq_pages);
- INIT_LIST_HEAD(&req->crq_layers);
result = cl_req_init(env, req, page);
} else
result = -ENOMEM;
@@ -1559,7 +1560,7 @@ EXPORT_SYMBOL(cl_req_prep);
* for the same request.
*/
void cl_req_attr_set(const struct lu_env *env, struct cl_req *req,
- struct cl_req_attr *attr, obd_valid flags)
+ struct cl_req_attr *attr, u64 flags)
{
const struct cl_req_slice *slice;
struct cl_page *page;
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
index bb15202f1aae..62ed706b136d 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-obdo.c
@@ -52,7 +52,7 @@
/*FIXME: Just copy from obdo_from_inode*/
void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid)
{
- obd_flag newvalid = 0;
+ u32 newvalid = 0;
if (valid & LA_ATIME) {
dst->o_atime = la->la_atime;
@@ -97,7 +97,7 @@ void obdo_from_la(struct obdo *dst, struct lu_attr *la, __u64 valid)
EXPORT_SYMBOL(obdo_from_la);
/*FIXME: Just copy from obdo_from_inode*/
-void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, obd_flag valid)
+void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, u32 valid)
{
__u64 newvalid = 0;
@@ -145,7 +145,7 @@ void la_from_obdo(struct lu_attr *dst, struct obdo *obdo, obd_flag valid)
}
EXPORT_SYMBOL(la_from_obdo);
-void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid)
+void obdo_refresh_inode(struct inode *dst, struct obdo *src, u32 valid)
{
valid &= src->o_valid;
@@ -180,7 +180,7 @@ void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid)
}
EXPORT_SYMBOL(obdo_refresh_inode);
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
+void obdo_to_inode(struct inode *dst, struct obdo *src, u32 valid)
{
valid &= src->o_valid;
diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c
index b3247fb7a35a..bfac8387021e 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c
@@ -61,9 +61,9 @@ static void print_llogd_body(struct llogd_body *d)
void lustre_swab_lu_fid(struct lu_fid *fid)
{
- __swab64s (&fid->f_seq);
- __swab32s (&fid->f_oid);
- __swab32s (&fid->f_ver);
+ __swab64s(&fid->f_seq);
+ __swab32s(&fid->f_oid);
+ __swab32s(&fid->f_ver);
}
EXPORT_SYMBOL(lustre_swab_lu_fid);
@@ -82,47 +82,47 @@ void lustre_swab_llog_id(struct llog_logid *log_id)
{
__swab64s(&log_id->lgl_oi.oi.oi_id);
__swab64s(&log_id->lgl_oi.oi.oi_seq);
- __swab32s(&log_id->lgl_ogen);
+ __swab32s(&log_id->lgl_ogen);
}
EXPORT_SYMBOL(lustre_swab_llog_id);
-void lustre_swab_llogd_body (struct llogd_body *d)
+void lustre_swab_llogd_body(struct llogd_body *d)
{
print_llogd_body(d);
lustre_swab_llog_id(&d->lgd_logid);
- __swab32s (&d->lgd_ctxt_idx);
- __swab32s (&d->lgd_llh_flags);
- __swab32s (&d->lgd_index);
- __swab32s (&d->lgd_saved_index);
- __swab32s (&d->lgd_len);
- __swab64s (&d->lgd_cur_offset);
+ __swab32s(&d->lgd_ctxt_idx);
+ __swab32s(&d->lgd_llh_flags);
+ __swab32s(&d->lgd_index);
+ __swab32s(&d->lgd_saved_index);
+ __swab32s(&d->lgd_len);
+ __swab64s(&d->lgd_cur_offset);
print_llogd_body(d);
}
EXPORT_SYMBOL(lustre_swab_llogd_body);
-void lustre_swab_llogd_conn_body (struct llogd_conn_body *d)
+void lustre_swab_llogd_conn_body(struct llogd_conn_body *d)
{
- __swab64s (&d->lgdc_gen.mnt_cnt);
- __swab64s (&d->lgdc_gen.conn_cnt);
+ __swab64s(&d->lgdc_gen.mnt_cnt);
+ __swab64s(&d->lgdc_gen.conn_cnt);
lustre_swab_llog_id(&d->lgdc_logid);
- __swab32s (&d->lgdc_ctxt_idx);
+ __swab32s(&d->lgdc_ctxt_idx);
}
EXPORT_SYMBOL(lustre_swab_llogd_conn_body);
void lustre_swab_ll_fid(struct ll_fid *fid)
{
- __swab64s (&fid->id);
- __swab32s (&fid->generation);
- __swab32s (&fid->f_type);
+ __swab64s(&fid->id);
+ __swab32s(&fid->generation);
+ __swab32s(&fid->f_type);
}
EXPORT_SYMBOL(lustre_swab_ll_fid);
void lustre_swab_lu_seq_range(struct lu_seq_range *range)
{
- __swab64s (&range->lsr_start);
- __swab64s (&range->lsr_end);
- __swab32s (&range->lsr_index);
- __swab32s (&range->lsr_flags);
+ __swab64s(&range->lsr_start);
+ __swab64s(&range->lsr_end);
+ __swab32s(&range->lsr_index);
+ __swab32s(&range->lsr_flags);
}
EXPORT_SYMBOL(lustre_swab_lu_seq_range);
@@ -168,7 +168,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
}
case CHANGELOG_REC:
{
- struct llog_changelog_rec *cr = (struct llog_changelog_rec*)rec;
+ struct llog_changelog_rec *cr = (struct llog_changelog_rec *)rec;
__swab16s(&cr->cr.cr_namelen);
__swab16s(&cr->cr.cr_flags);
@@ -193,7 +193,7 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
case CHANGELOG_USER_REC:
{
struct llog_changelog_user_rec *cur =
- (struct llog_changelog_user_rec*)rec;
+ (struct llog_changelog_user_rec *)rec;
__swab32s(&cur->cur_id);
__swab64s(&cur->cur_endrec);
@@ -294,7 +294,7 @@ static void print_llog_hdr(struct llog_log_hdr *h)
CDEBUG(D_OTHER, "\tllh_tail.lrt_len: %#x\n", h->llh_tail.lrt_len);
}
-void lustre_swab_llog_hdr (struct llog_log_hdr *h)
+void lustre_swab_llog_hdr(struct llog_log_hdr *h)
{
print_llog_hdr(h);
@@ -367,7 +367,7 @@ struct cfg_marker32 {
void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size)
{
- struct cfg_marker32 *cm32 = (struct cfg_marker32*)marker;
+ struct cfg_marker32 *cm32 = (struct cfg_marker32 *)marker;
if (swab) {
__swab32s(&marker->cm_step);
diff --git a/drivers/staging/lustre/lustre/obdclass/local_storage.c b/drivers/staging/lustre/lustre/obdclass/local_storage.c
index 78190225ac7a..6e0f6f2f1231 100644
--- a/drivers/staging/lustre/lustre/obdclass/local_storage.c
+++ b/drivers/staging/lustre/lustre/obdclass/local_storage.c
@@ -745,7 +745,7 @@ int local_oid_storage_init(const struct lu_env *env, struct dt_device *dev,
{
struct dt_thread_info *dti = dt_info(env);
struct ls_device *ls;
- obd_id lastid;
+ u64 lastid;
struct dt_object *o = NULL;
struct thandle *th;
__u32 first_oid = fid_oid(first_fid);
diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c
index c9fa36b17919..07469524773b 100644
--- a/drivers/staging/lustre/lustre/obdclass/obdo.c
+++ b/drivers/staging/lustre/lustre/obdclass/obdo.c
@@ -56,9 +56,9 @@ EXPORT_SYMBOL(obdo_set_parent_fid);
/* WARNING: the file systems must take care not to tinker with
attributes they don't manage (such as blocks). */
-void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
+void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid)
{
- obd_flag newvalid = 0;
+ u32 newvalid = 0;
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
@@ -115,7 +115,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
}
EXPORT_SYMBOL(obdo_from_inode);
-void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid)
+void obdo_cpy_md(struct obdo *dst, struct obdo *src, u32 valid)
{
CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n",
POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi));
@@ -157,7 +157,7 @@ void obdo_cpy_md(struct obdo *dst, struct obdo *src, obd_flag valid)
EXPORT_SYMBOL(obdo_cpy_md);
/* returns FALSE if comparison (by flags) is same, TRUE if changed */
-int obdo_cmp_md(struct obdo *dst, struct obdo *src, obd_flag compare)
+int obdo_cmp_md(struct obdo *dst, struct obdo *src, u32 compare)
{
int res = 0;
@@ -247,7 +247,7 @@ void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
}
EXPORT_SYMBOL(obdo_from_iattr);
-void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid)
+void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid)
{
valid &= oa->o_valid;
@@ -296,7 +296,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid)
}
EXPORT_SYMBOL(iattr_from_obdo);
-void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, obd_flag valid)
+void md_from_obdo(struct md_op_data *op_data, struct obdo *oa, u32 valid)
{
iattr_from_obdo(&op_data->op_attr, oa, valid);
if (valid & OBD_MD_FLBLOCKS) {
diff --git a/drivers/staging/lustre/lustre/obdecho/echo.c b/drivers/staging/lustre/lustre/obdecho/echo.c
index dae1599af384..358be902c872 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo.c
@@ -104,7 +104,7 @@ static int echo_destroy_export(struct obd_export *exp)
static __u64 echo_next_id(struct obd_device *obddev)
{
- obd_id id;
+ u64 id;
spin_lock(&obddev->u.echo.eo_lock);
id = ++obddev->u.echo.eo_lastino;
@@ -173,7 +173,7 @@ static int echo_getattr(const struct lu_env *env, struct obd_export *exp,
struct obd_info *oinfo)
{
struct obd_device *obd = class_exp2obd(exp);
- obd_id id = ostid_id(&oinfo->oi_oa->o_oi);
+ u64 id = ostid_id(&oinfo->oi_oa->o_oi);
if (!obd) {
CERROR("invalid client cookie %#llx\n",
@@ -224,7 +224,7 @@ static int echo_setattr(const struct lu_env *env, struct obd_export *exp,
}
static void
-echo_page_debug_setup(struct page *page, int rw, obd_id id,
+echo_page_debug_setup(struct page *page, int rw, u64 id,
__u64 offset, int len)
{
int page_offset = offset & ~CFS_PAGE_MASK;
@@ -251,7 +251,7 @@ echo_page_debug_setup(struct page *page, int rw, obd_id id,
}
static int
-echo_page_debug_check(struct page *page, obd_id id,
+echo_page_debug_check(struct page *page, u64 id,
__u64 offset, int len)
{
int page_offset = offset & ~CFS_PAGE_MASK;
@@ -293,7 +293,7 @@ static int echo_map_nb_to_lb(struct obdo *oa, struct obd_ioobj *obj,
(oa->o_valid & OBD_MD_FLFLAGS) != 0 &&
(oa->o_flags & OBD_FL_DEBUG_CHECK) != 0);
struct niobuf_local *res = lb;
- obd_off offset = nb->offset;
+ u64 offset = nb->offset;
int len = nb->len;
while (len > 0) {
@@ -354,11 +354,12 @@ static int echo_finalize_lb(struct obdo *oa, struct obd_ioobj *obj,
struct niobuf_local *lb, int verify)
{
struct niobuf_local *res = lb;
- obd_off start = rb->offset >> PAGE_CACHE_SHIFT;
- obd_off end = (rb->offset + rb->len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
- int count = (int)(end - start);
- int rc = 0;
- int i;
+ u64 start = rb->offset >> PAGE_CACHE_SHIFT;
+ u64 end = (rb->offset + rb->len + PAGE_CACHE_SIZE - 1) >>
+ PAGE_CACHE_SHIFT;
+ int count = (int)(end - start);
+ int rc = 0;
+ int i;
for (i = 0; i < count; i++, (*pgs) ++, res++) {
struct page *page = res->page;
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index f1847f3f579d..22736698ffff 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -175,10 +175,10 @@ struct echo_object_conf *cl2echo_conf(const struct cl_object_conf *c)
static struct echo_object *cl_echo_object_find(struct echo_device *d,
struct lov_stripe_md **lsm);
static int cl_echo_object_put(struct echo_object *eco);
-static int cl_echo_enqueue (struct echo_object *eco, obd_off start,
- obd_off end, int mode, __u64 *cookie);
-static int cl_echo_cancel (struct echo_device *d, __u64 cookie);
-static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset,
+static int cl_echo_enqueue(struct echo_object *eco, u64 start,
+ u64 end, int mode, __u64 *cookie);
+static int cl_echo_cancel(struct echo_device *d, __u64 cookie);
+static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
struct page **pages, int npages, int async);
static struct echo_thread_info *echo_env_info(const struct lu_env *env);
@@ -1141,7 +1141,7 @@ static int cl_echo_object_put(struct echo_object *eco)
}
static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
- obd_off start, obd_off end, int mode,
+ u64 start, u64 end, int mode,
__u64 *cookie , __u32 enqflags)
{
struct cl_io *io;
@@ -1186,7 +1186,7 @@ static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
return rc;
}
-static int cl_echo_enqueue(struct echo_object *eco, obd_off start, obd_off end,
+static int cl_echo_enqueue(struct echo_object *eco, u64 start, u64 end,
int mode, __u64 *cookie)
{
struct echo_thread_info *info;
@@ -1280,7 +1280,7 @@ static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io,
return result;
}
-static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset,
+static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
struct page **pages, int npages, int async)
{
struct lu_env *env;
@@ -1374,7 +1374,7 @@ out:
/** @} echo_exports */
-static obd_id last_object_id;
+static u64 last_object_id;
static int
echo_copyout_lsm (struct lov_stripe_md *lsm, void *_ulsm, int ulsm_nob)
@@ -2324,14 +2324,14 @@ static void echo_put_object(struct echo_object *eco)
}
static void
-echo_get_stripe_off_id (struct lov_stripe_md *lsm, obd_off *offp, obd_id *idp)
+echo_get_stripe_off_id(struct lov_stripe_md *lsm, u64 *offp, u64 *idp)
{
unsigned long stripe_count;
unsigned long stripe_size;
unsigned long width;
unsigned long woffset;
int stripe_index;
- obd_off offset;
+ u64 offset;
if (lsm->lsm_stripe_count <= 1)
return;
@@ -2354,12 +2354,12 @@ echo_get_stripe_off_id (struct lov_stripe_md *lsm, obd_off *offp, obd_id *idp)
static void
echo_client_page_debug_setup(struct lov_stripe_md *lsm,
- struct page *page, int rw, obd_id id,
- obd_off offset, obd_off count)
+ struct page *page, int rw, u64 id,
+ u64 offset, u64 count)
{
char *addr;
- obd_off stripe_off;
- obd_id stripe_id;
+ u64 stripe_off;
+ u64 stripe_id;
int delta;
/* no partial pages on the client */
@@ -2384,11 +2384,11 @@ echo_client_page_debug_setup(struct lov_stripe_md *lsm,
}
static int echo_client_page_debug_check(struct lov_stripe_md *lsm,
- struct page *page, obd_id id,
- obd_off offset, obd_off count)
+ struct page *page, u64 id,
+ u64 offset, u64 count)
{
- obd_off stripe_off;
- obd_id stripe_id;
+ u64 stripe_off;
+ u64 stripe_id;
char *addr;
int delta;
int rc;
@@ -2418,16 +2418,16 @@ static int echo_client_page_debug_check(struct lov_stripe_md *lsm,
}
static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
- struct echo_object *eco, obd_off offset,
- obd_size count, int async,
+ struct echo_object *eco, u64 offset,
+ u64 count, int async,
struct obd_trans_info *oti)
{
struct lov_stripe_md *lsm = eco->eo_lsm;
- obd_count npages;
+ u32 npages;
struct brw_page *pga;
struct brw_page *pgp;
struct page **pages;
- obd_off off;
+ u64 off;
int i;
int rc;
int verify;
@@ -2516,16 +2516,16 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa,
static int echo_client_prep_commit(const struct lu_env *env,
struct obd_export *exp, int rw,
struct obdo *oa, struct echo_object *eco,
- obd_off offset, obd_size count,
- obd_size batch, struct obd_trans_info *oti,
+ u64 offset, u64 count,
+ u64 batch, struct obd_trans_info *oti,
int async)
{
struct lov_stripe_md *lsm = eco->eo_lsm;
struct obd_ioobj ioo;
struct niobuf_local *lnb;
struct niobuf_remote *rnb;
- obd_off off;
- obd_size npages, tot_pages;
+ u64 off;
+ u64 npages, tot_pages;
int i, ret = 0, brw_flags = 0;
if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0 ||
@@ -2677,12 +2677,12 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw,
static int
echo_client_enqueue(struct obd_export *exp, struct obdo *oa,
- int mode, obd_off offset, obd_size nob)
+ int mode, u64 offset, u64 nob)
{
struct echo_device *ed = obd2echo_dev(exp->exp_obd);
struct lustre_handle *ulh = &oa->o_handle;
struct echo_object *eco;
- obd_off end;
+ u64 end;
int rc;
if (ed->ed_next == NULL)
@@ -2699,7 +2699,7 @@ echo_client_enqueue(struct obd_export *exp, struct obdo *oa,
if (rc != 0)
return rc;
- end = (nob == 0) ? ((obd_off) -1) : (offset + nob - 1);
+ end = (nob == 0) ? ((u64) -1) : (offset + nob - 1);
rc = cl_echo_enqueue(eco, offset, end, mode, &ulh->cookie);
if (rc == 0) {
oa->o_valid |= OBD_MD_FLHANDLE;
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 2ab403548b5e..ad2777fc217d 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -148,7 +148,7 @@ static ssize_t osc_max_dirty_mb_seq_write(struct file *file, const char *buffer,
return -ERANGE;
client_obd_list_lock(&cli->cl_loi_list_lock);
- cli->cl_dirty_max = (obd_count)(pages_number << PAGE_CACHE_SHIFT);
+ cli->cl_dirty_max = (u32)(pages_number << PAGE_CACHE_SHIFT);
osc_wake_cache_waiters(cli);
client_obd_list_unlock(&cli->cl_loi_list_lock);
diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 57d7dba23479..7734d666b7a1 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1885,7 +1885,7 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli,
struct osc_extent *ext;
struct osc_extent *tmp;
struct osc_extent *first = NULL;
- obd_count page_count = 0;
+ u32 page_count = 0;
int srvlock = 0;
int rc = 0;
diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
index 2d1f977dca36..3aa80d949b27 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h
@@ -435,7 +435,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
enum cl_req_type crt, int brw_flags);
int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops);
int osc_set_async_flags(struct osc_object *obj, struct osc_page *opg,
- obd_flag async_flags);
+ u32 async_flags);
int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
struct page *page, loff_t offset);
int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h
index f67a70083621..0f182da96dc4 100644
--- a/drivers/staging/lustre/lustre/osc/osc_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_internal.h
@@ -59,7 +59,7 @@ struct osc_async_page {
struct list_head oap_pending_item;
struct list_head oap_rpc_item;
- obd_off oap_obj_off;
+ u64 oap_obj_off;
unsigned oap_page_off;
enum async_flags oap_async_flags;
@@ -192,12 +192,12 @@ extern struct kmem_cache *osc_quota_kmem;
struct osc_quota_info {
/** linkage for quota hash table */
struct hlist_node oqi_hash;
- obd_uid oqi_id;
+ u32 oqi_id;
};
int osc_quota_setup(struct obd_device *obd);
int osc_quota_cleanup(struct obd_device *obd);
int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
- obd_flag valid, obd_flag flags);
+ u32 valid, u32 flags);
int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[]);
int osc_quotactl(struct obd_device *unused, struct obd_export *exp,
struct obd_quotactl *oqctl);
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
index 54fe836a64cd..886b1ef8f6ea 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -711,7 +711,7 @@ static void osc_req_completion(const struct lu_env *env,
static void osc_req_attr_set(const struct lu_env *env,
const struct cl_req_slice *slice,
const struct cl_object *obj,
- struct cl_req_attr *attr, obd_valid flags)
+ struct cl_req_attr *attr, u64 flags)
{
struct lov_oinfo *oinfo;
struct cl_req *clerq;
diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c
index 3563809072b4..db4540a0a495 100644
--- a/drivers/staging/lustre/lustre/osc/osc_quota.c
+++ b/drivers/staging/lustre/lustre/osc/osc_quota.c
@@ -31,7 +31,7 @@
#include "../include/obd_ost.h"
#include "osc_internal.h"
-static inline struct osc_quota_info *osc_oqi_alloc(obd_uid id)
+static inline struct osc_quota_info *osc_oqi_alloc(u32 id)
{
struct osc_quota_info *oqi;
@@ -71,7 +71,7 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[])
: OBD_FL_NO_GRPQUOTA)
int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],
- obd_flag valid, obd_flag flags)
+ u32 valid, u32 flags)
{
int type;
int rc = 0;
@@ -145,10 +145,10 @@ static int
oqi_keycmp(const void *key, struct hlist_node *hnode)
{
struct osc_quota_info *oqi;
- obd_uid uid;
+ u32 uid;
LASSERT(key != NULL);
- uid = *((obd_uid*)key);
+ uid = *((u32 *)key);
oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
return uid == oqi->oqi_id;
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index fb0d9fb9cebc..c502f346db9a 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -54,7 +54,7 @@
#include "osc_internal.h"
#include "osc_cl_internal.h"
-static void osc_release_ppga(struct brw_page **ppga, obd_count count);
+static void osc_release_ppga(struct brw_page **ppga, u32 count);
static int brw_interpret(const struct lu_env *env,
struct ptlrpc_request *req, void *data, int rc);
int osc_cleanup(struct obd_device *obd);
@@ -615,7 +615,7 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
}
static int osc_sync(const struct lu_env *env, struct obd_export *exp,
- struct obd_info *oinfo, obd_size start, obd_size end,
+ struct obd_info *oinfo, u64 start, u64 end,
struct ptlrpc_request_set *set)
{
if (!oinfo->oi_oa) {
@@ -799,7 +799,7 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
long writing_bytes)
{
- obd_flag bits = OBD_MD_FLBLOCKS|OBD_MD_FLGRANT;
+ u32 bits = OBD_MD_FLBLOCKS|OBD_MD_FLGRANT;
LASSERT(!(oa->o_valid & bits));
@@ -849,7 +849,7 @@ void osc_update_next_shrink(struct client_obd *cli)
cli->cl_next_shrink_grant);
}
-static void __osc_update_grant(struct client_obd *cli, obd_size grant)
+static void __osc_update_grant(struct client_obd *cli, u64 grant)
{
client_obd_list_lock(&cli->cl_loi_list_lock);
cli->cl_avail_grant += grant;
@@ -865,7 +865,7 @@ static void osc_update_grant(struct client_obd *cli, struct ost_body *body)
}
static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set);
static int osc_shrink_grant_interpret(const struct lu_env *env,
@@ -1067,7 +1067,7 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd)
* beyond the end of a stripe file; i.e. lustre is reading a sparse file
* via the LOV, and it _knows_ it's reading inside the file, it's just that
* this stripe never got written at or beyond this stripe offset yet. */
-static void handle_short_read(int nob_read, obd_count page_count,
+static void handle_short_read(int nob_read, u32 page_count,
struct brw_page **pga)
{
char *ptr;
@@ -1104,7 +1104,7 @@ static void handle_short_read(int nob_read, obd_count page_count,
static int check_write_rcs(struct ptlrpc_request *req,
int requested_nob, int niocount,
- obd_count page_count, struct brw_page **pga)
+ u32 page_count, struct brw_page **pga)
{
int i;
__u32 *remote_rcs;
@@ -1157,7 +1157,7 @@ static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2)
return (p1->off + p1->count == p2->off);
}
-static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
+static u32 osc_checksum_bulk(int nob, u32 pg_count,
struct brw_page **pga, int opc,
cksum_type_t cksum_type)
{
@@ -1219,7 +1219,7 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
}
static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
- struct lov_stripe_md *lsm, obd_count page_count,
+ struct lov_stripe_md *lsm, u32 page_count,
struct brw_page **pga,
struct ptlrpc_request **reqp,
struct obd_capa *ocapa, int reserve,
@@ -1422,7 +1422,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
static int check_write_checksum(struct obdo *oa, const lnet_process_id_t *peer,
__u32 client_cksum, __u32 server_cksum, int nob,
- obd_count page_count, struct brw_page **pga,
+ u32 page_count, struct brw_page **pga,
cksum_type_t client_cksum_type)
{
__u32 new_cksum;
@@ -1618,7 +1618,7 @@ out:
static int osc_brw_internal(int cmd, struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md *lsm,
- obd_count page_count, struct brw_page **pga,
+ u32 page_count, struct brw_page **pga,
struct obd_capa *ocapa)
{
struct ptlrpc_request *req;
@@ -1787,7 +1787,7 @@ static void sort_brw_pages(struct brw_page **array, int num)
} while (stride > 1);
}
-static obd_count max_unfragmented_pages(struct brw_page **pg, obd_count pages)
+static u32 max_unfragmented_pages(struct brw_page **pg, u32 pages)
{
int count = 1;
int offset;
@@ -1813,7 +1813,7 @@ static obd_count max_unfragmented_pages(struct brw_page **pg, obd_count pages)
}
}
-static struct brw_page **osc_build_ppga(struct brw_page *pga, obd_count count)
+static struct brw_page **osc_build_ppga(struct brw_page *pga, u32 count)
{
struct brw_page **ppga;
int i;
@@ -1827,14 +1827,14 @@ static struct brw_page **osc_build_ppga(struct brw_page *pga, obd_count count)
return ppga;
}
-static void osc_release_ppga(struct brw_page **ppga, obd_count count)
+static void osc_release_ppga(struct brw_page **ppga, u32 count)
{
LASSERT(ppga != NULL);
OBD_FREE(ppga, sizeof(*ppga) * count);
}
static int osc_brw(int cmd, struct obd_export *exp, struct obd_info *oinfo,
- obd_count page_count, struct brw_page *pga,
+ u32 page_count, struct brw_page *pga,
struct obd_trans_info *oti)
{
struct obdo *saved_oa = NULL;
@@ -1867,7 +1867,7 @@ static int osc_brw(int cmd, struct obd_export *exp, struct obd_info *oinfo,
sort_brw_pages(ppga, page_count);
while (page_count) {
- obd_count pages_per_brw;
+ u32 pages_per_brw;
if (page_count > cli->cl_max_pages_per_rpc)
pages_per_brw = cli->cl_max_pages_per_rpc;
@@ -2029,8 +2029,8 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
CRT_READ;
struct ldlm_lock *lock = NULL;
struct cl_req_attr *crattr = NULL;
- obd_off starting_offset = OBD_OBJECT_EOF;
- obd_off ending_offset = 0;
+ u64 starting_offset = OBD_OBJECT_EOF;
+ u64 ending_offset = 0;
int mpflag = 0;
int mem_tight = 0;
int page_count = 0;
@@ -2965,7 +2965,7 @@ out:
}
static int osc_get_info(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, __u32 *vallen, void *val,
+ u32 keylen, void *key, __u32 *vallen, void *val,
struct lov_stripe_md *lsm)
{
if (!vallen || !val)
@@ -2978,7 +2978,7 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp,
return 0;
} else if (KEY_IS(KEY_LAST_ID)) {
struct ptlrpc_request *req;
- obd_id *reply;
+ u64 *reply;
char *tmp;
int rc;
@@ -3008,7 +3008,7 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp,
if (reply == NULL)
GOTO(out, rc = -EPROTO);
- *((obd_id *)val) = *reply;
+ *((u64 *)val) = *reply;
out:
ptlrpc_req_finished(req);
return rc;
@@ -3100,7 +3100,7 @@ drop_lock:
}
static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
- obd_count keylen, void *key, obd_count vallen,
+ u32 keylen, void *key, u32 vallen,
void *val, struct ptlrpc_request_set *set)
{
struct ptlrpc_request *req;
@@ -3562,7 +3562,7 @@ int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg)
return(rc);
}
-static int osc_process_config(struct obd_device *obd, obd_count len, void *buf)
+static int osc_process_config(struct obd_device *obd, u32 len, void *buf)
{
return osc_process_config_base(obd, buf);
}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index 4146e8b29a6d..8fa9b7127c27 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -267,7 +267,7 @@ static void ptlrpc_at_adj_service(struct ptlrpc_request *req,
if (oldse != 0)
CDEBUG(D_ADAPTTO, "The RPC service estimate for %s ptl %d "
"has changed from %d to %d\n",
- req->rq_import->imp_obd->obd_name,req->rq_request_portal,
+ req->rq_import->imp_obd->obd_name, req->rq_request_portal,
oldse, at_get(&at->iat_service_estimate[idx]));
}
@@ -721,7 +721,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp,
*/
static struct ptlrpc_request *
ptlrpc_request_alloc_internal(struct obd_import *imp,
- struct ptlrpc_request_pool * pool,
+ struct ptlrpc_request_pool *pool,
const struct req_format *format)
{
struct ptlrpc_request *request;
@@ -751,7 +751,7 @@ EXPORT_SYMBOL(ptlrpc_request_alloc);
* initialize its buffer structure according to capsule template \a format.
*/
struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp,
- struct ptlrpc_request_pool * pool,
+ struct ptlrpc_request_pool *pool,
const struct req_format *format)
{
return ptlrpc_request_alloc_internal(imp, pool, format);
@@ -2132,7 +2132,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
* interrupts are allowed. Wait until all
* complete, or an in-flight req times out.
*/
- lwi = LWI_TIMEOUT(cfs_time_seconds(timeout? timeout : 1),
+ lwi = LWI_TIMEOUT(cfs_time_seconds(timeout ? timeout : 1),
ptlrpc_expired_set, set);
rc = l_wait_event(set->set_waitq, ptlrpc_check_set(NULL, set), &lwi);
@@ -2186,7 +2186,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
}
if (set->set_interpret != NULL) {
- int (*interpreter)(struct ptlrpc_request_set *set,void *,int) =
+ int (*interpreter)(struct ptlrpc_request_set *set, void *, int) =
set->set_interpret;
rc = interpreter (set, set->set_arg, rc);
} else {
@@ -2222,7 +2222,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)
}
LASSERTF(!request->rq_receiving_reply, "req %p\n", request);
- LASSERTF(request->rq_rqbd == NULL, "req %p\n",request);/* client-side */
+ LASSERTF(request->rq_rqbd == NULL, "req %p\n", request);/* client-side */
LASSERTF(list_empty(&request->rq_list), "req %p\n", request);
LASSERTF(list_empty(&request->rq_set_chain), "req %p\n", request);
LASSERTF(list_empty(&request->rq_exp_list), "req %p\n", request);
@@ -2692,7 +2692,7 @@ struct ptlrpc_replay_async_args {
*/
static int ptlrpc_replay_interpret(const struct lu_env *env,
struct ptlrpc_request *req,
- void * data, int rc)
+ void *data, int rc)
{
struct ptlrpc_replay_async_args *aa = data;
struct obd_import *imp = req->rq_import;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/connection.c b/drivers/staging/lustre/lustre/ptlrpc/connection.c
index adff1ab4f5a4..62154c45f420 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/connection.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/connection.c
@@ -41,7 +41,7 @@
#include "ptlrpc_internal.h"
-static struct cfs_hash *conn_hash = NULL;
+static struct cfs_hash *conn_hash;
static cfs_hash_ops_t conn_hash_ops;
struct ptlrpc_connection *
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c
index f522fc5d3a93..771b213b17ae 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -1024,10 +1024,17 @@ finish:
spin_unlock(&imp->imp_lock);
- if (!ocd->ocd_ibits_known &&
- ocd->ocd_connect_flags & OBD_CONNECT_IBITS)
- CERROR("Inodebits aware server returned zero compatible"
- " bits?\n");
+ if ((imp->imp_connect_flags_orig & OBD_CONNECT_IBITS) &&
+ !(ocd->ocd_connect_flags & OBD_CONNECT_IBITS)) {
+ LCONSOLE_WARN("%s: MDS %s does not support ibits "
+ "lock, either very old or invalid: "
+ "requested %llx, replied %llx\n",
+ imp->imp_obd->obd_name,
+ imp->imp_connection->c_remote_uuid.uuid,
+ imp->imp_connect_flags_orig,
+ ocd->ocd_connect_flags);
+ GOTO(out, rc = -EPROTO);
+ }
if ((ocd->ocd_connect_flags & OBD_CONNECT_VERSION) &&
(ocd->ocd_version > LUSTRE_VERSION_CODE +
diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c
index 511cb9cbf0d4..5b8337187b59 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
@@ -1094,8 +1094,8 @@ struct req_msg_field RMF_EAVALS_LENS =
EXPORT_SYMBOL(RMF_EAVALS_LENS);
struct req_msg_field RMF_OBD_ID =
- DEFINE_MSGF("obd_id", 0,
- sizeof(obd_id), lustre_swab_ost_last_id, NULL);
+ DEFINE_MSGF("u64", 0,
+ sizeof(u64), lustre_swab_ost_last_id, NULL);
EXPORT_SYMBOL(RMF_OBD_ID);
struct req_msg_field RMF_FID =
diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
index ac562932ccdf..50556db15f79 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
@@ -1600,8 +1600,8 @@ EXPORT_SYMBOL(ptlrpc_req_set_repsize);
*/
int do_set_info_async(struct obd_import *imp,
int opcode, int version,
- obd_count keylen, void *key,
- obd_count vallen, void *val,
+ u32 keylen, void *key,
+ u32 vallen, void *val,
struct ptlrpc_request_set *set)
{
struct ptlrpc_request *req;
@@ -1797,7 +1797,7 @@ void lustre_swab_ost_body(struct ost_body *b)
}
EXPORT_SYMBOL(lustre_swab_ost_body);
-void lustre_swab_ost_last_id(obd_id *id)
+void lustre_swab_ost_last_id(u64 *id)
{
__swab64s(id);
}
diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 3464e0c521e6..3628bcb840c3 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -252,15 +252,13 @@ static int spinand_enable_ecc(struct spi_device *spi_nand)
if (retval < 0)
return retval;
- if ((otp & OTP_ECC_MASK) == OTP_ECC_MASK) {
+ if ((otp & OTP_ECC_MASK) == OTP_ECC_MASK)
return 0;
- } else {
- otp |= OTP_ECC_MASK;
- retval = spinand_set_otp(spi_nand, &otp);
- if (retval < 0)
- return retval;
- return spinand_get_otp(spi_nand, &otp);
- }
+ otp |= OTP_ECC_MASK;
+ retval = spinand_set_otp(spi_nand, &otp);
+ if (retval < 0)
+ return retval;
+ return spinand_get_otp(spi_nand, &otp);
}
#endif
@@ -279,8 +277,8 @@ static int spinand_disable_ecc(struct spi_device *spi_nand)
if (retval < 0)
return retval;
return spinand_get_otp(spi_nand, &otp);
- } else
- return 0;
+ }
+ return 0;
}
/**
@@ -529,8 +527,8 @@ static int spinand_program_page(struct spi_device *spi_nand,
dev_err(&spi_nand->dev,
"program error, page %d\n", page_id);
return -1;
- } else
- break;
+ }
+ break;
}
}
#ifdef CONFIG_MTD_SPINAND_ONDIEECC
@@ -605,8 +603,8 @@ static int spinand_erase_block(struct spi_device *spi_nand, u16 block_id)
dev_err(&spi_nand->dev,
"erase error, block %d\n", block_id);
return -1;
- } else
- break;
+ }
+ break;
}
}
return 0;
diff --git a/drivers/staging/nokia_h4p/nokia_core.c b/drivers/staging/nokia_h4p/nokia_core.c
index 775e1d043230..240da0c4ee72 100644
--- a/drivers/staging/nokia_h4p/nokia_core.c
+++ b/drivers/staging/nokia_h4p/nokia_core.c
@@ -1113,7 +1113,7 @@ static int hci_h4p_probe(struct platform_device *pdev)
GPIOF_OUT_INIT_LOW, "bt_wakeup");
if (err < 0) {
- dev_err(info->dev, "Cannot get GPIO line 0x%d",
+ dev_err(info->dev, "Cannot get GPIO line 0x%x",
info->bt_wakeup_gpio);
return err;
}
diff --git a/drivers/staging/nokia_h4p/nokia_fw.c b/drivers/staging/nokia_h4p/nokia_fw.c
index 14ba2193efb6..18953aed5a29 100644
--- a/drivers/staging/nokia_h4p/nokia_fw.c
+++ b/drivers/staging/nokia_h4p/nokia_fw.c
@@ -197,8 +197,6 @@ void hci_h4p_parse_fw_event(struct hci_h4p_info *info, struct sk_buff *skb)
dev_err(info->dev, "Don't know how to parse fw event\n");
info->fw_error = -EINVAL;
}
-
- return;
}
MODULE_FIRMWARE(FW_NAME_TI1271_PRELE);
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index 10c0a96ce8bb..c73d3969a6b2 100644
--- a/drivers/staging/ozwpan/ozcdev.c
+++ b/drivers/staging/ozwpan/ozcdev.c
@@ -49,11 +49,11 @@ static struct oz_serial_ctx *oz_cdev_claim_ctx(struct oz_pd *pd)
{
struct oz_serial_ctx *ctx;
- spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
- ctx = (struct oz_serial_ctx *)pd->app_ctx[OZ_APPID_SERIAL-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
+ ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL];
if (ctx)
atomic_inc(&ctx->ref_count);
- spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
return ctx;
}
@@ -182,8 +182,8 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf,
app_hdr->app_id = OZ_APPID_SERIAL;
if (copy_from_user(app_hdr+1, buf, count))
goto out;
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- ctx = (struct oz_serial_ctx *)pd->app_ctx[OZ_APPID_SERIAL-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL];
if (ctx) {
app_hdr->elt_seq_num = ctx->tx_seq_num++;
if (ctx->tx_seq_num == 0)
@@ -193,7 +193,7 @@ static ssize_t oz_cdev_write(struct file *filp, const char __user *buf,
ei = NULL;
spin_unlock(&eb->lock);
}
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
out:
if (ei) {
count = 0;
@@ -360,7 +360,6 @@ int oz_cdev_register(void)
MAJOR(g_cdev.devnum), MINOR(g_cdev.devnum));
cdev_init(&g_cdev.cdev, &oz_fops);
g_cdev.cdev.owner = THIS_MODULE;
- g_cdev.cdev.ops = &oz_fops;
spin_lock_init(&g_cdev.lock);
init_waitqueue_head(&g_cdev.rdq);
err = cdev_add(&g_cdev.cdev, g_cdev.devnum, 1);
@@ -437,14 +436,14 @@ int oz_cdev_start(struct oz_pd *pd, int resume)
return -ENOMEM;
atomic_set(&ctx->ref_count, 1);
ctx->tx_seq_num = 1;
- spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
- old_ctx = pd->app_ctx[OZ_APPID_SERIAL-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
+ old_ctx = pd->app_ctx[OZ_APPID_SERIAL];
if (old_ctx) {
- spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
kfree(ctx);
} else {
- pd->app_ctx[OZ_APPID_SERIAL-1] = ctx;
- spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
+ pd->app_ctx[OZ_APPID_SERIAL] = ctx;
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
}
spin_lock(&g_cdev.lock);
if ((g_cdev.active_pd == NULL) &&
@@ -469,10 +468,10 @@ void oz_cdev_stop(struct oz_pd *pd, int pause)
oz_dbg(ON, "Serial service paused\n");
return;
}
- spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
- ctx = (struct oz_serial_ctx *)pd->app_ctx[OZ_APPID_SERIAL-1];
- pd->app_ctx[OZ_APPID_SERIAL-1] = NULL;
- spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL-1]);
+ spin_lock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
+ ctx = (struct oz_serial_ctx *) pd->app_ctx[OZ_APPID_SERIAL];
+ pd->app_ctx[OZ_APPID_SERIAL] = NULL;
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_SERIAL]);
if (ctx)
oz_cdev_release_ctx(ctx);
spin_lock(&g_cdev.lock);
diff --git a/drivers/staging/ozwpan/ozeltbuf.c b/drivers/staging/ozwpan/ozeltbuf.c
index bd560c67fc8c..400cc75279b0 100644
--- a/drivers/staging/ozwpan/ozeltbuf.c
+++ b/drivers/staging/ozwpan/ozeltbuf.c
@@ -10,21 +10,16 @@
#include "ozeltbuf.h"
#include "ozpd.h"
-#define OZ_ELT_INFO_MAGIC_USED 0x35791057
-#define OZ_ELT_INFO_MAGIC_FREE 0x78940102
-
/*
* Context: softirq-serialized
*/
-int oz_elt_buf_init(struct oz_elt_buf *buf)
+void oz_elt_buf_init(struct oz_elt_buf *buf)
{
memset(buf, 0, sizeof(struct oz_elt_buf));
INIT_LIST_HEAD(&buf->stream_list);
INIT_LIST_HEAD(&buf->order_list);
INIT_LIST_HEAD(&buf->isoc_list);
- buf->max_free_elts = 32;
spin_lock_init(&buf->lock);
- return 0;
}
/*
@@ -32,32 +27,12 @@ int oz_elt_buf_init(struct oz_elt_buf *buf)
*/
void oz_elt_buf_term(struct oz_elt_buf *buf)
{
- struct list_head *e;
- int i;
+ struct oz_elt_info *ei, *n;
- /* Free any elements in the order or isoc lists. */
- for (i = 0; i < 2; i++) {
- struct list_head *list;
- if (i)
- list = &buf->order_list;
- else
- list = &buf->isoc_list;
- e = list->next;
- while (e != list) {
- struct oz_elt_info *ei =
- container_of(e, struct oz_elt_info, link_order);
- e = e->next;
- kfree(ei);
- }
- }
- /* Free any elelment in the pool. */
- while (buf->elt_pool) {
- struct oz_elt_info *ei =
- container_of(buf->elt_pool, struct oz_elt_info, link);
- buf->elt_pool = buf->elt_pool->next;
+ list_for_each_entry_safe(ei, n, &buf->isoc_list, link_order)
+ kfree(ei);
+ list_for_each_entry_safe(ei, n, &buf->order_list, link_order)
kfree(ei);
- }
- buf->free_elts = 0;
}
/*
@@ -67,27 +42,8 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
{
struct oz_elt_info *ei;
- spin_lock_bh(&buf->lock);
- if (buf->free_elts && buf->elt_pool) {
- ei = container_of(buf->elt_pool, struct oz_elt_info, link);
- buf->elt_pool = ei->link.next;
- buf->free_elts--;
- spin_unlock_bh(&buf->lock);
- if (ei->magic != OZ_ELT_INFO_MAGIC_FREE) {
- oz_dbg(ON, "%s: ei with bad magic: 0x%x\n",
- __func__, ei->magic);
- }
- } else {
- spin_unlock_bh(&buf->lock);
- ei = kmalloc(sizeof(struct oz_elt_info), GFP_ATOMIC);
- }
+ ei = kmem_cache_zalloc(oz_elt_info_cache, GFP_ATOMIC);
if (ei) {
- ei->flags = 0;
- ei->app_id = 0;
- ei->callback = NULL;
- ei->context = 0;
- ei->stream = NULL;
- ei->magic = OZ_ELT_INFO_MAGIC_USED;
INIT_LIST_HEAD(&ei->link);
INIT_LIST_HEAD(&ei->link_order);
}
@@ -100,17 +56,8 @@ struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf)
*/
void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei)
{
- if (ei) {
- if (ei->magic == OZ_ELT_INFO_MAGIC_USED) {
- buf->free_elts++;
- ei->link.next = buf->elt_pool;
- buf->elt_pool = &ei->link;
- ei->magic = OZ_ELT_INFO_MAGIC_FREE;
- } else {
- oz_dbg(ON, "%s: bad magic ei: %p magic: 0x%x\n",
- __func__, ei, ei->magic);
- }
- }
+ if (ei)
+ kmem_cache_free(oz_elt_info_cache, ei);
}
/*------------------------------------------------------------------------------
@@ -118,16 +65,11 @@ void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei)
*/
void oz_elt_info_free_chain(struct oz_elt_buf *buf, struct list_head *list)
{
- struct list_head *e;
+ struct oz_elt_info *ei, *n;
- e = list->next;
spin_lock_bh(&buf->lock);
- while (e != list) {
- struct oz_elt_info *ei;
- ei = container_of(e, struct oz_elt_info, link);
- e = e->next;
+ list_for_each_entry_safe(ei, n, list->next, link)
oz_elt_info_free(buf, ei);
- }
spin_unlock_bh(&buf->lock);
}
@@ -152,14 +94,13 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
{
- struct list_head *e;
+ struct list_head *e, *n;
struct oz_elt_stream *st = NULL;
oz_dbg(ON, "%s: (0x%x)\n", __func__, id);
spin_lock_bh(&buf->lock);
- e = buf->stream_list.next;
- while (e != &buf->stream_list) {
- st = container_of(e, struct oz_elt_stream, link);
+ list_for_each(e, &buf->stream_list) {
+ st = list_entry(e, struct oz_elt_stream, link);
if (st->id == id) {
list_del(e);
break;
@@ -170,11 +111,9 @@ int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
spin_unlock_bh(&buf->lock);
return -1;
}
- e = st->elt_list.next;
- while (e != &st->elt_list) {
+ list_for_each_safe(e, n, &st->elt_list) {
struct oz_elt_info *ei =
- container_of(e, struct oz_elt_info, link);
- e = e->next;
+ list_entry(e, struct oz_elt_info, link);
list_del_init(&ei->link);
list_del_init(&ei->link_order);
st->buf_count -= ei->length;
@@ -214,7 +153,7 @@ int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id,
if (id) {
list_for_each(e, &buf->stream_list) {
- st = container_of(e, struct oz_elt_stream, link);
+ st = list_entry(e, struct oz_elt_stream, link);
if (st->id == id)
break;
}
@@ -269,22 +208,18 @@ int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
unsigned max_len, struct list_head *list)
{
int count = 0;
- struct list_head *e;
struct list_head *el;
- struct oz_elt_info *ei;
+ struct oz_elt_info *ei, *n;
spin_lock_bh(&buf->lock);
if (isoc)
el = &buf->isoc_list;
else
el = &buf->order_list;
- e = el->next;
- while (e != el) {
- struct oz_app_hdr *app_hdr;
- ei = container_of(e, struct oz_elt_info, link_order);
- e = e->next;
+
+ list_for_each_entry_safe(ei, n, el, link_order) {
if ((*len + ei->length) <= max_len) {
- app_hdr = (struct oz_app_hdr *)
+ struct oz_app_hdr *app_hdr = (struct oz_app_hdr *)
&ei->data[sizeof(struct oz_elt)];
app_hdr->elt_seq_num = buf->tx_seq_num[ei->app_id]++;
if (buf->tx_seq_num[ei->app_id] == 0)
@@ -312,27 +247,5 @@ int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
int oz_are_elts_available(struct oz_elt_buf *buf)
{
- return buf->order_list.next != &buf->order_list;
-}
-
-void oz_trim_elt_pool(struct oz_elt_buf *buf)
-{
- struct list_head *free = NULL;
- struct list_head *e;
-
- spin_lock_bh(&buf->lock);
- while (buf->free_elts > buf->max_free_elts) {
- e = buf->elt_pool;
- buf->elt_pool = e->next;
- e->next = free;
- free = e;
- buf->free_elts--;
- }
- spin_unlock_bh(&buf->lock);
- while (free) {
- struct oz_elt_info *ei =
- container_of(free, struct oz_elt_info, link);
- free = free->next;
- kfree(ei);
- }
+ return !list_empty(&buf->order_list);
}
diff --git a/drivers/staging/ozwpan/ozeltbuf.h b/drivers/staging/ozwpan/ozeltbuf.h
index 03c12f57b9bb..f09f5fe3ffbe 100644
--- a/drivers/staging/ozwpan/ozeltbuf.h
+++ b/drivers/staging/ozwpan/ozeltbuf.h
@@ -34,7 +34,6 @@ struct oz_elt_info {
struct oz_elt_stream *stream;
u8 data[sizeof(struct oz_elt) + OZ_MAX_ELT_PAYLOAD];
int length;
- unsigned magic;
};
/* Flags values */
#define OZ_EI_F_MARKED 0x1
@@ -44,13 +43,10 @@ struct oz_elt_buf {
struct list_head stream_list;
struct list_head order_list;
struct list_head isoc_list;
- struct list_head *elt_pool;
- int free_elts;
- int max_free_elts;
u8 tx_seq_num[OZ_NB_APPS];
};
-int oz_elt_buf_init(struct oz_elt_buf *buf);
+void oz_elt_buf_init(struct oz_elt_buf *buf);
void oz_elt_buf_term(struct oz_elt_buf *buf);
struct oz_elt_info *oz_elt_info_alloc(struct oz_elt_buf *buf);
void oz_elt_info_free(struct oz_elt_buf *buf, struct oz_elt_info *ei);
@@ -64,7 +60,6 @@ int oz_queue_elt_info(struct oz_elt_buf *buf, u8 isoc, u8 id,
int oz_select_elts_for_tx(struct oz_elt_buf *buf, u8 isoc, unsigned *len,
unsigned max_len, struct list_head *list);
int oz_are_elts_available(struct oz_elt_buf *buf);
-void oz_trim_elt_pool(struct oz_elt_buf *buf);
#endif /* _OZELTBUF_H */
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c
index 30bd9286d47d..b30c4d87c25e 100644
--- a/drivers/staging/ozwpan/ozhcd.c
+++ b/drivers/staging/ozwpan/ozhcd.c
@@ -45,14 +45,6 @@
*/
#define OZ_PLAT_DEV_NAME "ozwpan"
-/* Maximum number of free urb links that can be kept in the pool.
- */
-#define OZ_MAX_LINK_POOL_SIZE 16
-
-/* Get endpoint object from the containing link.
- */
-#define ep_from_link(__e) container_of((__e), struct oz_endpoint, link)
-
/*EP0 timeout before ep0 request is again added to TX queue. (13*8 = 98mSec)
*/
#define EP0_TIMEOUT_COUNTER 13
@@ -75,6 +67,8 @@ struct oz_urb_link {
unsigned submit_counter;
};
+static struct kmem_cache *oz_urb_link_cache;
+
/* Holds state information about a USB endpoint.
*/
#define OZ_EP_BUFFER_SIZE_ISOC (1024 * 24)
@@ -198,9 +192,6 @@ static struct platform_device *g_plat_dev;
static struct oz_hcd *g_ozhcd;
static DEFINE_SPINLOCK(g_hcdlock); /* Guards g_ozhcd. */
static const char g_hcd_name[] = "Ozmo WPAN";
-static struct list_head *g_link_pool;
-static int g_link_pool_size;
-static DEFINE_SPINLOCK(g_link_lock);
static DEFINE_SPINLOCK(g_tasklet_lock);
static struct tasklet_struct g_urb_process_tasklet;
static struct tasklet_struct g_urb_cancel_tasklet;
@@ -265,68 +256,22 @@ static int oz_get_port_from_addr(struct oz_hcd *ozhcd, u8 bus_addr)
}
/*
- * Allocates an urb link, first trying the pool but going to heap if empty.
* Context: any
*/
static struct oz_urb_link *oz_alloc_urb_link(void)
{
- struct oz_urb_link *urbl = NULL;
- unsigned long irq_state;
-
- spin_lock_irqsave(&g_link_lock, irq_state);
- if (g_link_pool) {
- urbl = container_of(g_link_pool, struct oz_urb_link, link);
- g_link_pool = urbl->link.next;
- --g_link_pool_size;
- }
- spin_unlock_irqrestore(&g_link_lock, irq_state);
- if (urbl == NULL)
- urbl = kmalloc(sizeof(struct oz_urb_link), GFP_ATOMIC);
- return urbl;
+ return kmem_cache_alloc(oz_urb_link_cache, GFP_ATOMIC);
}
/*
- * Frees an urb link by putting it in the pool if there is enough space or
- * deallocating it to heap otherwise.
* Context: any
*/
static void oz_free_urb_link(struct oz_urb_link *urbl)
{
- if (urbl) {
- unsigned long irq_state;
-
- spin_lock_irqsave(&g_link_lock, irq_state);
- if (g_link_pool_size < OZ_MAX_LINK_POOL_SIZE) {
- urbl->link.next = g_link_pool;
- g_link_pool = &urbl->link;
- urbl = NULL;
- g_link_pool_size++;
- }
- spin_unlock_irqrestore(&g_link_lock, irq_state);
- kfree(urbl);
- }
-}
-
-/*
- * Deallocates all the urb links in the pool.
- * Context: unknown
- */
-static void oz_empty_link_pool(void)
-{
- struct list_head *e;
- unsigned long irq_state;
+ if (!urbl)
+ return;
- spin_lock_irqsave(&g_link_lock, irq_state);
- e = g_link_pool;
- g_link_pool = NULL;
- g_link_pool_size = 0;
- spin_unlock_irqrestore(&g_link_lock, irq_state);
- while (e) {
- struct oz_urb_link *urbl =
- container_of(e, struct oz_urb_link, link);
- e = e->next;
- kfree(urbl);
- }
+ kmem_cache_free(oz_urb_link_cache, urbl);
}
/*
@@ -359,12 +304,10 @@ static struct oz_urb_link *oz_uncancel_urb(struct oz_hcd *ozhcd,
struct urb *urb)
{
struct oz_urb_link *urbl;
- struct list_head *e;
- list_for_each(e, &ozhcd->urb_cancel_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ list_for_each_entry(urbl, &ozhcd->urb_cancel_list, link) {
if (urb == urbl->urb) {
- list_del_init(e);
+ list_del_init(&urbl->link);
return urbl;
}
}
@@ -423,10 +366,9 @@ static void oz_complete_urb(struct usb_hcd *hcd, struct urb *urb,
static void oz_ep_free(struct oz_port *port, struct oz_endpoint *ep)
{
if (port) {
- struct list_head list;
+ LIST_HEAD(list);
struct oz_hcd *ozhcd = port->ozhcd;
- INIT_LIST_HEAD(&list);
if (ep->flags & OZ_F_EP_HAVE_STREAM)
oz_usb_stream_delete(port->hpd, ep->ep_num);
/* Transfer URBs to the orphanage while we hold the lock. */
@@ -572,7 +514,7 @@ static int oz_dequeue_ep_urb(struct oz_port *port, u8 ep_addr, int in_dir,
struct list_head *e;
list_for_each(e, &ep->urb_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ urbl = list_entry(e, struct oz_urb_link, link);
if (urbl->urb == urb) {
list_del_init(e);
break;
@@ -604,7 +546,7 @@ static struct urb *oz_find_urb_by_id(struct oz_port *port, int ep_ix,
struct list_head *e;
list_for_each(e, &ep->urb_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ urbl = list_entry(e, struct oz_urb_link, link);
if (urbl->req_id == req_id) {
urb = urbl->urb;
list_del_init(e);
@@ -1097,21 +1039,17 @@ int oz_hcd_heartbeat(void *hport)
int rc = 0;
struct oz_port *port = (struct oz_port *)hport;
struct oz_hcd *ozhcd = port->ozhcd;
- struct oz_urb_link *urbl;
- struct list_head xfr_list;
- struct list_head *e;
- struct list_head *n;
+ struct oz_urb_link *urbl, *n;
+ LIST_HEAD(xfr_list);
struct urb *urb;
struct oz_endpoint *ep;
struct timespec ts, delta;
getrawmonotonic(&ts);
- INIT_LIST_HEAD(&xfr_list);
/* Check the OUT isoc endpoints to see if any URB data can be sent.
*/
spin_lock_bh(&ozhcd->hcd_lock);
- list_for_each(e, &port->isoc_out_ep) {
- ep = ep_from_link(e);
+ list_for_each_entry(ep, &port->isoc_out_ep, link) {
if (ep->credit < 0)
continue;
delta = timespec_sub(ts, ep->timestamp);
@@ -1134,10 +1072,9 @@ int oz_hcd_heartbeat(void *hport)
spin_unlock_bh(&ozhcd->hcd_lock);
/* Send to PD and complete URBs.
*/
- list_for_each_safe(e, n, &xfr_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &xfr_list, link) {
urb = urbl->urb;
- list_del_init(e);
+ list_del_init(&urbl->link);
urb->error_count = 0;
urb->start_frame = oz_usb_get_frame_number();
oz_usb_send_isoc(port->hpd, urbl->ep_num, urb);
@@ -1147,9 +1084,7 @@ int oz_hcd_heartbeat(void *hport)
/* Check the IN isoc endpoints to see if any URBs can be completed.
*/
spin_lock_bh(&ozhcd->hcd_lock);
- list_for_each(e, &port->isoc_in_ep) {
- struct oz_endpoint *ep = ep_from_link(e);
-
+ list_for_each_entry(ep, &port->isoc_in_ep, link) {
if (ep->flags & OZ_F_EP_BUFFERING) {
if (ep->buffered_units >= OZ_IN_BUFFERING_UNITS) {
ep->flags &= ~OZ_F_EP_BUFFERING;
@@ -1162,10 +1097,7 @@ int oz_hcd_heartbeat(void *hport)
delta = timespec_sub(ts, ep->timestamp);
ep->credit += div_u64(timespec_to_ns(&delta), NSEC_PER_MSEC);
ep->timestamp = ts;
- while (!list_empty(&ep->urb_list)) {
- struct oz_urb_link *urbl =
- list_first_entry(&ep->urb_list,
- struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &ep->urb_list, link) {
struct urb *urb = urbl->urb;
int len = 0;
int copy_len;
@@ -1212,10 +1144,9 @@ int oz_hcd_heartbeat(void *hport)
spin_unlock_bh(&ozhcd->hcd_lock);
/* Complete the filled URBs.
*/
- list_for_each_safe(e, n, &xfr_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &xfr_list, link) {
urb = urbl->urb;
- list_del_init(e);
+ list_del_init(&urbl->link);
oz_free_urb_link(urbl);
oz_complete_urb(port->ozhcd->hcd, urb, 0);
}
@@ -1224,15 +1155,11 @@ int oz_hcd_heartbeat(void *hport)
*/
ep = port->out_ep[0];
if (ep) {
- struct list_head *e;
- struct list_head *n;
-
spin_lock_bh(&ozhcd->hcd_lock);
- list_for_each_safe(e, n, &ep->urb_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &ep->urb_list, link) {
if (urbl->submit_counter > EP0_TIMEOUT_COUNTER) {
oz_dbg(ON, "Request 0x%p timeout\n", urbl->urb);
- list_move_tail(e, &xfr_list);
+ list_move_tail(&urbl->link, &xfr_list);
urbl->submit_counter = 0;
} else {
urbl->submit_counter++;
@@ -1241,10 +1168,7 @@ int oz_hcd_heartbeat(void *hport)
if (!list_empty(&ep->urb_list))
rc = 1;
spin_unlock_bh(&ozhcd->hcd_lock);
- e = xfr_list.next;
- while (e != &xfr_list) {
- urbl = container_of(e, struct oz_urb_link, link);
- e = e->next;
+ list_for_each_entry_safe(urbl, n, &xfr_list, link) {
oz_dbg(ON, "Resending request to PD\n");
oz_process_ep0_urb(ozhcd, urbl->urb, GFP_ATOMIC);
oz_free_urb_link(urbl);
@@ -1343,12 +1267,12 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
struct oz_hcd *ozhcd = port->ozhcd;
unsigned mask;
int i;
- struct list_head ep_list;
+ LIST_HEAD(ep_list);
+ struct oz_endpoint *ep, *n;
oz_dbg(ON, "Deleting endpoints for interface %d\n", if_ix);
if (if_ix >= port->num_iface)
return;
- INIT_LIST_HEAD(&ep_list);
spin_lock_bh(&ozhcd->hcd_lock);
mask = port->iface[if_ix].ep_mask;
port->iface[if_ix].ep_mask = 0;
@@ -1372,9 +1296,7 @@ static void oz_clean_endpoints_for_interface(struct usb_hcd *hcd,
}
}
spin_unlock_bh(&ozhcd->hcd_lock);
- while (!list_empty(&ep_list)) {
- struct oz_endpoint *ep =
- list_first_entry(&ep_list, struct oz_endpoint, link);
+ list_for_each_entry_safe(ep, n, &ep_list, link) {
list_del_init(&ep->link);
oz_ep_free(port, ep);
}
@@ -1645,6 +1567,7 @@ static void oz_urb_process_tasklet(unsigned long unused)
unsigned long irq_state;
struct urb *urb;
struct oz_hcd *ozhcd = oz_hcd_claim();
+ struct oz_urb_link *urbl, *n;
int rc = 0;
if (ozhcd == NULL)
@@ -1654,10 +1577,7 @@ static void oz_urb_process_tasklet(unsigned long unused)
* appropriately while removing urbs.
*/
spin_lock_irqsave(&g_tasklet_lock, irq_state);
- while (!list_empty(&ozhcd->urb_pending_list)) {
- struct oz_urb_link *urbl =
- list_first_entry(&ozhcd->urb_pending_list,
- struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &ozhcd->urb_pending_list, link) {
list_del_init(&urbl->link);
spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
urb = urbl->urb;
@@ -1702,7 +1622,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
*/
spin_lock_irqsave(&g_tasklet_lock, irq_state);
list_for_each(e, &ozhcd->urb_cancel_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+ urbl = list_entry(e, struct oz_urb_link, link);
if (urb == urbl->urb) {
list_del_init(e);
spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
@@ -1716,7 +1636,7 @@ static void oz_urb_cancel(struct oz_port *port, u8 ep_num, struct urb *urb)
*/
spin_lock_irqsave(&ozhcd->hcd_lock, irq_state);
list_for_each(e, &ozhcd->orphanage) {
- urbl = container_of(e, struct oz_urb_link, link);
+ urbl = list_entry(e, struct oz_urb_link, link);
if (urbl->urb == urb) {
list_del(e);
oz_dbg(ON, "Found urb in orphanage\n");
@@ -1746,15 +1666,13 @@ static void oz_urb_cancel_tasklet(unsigned long unused)
{
unsigned long irq_state;
struct urb *urb;
+ struct oz_urb_link *urbl, *n;
struct oz_hcd *ozhcd = oz_hcd_claim();
if (ozhcd == NULL)
return;
spin_lock_irqsave(&g_tasklet_lock, irq_state);
- while (!list_empty(&ozhcd->urb_cancel_list)) {
- struct oz_urb_link *urbl =
- list_first_entry(&ozhcd->urb_cancel_list,
- struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &ozhcd->urb_cancel_list, link) {
list_del_init(&urbl->link);
spin_unlock_irqrestore(&g_tasklet_lock, irq_state);
urb = urbl->urb;
@@ -1773,11 +1691,9 @@ static void oz_urb_cancel_tasklet(unsigned long unused)
static void oz_hcd_clear_orphanage(struct oz_hcd *ozhcd, int status)
{
if (ozhcd) {
- struct oz_urb_link *urbl;
+ struct oz_urb_link *urbl, *n;
- while (!list_empty(&ozhcd->orphanage)) {
- urbl = list_first_entry(&ozhcd->orphanage,
- struct oz_urb_link, link);
+ list_for_each_entry_safe(urbl, n, &ozhcd->orphanage, link) {
list_del(&urbl->link);
oz_complete_urb(ozhcd->hcd, urbl->urb, status);
oz_free_urb_link(urbl);
@@ -1875,14 +1791,13 @@ static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep,
struct urb *urb)
{
struct oz_urb_link *urbl;
- struct list_head *e;
if (unlikely(ep == NULL))
return NULL;
- list_for_each(e, &ep->urb_list) {
- urbl = container_of(e, struct oz_urb_link, link);
+
+ list_for_each_entry(urbl, &ep->urb_list, link) {
if (urbl->urb == urb) {
- list_del_init(e);
+ list_del_init(&urbl->link);
if (usb_pipeisoc(urb->pipe)) {
ep->credit -= urb->number_of_packets;
if (ep->credit < 0)
@@ -2311,7 +2226,6 @@ static int oz_plat_remove(struct platform_device *dev)
oz_dbg(ON, "Removing hcd\n");
usb_remove_hcd(hcd);
usb_put_hcd(hcd);
- oz_empty_link_pool();
return 0;
}
@@ -2341,6 +2255,11 @@ int oz_hcd_init(void)
if (usb_disabled())
return -ENODEV;
+
+ oz_urb_link_cache = KMEM_CACHE(oz_urb_link, 0);
+ if (!oz_urb_link_cache)
+ return -ENOMEM;
+
tasklet_init(&g_urb_process_tasklet, oz_urb_process_tasklet, 0);
tasklet_init(&g_urb_cancel_tasklet, oz_urb_cancel_tasklet, 0);
err = platform_driver_register(&g_oz_plat_drv);
@@ -2380,4 +2299,5 @@ void oz_hcd_term(void)
platform_device_unregister(g_plat_dev);
platform_driver_unregister(&g_oz_plat_drv);
oz_dbg(ON, "Pending urbs:%d\n", atomic_read(&g_pending_urbs));
+ kmem_cache_destroy(oz_urb_link_cache);
}
diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c
index d1a5b7a2c16d..7d6ef4cadf1a 100644
--- a/drivers/staging/ozwpan/ozmain.c
+++ b/drivers/staging/ozwpan/ozmain.c
@@ -25,6 +25,9 @@ unsigned int oz_dbg_mask = OZ_DEFAULT_DBG_MASK;
* netcards. Bindings can be added later using an IOCTL.
*/
static char *g_net_dev = "";
+module_param(g_net_dev, charp, S_IRUGO);
+MODULE_PARM_DESC(g_net_dev, "The device(s) to bind to; "
+ "'*' means all, '' (empty string; default) means none.");
/*
* Context: process
@@ -48,7 +51,6 @@ static void __exit ozwpan_exit(void)
oz_cdev_deregister();
}
-module_param(g_net_dev, charp, S_IRUGO);
module_init(ozwpan_init);
module_exit(ozwpan_exit);
diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index 10f1b3ac8832..772641011a44 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -21,8 +21,6 @@
#include <linux/uaccess.h>
#include <net/psnap.h>
-#define OZ_MAX_TX_POOL_SIZE 6
-
static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd);
static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f);
static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f);
@@ -32,11 +30,6 @@ static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f);
static void oz_isoc_stream_free(struct oz_isoc_stream *st);
static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data);
static void oz_isoc_destructor(struct sk_buff *skb);
-static int oz_def_app_init(void);
-static void oz_def_app_term(void);
-static int oz_def_app_start(struct oz_pd *pd, int resume);
-static void oz_def_app_stop(struct oz_pd *pd, int pause);
-static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt);
/*
* Counts the uncompleted isoc frames submitted to netcard.
@@ -45,80 +38,25 @@ static atomic_t g_submitted_isoc = ATOMIC_INIT(0);
/* Application handler functions.
*/
-static const struct oz_app_if g_app_if[OZ_APPID_MAX] = {
- {oz_usb_init,
- oz_usb_term,
- oz_usb_start,
- oz_usb_stop,
- oz_usb_rx,
- oz_usb_heartbeat,
- oz_usb_farewell,
- OZ_APPID_USB},
-
- {oz_def_app_init,
- oz_def_app_term,
- oz_def_app_start,
- oz_def_app_stop,
- oz_def_app_rx,
- NULL,
- NULL,
- OZ_APPID_UNUSED1},
-
- {oz_def_app_init,
- oz_def_app_term,
- oz_def_app_start,
- oz_def_app_stop,
- oz_def_app_rx,
- NULL,
- NULL,
- OZ_APPID_UNUSED2},
-
- {oz_cdev_init,
- oz_cdev_term,
- oz_cdev_start,
- oz_cdev_stop,
- oz_cdev_rx,
- NULL,
- NULL,
- OZ_APPID_SERIAL},
+static const struct oz_app_if g_app_if[OZ_NB_APPS] = {
+ [OZ_APPID_USB] = {
+ .init = oz_usb_init,
+ .term = oz_usb_term,
+ .start = oz_usb_start,
+ .stop = oz_usb_stop,
+ .rx = oz_usb_rx,
+ .heartbeat = oz_usb_heartbeat,
+ .farewell = oz_usb_farewell,
+ },
+ [OZ_APPID_SERIAL] = {
+ .init = oz_cdev_init,
+ .term = oz_cdev_term,
+ .start = oz_cdev_start,
+ .stop = oz_cdev_stop,
+ .rx = oz_cdev_rx,
+ },
};
-/*
- * Context: process
- */
-static int oz_def_app_init(void)
-{
- return 0;
-}
-
-/*
- * Context: process
- */
-static void oz_def_app_term(void)
-{
-}
-
-/*
- * Context: softirq
- */
-static int oz_def_app_start(struct oz_pd *pd, int resume)
-{
- return 0;
-}
-
-/*
- * Context: softirq
- */
-static void oz_def_app_stop(struct oz_pd *pd, int pause)
-{
-}
-
-/*
- * Context: softirq
- */
-static void oz_def_app_rx(struct oz_pd *pd, struct oz_elt *elt)
-{
-}
/*
* Context: softirq or process
@@ -169,16 +107,13 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
if (pd) {
int i;
atomic_set(&pd->ref_count, 2);
- for (i = 0; i < OZ_APPID_MAX; i++)
+ for (i = 0; i < OZ_NB_APPS; i++)
spin_lock_init(&pd->app_lock[i]);
pd->last_rx_pkt_num = 0xffffffff;
oz_pd_set_state(pd, OZ_PD_S_IDLE);
pd->max_tx_size = OZ_MAX_TX_SIZE;
ether_addr_copy(pd->mac_addr, mac_addr);
- if (0 != oz_elt_buf_init(&pd->elt_buff)) {
- kfree(pd);
- pd = NULL;
- }
+ oz_elt_buf_init(&pd->elt_buff);
spin_lock_init(&pd->tx_frame_lock);
INIT_LIST_HEAD(&pd->tx_queue);
INIT_LIST_HEAD(&pd->farewell_list);
@@ -202,10 +137,7 @@ struct oz_pd *oz_pd_alloc(const u8 *mac_addr)
*/
static void oz_pd_free(struct work_struct *work)
{
- struct list_head *e;
- struct oz_tx_frame *f;
- struct oz_isoc_stream *st;
- struct oz_farewell *fwell;
+ struct list_head *e, *n;
struct oz_pd *pd;
oz_pd_dbg(pd, ON, "Destroying PD\n");
@@ -213,40 +145,24 @@ static void oz_pd_free(struct work_struct *work)
/*Disable timer tasklets*/
tasklet_kill(&pd->heartbeat_tasklet);
tasklet_kill(&pd->timeout_tasklet);
- /* Delete any streams.
- */
- e = pd->stream_list.next;
- while (e != &pd->stream_list) {
- st = container_of(e, struct oz_isoc_stream, link);
- e = e->next;
- oz_isoc_stream_free(st);
- }
- /* Free any queued tx frames.
- */
- e = pd->tx_queue.next;
- while (e != &pd->tx_queue) {
- f = container_of(e, struct oz_tx_frame, link);
- e = e->next;
+
+ /* Free streams, queued tx frames and farewells. */
+
+ list_for_each_safe(e, n, &pd->stream_list)
+ oz_isoc_stream_free(list_entry(e, struct oz_isoc_stream, link));
+
+ list_for_each_safe(e, n, &pd->tx_queue) {
+ struct oz_tx_frame *f = list_entry(e, struct oz_tx_frame, link);
if (f->skb != NULL)
kfree_skb(f->skb);
oz_retire_frame(pd, f);
}
+
oz_elt_buf_term(&pd->elt_buff);
- /* Free any farewells.
- */
- e = pd->farewell_list.next;
- while (e != &pd->farewell_list) {
- fwell = container_of(e, struct oz_farewell, link);
- e = e->next;
- kfree(fwell);
- }
- /* Deallocate all frames in tx pool.
- */
- while (pd->tx_pool) {
- e = pd->tx_pool;
- pd->tx_pool = e->next;
- kfree(container_of(e, struct oz_tx_frame, link));
- }
+
+ list_for_each_safe(e, n, &pd->farewell_list)
+ kfree(list_entry(e, struct oz_farewell, link));
+
if (pd->net_dev)
dev_put(pd->net_dev);
kfree(pd);
@@ -272,23 +188,21 @@ void oz_pd_destroy(struct oz_pd *pd)
*/
int oz_services_start(struct oz_pd *pd, u16 apps, int resume)
{
- const struct oz_app_if *ai;
- int rc = 0;
+ int i, rc = 0;
oz_pd_dbg(pd, ON, "%s: (0x%x) resume(%d)\n", __func__, apps, resume);
- for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) {
- if (apps & (1<<ai->app_id)) {
- if (ai->start(pd, resume)) {
+ for (i = 0; i < OZ_NB_APPS; i++) {
+ if (g_app_if[i].start && (apps & (1 << i))) {
+ if (g_app_if[i].start(pd, resume)) {
rc = -1;
oz_pd_dbg(pd, ON,
- "Unable to start service %d\n",
- ai->app_id);
+ "Unable to start service %d\n", i);
break;
}
spin_lock_bh(&g_polling_lock);
- pd->total_apps |= (1<<ai->app_id);
+ pd->total_apps |= (1 << i);
if (resume)
- pd->paused_apps &= ~(1<<ai->app_id);
+ pd->paused_apps &= ~(1 << i);
spin_unlock_bh(&g_polling_lock);
}
}
@@ -300,20 +214,20 @@ int oz_services_start(struct oz_pd *pd, u16 apps, int resume)
*/
void oz_services_stop(struct oz_pd *pd, u16 apps, int pause)
{
- const struct oz_app_if *ai;
+ int i;
oz_pd_dbg(pd, ON, "%s: (0x%x) pause(%d)\n", __func__, apps, pause);
- for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) {
- if (apps & (1<<ai->app_id)) {
+ for (i = 0; i < OZ_NB_APPS; i++) {
+ if (g_app_if[i].stop && (apps & (1 << i))) {
spin_lock_bh(&g_polling_lock);
if (pause) {
- pd->paused_apps |= (1<<ai->app_id);
+ pd->paused_apps |= (1 << i);
} else {
- pd->total_apps &= ~(1<<ai->app_id);
- pd->paused_apps &= ~(1<<ai->app_id);
+ pd->total_apps &= ~(1 << i);
+ pd->paused_apps &= ~(1 << i);
}
spin_unlock_bh(&g_polling_lock);
- ai->stop(pd, pause);
+ g_app_if[i].stop(pd, pause);
}
}
}
@@ -323,12 +237,11 @@ void oz_services_stop(struct oz_pd *pd, u16 apps, int pause)
*/
void oz_pd_heartbeat(struct oz_pd *pd, u16 apps)
{
- const struct oz_app_if *ai;
- int more = 0;
+ int i, more = 0;
- for (ai = g_app_if; ai < &g_app_if[OZ_APPID_MAX]; ai++) {
- if (ai->heartbeat && (apps & (1<<ai->app_id))) {
- if (ai->heartbeat(pd))
+ for (i = 0; i < OZ_NB_APPS; i++) {
+ if (g_app_if[i].heartbeat && (apps & (1 << i))) {
+ if (g_app_if[i].heartbeat(pd))
more = 1;
}
}
@@ -399,17 +312,9 @@ int oz_pd_sleep(struct oz_pd *pd)
*/
static struct oz_tx_frame *oz_tx_frame_alloc(struct oz_pd *pd)
{
- struct oz_tx_frame *f = NULL;
+ struct oz_tx_frame *f;
- spin_lock_bh(&pd->tx_frame_lock);
- if (pd->tx_pool) {
- f = container_of(pd->tx_pool, struct oz_tx_frame, link);
- pd->tx_pool = pd->tx_pool->next;
- pd->tx_pool_count--;
- }
- spin_unlock_bh(&pd->tx_frame_lock);
- if (f == NULL)
- f = kmalloc(sizeof(struct oz_tx_frame), GFP_ATOMIC);
+ f = kmem_cache_alloc(oz_tx_frame_cache, GFP_ATOMIC);
if (f) {
f->total_size = sizeof(struct oz_hdr);
INIT_LIST_HEAD(&f->link);
@@ -425,13 +330,9 @@ static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f)
{
pd->nb_queued_isoc_frames--;
list_del_init(&f->link);
- if (pd->tx_pool_count < OZ_MAX_TX_POOL_SIZE) {
- f->link.next = pd->tx_pool;
- pd->tx_pool = &f->link;
- pd->tx_pool_count++;
- } else {
- kfree(f);
- }
+
+ kmem_cache_free(oz_tx_frame_cache, f);
+
oz_dbg(TX_FRAMES, "Releasing ISOC Frame isoc_nb= %d\n",
pd->nb_queued_isoc_frames);
}
@@ -441,15 +342,7 @@ static void oz_tx_isoc_free(struct oz_pd *pd, struct oz_tx_frame *f)
*/
static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f)
{
- spin_lock_bh(&pd->tx_frame_lock);
- if (pd->tx_pool_count < OZ_MAX_TX_POOL_SIZE) {
- f->link.next = pd->tx_pool;
- pd->tx_pool = &f->link;
- pd->tx_pool_count++;
- f = NULL;
- }
- spin_unlock_bh(&pd->tx_frame_lock);
- kfree(f);
+ kmem_cache_free(oz_tx_frame_cache, f);
}
/*
@@ -513,7 +406,7 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
struct net_device *dev = pd->net_dev;
struct oz_hdr *oz_hdr;
struct oz_elt *elt;
- struct list_head *e;
+ struct oz_elt_info *ei;
/* Allocate skb with enough space for the lower layers as well
* as the space we need.
@@ -538,9 +431,7 @@ static struct sk_buff *oz_build_frame(struct oz_pd *pd, struct oz_tx_frame *f)
/* Copy the elements into the frame body.
*/
elt = (struct oz_elt *)(oz_hdr+1);
- for (e = f->elt_list.next; e != &f->elt_list; e = e->next) {
- struct oz_elt_info *ei;
- ei = container_of(e, struct oz_elt_info, link);
+ list_for_each_entry(ei, &f->elt_list, link) {
memcpy(elt, ei->data, ei->length);
elt = oz_next_elt(elt);
}
@@ -555,13 +446,9 @@ fail:
*/
static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f)
{
- struct list_head *e;
- struct oz_elt_info *ei;
+ struct oz_elt_info *ei, *n;
- e = f->elt_list.next;
- while (e != &f->elt_list) {
- ei = container_of(e, struct oz_elt_info, link);
- e = e->next;
+ list_for_each_entry_safe(ei, n, &f->elt_list, link) {
list_del_init(&ei->link);
if (ei->callback)
ei->callback(pd, ei->context);
@@ -570,8 +457,6 @@ static void oz_retire_frame(struct oz_pd *pd, struct oz_tx_frame *f)
spin_unlock_bh(&pd->elt_buff.lock);
}
oz_tx_frame_free(pd, f);
- if (pd->elt_buff.free_elts > pd->elt_buff.max_free_elts)
- oz_trim_elt_pool(&pd->elt_buff);
}
/*
@@ -589,7 +474,7 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
spin_unlock(&pd->tx_frame_lock);
return -1;
}
- f = container_of(e, struct oz_tx_frame, link);
+ f = list_entry(e, struct oz_tx_frame, link);
if (f->skb != NULL) {
skb = f->skb;
@@ -677,15 +562,13 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
struct net_device *dev = pd->net_dev;
struct oz_hdr *oz_hdr;
struct oz_elt *elt;
- struct list_head *e;
- struct list_head list;
+ struct oz_elt_info *ei;
+ LIST_HEAD(list);
int total_size = sizeof(struct oz_hdr);
- INIT_LIST_HEAD(&list);
-
oz_select_elts_for_tx(&pd->elt_buff, 1, &total_size,
pd->max_tx_size, &list);
- if (list.next == &list)
+ if (list_empty(&list))
return 0;
skb = alloc_skb(total_size + OZ_ALLOCATED_SPACE(dev), GFP_ATOMIC);
if (skb == NULL) {
@@ -707,9 +590,7 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
oz_hdr->last_pkt_num = pd->trigger_pkt_num & OZ_LAST_PN_MASK;
elt = (struct oz_elt *)(oz_hdr+1);
- for (e = list.next; e != &list; e = e->next) {
- struct oz_elt_info *ei;
- ei = container_of(e, struct oz_elt_info, link);
+ list_for_each_entry(ei, &list, link) {
memcpy(elt, ei->data, ei->length);
elt = oz_next_elt(elt);
}
@@ -723,41 +604,30 @@ static int oz_send_isoc_frame(struct oz_pd *pd)
*/
void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
{
- struct list_head *e;
- struct oz_tx_frame *f;
- struct list_head *first = NULL;
- struct list_head *last = NULL;
+ struct oz_tx_frame *f, *tmp = NULL;
u8 diff;
u32 pkt_num;
+ LIST_HEAD(list);
+
spin_lock(&pd->tx_frame_lock);
- e = pd->tx_queue.next;
- while (e != &pd->tx_queue) {
- f = container_of(e, struct oz_tx_frame, link);
+ list_for_each_entry(f, &pd->tx_queue, link) {
pkt_num = le32_to_cpu(get_unaligned(&f->hdr.pkt_num));
diff = (lpn - (pkt_num & OZ_LAST_PN_MASK)) & OZ_LAST_PN_MASK;
if ((diff > OZ_LAST_PN_HALF_CYCLE) || (pkt_num == 0))
break;
oz_dbg(TX_FRAMES, "Releasing pkt_num= %u, nb= %d\n",
pkt_num, pd->nb_queued_frames);
- if (first == NULL)
- first = e;
- last = e;
- e = e->next;
+ tmp = f;
pd->nb_queued_frames--;
}
- if (first) {
- last->next->prev = &pd->tx_queue;
- pd->tx_queue.next = last->next;
- last->next = NULL;
- }
+ if (tmp)
+ list_cut_position(&list, &pd->tx_queue, &tmp->link);
pd->last_sent_frame = &pd->tx_queue;
spin_unlock(&pd->tx_frame_lock);
- while (first) {
- f = container_of(first, struct oz_tx_frame, link);
- first = first->next;
+
+ list_for_each_entry_safe(f, tmp, &list, link)
oz_retire_frame(pd, f);
- }
}
/*
@@ -766,11 +636,9 @@ void oz_retire_tx_frames(struct oz_pd *pd, u8 lpn)
*/
static struct oz_isoc_stream *pd_stream_find(struct oz_pd *pd, u8 ep_num)
{
- struct list_head *e;
struct oz_isoc_stream *st;
- list_for_each(e, &pd->stream_list) {
- st = container_of(e, struct oz_isoc_stream, link);
+ list_for_each_entry(st, &pd->stream_list, link) {
if (st->ep_num == ep_num)
return st;
}
@@ -907,14 +775,11 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len)
struct oz_tx_frame *isoc_unit = NULL;
int nb = pd->nb_queued_isoc_frames;
if (nb >= pd->isoc_latency) {
- struct list_head *e;
struct oz_tx_frame *f;
oz_dbg(TX_FRAMES, "Dropping ISOC Unit nb= %d\n",
nb);
spin_lock(&pd->tx_frame_lock);
- list_for_each(e, &pd->tx_queue) {
- f = container_of(e, struct oz_tx_frame,
- link);
+ list_for_each_entry(f, &pd->tx_queue, link) {
if (f->skb != NULL) {
oz_tx_isoc_free(pd, f);
break;
@@ -960,9 +825,10 @@ void oz_apps_init(void)
{
int i;
- for (i = 0; i < OZ_APPID_MAX; i++)
+ for (i = 0; i < OZ_NB_APPS; i++) {
if (g_app_if[i].init)
g_app_if[i].init();
+ }
}
/*
@@ -973,9 +839,10 @@ void oz_apps_term(void)
int i;
/* Terminate all the apps. */
- for (i = 0; i < OZ_APPID_MAX; i++)
+ for (i = 0; i < OZ_NB_APPS; i++) {
if (g_app_if[i].term)
g_app_if[i].term();
+ }
}
/*
@@ -983,12 +850,8 @@ void oz_apps_term(void)
*/
void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt)
{
- const struct oz_app_if *ai;
-
- if (app_id == 0 || app_id > OZ_APPID_MAX)
- return;
- ai = &g_app_if[app_id-1];
- ai->rx(pd, elt);
+ if (app_id < OZ_NB_APPS && g_app_if[app_id].rx)
+ g_app_if[app_id].rx(pd, elt);
}
/*
@@ -997,7 +860,7 @@ void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt)
void oz_pd_indicate_farewells(struct oz_pd *pd)
{
struct oz_farewell *f;
- const struct oz_app_if *ai = &g_app_if[OZ_APPID_USB-1];
+ const struct oz_app_if *ai = &g_app_if[OZ_APPID_USB];
while (1) {
spin_lock_bh(&g_polling_lock);
diff --git a/drivers/staging/ozwpan/ozpd.h b/drivers/staging/ozwpan/ozpd.h
index ad5fe7a6e619..212fab0d807a 100644
--- a/drivers/staging/ozwpan/ozpd.h
+++ b/drivers/staging/ozwpan/ozpd.h
@@ -81,8 +81,8 @@ struct oz_pd {
unsigned long presleep;
unsigned long keep_alive;
struct oz_elt_buf elt_buff;
- void *app_ctx[OZ_APPID_MAX];
- spinlock_t app_lock[OZ_APPID_MAX];
+ void *app_ctx[OZ_NB_APPS];
+ spinlock_t app_lock[OZ_NB_APPS];
int max_tx_size;
u8 mode;
u8 ms_per_isoc;
@@ -90,8 +90,6 @@ struct oz_pd {
unsigned max_stream_buffering;
int nb_queued_frames;
int nb_queued_isoc_frames;
- struct list_head *tx_pool;
- int tx_pool_count;
spinlock_t tx_frame_lock;
struct list_head *last_sent_frame;
struct list_head tx_queue;
@@ -130,4 +128,7 @@ void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt);
void oz_apps_init(void);
void oz_apps_term(void);
+extern struct kmem_cache *oz_elt_info_cache;
+extern struct kmem_cache *oz_tx_frame_cache;
+
#endif /* Sentry */
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index 110205599190..af3da3ebabc2 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -11,6 +11,7 @@
#include <linux/etherdevice.h>
#include <linux/errno.h>
#include <linux/ieee80211.h>
+#include <linux/slab.h>
#include "ozdbg.h"
#include "ozprotocol.h"
#include "ozeltbuf.h"
@@ -29,8 +30,6 @@
#define OZ_DO_STOP 1
#define OZ_DO_SLEEP 2
-#define OZ_MAX_TIMER_POOL_SIZE 16
-
struct oz_binding {
struct packet_type ptype;
char name[OZ_MAX_BINDING_LEN];
@@ -53,6 +52,9 @@ static u8 g_session_id;
static u16 g_apps = 0x1;
static int g_processing_rx;
+struct kmem_cache *oz_elt_info_cache;
+struct kmem_cache *oz_tx_frame_cache;
+
/*
* Context: softirq-serialized
*/
@@ -183,7 +185,7 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt,
getnstimeofday(&pd->last_rx_timestamp);
spin_lock_bh(&g_polling_lock);
list_for_each(e, &g_pd_list) {
- pd2 = container_of(e, struct oz_pd, link);
+ pd2 = list_entry(e, struct oz_pd, link);
if (ether_addr_equal(pd2->mac_addr, pd_addr)) {
free_pd = pd;
pd = pd2;
@@ -481,6 +483,9 @@ void oz_protocol_term(void)
}
spin_unlock_bh(&g_polling_lock);
oz_dbg(ON, "Protocol stopped\n");
+
+ kmem_cache_destroy(oz_tx_frame_cache);
+ kmem_cache_destroy(oz_elt_info_cache);
}
/*
@@ -596,13 +601,11 @@ void oz_pd_request_heartbeat(struct oz_pd *pd)
struct oz_pd *oz_pd_find(const u8 *mac_addr)
{
struct oz_pd *pd;
- struct list_head *e;
spin_lock_bh(&g_polling_lock);
- list_for_each(e, &g_pd_list) {
- pd = container_of(e, struct oz_pd, link);
+ list_for_each_entry(pd, &g_pd_list, link) {
if (ether_addr_equal(pd->mac_addr, mac_addr)) {
- atomic_inc(&pd->ref_count);
+ oz_pd_get(pd);
spin_unlock_bh(&g_polling_lock);
return pd;
}
@@ -616,7 +619,7 @@ struct oz_pd *oz_pd_find(const u8 *mac_addr)
*/
void oz_app_enable(int app_id, int enable)
{
- if (app_id <= OZ_APPID_MAX) {
+ if (app_id < OZ_NB_APPS) {
spin_lock_bh(&g_polling_lock);
if (enable)
g_apps |= (1<<app_id);
@@ -695,11 +698,10 @@ void oz_binding_add(const char *net_dev)
*/
static void pd_stop_all_for_device(struct net_device *net_dev)
{
- struct list_head h;
+ LIST_HEAD(h);
struct oz_pd *pd;
struct oz_pd *n;
- INIT_LIST_HEAD(&h);
spin_lock_bh(&g_polling_lock);
list_for_each_entry_safe(pd, n, &g_pd_list, link) {
if (pd->net_dev == net_dev) {
@@ -764,6 +766,16 @@ static char *oz_get_next_device_name(char *s, char *dname, int max_size)
*/
int oz_protocol_init(char *devs)
{
+ oz_elt_info_cache = KMEM_CACHE(oz_elt_info, 0);
+ if (!oz_elt_info_cache)
+ return -ENOMEM;
+
+ oz_tx_frame_cache = KMEM_CACHE(oz_tx_frame, 0);
+ if (!oz_tx_frame_cache) {
+ kmem_cache_destroy(oz_elt_info_cache);
+ return -ENOMEM;
+ }
+
skb_queue_head_init(&g_rx_queue);
if (devs[0] == '*') {
oz_binding_add(NULL);
@@ -784,14 +796,12 @@ int oz_protocol_init(char *devs)
int oz_get_pd_list(struct oz_mac_addr *addr, int max_count)
{
struct oz_pd *pd;
- struct list_head *e;
int count = 0;
spin_lock_bh(&g_polling_lock);
- list_for_each(e, &g_pd_list) {
+ list_for_each_entry(pd, &g_pd_list, link) {
if (count >= max_count)
break;
- pd = container_of(e, struct oz_pd, link);
ether_addr_copy((u8 *)&addr[count++], pd->mac_addr);
}
spin_unlock_bh(&g_polling_lock);
diff --git a/drivers/staging/ozwpan/ozproto.h b/drivers/staging/ozwpan/ozproto.h
index cb38e02c968e..73cc69bd30a6 100644
--- a/drivers/staging/ozwpan/ozproto.h
+++ b/drivers/staging/ozwpan/ozproto.h
@@ -34,7 +34,7 @@ typedef void (*oz_app_term_fn_t)(void);
typedef int (*oz_app_start_fn_t)(struct oz_pd *pd, int resume);
typedef void (*oz_app_stop_fn_t)(struct oz_pd *pd, int pause);
typedef void (*oz_app_rx_fn_t)(struct oz_pd *pd, struct oz_elt *elt);
-typedef int (*oz_app_hearbeat_fn_t)(struct oz_pd *pd);
+typedef int (*oz_app_heartbeat_fn_t)(struct oz_pd *pd);
typedef void (*oz_app_farewell_fn_t)(struct oz_pd *pd, u8 ep_num,
u8 *data, u8 len);
@@ -44,9 +44,8 @@ struct oz_app_if {
oz_app_start_fn_t start;
oz_app_stop_fn_t stop;
oz_app_rx_fn_t rx;
- oz_app_hearbeat_fn_t heartbeat;
+ oz_app_heartbeat_fn_t heartbeat;
oz_app_farewell_fn_t farewell;
- int app_id;
};
int oz_protocol_init(char *devs);
@@ -66,4 +65,7 @@ enum hrtimer_restart oz_pd_timeout_event(struct hrtimer *timer);
int oz_get_pd_status_list(char *pd_list, int max_count);
int oz_get_binding_list(char *buf, int max_if);
+extern struct kmem_cache *oz_elt_info_cache;
+extern struct kmem_cache *oz_tx_frame_cache;
+
#endif /* _OZPROTO_H */
diff --git a/drivers/staging/ozwpan/ozprotocol.h b/drivers/staging/ozwpan/ozprotocol.h
index 9bbb182f2776..4642072596da 100644
--- a/drivers/staging/ozwpan/ozprotocol.h
+++ b/drivers/staging/ozwpan/ozprotocol.h
@@ -139,8 +139,6 @@ struct oz_app_hdr {
/* Values for app_id.
*/
#define OZ_APPID_USB 0x1
-#define OZ_APPID_UNUSED1 0x2
-#define OZ_APPID_UNUSED2 0x3
#define OZ_APPID_SERIAL 0x4
#define OZ_APPID_MAX OZ_APPID_SERIAL
#define OZ_NB_APPS (OZ_APPID_MAX+1)
diff --git a/drivers/staging/ozwpan/ozusbsvc.c b/drivers/staging/ozwpan/ozusbsvc.c
index edd44c457a4b..db4a3876886a 100644
--- a/drivers/staging/ozwpan/ozusbsvc.c
+++ b/drivers/staging/ozwpan/ozusbsvc.c
@@ -73,12 +73,12 @@ int oz_usb_start(struct oz_pd *pd, int resume)
* If it does already have one then destroy the one we have just
* created.
*/
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- old_ctx = pd->app_ctx[OZ_APPID_USB-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ old_ctx = pd->app_ctx[OZ_APPID_USB];
if (old_ctx == NULL)
- pd->app_ctx[OZ_APPID_USB-1] = usb_ctx;
- oz_usb_get(pd->app_ctx[OZ_APPID_USB-1]);
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ pd->app_ctx[OZ_APPID_USB] = usb_ctx;
+ oz_usb_get(pd->app_ctx[OZ_APPID_USB]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
if (old_ctx) {
oz_dbg(ON, "Already have USB context\n");
kfree(usb_ctx);
@@ -99,9 +99,9 @@ int oz_usb_start(struct oz_pd *pd, int resume)
usb_ctx->hport = oz_hcd_pd_arrived(usb_ctx);
if (usb_ctx->hport == NULL) {
oz_dbg(ON, "USB hub returned null port\n");
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- pd->app_ctx[OZ_APPID_USB-1] = NULL;
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ pd->app_ctx[OZ_APPID_USB] = NULL;
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
oz_usb_put(usb_ctx);
rc = -1;
}
@@ -122,10 +122,10 @@ void oz_usb_stop(struct oz_pd *pd, int pause)
oz_dbg(ON, "USB service paused\n");
return;
}
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1];
- pd->app_ctx[OZ_APPID_USB-1] = NULL;
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ usb_ctx = (struct oz_usb_ctx *) pd->app_ctx[OZ_APPID_USB];
+ pd->app_ctx[OZ_APPID_USB] = NULL;
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
if (usb_ctx) {
struct timespec ts, now;
getnstimeofday(&ts);
@@ -187,11 +187,11 @@ int oz_usb_heartbeat(struct oz_pd *pd)
struct oz_usb_ctx *usb_ctx;
int rc = 0;
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ usb_ctx = (struct oz_usb_ctx *) pd->app_ctx[OZ_APPID_USB];
if (usb_ctx)
oz_usb_get(usb_ctx);
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
if (usb_ctx == NULL)
return rc;
if (usb_ctx->stopped)
diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c
index f32d01427f77..12bb236174dc 100644
--- a/drivers/staging/ozwpan/ozusbsvc1.c
+++ b/drivers/staging/ozwpan/ozusbsvc1.c
@@ -364,11 +364,11 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
struct oz_usb_hdr *usb_hdr = (struct oz_usb_hdr *)(elt + 1);
struct oz_usb_ctx *usb_ctx;
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB];
if (usb_ctx)
oz_usb_get(usb_ctx);
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
if (usb_ctx == NULL)
return; /* Context has gone so nothing to do. */
if (usb_ctx->stopped)
@@ -434,11 +434,11 @@ void oz_usb_farewell(struct oz_pd *pd, u8 ep_num, u8 *data, u8 len)
{
struct oz_usb_ctx *usb_ctx;
- spin_lock_bh(&pd->app_lock[OZ_APPID_USB-1]);
- usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB-1];
+ spin_lock_bh(&pd->app_lock[OZ_APPID_USB]);
+ usb_ctx = (struct oz_usb_ctx *)pd->app_ctx[OZ_APPID_USB];
if (usb_ctx)
oz_usb_get(usb_ctx);
- spin_unlock_bh(&pd->app_lock[OZ_APPID_USB-1]);
+ spin_unlock_bh(&pd->app_lock[OZ_APPID_USB]);
if (usb_ctx == NULL)
return; /* Context has gone so nothing to do. */
if (!usb_ctx->stopped) {
diff --git a/drivers/staging/rtl8188eu/Makefile b/drivers/staging/rtl8188eu/Makefile
index aeebf9311f15..1b8c89ba7ac2 100644
--- a/drivers/staging/rtl8188eu/Makefile
+++ b/drivers/staging/rtl8188eu/Makefile
@@ -17,6 +17,7 @@ r8188eu-y := \
core/rtw_sta_mgt.o \
core/rtw_wlan_util.o \
core/rtw_xmit.o \
+ hal/fw.o \
hal/HalHWImg8188E_MAC.o \
hal/HalHWImg8188E_BB.o \
hal/HalHWImg8188E_RF.o \
@@ -29,7 +30,6 @@ r8188eu-y := \
hal/odm.o \
hal/odm_debug.o \
hal/odm_HWConfig.o \
- hal/odm_RegConfig8188E.o\
hal/odm_RTL8188E.o \
hal/rtl8188e_cmd.o \
hal/rtl8188e_dm.o \
diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c
index 5b997b2b404a..7006088d1ad0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_efuse.c
+++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c
@@ -440,7 +440,7 @@ u8 Efuse_WordEnableDataWrite(struct adapter *pAdapter, u16 efuse_addr, u8 word_e
return badworden;
}
-u16 Efuse_GetCurrentSize(struct adapter *pAdapter)
+static u16 Efuse_GetCurrentSize(struct adapter *pAdapter)
{
int bContinual = true;
u16 efuse_addr = 0;
diff --git a/drivers/staging/rtl8188eu/core/rtw_iol.c b/drivers/staging/rtl8188eu/core/rtw_iol.c
index 7796287be8f4..cdcf0eacc0e0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_iol.c
+++ b/drivers/staging/rtl8188eu/core/rtw_iol.c
@@ -20,65 +20,6 @@
#include<rtw_iol.h>
-struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter)
-{
- struct xmit_frame *xmit_frame;
- struct xmit_buf *xmitbuf;
- struct pkt_attrib *pattrib;
- struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
-
- xmit_frame = rtw_alloc_xmitframe(pxmitpriv);
- if (xmit_frame == NULL) {
- DBG_88E("%s rtw_alloc_xmitframe return null\n", __func__);
- goto exit;
- }
-
- xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
- if (xmitbuf == NULL) {
- DBG_88E("%s rtw_alloc_xmitbuf return null\n", __func__);
- rtw_free_xmitframe(pxmitpriv, xmit_frame);
- xmit_frame = NULL;
- goto exit;
- }
-
- xmit_frame->frame_tag = MGNT_FRAMETAG;
- xmit_frame->pxmitbuf = xmitbuf;
- xmit_frame->buf_addr = xmitbuf->pbuf;
- xmitbuf->priv_data = xmit_frame;
-
- pattrib = &xmit_frame->attrib;
- update_mgntframe_attrib(adapter, pattrib);
- pattrib->qsel = 0x10;/* Beacon */
- pattrib->subtype = WIFI_BEACON;
- pattrib->pktlen = 0;
- pattrib->last_txcmdsz = 0;
-exit:
- return xmit_frame;
-}
-
-int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len)
-{
- struct pkt_attrib *pattrib = &xmit_frame->attrib;
- u16 buf_offset;
- u32 ori_len;
-
- buf_offset = TXDESC_OFFSET;
- ori_len = buf_offset+pattrib->pktlen;
-
- /* check if the io_buf can accommodate new cmds */
- if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
- DBG_88E("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n",
- __func__ , ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
- return _FAIL;
- }
-
- memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
- pattrib->pktlen += cmd_len;
- pattrib->last_txcmdsz += cmd_len;
-
- return _SUCCESS;
-}
-
bool rtw_IOL_applied(struct adapter *adapter)
{
if (1 == adapter->registrypriv.fw_iol)
@@ -88,108 +29,3 @@ bool rtw_IOL_applied(struct adapter *adapter)
return true;
return false;
}
-
-int rtw_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
-{
- return rtw_hal_iol_cmd(adapter, xmit_frame, max_wating_ms, bndy_cnt);
-}
-
-int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
-{
- return _SUCCESS;
-}
-
-int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask)
-{
- struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0};
-
- cmd.address = cpu_to_le16(addr);
- cmd.data = cpu_to_le32(value);
-
- if (mask != 0xFF) {
- cmd.length = 12;
- cmd.mask = cpu_to_le32(mask);
- }
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
-}
-
-int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask)
-{
- struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0};
-
- cmd.address = cpu_to_le16(addr);
- cmd.data = cpu_to_le32(value);
-
- if (mask != 0xFFFFFFFF) {
- cmd.length = 12;
- cmd.mask = cpu_to_le32(mask);
- }
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
-}
-
-int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask)
-{
- struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0};
-
- cmd.address = cpu_to_le16((rf_path<<8) | ((addr) & 0xFF));
- cmd.data = cpu_to_le32(value);
-
- if (mask != 0x000FFFFF) {
- cmd.length = 12;
- cmd.mask = cpu_to_le32(mask);
- }
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
-}
-
-int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
-{
- struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
- cmd.address = cpu_to_le16(us);
-
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
-}
-
-int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
-{
- struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
-
- cmd.address = cpu_to_le16(ms);
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
-}
-
-int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
-{
- struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF), cpu_to_le32(0xFF), 0x0};
-
- return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
-}
-
-u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
-{
- u8 is_cmd_bndy = false;
- if (((pxmit_frame->attrib.pktlen+32)%256) + 8 >= 256) {
- rtw_IOL_append_END_cmd(pxmit_frame);
- pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen+32)/256)+1)*256);
-
- pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
- is_cmd_bndy = true;
- }
- return is_cmd_bndy;
-}
-
-void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf)
-{
- int i;
- int j = 1;
-
- pr_info("###### %s ######\n", __func__);
- for (i = 0; i < buf_len; i++) {
- printk("%02x-", *(pbuf+i));
-
- if (j%32 == 0)
- printk("\n");
- j++;
- }
- printk("\n");
- pr_info("=============ioreg_cmd len=%d===============\n", buf_len);
-}
diff --git a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_BB.c b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_BB.c
index 787e8f1f97f9..00f9cd737193 100644
--- a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_BB.c
+++ b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_BB.c
@@ -20,7 +20,7 @@
#include "odm_precomp.h"
-#include <rtw_iol.h>
+#include <phy.h>
#define read_next_pair(array, v1, v2, i) \
do { \
@@ -29,36 +29,8 @@
v2 = array[i+1]; \
} while (0)
-static bool CheckCondition(const u32 condition, const u32 hex)
-{
- u32 _board = (hex & 0x000000FF);
- u32 _interface = (hex & 0x0000FF00) >> 8;
- u32 _platform = (hex & 0x00FF0000) >> 16;
- u32 cond = condition;
-
- if (condition == 0xCDCDCDCD)
- return true;
-
- cond = condition & 0x000000FF;
- if ((_board == cond) && cond != 0x00)
- return false;
-
- cond = condition & 0x0000FF00;
- cond = cond >> 8;
- if ((_interface & cond) == 0 && cond != 0x07)
- return false;
-
- cond = condition & 0x00FF0000;
- cond = cond >> 16;
- if ((_platform & cond) == 0 && cond != 0x0F)
- return false;
- return true;
-}
-
-/******************************************************************************
-* AGC_TAB_1T.TXT
-******************************************************************************/
+/* AGC_TAB_1T.TXT */
static u32 array_agc_tab_1t_8188e[] = {
0xC78, 0xFB000001,
@@ -191,91 +163,25 @@ static u32 array_agc_tab_1t_8188e[] = {
0xC78, 0x407F0001,
};
-enum HAL_STATUS ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct *dm_odm)
+static bool set_baseband_agc_config(struct adapter *adapt)
{
- u32 hex = 0;
- u32 i = 0;
- u8 platform = dm_odm->SupportPlatform;
- u8 interfaceValue = dm_odm->SupportInterface;
- u8 board = dm_odm->BoardType;
- u32 arraylen = sizeof(array_agc_tab_1t_8188e)/sizeof(u32);
- u32 *array = array_agc_tab_1t_8188e;
- bool biol = false;
- struct adapter *adapter = dm_odm->Adapter;
- struct xmit_frame *pxmit_frame = NULL;
- u8 bndy_cnt = 1;
- enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += interfaceValue << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- biol = rtw_IOL_applied(adapter);
-
- if (biol) {
- pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
- if (pxmit_frame == NULL) {
- pr_info("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
+ u32 i;
+ u32 arraylen = sizeof(array_agc_tab_1t_8188e)/sizeof(u32);
+ u32 *array = array_agc_tab_1t_8188e;
for (i = 0; i < arraylen; i += 2) {
u32 v1 = array[i];
u32 v2 = array[i+1];
- /* This (offset, data) pair meets the condition. */
- if (v1 < 0xCDCDCDCD) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
- } else {
- odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
- }
- continue;
- } else {
- /* This line is the start line of branch. */
- if (!CheckCondition(array[i], hex)) {
- /* Discard the following (offset, data) pairs. */
- read_next_pair(array, v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < arraylen - 2)
- read_next_pair(array, v1, v2, i);
- i -= 2; /* prevent from for-loop += 2 */
- } else { /* Configure matched pairs and skip to end of if-else. */
- read_next_pair(array, v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < arraylen - 2) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
- } else {
- odm_ConfigBB_AGC_8188E(dm_odm, v1, bMaskDWord, v2);
- }
- read_next_pair(array, v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < arraylen - 2)
- read_next_pair(array, v1, v2, i);
- }
- }
- }
- if (biol) {
- if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
- printk("~~~ %s IOL_exec_cmds Failed !!!\n", __func__);
- rst = HAL_STATUS_FAILURE;
+ if (v1 < 0xCDCDCDCD){
+ PHY_SetBBReg(adapt, v1, bMaskDWord, v2);
+ udelay(1);
}
}
- return rst;
+ return true;
}
-/******************************************************************************
-* PHY_REG_1T.TXT
-******************************************************************************/
+/* PHY_REG_1T.TXT */
static u32 array_phy_reg_1t_8188e[] = {
0x800, 0x80040000,
@@ -471,122 +377,44 @@ static u32 array_phy_reg_1t_8188e[] = {
0xF00, 0x00000300,
};
-enum HAL_STATUS ODM_ReadAndConfig_PHY_REG_1T_8188E(struct odm_dm_struct *dm_odm)
+static void rtl_bb_delay(struct adapter *adapt, u32 addr, u32 data)
{
- u32 hex = 0;
- u32 i = 0;
- u8 platform = dm_odm->SupportPlatform;
- u8 interfaceValue = dm_odm->SupportInterface;
- u8 board = dm_odm->BoardType;
- u32 arraylen = sizeof(array_phy_reg_1t_8188e)/sizeof(u32);
- u32 *array = array_phy_reg_1t_8188e;
- bool biol = false;
- struct adapter *adapter = dm_odm->Adapter;
- struct xmit_frame *pxmit_frame = NULL;
- u8 bndy_cnt = 1;
- enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
- hex += board;
- hex += interfaceValue << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- biol = rtw_IOL_applied(adapter);
-
- if (biol) {
- pxmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
- if (pxmit_frame == NULL) {
- pr_info("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
+ if (addr == 0xfe) {
+ msleep(50);
+ } else if (addr == 0xfd) {
+ mdelay(5);
+ } else if (addr == 0xfc) {
+ mdelay(1);
+ } else if (addr == 0xfb) {
+ udelay(50);
+ } else if (addr == 0xfa) {
+ udelay(5);
+ } else if (addr == 0xf9) {
+ udelay(1);
+ } else {
+ PHY_SetBBReg(adapt, addr, bMaskDWord, data);
+ /* Add 1us delay between BB/RF register setting. */
+ udelay(1);
}
+}
+
+static bool set_baseband_phy_config(struct adapter *adapt)
+{
+ u32 i;
+ u32 arraylen = sizeof(array_phy_reg_1t_8188e)/sizeof(u32);
+ u32 *array = array_phy_reg_1t_8188e;
for (i = 0; i < arraylen; i += 2) {
u32 v1 = array[i];
u32 v2 = array[i+1];
- /* This (offset, data) pair meets the condition. */
- if (v1 < 0xCDCDCDCD) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- if (v1 == 0xfe) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
- } else if (v1 == 0xfd) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
- } else if (v1 == 0xfc) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
- } else if (v1 == 0xfb) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
- } else if (v1 == 0xfa) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- } else if (v1 == 0xf9) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
- } else {
- if (v1 == 0xa24)
- dm_odm->RFCalibrateInfo.RegA24 = v2;
- rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
- }
- } else {
- odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
- }
- continue;
- } else { /* This line is the start line of branch. */
- if (!CheckCondition(array[i], hex)) {
- /* Discard the following (offset, data) pairs. */
- read_next_pair(array, v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < arraylen - 2)
- read_next_pair(array, v1, v2, i);
- i -= 2; /* prevent from for-loop += 2 */
- } else { /* Configure matched pairs and skip to end of if-else. */
- read_next_pair(array, v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < arraylen - 2) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- if (v1 == 0xfe) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
- } else if (v1 == 0xfd) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
- } else if (v1 == 0xfc) {
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
- } else if (v1 == 0xfb) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
- } else if (v1 == 0xfa) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- } else if (v1 == 0xf9) {
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
- } else{
- if (v1 == 0xa24)
- dm_odm->RFCalibrateInfo.RegA24 = v2;
-
- rtw_IOL_append_WD_cmd(pxmit_frame, (u16)v1, v2, bMaskDWord);
- }
- } else {
- odm_ConfigBB_PHY_8188E(dm_odm, v1, bMaskDWord, v2);
- }
- read_next_pair(array, v1, v2, i);
- }
-
- while (v2 != 0xDEAD && i < arraylen - 2)
- read_next_pair(array, v1, v2, i);
- }
- }
+ if (v1 < 0xCDCDCDCD)
+ rtl_bb_delay(adapt, v1, v2);
}
- if (biol) {
- if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
- rst = HAL_STATUS_FAILURE;
- pr_info("~~~ IOL Config %s Failed !!!\n", __func__);
- }
- }
- return rst;
+ return true;
}
-/******************************************************************************
-* PHY_REG_PG.TXT
-******************************************************************************/
+/* PHY_REG_PG.TXT */
static u32 array_phy_reg_pg_8188e[] = {
0xE00, 0xFFFFFFFF, 0x06070809,
@@ -680,42 +508,208 @@ static u32 array_phy_reg_pg_8188e[] = {
};
-void ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct *dm_odm)
+static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitmask, u32 data)
{
- u32 hex;
- u32 i = 0;
- u8 platform = dm_odm->SupportPlatform;
- u8 interfaceValue = dm_odm->SupportInterface;
- u8 board = dm_odm->BoardType;
- u32 arraylen = sizeof(array_phy_reg_pg_8188e) / sizeof(u32);
- u32 *array = array_phy_reg_pg_8188e;
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter);
+
+ if (regaddr == rTxAGC_A_Rate18_06)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][0] = data;
+ if (regaddr == rTxAGC_A_Rate54_24)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][1] = data;
+ if (regaddr == rTxAGC_A_CCK1_Mcs32)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][6] = data;
+ if (regaddr == rTxAGC_B_CCK11_A_CCK2_11 && bitmask == 0xffffff00)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][7] = data;
+ if (regaddr == rTxAGC_A_Mcs03_Mcs00)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][2] = data;
+ if (regaddr == rTxAGC_A_Mcs07_Mcs04)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][3] = data;
+ if (regaddr == rTxAGC_A_Mcs11_Mcs08)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][4] = data;
+ if (regaddr == rTxAGC_A_Mcs15_Mcs12) {
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][5] = data;
+ if (hal_data->rf_type == RF_1T1R)
+ hal_data->pwrGroupCnt++;
+ }
+ if (regaddr == rTxAGC_B_Rate18_06)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][8] = data;
+ if (regaddr == rTxAGC_B_Rate54_24)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][9] = data;
+ if (regaddr == rTxAGC_B_CCK1_55_Mcs32)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][14] = data;
+ if (regaddr == rTxAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][15] = data;
+ if (regaddr == rTxAGC_B_Mcs03_Mcs00)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][10] = data;
+ if (regaddr == rTxAGC_B_Mcs07_Mcs04)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][11] = data;
+ if (regaddr == rTxAGC_B_Mcs11_Mcs08)
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][12] = data;
+ if (regaddr == rTxAGC_B_Mcs15_Mcs12) {
+ hal_data->MCSTxPowerLevelOriginalOffset[hal_data->pwrGroupCnt][13] = data;
+ if (hal_data->rf_type != RF_1T1R)
+ hal_data->pwrGroupCnt++;
+ }
+}
- hex = board + (interfaceValue << 8);
- hex += (platform << 16) + 0xFF000000;
+static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask ,u32 data)
+{
+ if (addr == 0xfe) {
+ msleep(50);
+ } else if (addr == 0xfd) {
+ mdelay(5);
+ } else if (addr == 0xfc) {
+ mdelay(1);
+ } else if (addr == 0xfb) {
+ udelay(50);
+ } else if (addr == 0xfa) {
+ udelay(5);
+ } else if (addr == 0xf9) {
+ udelay(1);
+ } else{
+ store_pwrindex_offset(adapt, addr, bit_mask, data);
+ }
+}
+
+static bool config_bb_with_pgheader(struct adapter *adapt)
+{
+ u32 i = 0;
+ u32 arraylen = sizeof(array_phy_reg_pg_8188e) / sizeof(u32);
+ u32 *array = array_phy_reg_pg_8188e;
for (i = 0; i < arraylen; i += 3) {
u32 v1 = array[i];
u32 v2 = array[i+1];
u32 v3 = array[i+2];
- /* this line is a line of pure_body */
- if (v1 < 0xCDCDCDCD) {
- odm_ConfigBB_PHY_REG_PG_8188E(dm_odm, v1, v2, v3);
- continue;
- } else { /* this line is the start of branch */
- if (!CheckCondition(array[i], hex)) {
- /* don't need the hw_body */
- i += 2; /* skip the pair of expression */
- v1 = array[i];
- v2 = array[i+1];
- v3 = array[i+2];
- while (v2 != 0xDEAD) {
- i += 3;
- v1 = array[i];
- v2 = array[i+1];
- v3 = array[i+1];
- }
- }
- }
+ if (v1 < 0xCDCDCDCD)
+ rtl_addr_delay(adapt, v1, v2, v3);
+ }
+ return true;
+}
+
+static void rtl88e_phy_init_bb_rf_register_definition(struct adapter *Adapter)
+{
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(Adapter);
+
+ hal_data->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW;
+ hal_data->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW;
+ hal_data->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;
+ hal_data->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB;
+ hal_data->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;
+ hal_data->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;
+ hal_data->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE;
+ hal_data->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE;
+ hal_data->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE;
+
+ hal_data->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter;
+ hal_data->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter;
+ hal_data->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter;
+ hal_data->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter;
+ hal_data->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage;
+ hal_data->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage;
+ hal_data->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage;
+ hal_data->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1;
+ hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2;
+ hal_data->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl;
+ hal_data->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl;
+ hal_data->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl;
+ hal_data->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1;
+ hal_data->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1;
+ hal_data->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1;
+ hal_data->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2;
+ hal_data->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2;
+ hal_data->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2;
+ hal_data->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE;
+ hal_data->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE;
+ hal_data->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE;
+ hal_data->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance;
+ hal_data->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE;
+ hal_data->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE;
+ hal_data->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE;
+ hal_data->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
+ hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
+ hal_data->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
+ hal_data->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
+
+ hal_data->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
+ hal_data->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
+}
+
+static bool config_parafile(struct adapter *adapt)
+{
+ struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(adapt);
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
+
+ set_baseband_phy_config(adapt);
+
+ /* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */
+ if (!pEEPROM->bautoload_fail_flag) {
+ hal_data->pwrGroupCnt = 0;
+ config_bb_with_pgheader(adapt);
}
+ set_baseband_agc_config(adapt);
+ return true;
+}
+
+bool rtl88e_phy_bb_config(struct adapter *adapt)
+{
+ int rtstatus = true;
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
+ u32 regval;
+ u8 crystal_cap;
+
+ rtl88e_phy_init_bb_rf_register_definition(adapt);
+
+ /* Enable BB and RF */
+ regval = usb_read16(adapt, REG_SYS_FUNC_EN);
+ usb_write16(adapt, REG_SYS_FUNC_EN, (u16)(regval|BIT13|BIT0|BIT1));
+
+ usb_write8(adapt, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB);
+
+ usb_write8(adapt, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
+
+ /* Config BB and AGC */
+ rtstatus = config_parafile(adapt);
+
+ /* write 0x24[16:11] = 0x24[22:17] = crystal_cap */
+ crystal_cap = hal_data->CrystalCap & 0x3F;
+ PHY_SetBBReg(adapt, REG_AFE_XTAL_CTRL, 0x7ff800, (crystal_cap | (crystal_cap << 6)));
+
+ return rtstatus;
}
diff --git a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_MAC.c b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_MAC.c
index b49b5ab48b18..ccca6a496b2b 100644
--- a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_MAC.c
+++ b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_MAC.c
@@ -21,36 +21,7 @@
#include "odm_precomp.h"
#include <rtw_iol.h>
-static bool Checkcondition(const u32 condition, const u32 hex)
-{
- u32 _board = (hex & 0x000000FF);
- u32 _interface = (hex & 0x0000FF00) >> 8;
- u32 _platform = (hex & 0x00FF0000) >> 16;
- u32 cond = condition;
-
- if (condition == 0xCDCDCDCD)
- return true;
-
- cond = condition & 0x000000FF;
- if ((_board == cond) && cond != 0x00)
- return false;
-
- cond = condition & 0x0000FF00;
- cond = cond >> 8;
- if ((_interface & cond) == 0 && cond != 0x07)
- return false;
-
- cond = condition & 0x00FF0000;
- cond = cond >> 16;
- if ((_platform & cond) == 0 && cond != 0x0F)
- return false;
- return true;
-}
-
-
-/******************************************************************************
-* MAC_REG.TXT
-******************************************************************************/
+/* MAC_REG.TXT */
static u32 array_MAC_REG_8188E[] = {
0x026, 0x00000041,
@@ -145,87 +116,18 @@ static u32 array_MAC_REG_8188E[] = {
0x70B, 0x00000087,
};
-enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *dm_odm)
+bool rtl88e_phy_mac_config(struct adapter *adapt)
{
- #define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = array[i]; v2 = array[i+1]; } while (0)
-
- u32 hex = 0;
- u32 i;
- u8 platform = dm_odm->SupportPlatform;
- u8 interface_val = dm_odm->SupportInterface;
- u8 board = dm_odm->BoardType;
- u32 array_len = sizeof(array_MAC_REG_8188E)/sizeof(u32);
- u32 *array = array_MAC_REG_8188E;
- bool biol = false;
+ u32 i;
+ u32 arraylength;
+ u32 *ptrarray;
- struct adapter *adapt = dm_odm->Adapter;
- struct xmit_frame *pxmit_frame = NULL;
- u8 bndy_cnt = 1;
- enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
- hex += board;
- hex += interface_val << 8;
- hex += platform << 16;
- hex += 0xFF000000;
+ arraylength = sizeof(array_MAC_REG_8188E)/sizeof(u32);
+ ptrarray = array_MAC_REG_8188E;
- biol = rtw_IOL_applied(adapt);
+ for (i = 0; i < arraylength; i = i + 2)
+ usb_write8(adapt, ptrarray[i], (u8) ptrarray[i + 1]);
- if (biol) {
- pxmit_frame = rtw_IOL_accquire_xmit_frame(adapt);
- if (pxmit_frame == NULL) {
- pr_info("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
- }
-
- for (i = 0; i < array_len; i += 2) {
- u32 v1 = array[i];
- u32 v2 = array[i+1];
-
- /* This (offset, data) pair meets the condition. */
- if (v1 < 0xCDCDCDCD) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame, (u16)v1, (u8)v2, 0xFF);
- } else {
- odm_ConfigMAC_8188E(dm_odm, v1, (u8)v2);
- }
- continue;
- } else { /* This line is the start line of branch. */
- if (!Checkcondition(array[i], hex)) {
- /* Discard the following (offset, data) pairs. */
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < array_len - 2) {
- READ_NEXT_PAIR(v1, v2, i);
- }
- i -= 2; /* prevent from for-loop += 2 */
- } else { /* Configure matched pairs and skip to end of if-else. */
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < array_len - 2) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
- rtw_IOL_append_WB_cmd(pxmit_frame, (u16)v1, (u8)v2, 0xFF);
- } else {
- odm_ConfigMAC_8188E(dm_odm, v1, (u8)v2);
- }
-
- READ_NEXT_PAIR(v1, v2, i);
- }
- while (v2 != 0xDEAD && i < array_len - 2)
- READ_NEXT_PAIR(v1, v2, i);
- }
- }
- }
- if (biol) {
- if (!rtw_IOL_exec_cmds_sync(dm_odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
- pr_info("~~~ MAC IOL_exec_cmds Failed !!!\n");
- rst = HAL_STATUS_FAILURE;
- }
- }
- return rst;
+ usb_write8(adapt, REG_MAX_AGGR_NUM, MAX_AGGR_NUM);
+ return true;
}
diff --git a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_RF.c b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_RF.c
index 17c6411ce8ac..2648840f9e20 100644
--- a/drivers/staging/rtl8188eu/hal/HalHWImg8188E_RF.c
+++ b/drivers/staging/rtl8188eu/hal/HalHWImg8188E_RF.c
@@ -20,38 +20,36 @@
#include "odm_precomp.h"
-#include <rtw_iol.h>
+#include <phy.h>
-static bool CheckCondition(const u32 Condition, const u32 Hex)
+static bool check_condition(struct adapter *adapt, const u32 condition)
{
- u32 _board = (Hex & 0x000000FF);
- u32 _interface = (Hex & 0x0000FF00) >> 8;
- u32 _platform = (Hex & 0x00FF0000) >> 16;
- u32 cond = Condition;
+ struct odm_dm_struct *odm = &GET_HAL_DATA(adapt)->odmpriv;
+ u32 _board = odm->BoardType;
+ u32 _platform = odm->SupportPlatform;
+ u32 _interface = odm->SupportInterface;
+ u32 cond = condition;
- if (Condition == 0xCDCDCDCD)
+ if (condition == 0xCDCDCDCD)
return true;
- cond = Condition & 0x000000FF;
+ cond = condition & 0x000000FF;
if ((_board == cond) && cond != 0x00)
return false;
- cond = Condition & 0x0000FF00;
+ cond = condition & 0x0000FF00;
cond = cond >> 8;
if ((_interface & cond) == 0 && cond != 0x07)
return false;
- cond = Condition & 0x00FF0000;
+ cond = condition & 0x00FF0000;
cond = cond >> 16;
if ((_platform & cond) == 0 && cond != 0x0F)
return false;
return true;
}
-
-/******************************************************************************
-* RadioA_1T.TXT
-******************************************************************************/
+/* RadioA_1T.TXT */
static u32 Array_RadioA_1T_8188E[] = {
0x000, 0x00030000,
@@ -155,115 +153,166 @@ static u32 Array_RadioA_1T_8188E[] = {
0x000, 0x00033E60,
};
-enum HAL_STATUS ODM_ReadAndConfig_RadioA_1T_8188E(struct odm_dm_struct *pDM_Odm)
+#define READ_NEXT_PAIR(v1, v2, i) \
+do { \
+ i += 2; v1 = array[i]; \
+ v2 = array[i+1]; \
+} while (0)
+
+#define RFREG_OFFSET_MASK 0xfffff
+#define B3WIREADDREAALENGTH 0x400
+#define B3WIREDATALENGTH 0x800
+#define BRFSI_RFENV 0x10
+
+static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path rfpath,u32 addr, u32 mask, u32 data)
{
- #define READ_NEXT_PAIR(v1, v2, i) do \
- { i += 2; v1 = Array[i]; \
- v2 = Array[i+1]; } while (0)
-
- u32 hex = 0;
- u32 i = 0;
- u8 platform = pDM_Odm->SupportPlatform;
- u8 interfaceValue = pDM_Odm->SupportInterface;
- u8 board = pDM_Odm->BoardType;
- u32 ArrayLen = sizeof(Array_RadioA_1T_8188E)/sizeof(u32);
- u32 *Array = Array_RadioA_1T_8188E;
- bool biol = false;
- struct adapter *Adapter = pDM_Odm->Adapter;
- struct xmit_frame *pxmit_frame = NULL;
- u8 bndy_cnt = 1;
- enum HAL_STATUS rst = HAL_STATUS_SUCCESS;
-
- hex += board;
- hex += interfaceValue << 8;
- hex += platform << 16;
- hex += 0xFF000000;
- biol = rtw_IOL_applied(Adapter);
-
- if (biol) {
- pxmit_frame = rtw_IOL_accquire_xmit_frame(Adapter);
- if (pxmit_frame == NULL) {
- pr_info("rtw_IOL_accquire_xmit_frame failed\n");
- return HAL_STATUS_FAILURE;
- }
+ if (addr == 0xfe) {
+ mdelay(50);
+ } else if (addr == 0xfd) {
+ mdelay(5);
+ } else if (addr == 0xfc) {
+ mdelay(1);
+ } else if (addr == 0xfb) {
+ udelay(50);
+ } else if (addr == 0xfa) {
+ udelay(5);
+ } else if (addr == 0xf9) {
+ udelay(1);
+ } else {
+ rtl8188e_PHY_SetRFReg(adapt, rfpath, addr, mask, data);
+ udelay(1);
}
+}
- for (i = 0; i < ArrayLen; i += 2) {
- u32 v1 = Array[i];
- u32 v2 = Array[i+1];
+static void rtl8188e_config_rf_reg(struct adapter *adapt,
+ u32 addr, u32 data)
+{
+ u32 content = 0x1000; /*RF Content: radio_a_txt*/
+ u32 maskforphyset = (u32)(content & 0xE000);
+
+ rtl_rfreg_delay(adapt, RF90_PATH_A, addr| maskforphyset,
+ RFREG_OFFSET_MASK,
+ data);
+}
+
+static bool rtl88e_phy_config_rf_with_headerfile(struct adapter *adapt)
+{
+ u32 i;
+ u32 array_len = sizeof(Array_RadioA_1T_8188E)/sizeof(u32);
+ u32 *array = Array_RadioA_1T_8188E;
+
+ for (i = 0; i < array_len; i += 2) {
+ u32 v1 = array[i];
+ u32 v2 = array[i+1];
- /* This (offset, data) pair meets the condition. */
if (v1 < 0xCDCDCDCD) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
- if (v1 == 0xffe)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
- else if (v1 == 0xfd)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
- else if (v1 == 0xfc)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
- else if (v1 == 0xfb)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
- else if (v1 == 0xfa)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- else if (v1 == 0xf9)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
- else
- rtw_IOL_append_WRF_cmd(pxmit_frame, RF_PATH_A, (u16)v1, v2, bRFRegOffsetMask);
- } else {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- }
- continue;
- } else { /* This line is the start line of branch. */
- if (!CheckCondition(Array[i], hex)) {
- /* Discard the following (offset, data) pairs. */
+ rtl8188e_config_rf_reg(adapt, v1, v2);
+ continue;
+ } else {
+ if (!check_condition(adapt, array[i])) {
READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen - 2)
- READ_NEXT_PAIR(v1, v2, i);
- i -= 2; /* prevent from for-loop += 2 */
- } else { /* Configure matched pairs and skip to end of if-else. */
- READ_NEXT_PAIR(v1, v2, i);
- while (v2 != 0xDEAD &&
- v2 != 0xCDEF &&
- v2 != 0xCDCD && i < ArrayLen - 2) {
- if (biol) {
- if (rtw_IOL_cmd_boundary_handle(pxmit_frame))
- bndy_cnt++;
-
- if (v1 == 0xffe)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 50);
- else if (v1 == 0xfd)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 5);
- else if (v1 == 0xfc)
- rtw_IOL_append_DELAY_MS_cmd(pxmit_frame, 1);
- else if (v1 == 0xfb)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 50);
- else if (v1 == 0xfa)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 5);
- else if (v1 == 0xf9)
- rtw_IOL_append_DELAY_US_cmd(pxmit_frame, 1);
- else
- rtw_IOL_append_WRF_cmd(pxmit_frame, RF_PATH_A, (u16)v1, v2, bRFRegOffsetMask);
- } else {
- odm_ConfigRF_RadioA_8188E(pDM_Odm, v1, v2);
- }
+ while (v2 != 0xDEAD && v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < array_len - 2)
READ_NEXT_PAIR(v1, v2, i);
+ i -= 2;
+ } else {
+ READ_NEXT_PAIR(v1, v2, i);
+ while (v2 != 0xDEAD && v2 != 0xCDEF &&
+ v2 != 0xCDCD && i < array_len - 2) {
+ rtl8188e_config_rf_reg(adapt, v1, v2);
+ READ_NEXT_PAIR(v1, v2, i);
}
- while (v2 != 0xDEAD && i < ArrayLen - 2)
+ while (v2 != 0xDEAD && i < array_len - 2)
READ_NEXT_PAIR(v1, v2, i);
}
}
}
- if (biol) {
- if (!rtw_IOL_exec_cmds_sync(pDM_Odm->Adapter, pxmit_frame, 1000, bndy_cnt)) {
- rst = HAL_STATUS_FAILURE;
- pr_info("~~~ IOL Config %s Failed !!!\n", __func__);
+ return true;
+}
+
+static bool rf6052_conf_para(struct adapter *adapt)
+{
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
+ u32 u4val = 0;
+ u8 rfpath;
+ bool rtstatus = true;
+ struct bb_reg_def *pphyreg;
+
+ for (rfpath = 0; rfpath < hal_data->NumTotalRFPath; rfpath++) {
+ pphyreg = &hal_data->PHYRegDef[rfpath];
+
+ switch (rfpath) {
+ case RF90_PATH_A:
+ case RF90_PATH_C:
+ u4val = PHY_QueryBBReg(adapt, pphyreg->rfintfs,
+ BRFSI_RFENV);
+ break;
+ case RF90_PATH_B:
+ case RF90_PATH_D:
+ u4val = PHY_QueryBBReg(adapt, pphyreg->rfintfs,
+ BRFSI_RFENV << 16);
+ break;
+ }
+
+ PHY_SetBBReg(adapt, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
+ udelay(1);
+
+ PHY_SetBBReg(adapt, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
+ udelay(1);
+
+ PHY_SetBBReg(adapt, pphyreg->rfHSSIPara2,
+ B3WIREADDREAALENGTH, 0x0);
+ udelay(1);
+
+ PHY_SetBBReg(adapt, pphyreg->rfHSSIPara2, B3WIREDATALENGTH, 0x0);
+ udelay(1);
+
+ switch (rfpath) {
+ case RF90_PATH_A:
+ rtstatus = rtl88e_phy_config_rf_with_headerfile(adapt);
+ break;
+ case RF90_PATH_B:
+ rtstatus = rtl88e_phy_config_rf_with_headerfile(adapt);
+ break;
+ case RF90_PATH_C:
+ break;
+ case RF90_PATH_D:
+ break;
+ }
+
+ switch (rfpath) {
+ case RF90_PATH_A:
+ case RF90_PATH_C:
+ PHY_SetBBReg(adapt, pphyreg->rfintfs, BRFSI_RFENV, u4val);
+ break;
+ case RF90_PATH_B:
+ case RF90_PATH_D:
+ PHY_SetBBReg(adapt, pphyreg->rfintfs, BRFSI_RFENV << 16,
+ u4val);
+ break;
}
+
+ if (rtstatus != true)
+ return false;
}
- return rst;
+
+ return rtstatus;
+}
+
+static bool rtl88e_phy_rf6052_config(struct adapter *adapt)
+{
+ struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
+
+ if (hal_data->rf_type == RF_1T1R)
+ hal_data->NumTotalRFPath = 1;
+ else
+ hal_data->NumTotalRFPath = 2;
+
+ return rf6052_conf_para(adapt);
+}
+
+bool rtl88e_phy_rf_config(struct adapter *adapt)
+{
+ return rtl88e_phy_rf6052_config(adapt);
}
diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c
new file mode 100644
index 000000000000..09324ae80e72
--- /dev/null
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -0,0 +1,236 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2013 Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * 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
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <wlanfae@realtek.com>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ *
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ *****************************************************************************/
+
+#include "fw.h"
+#include "drv_types.h"
+#include "usb_ops_linux.h"
+#include "rtl8188e_spec.h"
+#include "rtl8188e_hal.h"
+
+#include <linux/firmware.h>
+#include <linux/kmemleak.h>
+
+static void _rtl88e_enable_fw_download(struct adapter *adapt, bool enable)
+{
+ u8 tmp;
+
+ if (enable) {
+ tmp = usb_read8(adapt, REG_MCUFWDL);
+ usb_write8(adapt, REG_MCUFWDL, tmp | 0x01);
+
+ tmp = usb_read8(adapt, REG_MCUFWDL + 2);
+ usb_write8(adapt, REG_MCUFWDL + 2, tmp & 0xf7);
+ } else {
+ tmp = usb_read8(adapt, REG_MCUFWDL);
+ usb_write8(adapt, REG_MCUFWDL, tmp & 0xfe);
+
+ usb_write8(adapt, REG_MCUFWDL + 1, 0x00);
+ }
+}
+
+static void _rtl88e_fw_block_write(struct adapter *adapt,
+ const u8 *buffer, u32 size)
+{
+ u32 blk_sz = sizeof(u32);
+ u8 *buf_ptr = (u8 *)buffer;
+ u32 *pu4BytePtr = (u32 *)buffer;
+ u32 i, offset, blk_cnt, remain;
+
+ blk_cnt = size / blk_sz;
+ remain = size % blk_sz;
+
+ for (i = 0; i < blk_cnt; i++) {
+ offset = i * blk_sz;
+ usb_write32(adapt, (FW_8192C_START_ADDRESS + offset),
+ *(pu4BytePtr + i));
+ }
+
+ if (remain) {
+ offset = blk_cnt * blk_sz;
+ buf_ptr += offset;
+ for (i = 0; i < remain; i++) {
+ usb_write8(adapt, (FW_8192C_START_ADDRESS +
+ offset + i), *(buf_ptr + i));
+ }
+ }
+}
+
+static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen)
+{
+ u32 fwlen = *pfwlen;
+ u8 remain = (u8) (fwlen % 4);
+
+ remain = (remain == 0) ? 0 : (4 - remain);
+
+ while (remain > 0) {
+ pfwbuf[fwlen] = 0;
+ fwlen++;
+ remain--;
+ }
+
+ *pfwlen = fwlen;
+}
+
+static void _rtl88e_fw_page_write(struct adapter *adapt,
+ u32 page, const u8 *buffer, u32 size)
+{
+ u8 value8;
+ u8 u8page = (u8) (page & 0x07);
+
+ value8 = (usb_read8(adapt, REG_MCUFWDL + 2) & 0xF8) | u8page;
+
+ usb_write8(adapt, (REG_MCUFWDL + 2), value8);
+ _rtl88e_fw_block_write(adapt, buffer, size);
+}
+
+static void _rtl88e_write_fw(struct adapter *adapt, u8 *buffer, u32 size)
+{
+ u8 *buf_ptr = buffer;
+ u32 page_no, remain;
+ u32 page, offset;
+
+ _rtl88e_fill_dummy(buf_ptr, &size);
+
+ page_no = size / FW_8192C_PAGE_SIZE;
+ remain = size % FW_8192C_PAGE_SIZE;
+
+ for (page = 0; page < page_no; page++) {
+ offset = page * FW_8192C_PAGE_SIZE;
+ _rtl88e_fw_page_write(adapt, page, (buf_ptr + offset),
+ FW_8192C_PAGE_SIZE);
+ }
+
+ if (remain) {
+ offset = page_no * FW_8192C_PAGE_SIZE;
+ page = page_no;
+ _rtl88e_fw_page_write(adapt, page, (buf_ptr + offset), remain);
+ }
+}
+
+static void rtl88e_firmware_selfreset(struct adapter *adapt)
+{
+ u8 u1b_tmp;
+
+ u1b_tmp = usb_read8(adapt, REG_SYS_FUNC_EN+1);
+ usb_write8(adapt, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2))));
+ usb_write8(adapt, REG_SYS_FUNC_EN+1, (u1b_tmp | BIT(2)));
+}
+
+static int _rtl88e_fw_free_to_go(struct adapter *adapt)
+{
+ int err = -EIO;
+ u32 counter = 0;
+ u32 value32;
+
+ do {
+ value32 = usb_read32(adapt, REG_MCUFWDL);
+ if (value32 & FWDL_ChkSum_rpt)
+ break;
+ } while (counter++ < POLLING_READY_TIMEOUT_COUNT);
+
+ if (counter >= POLLING_READY_TIMEOUT_COUNT) {
+ goto exit;
+ }
+
+ value32 = usb_read32(adapt, REG_MCUFWDL);
+ value32 |= MCUFWDL_RDY;
+ value32 &= ~WINTINI_RDY;
+ usb_write32(adapt, REG_MCUFWDL, value32);
+
+ rtl88e_firmware_selfreset(adapt);
+ counter = 0;
+
+ do {
+ value32 = usb_read32(adapt, REG_MCUFWDL);
+ if (value32 & WINTINI_RDY) {
+ err = 0;
+ goto exit;
+ }
+
+ udelay(FW_8192C_POLLING_DELAY);
+
+ } while (counter++ < POLLING_READY_TIMEOUT_COUNT);
+
+exit:
+ return err;
+}
+
+int rtl88e_download_fw(struct adapter *adapt)
+{
+ struct hal_data_8188e *rtlhal = GET_HAL_DATA(adapt);
+ struct dvobj_priv *dvobj = adapter_to_dvobj(adapt);
+ struct device *device = dvobj_to_dev(dvobj);
+ const struct firmware *fw;
+ const char fw_name[] = "rtlwifi/rtl8188eufw.bin";
+ struct rtl92c_firmware_header *pfwheader = NULL;
+ u8 *pfwdata;
+ u32 fwsize;
+ int err;
+
+ if (request_firmware(&fw, fw_name, device)){
+ dev_err(device, "Firmware %s not available\n", fw_name);
+ return -ENOENT;
+ }
+
+ if (fw->size > FW_8188E_SIZE) {
+ dev_err(device,"Firmware size exceed 0x%X. Check it.\n",
+ FW_8188E_SIZE);
+ return -1;
+ }
+
+ pfwdata = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
+ if (!pfwdata)
+ return -ENOMEM;
+
+ rtlhal->pfirmware = pfwdata;
+ memcpy(rtlhal->pfirmware, fw->data, fw->size);
+ rtlhal->fwsize = fw->size;
+ release_firmware(fw);
+
+ fwsize = rtlhal->fwsize;
+ pfwheader = (struct rtl92c_firmware_header *)pfwdata;
+
+ if (IS_FW_HEADER_EXIST(pfwheader)) {
+ pfwdata = pfwdata + 32;
+ fwsize = fwsize - 32;
+ }
+
+ if (usb_read8(adapt, REG_MCUFWDL) & RAM_DL_SEL) {
+ usb_write8(adapt, REG_MCUFWDL, 0);
+ rtl88e_firmware_selfreset(adapt);
+ }
+ _rtl88e_enable_fw_download(adapt, true);
+ usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt);
+ _rtl88e_write_fw(adapt, pfwdata, fwsize);
+ _rtl88e_enable_fw_download(adapt, false);
+
+ err = _rtl88e_fw_free_to_go(adapt);
+
+ return err;
+}
diff --git a/drivers/staging/rtl8188eu/hal/hal_intf.c b/drivers/staging/rtl8188eu/hal/hal_intf.c
index 2faa690f7e26..bc89e9978ed3 100644
--- a/drivers/staging/rtl8188eu/hal/hal_intf.c
+++ b/drivers/staging/rtl8188eu/hal/hal_intf.c
@@ -354,16 +354,6 @@ u8 rtw_hal_sreset_get_wifi_status(struct adapter *adapt)
return status;
}
-int rtw_hal_iol_cmd(struct adapter *adapter, struct xmit_frame *xmit_frame,
- u32 max_wating_ms, u32 bndy_cnt)
-{
- if (adapter->HalFunc.IOL_exec_cmds_sync)
- return adapter->HalFunc.IOL_exec_cmds_sync(adapter, xmit_frame,
- max_wating_ms,
- bndy_cnt);
- return _FAIL;
-}
-
void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
{
if (adapter->HalFunc.hal_notch_filter)
diff --git a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
index f2e1d02b8ae3..dbc1368d81fa 100644
--- a/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/rtl8188eu/hal/odm_HWConfig.c
@@ -431,39 +431,3 @@ void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
{
ODM_PhyStatusQuery_92CSeries(dm_odm, pPhyInfo, pPhyStatus, pPktinfo);
}
-
-enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *dm_odm,
- enum rf_radio_path content,
- enum rf_radio_path rfpath)
-{
- ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===>ODM_ConfigRFWithHeaderFile\n"));
- if (rfpath == RF_PATH_A)
- READ_AND_CONFIG(8188E, _RadioA_1T_);
- ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_A:Rtl8188ERadioA_1TArray\n"));
- ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> ODM_ConfigRFWithHeaderFile() Radio_B:Rtl8188ERadioB_1TArray\n"));
-
- ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("ODM_ConfigRFWithHeaderFile: Radio No %x\n", rfpath));
- return HAL_STATUS_SUCCESS;
-}
-
-enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *dm_odm,
- enum odm_bb_config_type config_tp)
-{
- if (config_tp == CONFIG_BB_PHY_REG) {
- READ_AND_CONFIG(8188E, _PHY_REG_1T_);
- } else if (config_tp == CONFIG_BB_AGC_TAB) {
- READ_AND_CONFIG(8188E, _AGC_TAB_1T_);
- } else if (config_tp == CONFIG_BB_PHY_REG_PG) {
- READ_AND_CONFIG(8188E, _PHY_REG_PG_);
- ODM_RT_TRACE(dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8188EPHY_REG_PGArray\n"));
- }
- return HAL_STATUS_SUCCESS;
-}
-
-enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *dm_odm)
-{
- u8 result = HAL_STATUS_SUCCESS;
- result = READ_AND_CONFIG(8188E, _MAC_REG_);
- return result;
-}
diff --git a/drivers/staging/rtl8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/rtl8188eu/hal/odm_RegConfig8188E.c
deleted file mode 100644
index 4d4978bee51d..000000000000
--- a/drivers/staging/rtl8188eu/hal/odm_RegConfig8188E.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * 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
- *
- *
- ******************************************************************************/
-
-#include "odm_precomp.h"
-
-void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
- u32 Data, enum rf_radio_path RF_PATH,
- u32 RegAddr)
-{
- struct adapter *adapter = pDM_Odm->Adapter;
-
- if (Addr == 0xffe) {
- msleep(50);
- } else if (Addr == 0xfd) {
- mdelay(5);
- } else if (Addr == 0xfc) {
- mdelay(1);
- } else if (Addr == 0xfb) {
- udelay(50);
- } else if (Addr == 0xfa) {
- udelay(5);
- } else if (Addr == 0xf9) {
- udelay(1);
- } else {
- PHY_SetRFReg(adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
- /* Add 1us delay between BB/RF register setting. */
- udelay(1);
- }
-}
-
-void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data)
-{
- u32 content = 0x1000; /* RF_Content: radioa_txt */
- u32 maskforPhySet = (u32)(content&0xE000);
-
- odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr|maskforPhySet);
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data));
-}
-
-void odm_ConfigRF_RadioB_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data)
-{
- u32 content = 0x1001; /* RF_Content: radiob_txt */
- u32 maskforPhySet = (u32)(content&0xE000);
-
- odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_B, Addr|maskforPhySet);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioB] %08X %08X\n", Addr, Data));
-}
-
-void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data)
-{
- struct adapter *adapt = pDM_Odm->Adapter;
-
- usb_write8(adapt, Addr, Data);
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data));
-}
-
-void odm_ConfigBB_AGC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
-{
- struct adapter *adapter = pDM_Odm->Adapter;
-
- PHY_SetBBReg(adapter, Addr, Bitmask, Data);
- /* Add 1us delay between BB/RF register setting. */
- udelay(1);
-
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
- ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n",
- Addr, Data));
-}
-
-void odm_ConfigBB_PHY_REG_PG_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
- u32 Bitmask, u32 Data)
-{
- if (Addr == 0xfe) {
- msleep(50);
- } else if (Addr == 0xfd) {
- mdelay(5);
- } else if (Addr == 0xfc) {
- mdelay(1);
- } else if (Addr == 0xfb) {
- udelay(50);
- } else if (Addr == 0xfa) {
- udelay(5);
- } else if (Addr == 0xf9) {
- udelay(1);
- } else{
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD,
- ("===> @@@@@@@ ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n",
- Addr, Bitmask, Data));
- storePwrIndexDiffRateOffset(pDM_Odm->Adapter, Addr, Bitmask, Data);
- }
-}
-
-void odm_ConfigBB_PHY_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Bitmask, u32 Data)
-{
- struct adapter *adapter = pDM_Odm->Adapter;
-
- if (Addr == 0xfe) {
- msleep(50);
- } else if (Addr == 0xfd) {
- mdelay(5);
- } else if (Addr == 0xfc) {
- mdelay(1);
- } else if (Addr == 0xfb) {
- udelay(50);
- } else if (Addr == 0xfa) {
- udelay(5);
- } else if (Addr == 0xf9) {
- udelay(1);
- } else {
- if (Addr == 0xa24)
- pDM_Odm->RFCalibrateInfo.RegA24 = Data;
- PHY_SetBBReg(adapter, Addr, Bitmask, Data);
-
- /* Add 1us delay between BB/RF register setting. */
- udelay(1);
- ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE,
- ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n",
- Addr, Data));
- }
-}
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index fbf70f6a0151..50b13323c71d 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -99,216 +99,8 @@ s32 rtl8188e_iol_efuse_patch(struct adapter *padapter)
return result;
}
-static s32 iol_ioconfig(struct adapter *padapter, u8 iocfg_bndy)
-{
- s32 rst = _SUCCESS;
-
- usb_write8(padapter, REG_TDECTRL+1, iocfg_bndy);
- rst = iol_execute(padapter, CMD_IOCONFIG);
- return rst;
-}
-
-static int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
-{
- struct pkt_attrib *pattrib = &xmit_frame->attrib;
- u8 i;
- int ret = _FAIL;
-
- if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS)
- goto exit;
- if (rtw_usb_bulk_size_boundary(adapter, TXDESC_SIZE+pattrib->last_txcmdsz)) {
- if (rtw_IOL_append_END_cmd(xmit_frame) != _SUCCESS)
- goto exit;
- }
-
- dump_mgntframe_and_wait(adapter, xmit_frame, max_wating_ms);
-
- iol_mode_enable(adapter, 1);
- for (i = 0; i < bndy_cnt; i++) {
- u8 page_no = 0;
- page_no = i*2;
- ret = iol_ioconfig(adapter, page_no);
- if (ret != _SUCCESS)
- break;
- }
- iol_mode_enable(adapter, 0);
-exit:
- /* restore BCN_HEAD */
- usb_write8(adapter, REG_TDECTRL+1, 0);
- return ret;
-}
-
-void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter, int data_len)
-{
- u32 fifo_data, reg_140;
- u32 addr, rstatus, loop = 0;
- u16 data_cnts = (data_len/8)+1;
- u8 *pbuf = vzalloc(data_len+10);
- DBG_88E("###### %s ######\n", __func__);
-
- usb_write8(Adapter, REG_PKT_BUFF_ACCESS_CTRL, TXPKT_BUF_SELECT);
- if (pbuf) {
- for (addr = 0; addr < data_cnts; addr++) {
- usb_write32(Adapter, 0x140, addr);
- msleep(1);
- loop = 0;
- do {
- rstatus = (reg_140 = usb_read32(Adapter, REG_PKTBUF_DBG_CTRL)&BIT24);
- if (rstatus) {
- fifo_data = usb_read32(Adapter, REG_PKTBUF_DBG_DATA_L);
- memcpy(pbuf+(addr*8), &fifo_data, 4);
-
- fifo_data = usb_read32(Adapter, REG_PKTBUF_DBG_DATA_H);
- memcpy(pbuf+(addr*8+4), &fifo_data, 4);
- }
- msleep(1);
- } while (!rstatus && (loop++ < 10));
- }
- rtw_IOL_cmd_buf_dump(Adapter, data_len, pbuf);
- vfree(pbuf);
- }
- DBG_88E("###### %s ######\n", __func__);
-}
-
-static void _FWDownloadEnable(struct adapter *padapter, bool enable)
-{
- u8 tmp;
-
- if (enable) {
- /* MCU firmware download enable. */
- tmp = usb_read8(padapter, REG_MCUFWDL);
- usb_write8(padapter, REG_MCUFWDL, tmp | 0x01);
-
- /* 8051 reset */
- tmp = usb_read8(padapter, REG_MCUFWDL+2);
- usb_write8(padapter, REG_MCUFWDL+2, tmp&0xf7);
- } else {
- /* MCU firmware download disable. */
- tmp = usb_read8(padapter, REG_MCUFWDL);
- usb_write8(padapter, REG_MCUFWDL, tmp&0xfe);
-
- /* Reserved for fw extension. */
- usb_write8(padapter, REG_MCUFWDL+1, 0x00);
- }
-}
-
#define MAX_REG_BOLCK_SIZE 196
-static int _BlockWrite(struct adapter *padapter, void *buffer, u32 buffSize)
-{
- int ret = _SUCCESS;
- u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */
- u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */
- u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */
- u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0;
- u32 remainSize_p1 = 0, remainSize_p2 = 0;
- u8 *bufferPtr = (u8 *)buffer;
- u32 i = 0, offset = 0;
-
- blockSize_p1 = MAX_REG_BOLCK_SIZE;
-
- /* 3 Phase #1 */
- blockCount_p1 = buffSize / blockSize_p1;
- remainSize_p1 = buffSize % blockSize_p1;
-
- if (blockCount_p1) {
- RT_TRACE(_module_hal_init_c_, _drv_notice_,
- ("_BlockWrite: [P1] buffSize(%d) blockSize_p1(%d) blockCount_p1(%d) remainSize_p1(%d)\n",
- buffSize, blockSize_p1, blockCount_p1, remainSize_p1));
- }
-
- for (i = 0; i < blockCount_p1; i++) {
- ret = usb_writeN(padapter, (FW_8188E_START_ADDRESS + i * blockSize_p1), blockSize_p1, (bufferPtr + i * blockSize_p1));
- if (ret == _FAIL)
- goto exit;
- }
-
- /* 3 Phase #2 */
- if (remainSize_p1) {
- offset = blockCount_p1 * blockSize_p1;
-
- blockCount_p2 = remainSize_p1/blockSize_p2;
- remainSize_p2 = remainSize_p1%blockSize_p2;
-
- if (blockCount_p2) {
- RT_TRACE(_module_hal_init_c_, _drv_notice_,
- ("_BlockWrite: [P2] buffSize_p2(%d) blockSize_p2(%d) blockCount_p2(%d) remainSize_p2(%d)\n",
- (buffSize-offset), blockSize_p2 , blockCount_p2, remainSize_p2));
- }
-
- for (i = 0; i < blockCount_p2; i++) {
- ret = usb_writeN(padapter, (FW_8188E_START_ADDRESS + offset + i*blockSize_p2), blockSize_p2, (bufferPtr + offset + i*blockSize_p2));
-
- if (ret == _FAIL)
- goto exit;
- }
- }
-
- /* 3 Phase #3 */
- if (remainSize_p2) {
- offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2);
-
- blockCount_p3 = remainSize_p2 / blockSize_p3;
-
- RT_TRACE(_module_hal_init_c_, _drv_notice_,
- ("_BlockWrite: [P3] buffSize_p3(%d) blockSize_p3(%d) blockCount_p3(%d)\n",
- (buffSize-offset), blockSize_p3, blockCount_p3));
-
- for (i = 0; i < blockCount_p3; i++) {
- ret = usb_write8(padapter, (FW_8188E_START_ADDRESS + offset + i), *(bufferPtr + offset + i));
-
- if (ret == _FAIL)
- goto exit;
- }
- }
-
-exit:
- return ret;
-}
-
-static int _PageWrite(struct adapter *padapter, u32 page, void *buffer, u32 size)
-{
- u8 value8;
- u8 u8Page = (u8)(page & 0x07);
-
- value8 = (usb_read8(padapter, REG_MCUFWDL+2) & 0xF8) | u8Page;
- usb_write8(padapter, REG_MCUFWDL+2, value8);
-
- return _BlockWrite(padapter, buffer, size);
-}
-
-static int _WriteFW(struct adapter *padapter, void *buffer, u32 size)
-{
- /* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */
- /* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */
- int ret = _SUCCESS;
- u32 pageNums, remainSize;
- u32 page, offset;
- u8 *bufferPtr = (u8 *)buffer;
-
- pageNums = size / MAX_PAGE_SIZE;
- remainSize = size % MAX_PAGE_SIZE;
-
- for (page = 0; page < pageNums; page++) {
- offset = page * MAX_PAGE_SIZE;
- ret = _PageWrite(padapter, page, bufferPtr+offset, MAX_PAGE_SIZE);
-
- if (ret == _FAIL)
- goto exit;
- }
- if (remainSize) {
- offset = pageNums * MAX_PAGE_SIZE;
- page = pageNums;
- ret = _PageWrite(padapter, page, bufferPtr+offset, remainSize);
-
- if (ret == _FAIL)
- goto exit;
- }
- RT_TRACE(_module_hal_init_c_, _drv_info_, ("_WriteFW Done- for Normal chip.\n"));
-exit:
- return ret;
-}
-
void _8051Reset88E(struct adapter *padapter)
{
u8 u1bTmp;
@@ -319,167 +111,6 @@ void _8051Reset88E(struct adapter *padapter)
DBG_88E("=====> _8051Reset88E(): 8051 reset success .\n");
}
-static s32 _FWFreeToGo(struct adapter *padapter)
-{
- u32 counter = 0;
- u32 value32;
-
- /* polling CheckSum report */
- do {
- value32 = usb_read32(padapter, REG_MCUFWDL);
- if (value32 & FWDL_ChkSum_rpt)
- break;
- } while (counter++ < POLLING_READY_TIMEOUT_COUNT);
-
- if (counter >= POLLING_READY_TIMEOUT_COUNT) {
- DBG_88E("%s: chksum report fail! REG_MCUFWDL:0x%08x\n", __func__, value32);
- return _FAIL;
- }
- DBG_88E("%s: Checksum report OK! REG_MCUFWDL:0x%08x\n", __func__, value32);
-
- value32 = usb_read32(padapter, REG_MCUFWDL);
- value32 |= MCUFWDL_RDY;
- value32 &= ~WINTINI_RDY;
- usb_write32(padapter, REG_MCUFWDL, value32);
-
- _8051Reset88E(padapter);
-
- /* polling for FW ready */
- counter = 0;
- do {
- value32 = usb_read32(padapter, REG_MCUFWDL);
- if (value32 & WINTINI_RDY) {
- DBG_88E("%s: Polling FW ready success!! REG_MCUFWDL:0x%08x\n", __func__, value32);
- return _SUCCESS;
- }
- udelay(5);
- } while (counter++ < POLLING_READY_TIMEOUT_COUNT);
-
- DBG_88E("%s: Polling FW ready fail!! REG_MCUFWDL:0x%08x\n", __func__, value32);
- return _FAIL;
-}
-
-#define IS_FW_81xxC(padapter) (((GET_HAL_DATA(padapter))->FirmwareSignature & 0xFFF0) == 0x88C0)
-
-static int load_firmware(struct rt_firmware *pFirmware, struct device *device)
-{
- int rtstatus = _SUCCESS;
- const struct firmware *fw;
- const char fw_name[] = "rtlwifi/rtl8188eufw.bin";
-
- if (request_firmware(&fw, fw_name, device)) {
- rtstatus = _FAIL;
- goto exit;
- }
- if (!fw) {
- pr_err("Firmware %s not available\n", fw_name);
- rtstatus = _FAIL;
- goto exit;
- }
- if (fw->size > FW_8188E_SIZE) {
- rtstatus = _FAIL;
- RT_TRACE(_module_hal_init_c_, _drv_err_,
- ("Firmware size exceed 0x%X. Check it.\n",
- FW_8188E_SIZE));
- goto exit;
- }
-
- pFirmware->szFwBuffer = kzalloc(FW_8188E_SIZE, GFP_KERNEL);
- if (!pFirmware->szFwBuffer) {
- rtstatus = _FAIL;
- goto exit;
- }
- memcpy(pFirmware->szFwBuffer, fw->data, fw->size);
- pFirmware->ulFwLength = fw->size;
- release_firmware(fw);
-
- DBG_88E_LEVEL(_drv_info_,
- "+%s: !bUsedWoWLANFw, FmrmwareLen:%d+\n", __func__,
- pFirmware->ulFwLength);
-exit:
- return rtstatus;
-}
-
-s32 rtl8188e_FirmwareDownload(struct adapter *padapter)
-{
- s32 rtStatus = _SUCCESS;
- u8 writeFW_retry = 0;
- u32 fwdl_start_time;
- struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
- struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
- struct device *device = dvobj_to_dev(dvobj);
- struct rt_firmware_hdr *pFwHdr = NULL;
- u8 *pFirmwareBuf;
- u32 FirmwareLen;
- static int log_version;
-
- RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__));
- if (!dvobj->firmware.szFwBuffer)
- rtStatus = load_firmware(&dvobj->firmware, device);
- if (rtStatus == _FAIL) {
- dvobj->firmware.szFwBuffer = NULL;
- goto Exit;
- }
- pFirmwareBuf = dvobj->firmware.szFwBuffer;
- FirmwareLen = dvobj->firmware.ulFwLength;
-
- /* To Check Fw header. Added by tynli. 2009.12.04. */
- pFwHdr = (struct rt_firmware_hdr *)dvobj->firmware.szFwBuffer;
-
- pHalData->FirmwareVersion = le16_to_cpu(pFwHdr->Version);
- pHalData->FirmwareSubVersion = pFwHdr->Subversion;
- pHalData->FirmwareSignature = le16_to_cpu(pFwHdr->Signature);
-
- if (!log_version++)
- pr_info("%sFirmware Version %d, SubVersion %d, Signature 0x%x\n",
- DRIVER_PREFIX, pHalData->FirmwareVersion,
- pHalData->FirmwareSubVersion, pHalData->FirmwareSignature);
-
- if (IS_FW_HEADER_EXIST(pFwHdr)) {
- /* Shift 32 bytes for FW header */
- pFirmwareBuf = pFirmwareBuf + 32;
- FirmwareLen = FirmwareLen - 32;
- }
-
- /* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */
- /* or it will cause download Fw fail. 2010.02.01. by tynli. */
- if (usb_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */
- usb_write8(padapter, REG_MCUFWDL, 0x00);
- _8051Reset88E(padapter);
- }
-
- _FWDownloadEnable(padapter, true);
- fwdl_start_time = jiffies;
- while (1) {
- /* reset the FWDL chksum */
- usb_write8(padapter, REG_MCUFWDL, usb_read8(padapter, REG_MCUFWDL) | FWDL_ChkSum_rpt);
-
- rtStatus = _WriteFW(padapter, pFirmwareBuf, FirmwareLen);
-
- if (rtStatus == _SUCCESS ||
- (rtw_get_passing_time_ms(fwdl_start_time) > 500 && writeFW_retry++ >= 3))
- break;
-
- DBG_88E("%s writeFW_retry:%u, time after fwdl_start_time:%ums\n",
- __func__, writeFW_retry, rtw_get_passing_time_ms(fwdl_start_time)
- );
- }
- _FWDownloadEnable(padapter, false);
- if (_SUCCESS != rtStatus) {
- DBG_88E("DL Firmware failed!\n");
- goto Exit;
- }
-
- rtStatus = _FWFreeToGo(padapter);
- if (_SUCCESS != rtStatus) {
- DBG_88E("DL Firmware failed!\n");
- goto Exit;
- }
- RT_TRACE(_module_hal_init_c_, _drv_info_, ("Firmware is ready to run!\n"));
-Exit:
- return rtStatus;
-}
-
void rtl8188e_InitializeFirmwareVars(struct adapter *padapter)
{
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
@@ -609,8 +240,6 @@ void rtl8188e_set_hal_ops(struct hal_ops *pHalFunc)
pHalFunc->SetHalODMVarHandler = &rtl8188e_SetHalODMVar;
- pHalFunc->IOL_exec_cmds_sync = &rtl8188e_IOL_exec_cmds_sync;
-
pHalFunc->hal_notch_filter = &hal_notch_filter_8188e;
}
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c
index 9f016a5401d8..0f90cf4171eb 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_phycfg.c
@@ -354,283 +354,6 @@ rtl8188e_PHY_SetRFReg(
phy_RFSerialWrite(Adapter, eRFPath, RegAddr, Data);
}
-/* */
-/* 3. Initial MAC/BB/RF config by reading MAC/BB/RF txt. */
-/* */
-
-/*-----------------------------------------------------------------------------
- * Function: PHY_MACConfig8192C
- *
- * Overview: Condig MAC by header file or parameter file.
- *
- * Input: NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * When Who Remark
- * 08/12/2008 MHC Create Version 0.
- *
- *---------------------------------------------------------------------------*/
-s32 PHY_MACConfig8188E(struct adapter *Adapter)
-{
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- /* */
- /* Config MAC */
- /* */
- if (HAL_STATUS_FAILURE == ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv))
- rtStatus = _FAIL;
-
- /* 2010.07.13 AMPDU aggregation number B */
- usb_write16(Adapter, REG_MAX_AGGR_NUM, MAX_AGGR_NUM);
-
- return rtStatus;
-}
-
-/**
-* Function: phy_InitBBRFRegisterDefinition
-*
-* OverView: Initialize Register definition offset for Radio Path A/B/C/D
-*
-* Input:
-* struct adapter *Adapter,
-*
-* Output: None
-* Return: None
-* Note: The initialization value is constant and it should never be changes
-*/
-static void
-phy_InitBBRFRegisterDefinition(
- struct adapter *Adapter
-)
-{
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
-
- /* RF Interface Sowrtware Control */
- pHalData->PHYRegDef[RF_PATH_A].rfintfs = rFPGA0_XAB_RFInterfaceSW; /* 16 LSBs if read 32-bit from 0x870 */
- pHalData->PHYRegDef[RF_PATH_B].rfintfs = rFPGA0_XAB_RFInterfaceSW; /* 16 MSBs if read 32-bit from 0x870 (16-bit for 0x872) */
- pHalData->PHYRegDef[RF_PATH_C].rfintfs = rFPGA0_XCD_RFInterfaceSW;/* 16 LSBs if read 32-bit from 0x874 */
- pHalData->PHYRegDef[RF_PATH_D].rfintfs = rFPGA0_XCD_RFInterfaceSW;/* 16 MSBs if read 32-bit from 0x874 (16-bit for 0x876) */
-
- /* RF Interface Readback Value */
- pHalData->PHYRegDef[RF_PATH_A].rfintfi = rFPGA0_XAB_RFInterfaceRB; /* 16 LSBs if read 32-bit from 0x8E0 */
- pHalData->PHYRegDef[RF_PATH_B].rfintfi = rFPGA0_XAB_RFInterfaceRB;/* 16 MSBs if read 32-bit from 0x8E0 (16-bit for 0x8E2) */
- pHalData->PHYRegDef[RF_PATH_C].rfintfi = rFPGA0_XCD_RFInterfaceRB;/* 16 LSBs if read 32-bit from 0x8E4 */
- pHalData->PHYRegDef[RF_PATH_D].rfintfi = rFPGA0_XCD_RFInterfaceRB;/* 16 MSBs if read 32-bit from 0x8E4 (16-bit for 0x8E6) */
-
- /* RF Interface Output (and Enable) */
- pHalData->PHYRegDef[RF_PATH_A].rfintfo = rFPGA0_XA_RFInterfaceOE; /* 16 LSBs if read 32-bit from 0x860 */
- pHalData->PHYRegDef[RF_PATH_B].rfintfo = rFPGA0_XB_RFInterfaceOE; /* 16 LSBs if read 32-bit from 0x864 */
-
- /* RF Interface (Output and) Enable */
- pHalData->PHYRegDef[RF_PATH_A].rfintfe = rFPGA0_XA_RFInterfaceOE; /* 16 MSBs if read 32-bit from 0x860 (16-bit for 0x862) */
- pHalData->PHYRegDef[RF_PATH_B].rfintfe = rFPGA0_XB_RFInterfaceOE; /* 16 MSBs if read 32-bit from 0x864 (16-bit for 0x866) */
-
- /* Addr of LSSI. Wirte RF register by driver */
- pHalData->PHYRegDef[RF_PATH_A].rf3wireOffset = rFPGA0_XA_LSSIParameter; /* LSSI Parameter */
- pHalData->PHYRegDef[RF_PATH_B].rf3wireOffset = rFPGA0_XB_LSSIParameter;
-
- /* RF parameter */
- pHalData->PHYRegDef[RF_PATH_A].rfLSSI_Select = rFPGA0_XAB_RFParameter; /* BB Band Select */
- pHalData->PHYRegDef[RF_PATH_B].rfLSSI_Select = rFPGA0_XAB_RFParameter;
- pHalData->PHYRegDef[RF_PATH_C].rfLSSI_Select = rFPGA0_XCD_RFParameter;
- pHalData->PHYRegDef[RF_PATH_D].rfLSSI_Select = rFPGA0_XCD_RFParameter;
-
- /* Tx AGC Gain Stage (same for all path. Should we remove this?) */
- pHalData->PHYRegDef[RF_PATH_A].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */
- pHalData->PHYRegDef[RF_PATH_B].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */
- pHalData->PHYRegDef[RF_PATH_C].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */
- pHalData->PHYRegDef[RF_PATH_D].rfTxGainStage = rFPGA0_TxGainStage; /* Tx gain stage */
-
- /* Tranceiver A~D HSSI Parameter-1 */
- pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara1 = rFPGA0_XA_HSSIParameter1; /* wire control parameter1 */
- pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara1 = rFPGA0_XB_HSSIParameter1; /* wire control parameter1 */
-
- /* Tranceiver A~D HSSI Parameter-2 */
- pHalData->PHYRegDef[RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; /* wire control parameter2 */
- pHalData->PHYRegDef[RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; /* wire control parameter2 */
-
- /* RF switch Control */
- pHalData->PHYRegDef[RF_PATH_A].rfSwitchControl = rFPGA0_XAB_SwitchControl; /* TR/Ant switch control */
- pHalData->PHYRegDef[RF_PATH_B].rfSwitchControl = rFPGA0_XAB_SwitchControl;
- pHalData->PHYRegDef[RF_PATH_C].rfSwitchControl = rFPGA0_XCD_SwitchControl;
- pHalData->PHYRegDef[RF_PATH_D].rfSwitchControl = rFPGA0_XCD_SwitchControl;
-
- /* AGC control 1 */
- pHalData->PHYRegDef[RF_PATH_A].rfAGCControl1 = rOFDM0_XAAGCCore1;
- pHalData->PHYRegDef[RF_PATH_B].rfAGCControl1 = rOFDM0_XBAGCCore1;
- pHalData->PHYRegDef[RF_PATH_C].rfAGCControl1 = rOFDM0_XCAGCCore1;
- pHalData->PHYRegDef[RF_PATH_D].rfAGCControl1 = rOFDM0_XDAGCCore1;
-
- /* AGC control 2 */
- pHalData->PHYRegDef[RF_PATH_A].rfAGCControl2 = rOFDM0_XAAGCCore2;
- pHalData->PHYRegDef[RF_PATH_B].rfAGCControl2 = rOFDM0_XBAGCCore2;
- pHalData->PHYRegDef[RF_PATH_C].rfAGCControl2 = rOFDM0_XCAGCCore2;
- pHalData->PHYRegDef[RF_PATH_D].rfAGCControl2 = rOFDM0_XDAGCCore2;
-
- /* RX AFE control 1 */
- pHalData->PHYRegDef[RF_PATH_A].rfRxIQImbalance = rOFDM0_XARxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_B].rfRxIQImbalance = rOFDM0_XBRxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_C].rfRxIQImbalance = rOFDM0_XCRxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_D].rfRxIQImbalance = rOFDM0_XDRxIQImbalance;
-
- /* RX AFE control 1 */
- pHalData->PHYRegDef[RF_PATH_A].rfRxAFE = rOFDM0_XARxAFE;
- pHalData->PHYRegDef[RF_PATH_B].rfRxAFE = rOFDM0_XBRxAFE;
- pHalData->PHYRegDef[RF_PATH_C].rfRxAFE = rOFDM0_XCRxAFE;
- pHalData->PHYRegDef[RF_PATH_D].rfRxAFE = rOFDM0_XDRxAFE;
-
- /* Tx AFE control 1 */
- pHalData->PHYRegDef[RF_PATH_A].rfTxIQImbalance = rOFDM0_XATxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_B].rfTxIQImbalance = rOFDM0_XBTxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_C].rfTxIQImbalance = rOFDM0_XCTxIQImbalance;
- pHalData->PHYRegDef[RF_PATH_D].rfTxIQImbalance = rOFDM0_XDTxIQImbalance;
-
- /* Tx AFE control 2 */
- pHalData->PHYRegDef[RF_PATH_A].rfTxAFE = rOFDM0_XATxAFE;
- pHalData->PHYRegDef[RF_PATH_B].rfTxAFE = rOFDM0_XBTxAFE;
- pHalData->PHYRegDef[RF_PATH_C].rfTxAFE = rOFDM0_XCTxAFE;
- pHalData->PHYRegDef[RF_PATH_D].rfTxAFE = rOFDM0_XDTxAFE;
-
- /* Tranceiver LSSI Readback SI mode */
- pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_C].rfLSSIReadBack = rFPGA0_XC_LSSIReadBack;
- pHalData->PHYRegDef[RF_PATH_D].rfLSSIReadBack = rFPGA0_XD_LSSIReadBack;
-
- /* Tranceiver LSSI Readback PI mode */
- pHalData->PHYRegDef[RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback;
- pHalData->PHYRegDef[RF_PATH_B].rfLSSIReadBackPi = TransceiverB_HSPI_Readback;
-}
-
-void storePwrIndexDiffRateOffset(struct adapter *Adapter, u32 RegAddr, u32 BitMask, u32 Data)
-{
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
-
- if (RegAddr == rTxAGC_A_Rate18_06)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0] = Data;
- if (RegAddr == rTxAGC_A_Rate54_24)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][1] = Data;
- if (RegAddr == rTxAGC_A_CCK1_Mcs32)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][6] = Data;
- if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0xffffff00)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][7] = Data;
- if (RegAddr == rTxAGC_A_Mcs03_Mcs00)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][2] = Data;
- if (RegAddr == rTxAGC_A_Mcs07_Mcs04)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][3] = Data;
- if (RegAddr == rTxAGC_A_Mcs11_Mcs08)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][4] = Data;
- if (RegAddr == rTxAGC_A_Mcs15_Mcs12) {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][5] = Data;
- if (pHalData->rf_type == RF_1T1R)
- pHalData->pwrGroupCnt++;
- }
- if (RegAddr == rTxAGC_B_Rate18_06)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][8] = Data;
- if (RegAddr == rTxAGC_B_Rate54_24)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][9] = Data;
- if (RegAddr == rTxAGC_B_CCK1_55_Mcs32)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][14] = Data;
- if (RegAddr == rTxAGC_B_CCK11_A_CCK2_11 && BitMask == 0x000000ff)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][15] = Data;
- if (RegAddr == rTxAGC_B_Mcs03_Mcs00)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][10] = Data;
- if (RegAddr == rTxAGC_B_Mcs07_Mcs04)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][11] = Data;
- if (RegAddr == rTxAGC_B_Mcs11_Mcs08)
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][12] = Data;
- if (RegAddr == rTxAGC_B_Mcs15_Mcs12) {
- pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][13] = Data;
- if (pHalData->rf_type != RF_1T1R)
- pHalData->pwrGroupCnt++;
- }
-}
-
-static int phy_BB8188E_Config_ParaFile(struct adapter *Adapter)
-{
- struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(Adapter);
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- /* */
- /* 1. Read PHY_REG.TXT BB INIT!! */
- /* We will separate as 88C / 92C according to chip version */
- /* */
- if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG))
- rtStatus = _FAIL;
- if (rtStatus != _SUCCESS)
- goto phy_BB8190_Config_ParaFile_Fail;
-
- /* 2. If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */
- if (!pEEPROM->bautoload_fail_flag) {
- pHalData->pwrGroupCnt = 0;
-
- if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG))
- rtStatus = _FAIL;
- }
-
- if (rtStatus != _SUCCESS)
- goto phy_BB8190_Config_ParaFile_Fail;
-
- /* 3. BB AGC table Initialization */
- if (HAL_STATUS_FAILURE == ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_AGC_TAB))
- rtStatus = _FAIL;
-
- if (rtStatus != _SUCCESS)
- goto phy_BB8190_Config_ParaFile_Fail;
-
-phy_BB8190_Config_ParaFile_Fail:
-
- return rtStatus;
-}
-
-int
-PHY_BBConfig8188E(
- struct adapter *Adapter
- )
-{
- int rtStatus = _SUCCESS;
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
- u32 RegVal;
- u8 CrystalCap;
-
- phy_InitBBRFRegisterDefinition(Adapter);
-
-
- /* Enable BB and RF */
- RegVal = usb_read16(Adapter, REG_SYS_FUNC_EN);
- usb_write16(Adapter, REG_SYS_FUNC_EN, (u16)(RegVal|BIT13|BIT0|BIT1));
-
- /* 20090923 Joseph: Advised by Steven and Jenyu. Power sequence before init RF. */
-
- usb_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB);
-
- usb_write8(Adapter, REG_SYS_FUNC_EN, FEN_USBA | FEN_USBD | FEN_BB_GLB_RSTn | FEN_BBRSTB);
-
- /* Config BB and AGC */
- rtStatus = phy_BB8188E_Config_ParaFile(Adapter);
-
- /* write 0x24[16:11] = 0x24[22:17] = CrystalCap */
- CrystalCap = pHalData->CrystalCap & 0x3F;
- PHY_SetBBReg(Adapter, REG_AFE_XTAL_CTRL, 0x7ff800, (CrystalCap | (CrystalCap << 6)));
-
- return rtStatus;
-}
-
-int PHY_RFConfig8188E(struct adapter *Adapter)
-{
- int rtStatus = _SUCCESS;
-
- /* RF config */
- rtStatus = PHY_RF6052_Config8188E(Adapter);
- return rtStatus;
-}
-
static void getTxPowerIndex88E(struct adapter *Adapter, u8 channel, u8 *cckPowerLevel,
u8 *ofdmPowerLevel, u8 *BW20PowerLevel,
u8 *BW40PowerLevel)
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/rtl8188eu/hal/rtl8188e_rf6052.c
index 8ce9d0e4eeff..655d8e0d5cb7 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rf6052.c
@@ -429,99 +429,3 @@ rtl8188e_PHY_RF6052SetOFDMTxPower(
writeOFDMPowerReg88E(Adapter, index, &writeVal[0]);
}
}
-
-static int phy_RF6052_Config_ParaFile(struct adapter *Adapter)
-{
- struct bb_reg_def *pPhyReg;
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
- u32 u4RegValue = 0;
- u8 eRFPath;
- int rtStatus = _SUCCESS;
-
- /* 3----------------------------------------------------------------- */
- /* 3 <2> Initialize RF */
- /* 3----------------------------------------------------------------- */
- for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) {
- pPhyReg = &pHalData->PHYRegDef[eRFPath];
-
- /*----Store original RFENV control type----*/
- switch (eRFPath) {
- case RF_PATH_A:
- case RF_PATH_C:
- u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV);
- break;
- case RF_PATH_B:
- case RF_PATH_D:
- u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16);
- break;
- }
- /*----Set RF_ENV enable----*/
- PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1);
- udelay(1);/* PlatformStallExecution(1); */
-
- /*----Set RF_ENV output high----*/
- PHY_SetBBReg(Adapter, pPhyReg->rfintfo, bRFSI_RFENV, 0x1);
- udelay(1);/* PlatformStallExecution(1); */
-
- /* Set bit number of Address and Data for RF register */
- PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); /* Set 1 to 4 bits for 8255 */
- udelay(1);/* PlatformStallExecution(1); */
-
- PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); /* Set 0 to 12 bits for 8255 */
- udelay(1);/* PlatformStallExecution(1); */
-
- /*----Initialize RF fom connfiguration file----*/
- switch (eRFPath) {
- case RF_PATH_A:
- if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, (enum rf_radio_path)eRFPath, (enum rf_radio_path)eRFPath))
- rtStatus = _FAIL;
- break;
- case RF_PATH_B:
- if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, (enum rf_radio_path)eRFPath, (enum rf_radio_path)eRFPath))
- rtStatus = _FAIL;
- break;
- case RF_PATH_C:
- break;
- case RF_PATH_D:
- break;
- }
- /*----Restore RFENV control type----*/;
- switch (eRFPath) {
- case RF_PATH_A:
- case RF_PATH_C:
- PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue);
- break;
- case RF_PATH_B:
- case RF_PATH_D:
- PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue);
- break;
- }
- if (rtStatus != _SUCCESS)
- goto phy_RF6052_Config_ParaFile_Fail;
- }
- return rtStatus;
-
-phy_RF6052_Config_ParaFile_Fail:
- return rtStatus;
-}
-
-int PHY_RF6052_Config8188E(struct adapter *Adapter)
-{
- struct hal_data_8188e *pHalData = GET_HAL_DATA(Adapter);
- int rtStatus = _SUCCESS;
-
- /* */
- /* Initialize general global value */
- /* */
- /* TODO: Extend RF_PATH_C and RF_PATH_D in the future */
- if (pHalData->rf_type == RF_1T1R)
- pHalData->NumTotalRFPath = 1;
- else
- pHalData->NumTotalRFPath = 2;
-
- /* */
- /* Config BB and RF */
- /* */
- rtStatus = phy_RF6052_Config_ParaFile(Adapter);
- return rtStatus;
-}
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c b/drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c
index 7ecbcf731ea9..7a4f754d86df 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_xmit.c
@@ -64,6 +64,7 @@ void _dbg_dump_tx_info(struct adapter *padapter, int frame_tag,
{
u8 dmp_txpkt;
bool dump_txdesc = false;
+
rtw_hal_get_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(dmp_txpkt));
if (dmp_txpkt == 1) {/* dump txdesc for data frame */
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index f25c87c63250..bc275b2a7d37 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -41,15 +41,16 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
/* init recv_buf */
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
- precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_KERNEL);
+ precvpriv->pallocated_recv_buf =
+ kzalloc(NR_RECVBUFF * sizeof(struct recv_buf), GFP_KERNEL);
if (precvpriv->pallocated_recv_buf == NULL) {
res = _FAIL;
- RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("alloc recv_buf fail!\n"));
+ RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
+ ("alloc recv_buf fail!\n"));
goto exit;
}
- memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF * sizeof(struct recv_buf) + 4);
- precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_recv_buf), 4);
+ precvpriv->precv_buf = precvpriv->pallocated_recv_buf;
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
@@ -66,20 +67,23 @@ int rtl8188eu_init_recv_priv(struct adapter *padapter)
{
int i;
size_t tmpaddr = 0;
- size_t alignment = 0;
+ size_t alignm = 0;
struct sk_buff *pskb = NULL;
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
- pskb = __netdev_alloc_skb(padapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL);
+ pskb = __netdev_alloc_skb(padapter->pnetdev,
+ MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ,
+ GFP_KERNEL);
if (pskb) {
pskb->dev = padapter->pnetdev;
tmpaddr = (size_t)pskb->data;
- alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
- skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
+ alignm = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+ skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignm));
- skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
+ skb_queue_tail(&precvpriv->free_recv_skb_queue,
+ pskb);
}
pskb = NULL;
}
@@ -109,7 +113,8 @@ void rtl8188eu_free_recv_priv(struct adapter *padapter)
if (skb_queue_len(&precvpriv->free_recv_skb_queue))
- DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
+ DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n",
+ skb_queue_len(&precvpriv->free_recv_skb_queue));
skb_queue_purge(&precvpriv->free_recv_skb_queue);
}
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index e18393317bdc..c5559dfa4e92 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -22,15 +22,14 @@
#include <osdep_service.h>
#include <drv_types.h>
#include <rtw_efuse.h>
-
+#include <fw.h>
#include <rtl8188e_hal.h>
#include <rtl8188e_led.h>
#include <rtw_iol.h>
#include <usb_hal.h>
+#include <phy.h>
-#define HAL_MAC_ENABLE 1
#define HAL_BB_ENABLE 1
-#define HAL_RF_ENABLE 1
static void _ConfigNormalChipOutEP_8188E(struct adapter *adapt, u8 NumOutPipe)
{
@@ -744,9 +743,9 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter)
Adapter->bFWReady = false;
haldata->fw_ractrl = false;
} else {
- status = rtl8188e_FirmwareDownload(Adapter);
+ status = rtl88e_download_fw(Adapter);
- if (status != _SUCCESS) {
+ if (status) {
DBG_88E("%s: Download Firmware failed!!\n", __func__);
Adapter->bFWReady = false;
haldata->fw_ractrl = false;
@@ -759,35 +758,11 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter)
}
rtl8188e_InitializeFirmwareVars(Adapter);
- HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_MAC);
-#if (HAL_MAC_ENABLE == 1)
- status = PHY_MACConfig8188E(Adapter);
- if (status == _FAIL) {
- DBG_88E(" ### Failed to init MAC ......\n ");
- goto exit;
- }
-#endif
+ rtl88e_phy_mac_config(Adapter);
- /* */
- /* d. Initialize BB related configurations. */
- /* */
- HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BB);
-#if (HAL_BB_ENABLE == 1)
- status = PHY_BBConfig8188E(Adapter);
- if (status == _FAIL) {
- DBG_88E(" ### Failed to init BB ......\n ");
- goto exit;
- }
-#endif
+ rtl88e_phy_bb_config(Adapter);
- HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_RF);
-#if (HAL_RF_ENABLE == 1)
- status = PHY_RFConfig8188E(Adapter);
- if (status == _FAIL) {
- DBG_88E(" ### Failed to init RF ......\n ");
- goto exit;
- }
-#endif
+ rtl88e_phy_rf_config(Adapter);
HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_EFUSE_PATCH);
status = rtl8188e_iol_efuse_patch(Adapter);
diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
index 260ea6bf9e83..161ad7688da6 100644
--- a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
+++ b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
@@ -206,18 +206,6 @@ u32 rtl8188e_PHY_QueryRFReg(struct adapter *adapter, enum rf_radio_path rfpath,
void rtl8188e_PHY_SetRFReg(struct adapter *adapter, enum rf_radio_path rfpath,
u32 regaddr, u32 mask, u32 data);
-/* Initialization related function */
-/* MAC/BB/RF HAL config */
-int PHY_MACConfig8188E(struct adapter *adapter);
-int PHY_BBConfig8188E(struct adapter *adapter);
-int PHY_RFConfig8188E(struct adapter *adapter);
-
-/* RF config */
-int rtl8188e_PHY_ConfigRFWithParaFile(struct adapter *adapter, u8 *filename,
- enum rf_radio_path rfpath);
-int rtl8188e_PHY_ConfigRFWithHeaderFile(struct adapter *adapter,
- enum rf_radio_path rfpath);
-
/* Read initi reg value for tx power setting. */
void rtl8192c_PHY_GetHWRegOriginalValue(struct adapter *adapter);
@@ -245,8 +233,6 @@ void PHY_EnableHostClkReq(struct adapter *adapter);
bool SetAntennaConfig92C(struct adapter *adapter, u8 defaultant);
-void storePwrIndexDiffRateOffset(struct adapter *adapter, u32 regaddr,
- u32 mask, u32 data);
/*--------------------------Exported Function prototype---------------------*/
#define PHY_QueryBBReg(adapt, regaddr, mask) \
diff --git a/drivers/staging/rtl8188eu/include/HalHWImg8188E_BB.h b/drivers/staging/rtl8188eu/include/HalHWImg8188E_BB.h
deleted file mode 100644
index e57452104bfb..000000000000
--- a/drivers/staging/rtl8188eu/include/HalHWImg8188E_BB.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* 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
-*
-*
-******************************************************************************/
-
-#ifndef __INC_BB_8188E_HW_IMG_H
-#define __INC_BB_8188E_HW_IMG_H
-
-/* static bool CheckCondition(const u32 Condition, const u32 Hex); */
-
-/******************************************************************************
-* AGC_TAB_1T.TXT
-******************************************************************************/
-
-enum HAL_STATUS ODM_ReadAndConfig_AGC_TAB_1T_8188E(struct odm_dm_struct *odm);
-
-/******************************************************************************
-* PHY_REG_1T.TXT
-******************************************************************************/
-
-enum HAL_STATUS ODM_ReadAndConfig_PHY_REG_1T_8188E(struct odm_dm_struct *odm);
-
-/******************************************************************************
-* PHY_REG_PG.TXT
-******************************************************************************/
-
-void ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct *dm_odm);
-
-#endif
diff --git a/drivers/staging/rtl8188eu/include/HalHWImg8188E_MAC.h b/drivers/staging/rtl8188eu/include/HalHWImg8188E_MAC.h
deleted file mode 100644
index acf78b94fddb..000000000000
--- a/drivers/staging/rtl8188eu/include/HalHWImg8188E_MAC.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* 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
-*
-*
-******************************************************************************/
-
-#ifndef __INC_MAC_8188E_HW_IMG_H
-#define __INC_MAC_8188E_HW_IMG_H
-
-/******************************************************************************
-* MAC_REG.TXT
-******************************************************************************/
-
-enum HAL_STATUS ODM_ReadAndConfig_MAC_REG_8188E(struct odm_dm_struct *pDM_Odm);
-
-#endif /* end of HWIMG_SUPPORT */
diff --git a/drivers/staging/rtl8188eu/include/HalHWImg8188E_RF.h b/drivers/staging/rtl8188eu/include/HalHWImg8188E_RF.h
deleted file mode 100644
index 8ecb40d26c70..000000000000
--- a/drivers/staging/rtl8188eu/include/HalHWImg8188E_RF.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* 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
-*
-*
-******************************************************************************/
-
-#ifndef __INC_RF_8188E_HW_IMG_H
-#define __INC_RF_8188E_HW_IMG_H
-
-/******************************************************************************
- * RadioA_1T.TXT
- ******************************************************************************/
-
-enum HAL_STATUS ODM_ReadAndConfig_RadioA_1T_8188E(struct odm_dm_struct *odm);
-
-#endif /* end of HWIMG_SUPPORT */
diff --git a/drivers/staging/rtl8188eu/include/drv_types.h b/drivers/staging/rtl8188eu/include/drv_types.h
index 8f42d48243f0..c81317906adc 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -141,15 +141,8 @@ struct registry_priv {
#define MAX_CONTINUAL_URB_ERR 4
-struct rt_firmware {
- u8 *szFwBuffer;
- u32 ulFwLength;
-};
-
struct dvobj_priv {
struct adapter *if1;
- struct rt_firmware firmware;
-
/* For 92D, DMDP have 2 interface. */
u8 InterfaceNumber;
u8 NumInterfaces;
diff --git a/drivers/staging/rtl8188eu/include/fw.h b/drivers/staging/rtl8188eu/include/fw.h
new file mode 100644
index 000000000000..c7c7e7e5ffac
--- /dev/null
+++ b/drivers/staging/rtl8188eu/include/fw.h
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2013 Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * 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
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <wlanfae@realtek.com>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ *****************************************************************************/
+#include "drv_types.h"
+#include <linux/types.h>
+
+#ifndef __RTL92C__FW__H__
+#define __RTL92C__FW__H__
+
+#define FW_8192C_START_ADDRESS 0x1000
+#define FW_8192C_PAGE_SIZE 4096
+#define FW_8192C_POLLING_DELAY 5
+
+struct rtl92c_firmware_header {
+ u16 signature;
+ u8 category;
+ u8 function;
+ u16 version;
+ u8 subversion;
+ u8 rsvd1;
+ u8 month;
+ u8 date;
+ u8 hour;
+ u8 minute;
+ u16 ramcodesize;
+ u16 rsvd2;
+ u32 svnindex;
+ u32 rsvd3;
+ u32 rsvd4;
+ u32 rsvd5;
+};
+
+int rtl88e_download_fw(struct adapter *adapt);
+
+#endif
diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h
index 56d5c50bb734..1c5303eefcea 100644
--- a/drivers/staging/rtl8188eu/include/hal_intf.h
+++ b/drivers/staging/rtl8188eu/include/hal_intf.h
@@ -228,10 +228,6 @@ struct hal_ops {
void (*sreset_init_value)(struct adapter *padapter);
u8 (*sreset_get_wifi_status)(struct adapter *padapter);
- int (*IOL_exec_cmds_sync)(struct adapter *padapter,
- struct xmit_frame *frame, u32 max_wait,
- u32 bndy_cnt);
-
void (*hal_notch_filter)(struct adapter *adapter, bool enable);
void (*hal_reset_security_engine)(struct adapter *adapter);
};
@@ -331,9 +327,6 @@ void rtw_hal_antdiv_rssi_compared(struct adapter *padapter,
void rtw_hal_sreset_init(struct adapter *padapter);
u8 rtw_hal_sreset_get_wifi_status(struct adapter *padapter);
-int rtw_hal_iol_cmd(struct adapter *adapter, struct xmit_frame *xmit_frame,
- u32 max_wating_ms, u32 bndy_cnt);
-
void rtw_hal_notch_filter(struct adapter *adapter, bool enable);
void rtw_hal_reset_security_engine(struct adapter *adapter);
diff --git a/drivers/staging/rtl8188eu/include/odm_HWConfig.h b/drivers/staging/rtl8188eu/include/odm_HWConfig.h
index 49e7e163ba70..1de4e6399435 100644
--- a/drivers/staging/rtl8188eu/include/odm_HWConfig.h
+++ b/drivers/staging/rtl8188eu/include/odm_HWConfig.h
@@ -120,13 +120,7 @@ void ODM_MacStatusQuery(struct odm_dm_struct *pDM_Odm,
bool bPacketToSelf,
bool bPacketBeacon);
-enum HAL_STATUS ODM_ConfigRFWithHeaderFile(struct odm_dm_struct *pDM_Odm,
- enum rf_radio_path Content,
- enum rf_radio_path eRFPath);
-
enum HAL_STATUS ODM_ConfigBBWithHeaderFile(struct odm_dm_struct *pDM_Odm,
enum odm_bb_config_type ConfigType);
-enum HAL_STATUS ODM_ConfigMACWithHeaderFile(struct odm_dm_struct *pDM_Odm);
-
#endif
diff --git a/drivers/staging/rtl8188eu/include/odm_RegConfig8188E.h b/drivers/staging/rtl8188eu/include/odm_RegConfig8188E.h
deleted file mode 100644
index f2bf7a0d9867..000000000000
--- a/drivers/staging/rtl8188eu/include/odm_RegConfig8188E.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * 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
- *
- *
- ******************************************************************************/
-#ifndef __INC_ODM_REGCONFIG_H_8188E
-#define __INC_ODM_REGCONFIG_H_8188E
-
-void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data,
- enum rf_radio_path RF_PATH, u32 RegAddr);
-
-void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm,
- u32 Addr, u32 Data);
-
-void odm_ConfigRF_RadioB_8188E(struct odm_dm_struct *pDM_Odm,
- u32 Addr, u32 Data);
-
-void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data);
-
-void odm_ConfigBB_AGC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
- u32 Bitmask, u32 Data);
-
-void odm_ConfigBB_PHY_REG_PG_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
- u32 Bitmask, u32 Data);
-
-void odm_ConfigBB_PHY_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
- u32 Bitmask, u32 Data);
-
-#endif
diff --git a/drivers/staging/rtl8188eu/include/odm_precomp.h b/drivers/staging/rtl8188eu/include/odm_precomp.h
index 0ab8254ce901..436d6ff14ca3 100644
--- a/drivers/staging/rtl8188eu/include/odm_precomp.h
+++ b/drivers/staging/rtl8188eu/include/odm_precomp.h
@@ -46,11 +46,6 @@
#include "odm_reg.h"
-#include "HalHWImg8188E_MAC.h"
-#include "HalHWImg8188E_RF.h"
-#include "HalHWImg8188E_BB.h"
-
-#include "odm_RegConfig8188E.h"
#include "odm_RTL8188E.h"
void odm_CmnInfoHook_Debug(struct odm_dm_struct *pDM_Odm);
diff --git a/drivers/staging/rtl8188eu/include/phy.h b/drivers/staging/rtl8188eu/include/phy.h
new file mode 100644
index 000000000000..676a66c44264
--- /dev/null
+++ b/drivers/staging/rtl8188eu/include/phy.h
@@ -0,0 +1,3 @@
+bool rtl88e_phy_mac_config(struct adapter *adapt);
+bool rtl88e_phy_rf_config(struct adapter *adapt);
+bool rtl88e_phy_bb_config(struct adapter *adapt);
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index fb206538392e..814ba1ab4b52 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -70,45 +70,10 @@
#define MAX_PAGE_SIZE 4096 /* @ page : 4k bytes */
#define IS_FW_HEADER_EXIST(_pFwHdr) \
- ((le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x92C0 || \
- (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88C0 || \
- (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x2300 || \
- (le16_to_cpu(_pFwHdr->Signature)&0xFFF0) == 0x88E0)
-
-/* This structure must be careful with byte-ordering */
-
-struct rt_firmware_hdr {
- /* 8-byte alinment required */
- /* LONG WORD 0 ---- */
- __le16 Signature; /* 92C0: test chip; 92C,
- * 88C0: test chip; 88C1: MP A-cut;
- * 92C1: MP A-cut */
- u8 Category; /* AP/NIC and USB/PCI */
- u8 Function; /* Reserved for different FW function
- * indcation, for further use when
- * driver needs to download different
- * FW for different conditions */
- __le16 Version; /* FW Version */
- u8 Subversion; /* FW Subversion, default 0x00 */
- u16 Rsvd1;
-
- /* LONG WORD 1 ---- */
- u8 Month; /* Release time Month field */
- u8 Date; /* Release time Date field */
- u8 Hour; /* Release time Hour field */
- u8 Minute; /* Release time Minute field */
- __le16 RamCodeSize; /* The size of RAM code */
- u8 Foundry;
- u8 Rsvd2;
-
- /* LONG WORD 2 ---- */
- __le32 SvnIdx; /* The SVN entry index */
- u32 Rsvd3;
-
- /* LONG WORD 3 ---- */
- u32 Rsvd4;
- u32 Rsvd5;
-};
+ ((le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x92C0 || \
+ (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x88C0 || \
+ (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x2300 || \
+ (le16_to_cpu(_pFwHdr->signature)&0xFFF0) == 0x88E0)
#define DRIVER_EARLY_INT_TIME 0x05
#define BCN_DMA_ATIME_INT_TIME 0x02
@@ -242,7 +207,8 @@ struct hal_data_8188e {
struct HAL_VERSION VersionID;
enum rt_regulator_mode RegulatorMode; /* switching regulator or LDO */
u16 CustomerID;
-
+ u8 *pfirmware;
+ u32 fwsize;
u16 FirmwareVersion;
u16 FirmwareVersionRev;
u16 FirmwareSubVersion;
@@ -419,7 +385,6 @@ struct hal_data_8188e {
(GET_HAL_DATA(_Adapter)->MultiFunc & RT_MULTI_FUNC_GPS)
/* rtl8188e_hal_init.c */
-s32 rtl8188e_FirmwareDownload(struct adapter *padapter);
void _8051Reset88E(struct adapter *padapter);
void rtl8188e_InitializeFirmwareVars(struct adapter *padapter);
@@ -458,7 +423,6 @@ void SetBcnCtrlReg(struct adapter *padapter, u8 SetBits, u8 ClearBits);
void rtl8188e_start_thread(struct adapter *padapter);
void rtl8188e_stop_thread(struct adapter *padapter);
-void rtw_IOL_cmd_tx_pkt_buf_dump(struct adapter *Adapter, int len);
s32 iol_execute(struct adapter *padapter, u8 control);
void iol_mode_enable(struct adapter *padapter, u8 enable);
s32 rtl8188e_iol_efuse_patch(struct adapter *padapter);
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_rf.h b/drivers/staging/rtl8188eu/include/rtl8188e_rf.h
index 10fc356e0209..20b5ba0ffb8a 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_rf.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_rf.h
@@ -25,7 +25,6 @@
#define RF6052_MAX_PATH 2
-int PHY_RF6052_Config8188E(struct adapter *Adapter);
void rtl8188e_RF_ChangeTxPath(struct adapter *Adapter, u16 DataRate);
void rtl8188e_PHY_RF6052SetBandwidth(struct adapter *Adapter,
enum ht_channel_width Bandwidth);
diff --git a/drivers/staging/rtl8188eu/include/rtw_efuse.h b/drivers/staging/rtl8188eu/include/rtw_efuse.h
index 720f9ea24d52..5660eed7196b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_efuse.h
+++ b/drivers/staging/rtl8188eu/include/rtw_efuse.h
@@ -99,7 +99,6 @@ struct efuse_hal {
u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN];
};
-u16 Efuse_GetCurrentSize(struct adapter *adapter);
u8 Efuse_CalculateWordCnts(u8 word_en);
void EFUSE_GetEfuseDefinition(struct adapter *adapt, u8 type, u8 type1,
void *out);
diff --git a/drivers/staging/rtl8188eu/include/rtw_iol.h b/drivers/staging/rtl8188eu/include/rtw_iol.h
index 80bfd063dd8d..68aae7f0b02f 100644
--- a/drivers/staging/rtl8188eu/include/rtw_iol.h
+++ b/drivers/staging/rtl8188eu/include/rtw_iol.h
@@ -23,60 +23,6 @@
#include <osdep_service.h>
#include <drv_types.h>
-#define IOREG_CMD_END_LEN 4
-
-struct ioreg_cfg {
- u8 length;
- u8 cmd_id;
- __le16 address;
- __le32 data;
- __le32 mask;
-};
-
-enum ioreg_cmd {
- IOREG_CMD_LLT = 0x01,
- IOREG_CMD_REFUSE = 0x02,
- IOREG_CMD_EFUSE_PATH = 0x03,
- IOREG_CMD_WB_REG = 0x04,
- IOREG_CMD_WW_REG = 0x05,
- IOREG_CMD_WD_REG = 0x06,
- IOREG_CMD_W_RF = 0x07,
- IOREG_CMD_DELAY_US = 0x10,
- IOREG_CMD_DELAY_MS = 0x11,
- IOREG_CMD_END = 0xFF,
-};
-
-struct xmit_frame *rtw_IOL_accquire_xmit_frame(struct adapter *adapter);
-int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds,
- u32 cmd_len);
-int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);
-int rtw_IOL_exec_cmds_sync(struct adapter *adapter,
- struct xmit_frame *xmit_frame, u32 max_wating_ms,
- u32 bndy_cnt);
bool rtw_IOL_applied(struct adapter *adapter);
-int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);
-int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);
-int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
-
-void read_efuse_from_txpktbuf(struct adapter *adapter, int bcnhead,
- u8 *content, u16 *size);
-
-int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr,
- u8 value, u8 mask);
-int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr,
- u32 value, u32 mask);
-int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path,
- u16 addr, u32 value, u32 mask);
-#define rtw_IOL_append_WB_cmd(xmit_frame, addr, value, mask) \
- _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) , (mask))
-#define rtw_IOL_append_WW_cmd(xmit_frame, addr, value, mask) \
- _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), (mask))
-#define rtw_IOL_append_WD_cmd(xmit_frame, addr, value, mask) \
- _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), (mask))
-#define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value, mask) \
- _rtw_IOL_append_WRF_cmd((xmit_frame), (rf_path), (addr), (value), (mask))
-
-u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);
-void rtw_IOL_cmd_buf_dump(struct adapter *Adapter, int buf_len, u8 *pbuf);
#endif /* __RTW_IOL_H_ */
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index c7a44ab33d64..08a80f759b8d 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -26,6 +26,7 @@
#include <recv_osdep.h>
#include <hal_intf.h>
#include <rtw_ioctl.h>
+#include <rtl8188e_hal.h>
#include <usb_hal.h>
@@ -1121,7 +1122,7 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
int netdev_close(struct net_device *pnetdev)
{
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
- struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
+ struct hal_data_8188e *rtlhal = GET_HAL_DATA(padapter);
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n"));
@@ -1154,8 +1155,8 @@ int netdev_close(struct net_device *pnetdev)
rtw_led_control(padapter, LED_CTL_POWER_OFF);
}
- kfree(dvobj->firmware.szFwBuffer);
- dvobj->firmware.szFwBuffer = NULL;
+ kfree(rtlhal->pfirmware);
+ rtlhal->pfirmware = NULL;
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n"));
DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup);
diff --git a/drivers/staging/rtl8192ee/base.c b/drivers/staging/rtl8192ee/base.c
index f7c3c8bf71a5..2f0fea5010f3 100644
--- a/drivers/staging/rtl8192ee/base.c
+++ b/drivers/staging/rtl8192ee/base.c
@@ -206,7 +206,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
*highest supported RX rate
*/
if (rtlpriv->dm.supp_phymode_switch) {
- RT_TRACE(COMP_INIT, DBG_EMERG, ("Support phy mode switch\n"));
+ RT_TRACE(COMP_INIT, DBG_EMERG, "Support phy mode switch\n");
ht_cap->mcs.rx_mask[0] = 0xFF;
ht_cap->mcs.rx_mask[1] = 0xFF;
@@ -216,7 +216,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
} else {
if (get_rf_type(rtlphy) == RF_1T2R ||
get_rf_type(rtlphy) == RF_2T2R) {
- RT_TRACE(COMP_INIT, DBG_DMESG, ("1T2R or 2T2R\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "1T2R or 2T2R\n");
ht_cap->mcs.rx_mask[0] = 0xFF;
ht_cap->mcs.rx_mask[1] = 0xFF;
@@ -224,7 +224,7 @@ static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw,
ht_cap->mcs.rx_highest = cpu_to_le16(MAX_BIT_RATE_40MHZ_MCS15);
} else if (get_rf_type(rtlphy) == RF_1T1R) {
- RT_TRACE(COMP_INIT, DBG_DMESG, ("1T1R\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "1T1R\n");
ht_cap->mcs.rx_mask[0] = 0xFF;
ht_cap->mcs.rx_mask[1] = 0x00;
@@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
} else {
RT_TRACE(COMP_INIT, DBG_EMERG,
- ("Err BAND %d\n", rtlhal->current_bandtype));
+ "Err BAND %d\n", rtlhal->current_bandtype);
}
}
/* <5> set hw caps */
@@ -556,7 +556,7 @@ int rtl92e_init_core(struct ieee80211_hw *hw)
* mac80211 hw in _rtl_init_mac80211.
*/
if (rtl92e_regd_init(hw, rtl92e_reg_notifier)) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("REGD init failed\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "REGD init failed\n");
return 1;
}
@@ -952,7 +952,7 @@ bool rtl92e_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb)
rtlpriv->cfg->ops->check_switch_to_dmdp(hw);
}
if (ieee80211_is_auth(fc)) {
- RT_TRACE(COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n"));
+ RT_TRACE(COMP_SEND, DBG_DMESG, "MAC80211_LINKING\n");
rtl92e_ips_nic_on(hw);
mac->link_state = MAC80211_LINKING;
@@ -987,8 +987,8 @@ bool rtl92e_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
return false;
RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG,
- ("%s ACT_ADDBAREQ From:%pM\n",
- is_tx ? "Tx" : "Rx", hdr->addr2));
+ "%s ACT_ADDBAREQ From:%pM\n",
+ is_tx ? "Tx" : "Rx", hdr->addr2);
RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, "req\n",
skb->data, skb->len);
if (!is_tx) {
@@ -1004,7 +1004,7 @@ bool rtl92e_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
sta = rtl_find_sta(hw, hdr->addr3);
if (sta == NULL) {
RT_TRACE((COMP_SEND | COMP_RECV),
- DBG_TRACE, ("sta is NULL\n"));
+ DBG_TRACE, "sta is NULL\n");
rcu_read_unlock();
return true;
}
@@ -1047,12 +1047,12 @@ bool rtl92e_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx)
break;
case ACT_ADDBARSP:
RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG,
- ("%s ACT_ADDBARSP From :%pM\n",
- is_tx ? "Tx" : "Rx", hdr->addr2));
+ "%s ACT_ADDBARSP From :%pM\n",
+ is_tx ? "Tx" : "Rx", hdr->addr2);
break;
case ACT_DELBA:
RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG,
- ("ACT_ADDBADEL From :%pM\n", hdr->addr2));
+ "ACT_ADDBADEL From :%pM\n", hdr->addr2);
break;
}
break;
@@ -1094,9 +1094,8 @@ u8 rtl92e_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb,
* 68 : UDP BOOTP client
* 67 : UDP BOOTP server
*/
- RT_TRACE((COMP_SEND | COMP_RECV),
- DBG_DMESG, ("dhcp %s !!\n",
- (is_tx) ? "Tx" : "Rx"));
+ RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG,
+ "dhcp %s !!\n", is_tx ? "Tx" : "Rx");
if (is_tx) {
rtlpriv->ra.is_special_data = true;
@@ -1124,7 +1123,7 @@ u8 rtl92e_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb,
return true;
} else if (ETH_P_PAE == ether_type) {
RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG,
- ("802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx"));
+ "802.1X %s EAPOL pkt!!\n", is_tx ? "Tx" : "Rx");
if (is_tx) {
rtlpriv->ra.is_special_data = true;
@@ -1165,9 +1164,8 @@ int rtl92e_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return -ENXIO;
tid_data = &sta_entry->tids[tid];
- RT_TRACE(COMP_SEND, DBG_DMESG,
- ("on ra = %pM tid = %d seq:%d\n", sta->addr, tid,
- tid_data->seq_number));
+ RT_TRACE(COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d seq:%d\n",
+ sta->addr, tid, tid_data->seq_number);
*ssn = tid_data->seq_number;
tid_data->agg.agg_state = RTL_AGG_START;
@@ -1188,12 +1186,12 @@ int rtl92e_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
/* Comparing an array to null is not useful */
/*if (!sta->addr) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("ra = NULL\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "ra = NULL\n");
return -EINVAL;
}*/
- RT_TRACE(COMP_SEND, DBG_DMESG,
- ("on ra = %pM tid = %d\n", sta->addr, tid));
+ RT_TRACE(COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n",
+ sta->addr, tid);
if (unlikely(tid >= MAX_TID_COUNT))
return -EINVAL;
@@ -1224,9 +1222,8 @@ int rtl92e_rx_agg_start(struct ieee80211_hw *hw,
return -ENXIO;
tid_data = &sta_entry->tids[tid];
- RT_TRACE(COMP_RECV, DBG_DMESG,
- ("on ra = %pM tid = %d seq:%d\n", sta->addr, tid,
- tid_data->seq_number));
+ RT_TRACE(COMP_RECV, DBG_DMESG, "on ra = %pM tid = %d seq:%d\n",
+ sta->addr, tid, tid_data->seq_number);
tid_data->agg.rx_agg_state = RTL_RX_AGG_START;
return 0;
@@ -1244,12 +1241,12 @@ int rtl92e_rx_agg_stop(struct ieee80211_hw *hw,
/* Comparing an array to null is not useful */
/*if (!sta->addr) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("ra = NULL\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "ra = NULL\n");
return -EINVAL;
}*/
- RT_TRACE(COMP_SEND, DBG_DMESG,
- ("on ra = %pM tid = %d\n", sta->addr, tid));
+ RT_TRACE(COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n",
+ sta->addr, tid);
if (unlikely(tid >= MAX_TID_COUNT))
return -EINVAL;
@@ -1273,12 +1270,12 @@ int rtl92e_tx_agg_oper(struct ieee80211_hw *hw,
/* Comparing an array to null is not useful */
/*if (!sta->addr) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("ra = NULL\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "ra = NULL\n");
return -EINVAL;
}*/
- RT_TRACE(COMP_SEND, DBG_DMESG,
- ("on ra = %pM tid = %d\n", sta->addr, tid));
+ RT_TRACE(COMP_SEND, DBG_DMESG, "on ra = %pM tid = %d\n",
+ sta->addr, tid);
if (unlikely(tid >= MAX_TID_COUNT))
return -EINVAL;
@@ -1454,15 +1451,14 @@ void rtl92e_watchdog_wq_callback(void *data)
if ((rtlpriv->link_info.bcn_rx_inperiod +
rtlpriv->link_info.num_rx_inperiod) == 0) {
rtlpriv->link_info.roam_times++;
- RT_TRACE(COMP_ERR, DBG_DMESG,
- ("AP off for %d s\n",
- (rtlpriv->link_info.roam_times * 2)));
+ RT_TRACE(COMP_ERR, DBG_DMESG, "AP off for %d s\n",
+ rtlpriv->link_info.roam_times * 2);
/* if we can't recv beacon for 10s,
* we should reconnect this AP */
if (rtlpriv->link_info.roam_times >= 5) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("AP off, try to reconnect now\n"));
+ "AP off, try to reconnect now\n");
rtlpriv->link_info.roam_times = 0;
ieee80211_connection_loss(
rtlpriv->mac80211.vif);
@@ -1793,29 +1789,29 @@ void rtl92e_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len)
(memcmp(mac->bssid, ap5_6, 3) == 0) ||
vendor == PEER_ATH) {
vendor = PEER_ATH;
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>ath find\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "=>ath find\n");
} else if ((memcmp(mac->bssid, ap4_4, 3) == 0) ||
(memcmp(mac->bssid, ap4_5, 3) == 0) ||
(memcmp(mac->bssid, ap4_1, 3) == 0) ||
(memcmp(mac->bssid, ap4_2, 3) == 0) ||
(memcmp(mac->bssid, ap4_3, 3) == 0) ||
vendor == PEER_RAL) {
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>ral findn\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "=>ral findn\n");
vendor = PEER_RAL;
} else if (memcmp(mac->bssid, ap6_1, 3) == 0 ||
vendor == PEER_CISCO) {
vendor = PEER_CISCO;
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>cisco find\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "=>cisco find\n");
} else if ((memcmp(mac->bssid, ap3_1, 3) == 0) ||
(memcmp(mac->bssid, ap3_2, 3) == 0) ||
(memcmp(mac->bssid, ap3_3, 3) == 0) ||
vendor == PEER_BROAD) {
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>broad find\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "=>broad find\n");
vendor = PEER_BROAD;
} else if (memcmp(mac->bssid, ap7_1, 3) == 0 ||
vendor == PEER_MARV) {
vendor = PEER_MARV;
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>marv find\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "=>marv find\n");
}
mac->vendor = vendor;
diff --git a/drivers/staging/rtl8192ee/btcoexist/rtl_btc.c b/drivers/staging/rtl8192ee/btcoexist/rtl_btc.c
index 50c012a4c174..e2e3864c7cb1 100644
--- a/drivers/staging/rtl8192ee/btcoexist/rtl_btc.c
+++ b/drivers/staging/rtl8192ee/btcoexist/rtl_btc.c
@@ -57,17 +57,14 @@ void rtl92e_btc_init_hal_vars(struct rtl_priv *rtlpriv)
u8 bt_exist;
u8 bt_type;
ant_num = rtl92e_get_hwpg_ant_num(rtlpriv);
- RT_TRACE(COMP_INIT, DBG_DMESG,
- ("%s, antNum is %d\n", __func__, ant_num));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "antNum is %d\n", ant_num);
bt_exist = rtl92e_get_hwpg_bt_exist(rtlpriv);
- RT_TRACE(COMP_INIT, DBG_DMESG,
- ("%s, bt_exist is %d\n", __func__, bt_exist));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "bt_exist is %d\n", bt_exist);
exhalbtc92e_set_bt_exist(bt_exist);
bt_type = rtl92e_get_hwpg_bt_type(rtlpriv);
- RT_TRACE(COMP_INIT, DBG_DMESG,
- ("%s, bt_type is %d\n", __func__, bt_type));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "bt_type is %d\n", bt_type);
exhalbtc92e_set_chip_type(bt_type);
exhalbtc92e_set_ant_num(BT_COEX_ANT_TYPE_PG, ant_num);
diff --git a/drivers/staging/rtl8192ee/cam.c b/drivers/staging/rtl8192ee/cam.c
index e32c329da870..26f6f90257de 100644
--- a/drivers/staging/rtl8192ee/cam.c
+++ b/drivers/staging/rtl8192ee/cam.c
@@ -62,14 +62,12 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command);
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE %x: %x\n",
- rtlpriv->cfg->maps[WCAMI], target_content));
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("The Key ID is %d\n", entry_no));
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE %x: %x\n",
- rtlpriv->cfg->maps[RWCAM], target_command));
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE %x: %x\n",
+ rtlpriv->cfg->maps[WCAMI], target_content);
+ RT_TRACE(COMP_SEC, DBG_LOUD, "The Key ID is %d\n",
+ entry_no);
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE %x: %x\n",
+ rtlpriv->cfg->maps[RWCAM], target_command);
} else if (entry_i == 1) {
target_content = (u32) (*(mac_addr + 5)) << 24 |
(u32) (*(mac_addr + 4)) << 16 |
@@ -81,10 +79,10 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command);
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE A4: %x\n", target_content));
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE A0: %x\n", target_command));
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE A4: %x\n",
+ target_content);
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE A0: %x\n",
+ target_command);
} else {
target_content =
(u32) (*(key_cont_128 + (entry_i * 4 - 8) + 3)) <<
@@ -99,15 +97,14 @@ static void rtl_cam_program_entry(struct ieee80211_hw *hw, u32 entry_no,
target_command);
udelay(100);
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE A4: %x\n", target_content));
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("WRITE A0: %x\n", target_command));
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE A4: %x\n",
+ target_content);
+ RT_TRACE(COMP_SEC, DBG_LOUD, "WRITE A0: %x\n",
+ target_command);
}
}
- RT_TRACE(COMP_SEC, DBG_LOUD,
- ("after set key, usconfig:%x\n", us_config));
+ RT_TRACE(COMP_SEC, DBG_LOUD, "after set key, usconfig:%x\n", us_config);
}
u8 stg_rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
@@ -118,13 +115,11 @@ u8 stg_rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
struct rtl_priv *rtlpriv = rtl_priv(hw);
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
- ul_entry_idx, ul_key_id, ul_enc_alg,
- ul_default_key, mac_addr));
+ "EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
+ ul_entry_idx, ul_key_id, ul_enc_alg, ul_default_key, mac_addr);
if (ul_key_id == TOTAL_CAM_ENTRY) {
- RT_TRACE(COMP_ERR, DBG_WARNING,
- ("ulKeyId exceed!\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "ulKeyId exceed!\n");
return 0;
}
@@ -136,7 +131,7 @@ u8 stg_rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
(u8 *)key_content, us_config);
- RT_TRACE(COMP_SEC, DBG_DMESG, ("end\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "end\n");
return 1;
}
@@ -148,7 +143,7 @@ int stg_rtl_cam_delete_one_entry(struct ieee80211_hw *hw,
u32 ul_command;
struct rtl_priv *rtlpriv = rtl_priv(hw);
- RT_TRACE(COMP_SEC, DBG_DMESG, ("key_idx:%d\n", ul_key_id));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "key_idx:%d\n", ul_key_id);
ul_command = ul_key_id * CAM_CONTENT_COUNT;
ul_command = ul_command | BIT(31) | BIT(16);
@@ -157,10 +152,10 @@ int stg_rtl_cam_delete_one_entry(struct ieee80211_hw *hw,
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("stg_rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0));
+ "stg_rtl_cam_delete_one_entry(): WRITE A4: %x\n", 0);
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("stg_rtl_cam_delete_one_entry(): WRITE A0: %x\n",
- ul_command));
+ "stg_rtl_cam_delete_one_entry(): WRITE A0: %x\n",
+ ul_command);
return 0;
}
EXPORT_SYMBOL(stg_rtl_cam_delete_one_entry);
@@ -210,9 +205,9 @@ void stg_rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index)
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("stg_rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content));
+ "stg_rtl_cam_mark_invalid(): WRITE A4: %x\n", ul_content);
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("stg_rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command));
+ "stg_rtl_cam_mark_invalid(): WRITE A0: %x\n", ul_command);
}
EXPORT_SYMBOL(stg_rtl_cam_mark_invalid);
@@ -259,11 +254,11 @@ void stg_rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index)
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM], ul_command);
RT_TRACE(COMP_SEC, DBG_LOUD,
- ("stg_rtl_cam_empty_entry(): WRITE A4: %x\n",
- ul_content));
+ "stg_rtl_cam_empty_entry(): WRITE A4: %x\n",
+ ul_content);
RT_TRACE(COMP_SEC, DBG_LOUD,
- ("stg_rtl_cam_empty_entry(): WRITE A0: %x\n",
- ul_command));
+ "stg_rtl_cam_empty_entry(): WRITE A0: %x\n",
+ ul_command);
}
}
EXPORT_SYMBOL(stg_rtl_cam_empty_entry);
@@ -276,8 +271,7 @@ u8 stg_rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
u8 i, *addr;
if (!sta_addr) {
- RT_TRACE(COMP_SEC, DBG_EMERG,
- ("sta_addr is NULL\n"));
+ RT_TRACE(COMP_SEC, DBG_EMERG, "sta_addr is NULL\n");
return TOTAL_CAM_ENTRY;
}
/* Does STA already exist? */
@@ -290,8 +284,8 @@ u8 stg_rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
for (entry_idx = 4; entry_idx < TOTAL_CAM_ENTRY; entry_idx++) {
if ((bitmap & BIT(0)) == 0) {
RT_TRACE(COMP_SEC, DBG_EMERG,
- ("-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n",
- rtlpriv->sec.hwsec_cam_bitmap, entry_idx));
+ "-----hwsec_cam_bitmap: 0x%x entry_idx=%d\n",
+ rtlpriv->sec.hwsec_cam_bitmap, entry_idx);
rtlpriv->sec.hwsec_cam_bitmap |= BIT(0) << entry_idx;
memcpy(rtlpriv->sec.hwsec_cam_sta_addr[entry_idx],
sta_addr, ETH_ALEN);
@@ -310,14 +304,13 @@ void stg_rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
u8 i, *addr;
if (NULL == sta_addr) {
- RT_TRACE(COMP_SEC, DBG_EMERG,
- ("sta_addr is NULL.\n"));
+ RT_TRACE(COMP_SEC, DBG_EMERG, "sta_addr is NULL\n");
return;
}
if (is_zero_ether_addr(sta_addr)) {
RT_TRACE(COMP_SEC, DBG_EMERG,
- ("sta_addr is 00:00:00:00:00:00.\n"));
+ "sta_addr is 00:00:00:00:00:00\n");
return;
}
/* Does STA already exist? */
diff --git a/drivers/staging/rtl8192ee/core.c b/drivers/staging/rtl8192ee/core.c
index 7f6accd59986..71aa241b170b 100644
--- a/drivers/staging/rtl8192ee/core.c
+++ b/drivers/staging/rtl8192ee/core.c
@@ -124,7 +124,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
if (mac->vif) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("vif has been set!! mac->vif = 0x%p\n", mac->vif));
+ "vif has been set!! mac->vif = 0x%p\n", mac->vif);
return -EOPNOTSUPP;
}
@@ -140,15 +140,14 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
case NL80211_IFTYPE_STATION:
if (mac->beacon_enabled == 1) {
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("NL80211_IFTYPE_STATION\n"));
+ "NL80211_IFTYPE_STATION\n");
mac->beacon_enabled = 0;
rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
rtlpriv->cfg->maps[RTL_IBSS_INT_MASKS]);
}
break;
case NL80211_IFTYPE_ADHOC:
- RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("NL80211_IFTYPE_ADHOC\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "NL80211_IFTYPE_ADHOC\n");
mac->link_state = MAC80211_LINKED;
rtlpriv->cfg->ops->set_bcn_reg(hw);
if (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)
@@ -162,8 +161,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
mac->p2p = P2P_ROLE_GO;
/*fall through*/
case NL80211_IFTYPE_AP:
- RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("NL80211_IFTYPE_AP\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "NL80211_IFTYPE_AP\n");
mac->link_state = MAC80211_LINKED;
rtlpriv->cfg->ops->set_bcn_reg(hw);
@@ -176,7 +174,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
break;
case NL80211_IFTYPE_MESH_POINT:
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("NL80211_IFTYPE_MESH_POINT\n"));
+ "NL80211_IFTYPE_MESH_POINT\n");
mac->link_state = MAC80211_LINKED;
rtlpriv->cfg->ops->set_bcn_reg(hw);
@@ -189,7 +187,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("operation mode %d is not support!\n", vif->type));
+ "operation mode %d is not support!\n", vif->type);
err = -EOPNOTSUPP;
goto out;
}
@@ -200,8 +198,7 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw,
#endif
if (mac->p2p) {
- RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("p2p role %x\n", vif->type));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "p2p role %x\n", vif->type);
mac->basic_rates = 0xff0;/*disable cck rate for p2p*/
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BASIC_RATE,
(u8 *)(&mac->basic_rates));
@@ -262,8 +259,7 @@ static int rtl_op_change_interface(struct ieee80211_hw *hw,
vif->type = new_type;
vif->p2p = p2p;
ret = rtl_op_add_interface(hw, vif);
- RT_TRACE(COMP_MAC80211, DBG_LOUD,
- (" p2p %x\n", p2p));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, " p2p %x\n", p2p);
return ret;
}
@@ -336,7 +332,7 @@ static void _rtl_add_wowlan_patterns(struct ieee80211_hw *hw,
memset(mask, 0, MAX_WOL_BIT_MASK_SIZE);
if (patterns[i].pattern_len > MAX_WOL_PATTERN_SIZE) {
RT_TRACE(COMP_POWER, DBG_WARNING,
- ("Pattern[%d] is too long\n", i));
+ "Pattern[%d] is too long\n", i);
continue;
}
pattern_os = patterns[i].pattern;
@@ -414,8 +410,8 @@ static void _rtl_add_wowlan_patterns(struct ieee80211_hw *hw,
"pattern to hw\n", content, len);
/* 3. calculate crc */
rtl_pattern.crc = _calculate_wol_pattern_crc(content, len);
- RT_TRACE(COMP_POWER, DBG_TRACE,
- ("CRC_Remainder = 0x%x", rtl_pattern.crc));
+ RT_TRACE(COMP_POWER, DBG_TRACE, "CRC_Remainder = 0x%x\n",
+ rtl_pattern.crc);
/* 4. write crc & mask_for_hw to hw */
rtlpriv->cfg->ops->add_wowlan_pattern(hw, &rtl_pattern, i);
@@ -431,7 +427,7 @@ static int rtl_op_suspend(struct ieee80211_hw *hw,
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
struct timeval ts;
- RT_TRACE(COMP_POWER, DBG_DMESG, ("\n"));
+ RT_TRACE(COMP_POWER, DBG_DMESG, "\n");
if (WARN_ON(!wow))
return -EINVAL;
@@ -458,7 +454,7 @@ static int rtl_op_resume(struct ieee80211_hw *hw)
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
struct timeval ts;
- RT_TRACE(COMP_POWER, DBG_DMESG, ("\n"));
+ RT_TRACE(COMP_POWER, DBG_DMESG, "\n");
rtlhal->driver_is_goingto_unload = false;
rtlhal->b_enter_pnp_sleep = false;
rtlhal->b_wake_from_pnp_sleep = true;
@@ -491,7 +487,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
mutex_lock(&rtlpriv->locks.conf_mutex);
if (changed & IEEE80211_CONF_CHANGE_LISTEN_INTERVAL) { /* BIT(2) */
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n"));
+ "IEEE80211_CONF_CHANGE_LISTEN_INTERVAL\n");
}
/*For IPS */
@@ -534,8 +530,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
- hw->conf.long_frame_max_tx_count));
+ "IEEE80211_CONF_CHANGE_RETRY_LIMITS %x\n",
+ hw->conf.long_frame_max_tx_count);
mac->retry_long = hw->conf.long_frame_max_tx_count;
mac->retry_short = hw->conf.long_frame_max_tx_count;
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RETRY_LIMIT,
@@ -650,7 +646,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
mac->bw_40 = false;
mac->bw_80 = false;
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not processed\n"));
+ "switch case not processed\n");
break;
}
}
@@ -700,12 +696,12 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AM] |
rtlpriv->cfg->maps[MAC_RCR_AB];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Enable receive multicast frame.\n"));
+ "Enable receive multicast frame\n");
} else {
mac->rx_conf &= ~(rtlpriv->cfg->maps[MAC_RCR_AM] |
rtlpriv->cfg->maps[MAC_RCR_AB]);
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Disable receive multicast frame.\n"));
+ "Disable receive multicast frame\n");
}
}
@@ -713,11 +709,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
if (*new_flags & FIF_FCSFAIL) {
mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACRC32];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Enable receive FCS error frame.\n"));
+ "Enable receive FCS error frame\n");
} else {
mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACRC32];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Disable receive FCS error frame.\n"));
+ "Disable receive FCS error frame\n");
}
}
@@ -740,11 +736,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_ACF];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Enable receive control frame.\n"));
+ "Enable receive control frame\n");
} else {
mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_ACF];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Disable receive control frame.\n"));
+ "Disable receive control frame\n");
}
}
@@ -752,11 +748,11 @@ static void rtl_op_configure_filter(struct ieee80211_hw *hw,
if (*new_flags & FIF_OTHER_BSS) {
mac->rx_conf |= rtlpriv->cfg->maps[MAC_RCR_AAP];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Enable receive other BSS's frame.\n"));
+ "Enable receive other BSS's frame\n");
} else {
mac->rx_conf &= ~rtlpriv->cfg->maps[MAC_RCR_AAP];
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("Disable receive other BSS's frame.\n"));
+ "Disable receive other BSS's frame\n");
}
}
}
@@ -798,8 +794,8 @@ static int rtl_op_sta_add(struct ieee80211_hw *hw,
sta->supp_rates[0] &= 0xfffffff0;
ether_addr_copy(sta_entry->mac_addr, sta->addr);
- RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("Add sta addr is %pM\n", sta->addr));
+ RT_TRACE(COMP_MAC80211, DBG_DMESG, "Add sta addr is %pM\n",
+ sta->addr);
rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
}
@@ -813,8 +809,8 @@ static int rtl_op_sta_remove(struct ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_sta_info *sta_entry;
if (sta) {
- RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("Remove sta addr is %pM\n", sta->addr));
+ RT_TRACE(COMP_MAC80211, DBG_DMESG, "Remove sta addr is %pM\n",
+ sta->addr);
sta_entry = (struct rtl_sta_info *)sta->drv_priv;
sta_entry->wireless_mode = 0;
sta_entry->ratr_index = 0;
@@ -862,7 +858,7 @@ static int rtl_op_conf_tx(struct ieee80211_hw *hw,
if (queue >= AC_MAX) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("queue number %d is incorrect!\n", queue));
+ "queue number %d is incorrect!\n", queue);
return -EINVAL;
}
@@ -895,7 +891,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
bss_conf->enable_beacon)) {
if (mac->beacon_enabled == 0) {
RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("BSS_CHANGED_BEACON_ENABLED\n"));
+ "BSS_CHANGED_BEACON_ENABLED\n");
/*start hw beacon interrupt. */
/*rtlpriv->cfg->ops->set_bcn_reg(hw); */
@@ -912,7 +908,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
!bss_conf->enable_beacon) {
if (mac->beacon_enabled == 1) {
RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("ADHOC DISABLE BEACON\n"));
+ "ADHOC DISABLE BEACON\n");
mac->beacon_enabled = 0;
rtlpriv->cfg->ops->update_interrupt_mask(hw, 0,
@@ -922,7 +918,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
}
if (changed & BSS_CHANGED_BEACON_INT) {
RT_TRACE(COMP_BEACON, DBG_TRACE,
- ("BSS_CHANGED_BEACON_INT\n"));
+ "BSS_CHANGED_BEACON_INT\n");
mac->beacon_interval = bss_conf->beacon_int;
rtlpriv->cfg->ops->set_bcn_intv(hw);
}
@@ -965,7 +961,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
if (vif->type == NL80211_IFTYPE_STATION && sta)
rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0);
RT_TRACE(COMP_EASY_CONCURRENT, DBG_LOUD,
- ("send PS STATIC frame\n"));
+ "send PS STATIC frame\n");
if (rtlpriv->dm.supp_phymode_switch) {
if (sta->ht_cap.ht_supported)
stg_rtl_send_smps_action(hw, sta,
@@ -1003,7 +999,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
(u8 *)(&keep_alive));
RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("BSS_CHANGED_ASSOC\n"));
+ "BSS_CHANGED_ASSOC\n");
} else {
mstatus = RT_MEDIA_DISCONNECT;
@@ -1021,7 +1017,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
rtlpriv->cfg->ops->check_switch_to_dmdp(hw);
}
RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("BSS_CHANGED_UN_ASSOC\n"));
+ "BSS_CHANGED_UN_ASSOC\n");
}
rtlpriv->cfg->ops->set_network_type(hw, vif->type);
/* For FW LPS:
@@ -1039,14 +1035,14 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_ERP_CTS_PROT) {
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("BSS_CHANGED_ERP_CTS_PROT\n"));
+ "BSS_CHANGED_ERP_CTS_PROT\n");
mac->use_cts_protect = bss_conf->use_cts_prot;
}
if (changed & BSS_CHANGED_ERP_PREAMBLE) {
RT_TRACE(COMP_MAC80211, DBG_LOUD,
- ("BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n",
- bss_conf->use_short_preamble));
+ "BSS_CHANGED_ERP_PREAMBLE use short preamble:%x\n",
+ bss_conf->use_short_preamble);
mac->short_preamble = bss_conf->use_short_preamble;
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ACK_PREAMBLE,
@@ -1054,8 +1050,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
}
if (changed & BSS_CHANGED_ERP_SLOT) {
- RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("BSS_CHANGED_ERP_SLOT\n"));
+ RT_TRACE(COMP_MAC80211, DBG_TRACE, "BSS_CHANGED_ERP_SLOT\n");
if (bss_conf->use_short_slot)
mac->slot_time = RTL_SLOT_TIME_9;
@@ -1069,8 +1064,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_HT) {
struct ieee80211_sta *sta = NULL;
- RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("BSS_CHANGED_HT\n"));
+ RT_TRACE(COMP_MAC80211, DBG_TRACE, "BSS_CHANGED_HT\n");
rcu_read_lock();
sta = ieee80211_find_sta(vif, (u8 *)bss_conf->bssid);
@@ -1101,8 +1095,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_BSSID,
(u8 *)bss_conf->bssid);
- RT_TRACE(COMP_MAC80211, DBG_DMESG,
- ("bssid: %pM\n", bss_conf->bssid));
+ RT_TRACE(COMP_MAC80211, DBG_DMESG, "bssid: %pM\n",
+ bss_conf->bssid);
mac->vendor = PEER_UNKNOWN;
memcpy(mac->bssid, bss_conf->bssid, 6);
@@ -1231,34 +1225,34 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw,
switch (action) {
case IEEE80211_AMPDU_TX_START:
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("IEEE80211_AMPDU_TX_START: TID:%d\n", tid));
+ "IEEE80211_AMPDU_TX_START: TID:%d\n", tid);
return rtl92e_tx_agg_start(hw, vif, sta, tid, ssn);
break;
case IEEE80211_AMPDU_TX_STOP_CONT:
case IEEE80211_AMPDU_TX_STOP_FLUSH:
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid));
+ "IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid);
return rtl92e_tx_agg_stop(hw, vif, sta, tid);
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid));
+ "IEEE80211_AMPDU_TX_OPERATIONAL:TID:%d\n", tid);
rtl92e_tx_agg_oper(hw, sta, tid);
break;
case IEEE80211_AMPDU_RX_START:
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("IEEE80211_AMPDU_RX_START:TID:%d\n", tid));
+ "IEEE80211_AMPDU_RX_START:TID:%d\n", tid);
return rtl92e_rx_agg_start(hw, sta, tid);
break;
case IEEE80211_AMPDU_RX_STOP:
RT_TRACE(COMP_MAC80211, DBG_TRACE,
- ("IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid));
+ "IEEE80211_AMPDU_RX_STOP:TID:%d\n", tid);
return rtl92e_rx_agg_stop(hw, sta, tid);
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("IEEE80211_AMPDU_ERR!!!!:\n"));
+ "IEEE80211_AMPDU_ERR!!!!:\n");
return -EOPNOTSUPP;
}
return 0;
@@ -1269,7 +1263,7 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "\n");
mac->act_scanning = true;
if (rtlpriv->link_info.b_higher_busytraffic) {
mac->skip_scan = true;
@@ -1303,7 +1297,7 @@ static void rtl_op_sw_scan_complete(struct ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
- RT_TRACE(COMP_MAC80211, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_MAC80211, DBG_LOUD, "\n");
mac->act_scanning = false;
mac->skip_scan = false;
if (rtlpriv->link_info.b_higher_busytraffic)
@@ -1345,8 +1339,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
- RT_TRACE(COMP_ERR, DBG_WARNING,
- ("not open hw encryption\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "not open hw encryption\n");
return -ENOSPC; /*User disabled HW-crypto */
}
/* To support IBSS, use sw-crypto for GTK */
@@ -1355,9 +1348,9 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
return -ENOSPC;
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("%s hardware based encryption for keyidx: %d, mac: %pM\n",
- cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
- sta ? sta->addr : bcast_addr));
+ "%s hardware based encryption for keyidx: %d, mac: %pM\n",
+ cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
+ sta ? sta->addr : bcast_addr);
rtlpriv->sec.being_setkey = true;
rtl92e_ips_nic_on(hw);
mutex_lock(&rtlpriv->locks.conf_mutex);
@@ -1366,32 +1359,31 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
switch (key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
key_type = WEP40_ENCRYPTION;
- RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:WEP40\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "alg:WEP40\n");
break;
case WLAN_CIPHER_SUITE_WEP104:
- RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:WEP104\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "alg:WEP104\n");
key_type = WEP104_ENCRYPTION;
break;
case WLAN_CIPHER_SUITE_TKIP:
key_type = TKIP_ENCRYPTION;
- RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:TKIP\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "alg:TKIP\n");
break;
case WLAN_CIPHER_SUITE_CCMP:
key_type = AESCCMP_ENCRYPTION;
- RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CCMP\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "alg:CCMP\n");
break;
case WLAN_CIPHER_SUITE_AES_CMAC:
/* HW don't support CMAC encryption,
* use software CMAC encryption */
key_type = AESCMAC_ENCRYPTION;
- RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CMAC\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "alg:CMAC\n");
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("HW don't support CMAC encrypiton, use software CMAC encryption\n"));
+ "HW don't support CMAC encrypiton, use software CMAC encryption\n");
err = -EOPNOTSUPP;
goto out_unlock;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("alg_err:%x!!!!:\n", key->cipher));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "alg_err:%x!!!!:\n", key->cipher);
goto out_unlock;
}
if (key_type == WEP40_ENCRYPTION ||
@@ -1434,8 +1426,8 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
wep_only = true;
rtlpriv->sec.pairwise_enc_algorithm = key_type;
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n",
- key_type));
+ "set enable_hw_sec, key_type:%x(OPEN:0 WEP40:1 TKIP:2 AES:4 WEP104:5)\n",
+ key_type);
rtlpriv->cfg->ops->enable_hw_sec(hw);
}
}
@@ -1444,7 +1436,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
case SET_KEY:
if (wep_only) {
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set WEP(group/pairwise) key\n"));
+ "set WEP(group/pairwise) key\n");
/* Pairwise key with an assigned MAC address. */
rtlpriv->sec.pairwise_enc_algorithm = key_type;
rtlpriv->sec.group_enc_algorithm = key_type;
@@ -1454,8 +1446,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
rtlpriv->sec.key_len[key_idx] = key->keylen;
eth_zero_addr(mac_addr);
} else if (group_key) { /* group key */
- RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set group key\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "set group key\n");
/* group key */
rtlpriv->sec.group_enc_algorithm = key_type;
/*set local buf about group key. */
@@ -1464,8 +1455,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
rtlpriv->sec.key_len[key_idx] = key->keylen;
ether_addr_copy(mac_addr, bcast_addr);
} else { /* pairwise key */
- RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set pairwise key\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "set pairwise key\n");
if (!sta) {
RT_ASSERT(false,
("pairwise key without mac_addr\n"));
@@ -1497,8 +1487,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
break;
case DISABLE_KEY:
- RT_TRACE(COMP_SEC, DBG_DMESG,
- ("disable key delete one entry\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "disable key delete one entry\n");
/*set local buf about wep key. */
if (vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_MESH_POINT) {
@@ -1516,8 +1505,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
stg_rtl_cam_delete_one_entry(hw, mac_addr, key_idx);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("cmd_err:%x!!!!:\n", cmd));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "cmd_err:%x!!!!:\n", cmd);
}
out_unlock:
mutex_unlock(&rtlpriv->locks.conf_mutex);
@@ -1546,8 +1534,8 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
rtlpriv->rfkill.rfkill_state = radio_state;
RT_TRACE(COMP_RF, DBG_DMESG,
- (KERN_INFO "wireless radio switch turned %s\n",
- radio_state ? "on" : "off"));
+ "wireless radio switch turned %s\n",
+ radio_state ? "on" : "off");
blocked = (rtlpriv->rfkill.rfkill_state == 1) ? 0 : 1;
wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
diff --git a/drivers/staging/rtl8192ee/debug.c b/drivers/staging/rtl8192ee/debug.c
index feec3948585d..d32730c34744 100644
--- a/drivers/staging/rtl8192ee/debug.c
+++ b/drivers/staging/rtl8192ee/debug.c
@@ -779,9 +779,9 @@ void rtl_proc_add_one(struct ieee80211_hw *hw)
rtlpriv->dbg.proc_dir = proc_mkdir(rtlpriv->dbg.proc_name, proc_topdir);
if (!rtlpriv->dbg.proc_dir) {
RT_TRACE(COMP_INIT, DBG_EMERG,
- ("Unable to init /proc/net/%s/%s\n",
+ "Unable to init /proc/net/%s/%s\n",
rtlpriv->cfg->name,
- rtlpriv->dbg.proc_name));
+ rtlpriv->dbg.proc_name);
return;
}
@@ -789,148 +789,148 @@ void rtl_proc_add_one(struct ieee80211_hw *hw)
rtlpriv->dbg.proc_dir, &file_ops_mac_0, hw);
if (!entry)
RT_TRACE(COMP_INIT, DBG_EMERG,
- ("Unable to initialize /proc/net/%s/%s/mac-0\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-0\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-1", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_1, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-1\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-1\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-2", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_2, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-2\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-2\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-3", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_3, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-3\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-3\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-4", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_4, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-4\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-4\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-5", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_5, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-5\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-5\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-6", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_6, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-6\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-6\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("mac-7", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_mac_7, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/mac-7\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/mac-7\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-8", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_8, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-8\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-8\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-9", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_9, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-9\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-9\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-a", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_a, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-a\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-a\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-b", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_b, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-b\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-b\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-c", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_c, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-c\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-c\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-d", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_d, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-d\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-d\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-e", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_e, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-e\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-e\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("bb-f", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_bb_f, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/bb-f\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/bb-f\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("rf-a", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_rf_a, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/rf-a\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/rf-a\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("rf-b", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_rf_b, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/rf-b\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/rf-b\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("cam-1", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_cam_1, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/cam-1\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/cam-1\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("cam-2", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_cam_2, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/cam-2\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/cam-2\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
entry = proc_create_data("cam-3", S_IFREG | S_IRUGO,
rtlpriv->dbg.proc_dir, &file_ops_cam_3, hw);
if (!entry)
RT_TRACE(COMP_INIT, COMP_ERR,
- ("Unable to initialize /proc/net/%s/%s/cam-3\n",
- rtlpriv->cfg->name, rtlpriv->dbg.proc_name));
+ "Unable to initialize /proc/net/%s/%s/cam-3\n",
+ rtlpriv->cfg->name, rtlpriv->dbg.proc_name);
}
void rtl_proc_remove_one(struct ieee80211_hw *hw)
diff --git a/drivers/staging/rtl8192ee/debug.h b/drivers/staging/rtl8192ee/debug.h
index 093128d1f368..26857b727d17 100644
--- a/drivers/staging/rtl8192ee/debug.h
+++ b/drivers/staging/rtl8192ee/debug.h
@@ -171,17 +171,15 @@ enum dbgp_flag_e {
} \
} while (0)
-#define RT_TRACE(comp, level, fmt)\
- do { \
- if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \
- ((level) <= rtlpriv->dbg.global_debuglevel))) {\
- pr_debug("%s-%d:%s():<%lx> ", \
- KBUILD_MODNAME, \
- rtlpriv->rtlhal.interfaceindex, __func__, \
- in_interrupt()); \
- pr_cont fmt; \
- } \
- } while (0)
+#define RT_TRACE(comp, level, fmt, ...) \
+do { \
+ if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \
+ ((level) <= rtlpriv->dbg.global_debuglevel))) { \
+ pr_debug("%d:<%lx> " fmt, \
+ rtlpriv->rtlhal.interfaceindex, \
+ in_interrupt(), ##__VA_ARGS__); \
+ } \
+} while (0)
#define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...) \
do { \
diff --git a/drivers/staging/rtl8192ee/efuse.c b/drivers/staging/rtl8192ee/efuse.c
index 3fae18369831..ba39f104b943 100644
--- a/drivers/staging/rtl8192ee/efuse.c
+++ b/drivers/staging/rtl8192ee/efuse.c
@@ -151,8 +151,7 @@ void efuse92e_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value)
const u32 efuse_real_content_len =
rtlpriv->cfg->maps[EFUSE_REAL_CONTENT_SIZE];
- RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("Addr=%x Data =%x\n", address, value));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "Addr=%x Data =%x\n", address, value);
if (address < efuse_real_content_len) {
rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_CTRL], value);
@@ -242,8 +241,8 @@ void read92e_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte,
if ((_offset + _size_byte) > rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]) {
RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("read92e_efuse(): Invalid offset(%#x) with read bytes(%#x)!!\n",
- _offset, _size_byte));
+ "read92e_efuse(): Invalid offset(%#x) with read bytes(%#x)!!\n",
+ _offset, _size_byte);
return;
}
@@ -411,8 +410,8 @@ bool efuse92e_shadow_update_chk(struct ieee80211_hw *hw)
bresult = false;
RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("efuse92e_shadow_update_chk(): totalbytes(%#x), hdr_num(%#x), words_need(%#x), efuse_used(%d)\n",
- totalbytes, hdr_num, words_need, efuse_used));
+ "efuse92e_shadow_update_chk(): totalbytes(%#x), hdr_num(%#x), words_need(%#x), efuse_used(%d)\n",
+ totalbytes, hdr_num, words_need, efuse_used);
return bresult;
}
@@ -448,7 +447,7 @@ bool efuse92e_shadow_update(struct ieee80211_hw *hw)
u8 word_en = 0x0F;
u8 first_pg = false;
- RT_TRACE(COMP_EFUSE, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "\n");
if (!efuse92e_shadow_update_chk(hw)) {
efuse_read_all_map(hw, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0]);
@@ -456,8 +455,7 @@ bool efuse92e_shadow_update(struct ieee80211_hw *hw)
&rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
- RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("efuse out of capacity!!\n"));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "efuse out of capacity!!\n");
return false;
}
efuse_power_switch(hw, true, true);
@@ -494,7 +492,7 @@ bool efuse92e_shadow_update(struct ieee80211_hw *hw)
if (!efuse_pg_packet_write(hw, (u8) offset, word_en,
tmpdata)) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("PG section(%#x) fail!!\n", offset));
+ "PG section(%#x) fail!!\n", offset);
break;
}
}
@@ -507,7 +505,7 @@ bool efuse92e_shadow_update(struct ieee80211_hw *hw)
&rtlefuse->efuse_map[EFUSE_INIT_MAP][0],
rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]);
- RT_TRACE(COMP_EFUSE, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "\n");
return true;
}
@@ -640,8 +638,7 @@ static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr, u8 data)
u8 tmpidx = 0;
bool bresult;
- RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("Addr = %x Data=%x\n", addr, data));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "Addr = %x Data=%x\n", addr, data);
rtl_write_byte(rtlpriv,
rtlpriv->cfg->maps[EFUSE_CTRL] + 1, (u8) (addr & 0xff));
@@ -1021,7 +1018,7 @@ static int efuse_pg_packet_write(struct ieee80211_hw *hw,
if (efuse_addr >= (EFUSE_MAX_SIZE -
rtlpriv->cfg->maps[EFUSE_OOB_PROTECT_BYTES_LEN])) {
RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("efuse_addr(%#x) Out of size!!\n", efuse_addr));
+ "efuse_addr(%#x) Out of size!!\n", efuse_addr);
}
return true;
@@ -1061,8 +1058,8 @@ static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw,
u8 tmpdata[8];
memset(tmpdata, 0xff, PGPKT_DATA_SIZE);
- RT_TRACE(COMP_EFUSE, DBG_LOUD,
- ("word_en = %x efuse_addr=%x\n", word_en, efuse_addr));
+ RT_TRACE(COMP_EFUSE, DBG_LOUD, "word_en = %x efuse_addr=%x\n",
+ word_en, efuse_addr);
if (!(word_en & BIT(0))) {
tmpaddr = start_addr;
diff --git a/drivers/staging/rtl8192ee/pci.c b/drivers/staging/rtl8192ee/pci.c
index 0215aef1eacc..4b895b3cea0b 100644
--- a/drivers/staging/rtl8192ee/pci.c
+++ b/drivers/staging/rtl8192ee/pci.c
@@ -164,8 +164,7 @@ static void _rtl_pci_update_default_setting(struct ieee80211_hw *hw)
}
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not process\n");
break;
}
@@ -228,8 +227,7 @@ static void rtl_pci_disable_aspm(struct ieee80211_hw *hw)
return;
if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) {
- RT_TRACE(COMP_POWER, DBG_TRACE,
- ("PCI(Bridge) UNKNOWN.\n"));
+ RT_TRACE(COMP_POWER, DBG_TRACE, "PCI(Bridge) UNKNOWN\n");
return;
}
@@ -284,8 +282,7 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
return;
if (pcibridge_vendor == PCI_BRIDGE_VENDOR_UNKNOWN) {
- RT_TRACE(COMP_POWER, DBG_TRACE,
- ("PCI(Bridge) UNKNOWN.\n"));
+ RT_TRACE(COMP_POWER, DBG_TRACE, "PCI(Bridge) UNKNOWN\n");
return;
}
@@ -303,9 +300,9 @@ static void rtl_pci_enable_aspm(struct ieee80211_hw *hw)
rtl_pci_raw_write_port_uchar(PCI_CONF_DATA, u_pcibridge_aspmsetting);
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("PlatformEnableASPM(): Write reg[%x] = %x\n",
- (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10),
- u_pcibridge_aspmsetting));
+ "PlatformEnableASPM(): Write reg[%x] = %x\n",
+ pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10,
+ u_pcibridge_aspmsetting);
udelay(50);
@@ -371,11 +368,11 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw,
tpcipriv = (struct rtl_pci_priv *)tpriv->priv;
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("pcipriv->ndis_adapter.funcnumber %x\n",
- pcipriv->ndis_adapter.funcnumber));
+ "pcipriv->ndis_adapter.funcnumber %x\n",
+ pcipriv->ndis_adapter.funcnumber);
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("tpcipriv->ndis_adapter.funcnumber %x\n",
- tpcipriv->ndis_adapter.funcnumber));
+ "tpcipriv->ndis_adapter.funcnumber %x\n",
+ tpcipriv->ndis_adapter.funcnumber);
if ((pcipriv->ndis_adapter.busnumber ==
tpcipriv->ndis_adapter.busnumber) &&
@@ -389,8 +386,7 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw,
}
}
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("find_buddy_priv %d\n", find_buddy_priv));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "find_buddy_priv %d\n", find_buddy_priv);
if (find_buddy_priv)
*buddy_priv = tpriv;
@@ -431,9 +427,8 @@ static void rtl_pci_parse_configuration(struct pci_dev *pdev,
pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg);
pcipriv->ndis_adapter.linkctrl_reg = linkctrl_reg;
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Link Control Register =%x\n",
- pcipriv->ndis_adapter.linkctrl_reg));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Link Control Register = %x\n",
+ pcipriv->ndis_adapter.linkctrl_reg);
pci_read_config_byte(pdev, 0x98, &tmp);
tmp |= BIT(4);
@@ -601,10 +596,10 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
skb_pull(skb, EM_HDR_LEN);
RT_TRACE((COMP_INTR | COMP_SEND), DBG_TRACE,
- ("new ring->idx:%d, free: skb_queue_len:%d, free: seq:%d\n",
- ring->idx,
- skb_queue_len(&ring->queue),
- *(u16 *)(skb->data + 22)));
+ "new ring->idx:%d, free: skb_queue_len:%d, free: seq:%d\n",
+ ring->idx,
+ skb_queue_len(&ring->queue),
+ *(u16 *)(skb->data + 22));
if (prio == TXCMD_QUEUE) {
dev_kfree_skb(skb);
@@ -649,9 +644,8 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
if ((ring->entries - skb_queue_len(&ring->queue)) == 2) {
RT_TRACE(COMP_ERR, DBG_LOUD,
- ("more desc left, wake skb_queue@%d,ring->idx = %d, skb_queue_len = 0x%d\n",
- prio, ring->idx,
- skb_queue_len(&ring->queue)));
+ "more desc left, wake skb_queue@%d,ring->idx = %d, skb_queue_len = 0x%d\n",
+ prio, ring->idx, skb_queue_len(&ring->queue));
ieee80211_wake_queue(hw, skb_get_queue_mapping
(skb));
@@ -972,59 +966,59 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
goto done;
/*<1> beacon related */
if (inta & rtlpriv->cfg->maps[RTL_IMR_TBDOK])
- RT_TRACE(COMP_INTR, DBG_TRACE, ("beacon ok interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "beacon ok interrupt!\n");
if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_TBDER]))
- RT_TRACE(COMP_INTR, DBG_TRACE, ("beacon err interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "beacon err interrupt!\n");
if (inta & rtlpriv->cfg->maps[RTL_IMR_BDOK])
- RT_TRACE(COMP_INTR, DBG_TRACE, ("beacon interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "beacon interrupt!\n");
if (inta & rtlpriv->cfg->maps[RTL_IMR_BcnInt]) {
RT_TRACE(COMP_INTR, DBG_TRACE,
- ("prepare beacon for interrupt!\n"));
+ "prepare beacon for interrupt!\n");
tasklet_schedule(&rtlpriv->works.irq_prepare_bcn_tasklet);
}
/*<2> tx related */
if (unlikely(intb & rtlpriv->cfg->maps[RTL_IMR_TXFOVW]))
- RT_TRACE(COMP_ERR, DBG_TRACE, ("IMR_TXFOVW!\n"));
+ RT_TRACE(COMP_ERR, DBG_TRACE, "IMR_TXFOVW!\n");
if (inta & rtlpriv->cfg->maps[RTL_IMR_MGNTDOK]) {
- RT_TRACE(COMP_INTR, DBG_TRACE, ("Manage ok interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "Manage ok interrupt!\n");
_rtl_pci_tx_isr(hw, MGNT_QUEUE);
}
if (inta & rtlpriv->cfg->maps[RTL_IMR_HIGHDOK]) {
- RT_TRACE(COMP_INTR, DBG_TRACE, ("HIGH_QUEUE ok interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "HIGH_QUEUE ok interrupt!\n");
_rtl_pci_tx_isr(hw, HIGH_QUEUE);
}
if (inta & rtlpriv->cfg->maps[RTL_IMR_BKDOK]) {
rtlpriv->link_info.num_tx_inperiod++;
- RT_TRACE(COMP_INTR, DBG_TRACE, ("BK Tx OK interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "BK Tx OK interrupt!\n");
_rtl_pci_tx_isr(hw, BK_QUEUE);
}
if (inta & rtlpriv->cfg->maps[RTL_IMR_BEDOK]) {
rtlpriv->link_info.num_tx_inperiod++;
- RT_TRACE(COMP_INTR, DBG_TRACE, ("BE TX OK interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "BE TX OK interrupt!\n");
_rtl_pci_tx_isr(hw, BE_QUEUE);
}
if (inta & rtlpriv->cfg->maps[RTL_IMR_VIDOK]) {
rtlpriv->link_info.num_tx_inperiod++;
- RT_TRACE(COMP_INTR, DBG_TRACE, ("VI TX OK interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "VI TX OK interrupt!\n");
_rtl_pci_tx_isr(hw, VI_QUEUE);
}
if (inta & rtlpriv->cfg->maps[RTL_IMR_VODOK]) {
rtlpriv->link_info.num_tx_inperiod++;
- RT_TRACE(COMP_INTR, DBG_TRACE, ("Vo TX OK interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "Vo TX OK interrupt!\n");
_rtl_pci_tx_isr(hw, VO_QUEUE);
}
@@ -1033,25 +1027,25 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
rtlpriv->link_info.num_tx_inperiod++;
RT_TRACE(COMP_INTR, DBG_TRACE,
- ("CMD TX OK interrupt!\n"));
+ "CMD TX OK interrupt!\n");
_rtl_pci_tx_isr(hw, TXCMD_QUEUE);
}
}
/*<3> rx related */
if (inta & rtlpriv->cfg->maps[RTL_IMR_ROK]) {
- RT_TRACE(COMP_INTR, DBG_TRACE, ("Rx ok interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "Rx ok interrupt!\n");
_rtl_pci_rx_interrupt(hw);
}
if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_RDU])) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("rx descriptor unavailable!\n"));
+ "rx descriptor unavailable!\n");
_rtl_pci_rx_interrupt(hw);
}
if (unlikely(intb & rtlpriv->cfg->maps[RTL_IMR_RXFOVW])) {
- RT_TRACE(COMP_ERR, DBG_WARNING, ("rx overflow !\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "rx overflow !\n");
_rtl_pci_rx_interrupt(hw);
}
@@ -1059,7 +1053,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8723AE) {
if (inta & rtlpriv->cfg->maps[RTL_IMR_C2HCMD]) {
RT_TRACE(COMP_INTR, DBG_TRACE,
- ("firmware interrupt!\n"));
+ "firmware interrupt!\n");
queue_delayed_work(rtlpriv->works.rtl_wq,
&rtlpriv->works.fwevt_wq, 0);
}
@@ -1073,8 +1067,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id)
if (rtlhal->hw_type == HARDWARE_TYPE_RTL8188EE ||
rtlhal->hw_type == HARDWARE_TYPE_RTL8723BE) {
if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_HSISR_IND])) {
- RT_TRACE(COMP_INTR, DBG_TRACE,
- ("hsisr interrupt!\n"));
+ RT_TRACE(COMP_INTR, DBG_TRACE, "hsisr interrupt!\n");
_rtl_pci_hs_interrupt(hw);
}
}
@@ -1230,8 +1223,8 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
&buffer_desc_dma);
if (!buffer_desc || (unsigned long)buffer_desc & 0xFF) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Cannot allocate TX ring (prio = %d)\n",
- prio));
+ "Cannot allocate TX ring (prio = %d)\n",
+ prio);
return -ENOMEM;
}
@@ -1248,7 +1241,7 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
&desc_dma);
if (!desc || (unsigned long)desc & 0xFF) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Cannot allocate TX ring (prio = %d)\n", prio));
+ "Cannot allocate TX ring (prio = %d)\n", prio);
return -ENOMEM;
}
@@ -1258,8 +1251,7 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw,
rtlpci->tx_ring[prio].idx = 0;
rtlpci->tx_ring[prio].entries = entries;
skb_queue_head_init(&rtlpci->tx_ring[prio].queue);
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("queue:%d, ring_addr:%p\n", prio, desc));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "queue:%d, ring_addr:%p\n", prio, desc);
/* init every desc in this ring */
if (!rtlpriv->use_new_trx_flow) {
@@ -1293,7 +1285,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx)
if (!rtlpci->rx_ring[rxring_idx].buffer_desc ||
(unsigned long)rtlpci->rx_ring[rxring_idx].buffer_desc & 0xFF) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Cannot allocate RX ring\n"));
+ "Cannot allocate RX ring\n");
return -ENOMEM;
}
@@ -1317,7 +1309,7 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx)
if (!rtlpci->rx_ring[rxring_idx].desc ||
(unsigned long)rtlpci->rx_ring[rxring_idx].desc & 0xFF) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Cannot allocate RX ring\n"));
+ "Cannot allocate RX ring\n");
return -ENOMEM;
}
@@ -1628,9 +1620,9 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
if ((own == 1) && (hw_queue != BEACON_QUEUE)) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
- hw_queue, ring->idx, idx,
- skb_queue_len(&ring->queue)));
+ "No more TX desc@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
+ hw_queue, ring->idx, idx,
+ skb_queue_len(&ring->queue));
spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock,
flags);
@@ -1670,9 +1662,9 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
if ((ring->entries - skb_queue_len(&ring->queue)) < 2 &&
hw_queue != BEACON_QUEUE) {
RT_TRACE(COMP_ERR, DBG_LOUD,
- ("less desc left, stop skb_queue@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
- hw_queue, ring->idx, idx,
- skb_queue_len(&ring->queue)));
+ "less desc left, stop skb_queue@%d, ring->idx = %d, idx = %d, skb_queue_len = 0x%d\n",
+ hw_queue, ring->idx, idx,
+ skb_queue_len(&ring->queue));
ieee80211_stop_queue(hw, skb_get_queue_mapping(skb));
}
@@ -1745,7 +1737,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
err = _rtl_pci_init_trx_ring(hw);
if (err) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("tx ring initialization failed"));
+ "tx ring initialization failed\n");
return err;
}
@@ -1759,7 +1751,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
int err = 0;
- RT_TRACE(COMP_INIT, DBG_DMESG, (" rtl_pci_start\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, " rtl_pci_start\n");
rtl92e_pci_reset_trx_ring(hw);
rtlpriv->rtlhal.driver_is_goingto_unload = false;
@@ -1771,12 +1763,12 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
err = rtlpriv->cfg->ops->hw_init(hw);
if (err) {
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("Failed to config hardware err %x!\n" , err));
+ "Failed to config hardware err %x!\n" , err);
return err;
}
rtlpriv->cfg->ops->enable_interrupt(hw);
- RT_TRACE(COMP_INIT, DBG_LOUD, ("enable_interrupt OK\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "enable_interrupt OK\n");
rtl92e_init_rx_config(hw);
@@ -1787,7 +1779,7 @@ static int rtl_pci_start(struct ieee80211_hw *hw)
rtlpriv->rtlhal.up_first_time = false;
- RT_TRACE(COMP_INIT, DBG_DMESG, ("rtl_pci_start OK\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "rtl_pci_start OK\n");
return 0;
}
@@ -1863,67 +1855,67 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
switch (revisionid) {
case RTL_PCI_REVISION_ID_8192PCIE:
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("8192E is found but not supported now-vid/did=%x/%x\n",
- venderid, deviceid));
+ "8192E is found but not supported now-vid/did=%x/%x\n",
+ venderid, deviceid);
rtlhal->hw_type = HARDWARE_TYPE_RTL8192E;
return false;
break;
case RTL_PCI_REVISION_ID_8192SE:
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("8192SE is found - vid/did=%x/%x\n",
- venderid, deviceid));
+ "8192SE is found - vid/did=%x/%x\n",
+ venderid, deviceid);
rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE;
break;
default:
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("Err: Unknown device - vid/did=%x/%x\n",
- venderid, deviceid));
+ "Err: Unknown device - vid/did=%x/%x\n",
+ venderid, deviceid);
rtlhal->hw_type = HARDWARE_TYPE_RTL8192SE;
break;
}
} else if (deviceid == RTL_PCI_8723AE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8723AE;
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("8723AE PCI-E is found - vid/did=%x/%x\n",
- venderid, deviceid));
+ "8723AE PCI-E is found - vid/did=%x/%x\n",
+ venderid, deviceid);
} else if (deviceid == RTL_PCI_8192CET_DID ||
deviceid == RTL_PCI_8192CE_DID ||
deviceid == RTL_PCI_8191CE_DID ||
deviceid == RTL_PCI_8188CE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8192CE;
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("8192C PCI-E is found - vid/did=%x/%x\n",
- venderid, deviceid));
+ "8192C PCI-E is found - vid/did=%x/%x\n",
+ venderid, deviceid);
} else if (deviceid == RTL_PCI_8192DE_DID ||
deviceid == RTL_PCI_8192DE_DID2) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8192DE;
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("8192D PCI-E is found - vid/did=%x/%x\n",
- venderid, deviceid));
+ "8192D PCI-E is found - vid/did=%x/%x\n",
+ venderid, deviceid);
} else if (deviceid == RTL_PCI_8188EE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8188EE;
- RT_TRACE(COMP_INIT , DBG_LOUD,
- ("Find adapter, Hardware type is 8188EE\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ "Find adapter, Hardware type is 8188EE\n");
} else if (deviceid == RTL_PCI_8723BE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8723BE;
- RT_TRACE(COMP_INIT , DBG_LOUD,
- ("Find adapter, Hardware type is 8723BE\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ "Find adapter, Hardware type is 8723BE\n");
} else if (deviceid == RTL_PCI_8192EE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8192EE;
- RT_TRACE(COMP_INIT , DBG_LOUD,
- ("Find adapter, Hardware type is 8192EE\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ "Find adapter, Hardware type is 8192EE\n");
} else if (deviceid == RTL_PCI_8821AE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8821AE;
- RT_TRACE(COMP_INIT , DBG_LOUD,
- ("Find adapter, Hardware type is 8821AE\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ "Find adapter, Hardware type is 8821AE\n");
} else if (deviceid == RTL_PCI_8812AE_DID) {
rtlhal->hw_type = HARDWARE_TYPE_RTL8812AE;
- RT_TRACE(COMP_INIT , DBG_LOUD,
- ("Find adapter, Hardware type is 8812AE\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ "Find adapter, Hardware type is 8812AE\n");
} else {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("Err: Unknown device - vid/did=%x/%x\n",
- venderid, deviceid));
+ "Err: Unknown device - vid/did=%x/%x\n",
+ venderid, deviceid);
rtlhal->hw_type = RTL_DEFAULT_HARDWARE_TYPE;
}
@@ -1932,17 +1924,17 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
if (revisionid == 0 || revisionid == 1) {
if (revisionid == 0) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Find 92DE MAC0.\n"));
+ "Find 92DE MAC0\n");
rtlhal->interfaceindex = 0;
} else if (revisionid == 1) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Find 92DE MAC1.\n"));
+ "Find 92DE MAC1\n");
rtlhal->interfaceindex = 1;
}
} else {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Unknown device - VendorID/DeviceID=%x/%x, Revision=%x\n",
- venderid, deviceid, revisionid));
+ "Unknown device - VendorID/DeviceID=%x/%x, Revision=%x\n",
+ venderid, deviceid, revisionid);
rtlhal->interfaceindex = 0;
}
}
@@ -1968,8 +1960,8 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
if (bridge_pdev->vendor == pcibridge_vendors[tmp]) {
pcipriv->ndis_adapter.pcibridge_vendor = tmp;
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("Pci Bridge Vendor is found index: %d\n",
- tmp));
+ "Pci Bridge Vendor is found index: %d\n",
+ tmp);
break;
}
}
@@ -2002,21 +1994,21 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev,
}
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("pcidev busnumber:devnumber:funcnumber:vendor:link_ctl %d:%d:%d:%x:%x\n",
- pcipriv->ndis_adapter.busnumber,
- pcipriv->ndis_adapter.devnumber,
- pcipriv->ndis_adapter.funcnumber,
- pdev->vendor, pcipriv->ndis_adapter.linkctrl_reg));
+ "pcidev busnumber:devnumber:funcnumber:vendor:link_ctl %d:%d:%d:%x:%x\n",
+ pcipriv->ndis_adapter.busnumber,
+ pcipriv->ndis_adapter.devnumber,
+ pcipriv->ndis_adapter.funcnumber,
+ pdev->vendor, pcipriv->ndis_adapter.linkctrl_reg);
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("pci_bridge busnumber:devnumber:funcnumber:vendor:pcie_cap:link_ctl_reg:amd %d:%d:%d:%x:%x:%x:%x\n",
- pcipriv->ndis_adapter.pcibridge_busnum,
- pcipriv->ndis_adapter.pcibridge_devnum,
+ "pci_bridge busnumber:devnumber:funcnumber:vendor:pcie_cap:link_ctl_reg:amd %d:%d:%d:%x:%x:%x:%x\n",
+ pcipriv->ndis_adapter.pcibridge_busnum,
+ pcipriv->ndis_adapter.pcibridge_devnum,
pcipriv->ndis_adapter.pcibridge_funcnum,
- pcibridge_vendors[pcipriv->ndis_adapter.pcibridge_vendor],
- pcipriv->ndis_adapter.pcibridge_pciehdr_offset,
- pcipriv->ndis_adapter.pcibridge_linkctrlreg,
- pcipriv->ndis_adapter.amd_l1_patch));
+ pcibridge_vendors[pcipriv->ndis_adapter.pcibridge_vendor],
+ pcipriv->ndis_adapter.pcibridge_pciehdr_offset,
+ pcipriv->ndis_adapter.pcibridge_linkctrlreg,
+ pcipriv->ndis_adapter.amd_l1_patch);
rtl_pci_parse_configuration(pdev, hw);
list_add_tail(&rtlpriv->list, &rtlpriv->glb_var->glb_priv_list);
@@ -2042,7 +2034,7 @@ static int rtl_pci_intr_mode_msi(struct ieee80211_hw *hw)
rtlpci->using_msi = true;
- RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, ("MSI Interrupt Mode!\n"));
+ RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, "MSI Interrupt Mode!\n");
return 0;
}
@@ -2059,8 +2051,7 @@ static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw)
return ret;
rtlpci->using_msi = false;
- RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG,
- ("Pin-based Interrupt Mode!\n"));
+ RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, "Pin-based Interrupt Mode!\n");
return 0;
}
@@ -2166,9 +2157,8 @@ int stg_rtl_pci_probe(struct pci_dev *pdev,
}
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("mem mapped space: start: 0x%08lx len:%08lx flags:%08lx, after map:0x%08lx\n",
- pmem_start, pmem_len, pmem_flags,
- rtlpriv->io.pci_mem_start));
+ "mem mapped space: start: 0x%08lx len:%08lx flags:%08lx, after map:0x%08lx\n",
+ pmem_start, pmem_len, pmem_flags, rtlpriv->io.pci_mem_start);
/* Disable Clk Request */
pci_write_config_byte(pdev, 0x81, 0);
@@ -2192,7 +2182,7 @@ int stg_rtl_pci_probe(struct pci_dev *pdev,
rtlpriv->cfg->ops->read_eeprom_info(hw);
if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("Can't init_sw_vars.\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
goto fail3;
}
@@ -2205,21 +2195,20 @@ int stg_rtl_pci_probe(struct pci_dev *pdev,
err = rtl92e_init_core(hw);
if (err) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Can't allocate sw for mac80211.\n"));
+ "Can't allocate sw for mac80211\n");
goto fail3;
}
/* Init PCI sw */
err = !rtl_pci_init(hw, pdev);
if (err) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("Failed to init PCI.\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Failed to init PCI\n");
goto fail3;
}
err = ieee80211_register_hw(hw);
if (err) {
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Can't register mac80211 hw.\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Can't register mac80211 hw\n");
goto fail3;
} else {
rtlpriv->mac80211.mac80211_registered = 1;
@@ -2227,7 +2216,7 @@ int stg_rtl_pci_probe(struct pci_dev *pdev,
/* the wiphy must have been registed to
* cfg80211 prior to regulatory_hint */
if (regulatory_hint(hw->wiphy, rtlpriv->regd.alpha2))
- RT_TRACE(COMP_ERR, DBG_WARNING, ("regulatory_hint fail\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "regulatory_hint fail\n");
/* add for prov */
rtl_proc_add_one(hw);
@@ -2239,8 +2228,8 @@ int stg_rtl_pci_probe(struct pci_dev *pdev,
err = rtl_pci_intr_mode_decide(hw);
if (err) {
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("%s: failed to register IRQ handler\n",
- wiphy_name(hw->wiphy)));
+ "%s: failed to register IRQ handler\n",
+ wiphy_name(hw->wiphy));
goto fail3;
} else {
rtlpci->irq_alloc = 1;
diff --git a/drivers/staging/rtl8192ee/ps.c b/drivers/staging/rtl8192ee/ps.c
index 90c3fc2e62b6..1a547b31321a 100644
--- a/drivers/staging/rtl8192ee/ps.c
+++ b/drivers/staging/rtl8192ee/ps.c
@@ -40,7 +40,7 @@ bool stg_rtl_ps_enable_nic(struct ieee80211_hw *hw)
rtlpriv->intf_ops->reset_trx_ring(hw);
if (is_hal_stop(rtlhal))
- RT_TRACE(COMP_ERR, DBG_WARNING, ("Driver is already down!\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "Driver is already down!\n");
/*<2> Enable Adapter */
rtlpriv->cfg->ops->hw_init(hw);
@@ -101,8 +101,8 @@ bool stg_rtl_ps_set_rf_state(struct ieee80211_hw *hw,
spin_unlock(&rtlpriv->locks.rf_ps_lock);
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("RF Change in progress! Wait to set..state_toset(%d)\n",
- state_toset));
+ "RF Change in progress! Wait to set..state_toset(%d)\n",
+ state_toset);
/* Set RF after the previous action is done. */
while (ppsc->rfchange_inprogress) {
@@ -151,7 +151,7 @@ no_protect:
b_actionallowed = true;
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG, ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not process\n");
break;
}
@@ -212,7 +212,7 @@ void rtl92e_ips_nic_off_wq_callback(void *data)
enum rf_pwrstate rtstate;
if (mac->opmode != NL80211_IFTYPE_STATION) {
- RT_TRACE(COMP_ERR, DBG_WARNING, ("not station return\n"));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "not station return\n");
return;
}
@@ -249,7 +249,7 @@ void rtl92e_ips_nic_off_wq_callback(void *data)
(mac->link_state == MAC80211_NOLINK) &&
!mac->act_scanning) {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("IPSEnter(): Turn off RF.\n"));
+ "IPSEnter(): Turn off RF\n");
ppsc->inactive_pwrstate = ERFOFF;
ppsc->b_in_powersavemode = true;
@@ -326,7 +326,7 @@ static bool rtl_get_fwlps_doze(struct ieee80211_hw *hw)
if (ps_timediff < 2000) {
RT_TRACE(COMP_POWER, DBG_LOUD,
- ("Delay enter Fw LPS for DHCP, ARP, or EAPOL exchanging state\n"));
+ "Delay enter Fw LPS for DHCP, ARP, or EAPOL exchanging state\n");
return false;
}
@@ -372,8 +372,8 @@ void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
if ((ppsc->b_fwctrl_lps) && ppsc->report_linked) {
if (ppsc->dot11_psmode == EACTIVE) {
RT_TRACE(COMP_RF, DBG_DMESG,
- ("FW LPS leave ps_mode:%x\n",
- FW_PS_ACTIVE_MODE));
+ "FW LPS leave ps_mode:%x\n",
+ FW_PS_ACTIVE_MODE);
enter_fwlps = false;
ppsc->pwr_mode = FW_PS_ACTIVE_MODE;
ppsc->smart_ps = 0;
@@ -387,8 +387,8 @@ void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
} else {
if (rtl_get_fwlps_doze(hw)) {
RT_TRACE(COMP_RF, DBG_DMESG,
- ("FW LPS enter ps_mode:%x\n",
- ppsc->fwctrl_psmode));
+ "FW LPS enter ps_mode:%x\n",
+ ppsc->fwctrl_psmode);
if (rtlpriv->cfg->ops->get_btc_status())
rtlpriv->btcoexist.btc_ops->btc_lps_notify(rtlpriv, rt_psmode);
enter_fwlps = true;
@@ -439,7 +439,7 @@ void rtl92e_lps_enter(struct ieee80211_hw *hw)
if (mac->cnt_after_linked >= 2) {
if (ppsc->dot11_psmode == EACTIVE) {
RT_TRACE(COMP_POWER, DBG_LOUD,
- ("Enter 802.11 power save mode...\n"));
+ "Enter 802.11 power save mode...\n");
rtl_lps_set_psmode(hw, EAUTOPS);
}
@@ -469,7 +469,7 @@ void rtl92e_lps_leave(struct ieee80211_hw *hw)
}
RT_TRACE(COMP_POWER, DBG_LOUD,
- ("Busy Traffic,Leave 802.11 power save..\n"));
+ "Busy Traffic,Leave 802.11 power save..\n");
rtl_lps_set_psmode(hw, EACTIVE);
}
@@ -555,8 +555,8 @@ void rtl92e_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
&rtlpriv->works.ps_work, MSECS(5));
} else {
RT_TRACE(COMP_POWER, DBG_DMESG,
- ("u_bufferd: %x, m_buffered: %x\n",
- u_buffed, m_buffed));
+ "u_bufferd: %x, m_buffered: %x\n",
+ u_buffed, m_buffed);
}
}
@@ -653,8 +653,8 @@ void rtl92e_swlps_rf_sleep(struct ieee80211_hw *hw)
* sleep = dtim_period, that meaons, we should
* awake before every dtim */
RT_TRACE(COMP_POWER, DBG_DMESG,
- ("dtim_counter:%x will sleep :%d beacon_intv\n",
- rtlpriv->psc.dtim_counter, sleep_intv));
+ "dtim_counter:%x will sleep :%d beacon_intv\n",
+ rtlpriv->psc.dtim_counter, sleep_intv);
/* we tested that 40ms is enough for sw & hw sw delay */
queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq,
@@ -731,8 +731,8 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
find_p2p_ps_ie = true;
if ((noa_len - 2) % 13 != 0) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("P2P notice of absence: invalid length%d\n",
- noa_len));
+ "P2P notice of absence: invalid length%d\n",
+ noa_len);
return;
} else {
noa_num = (noa_len - 2) / 13;
@@ -740,8 +740,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
noa_index = ie[3];
if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
P2P_PS_NONE || noa_index != p2pinfo->noa_index) {
- RT_TRACE(COMP_FW, DBG_LOUD,
- ("update NOA ie.\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "update NOA ie\n");
p2pinfo->noa_index = noa_index;
p2pinfo->opp_ps = (ie[4] >> 7);
p2pinfo->ctwindow = ie[4] & 0x7F;
@@ -815,7 +814,7 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
return;
find_p2p_ie = true;
- RT_TRACE(COMP_FW, DBG_LOUD, ("action frame find P2P IE.\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "action frame find P2P IE.\n");
/*to find noa ie*/
while (ie + 1 < end) {
noa_len = READEF2BYTE((__le16 *)&ie[1]);
@@ -823,14 +822,14 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
return;
if (ie[0] == 12) {
- RT_TRACE(COMP_FW, DBG_LOUD, ("find NOA IE\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "find NOA IE\n");
RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_LOUD, "noa ie ",
ie, noa_len);
find_p2p_ps_ie = true;
if ((noa_len - 2) % 13 != 0) {
RT_TRACE(COMP_FW, DBG_LOUD,
- ("P2P notice of absence: invalid length%d\n",
- noa_len));
+ "P2P notice of absence: invalid length%d\n",
+ noa_len);
return;
} else {
noa_num = (noa_len - 2) / 13;
@@ -887,7 +886,7 @@ void rtl92e_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info);
- RT_TRACE(COMP_FW, DBG_LOUD, ("p2p state %x\n", p2p_ps_state));
+ RT_TRACE(COMP_FW, DBG_LOUD, "p2p state %x\n", p2p_ps_state);
switch (p2p_ps_state) {
case P2P_PS_DISABLE:
p2pinfo->p2p_ps_state = p2p_ps_state;
@@ -939,17 +938,17 @@ void rtl92e_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
default:
break;
}
- RT_TRACE(COMP_FW, DBG_LOUD, (" ctwindow %x oppps %x\n",
- p2pinfo->ctwindow , p2pinfo->opp_ps));
+ RT_TRACE(COMP_FW, DBG_LOUD, " ctwindow %x oppps %x\n",
+ p2pinfo->ctwindow , p2pinfo->opp_ps);
RT_TRACE(COMP_FW, DBG_LOUD,
- ("count %x duration %x index %x interval %x start time %x noa num %x\n",
+ "count %x duration %x index %x interval %x start time %x noa num %x\n",
p2pinfo->noa_count_type[0],
p2pinfo->noa_duration[0],
p2pinfo->noa_index,
p2pinfo->noa_interval[0],
p2pinfo->noa_start_time[0],
- p2pinfo->noa_num));
- RT_TRACE(COMP_FW, DBG_LOUD, ("end\n"));
+ p2pinfo->noa_num);
+ RT_TRACE(COMP_FW, DBG_LOUD, "end\n");
}
void rtl92e_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len)
diff --git a/drivers/staging/rtl8192ee/rc.c b/drivers/staging/rtl8192ee/rc.c
index c4c34ddcf8cd..31146a56fa28 100644
--- a/drivers/staging/rtl8192ee/rc.c
+++ b/drivers/staging/rtl8192ee/rc.c
@@ -250,7 +250,7 @@ static void *rtl_rate_alloc_sta(void *ppriv,
rate_priv = kzalloc(sizeof(*rate_priv), gfp);
if (!rate_priv) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Unable to allocate private rc structure\n"));
+ "Unable to allocate private rc structure\n");
return NULL;
}
diff --git a/drivers/staging/rtl8192ee/regd.c b/drivers/staging/rtl8192ee/regd.c
index 7272fae68ec6..58b1d9f4717a 100644
--- a/drivers/staging/rtl8192ee/regd.c
+++ b/drivers/staging/rtl8192ee/regd.c
@@ -407,12 +407,12 @@ int rtl92e_regd_init(struct ieee80211_hw *hw,
rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan;
RT_TRACE(COMP_REGD, DBG_TRACE,
- (KERN_DEBUG "rtl: EEPROM regdomain: 0x%0x\n",
- rtlpriv->regd.country_code));
+ KERN_DEBUG "rtl: EEPROM regdomain: 0x%0x\n",
+ rtlpriv->regd.country_code);
if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) {
RT_TRACE(COMP_REGD, DBG_DMESG,
- ("rtl: EEPROM indicates invalid contry code world wide 13 should be used\n"));
+ "rtl: EEPROM indicates invalid contry code world wide 13 should be used\n");
rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13;
}
@@ -428,8 +428,8 @@ int rtl92e_regd_init(struct ieee80211_hw *hw,
}
RT_TRACE(COMP_REGD, DBG_TRACE,
- (KERN_DEBUG "rtl: Country alpha2 being used: %c%c\n",
- rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]));
+ KERN_DEBUG "rtl: Country alpha2 being used: %c%c\n",
+ rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]);
_rtl92e_regd_init_wiphy(&rtlpriv->regd, wiphy, reg_notifier);
@@ -442,7 +442,7 @@ void rtl92e_reg_notifier(struct wiphy *wiphy,
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct rtl_priv *rtlpriv = rtl_priv(hw);
- RT_TRACE(COMP_REGD, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_REGD, DBG_LOUD, "\n");
_rtl92e_reg_notifier_apply(wiphy, request, &rtlpriv->regd);
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/dm.c b/drivers/staging/rtl8192ee/rtl8192ee/dm.c
index 41c2d98e81db..64254c4070f7 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/dm.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/dm.c
@@ -256,16 +256,15 @@ static void rtl92ee_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
RT_TRACE(COMP_DIG, DBG_TRACE,
- ("cnt_parity_fail = %d, cnt_rate_illegal = %d, "
- "cnt_crc8_fail = %d, cnt_mcs_fail = %d\n",
- falsealm_cnt->cnt_parity_fail,
- falsealm_cnt->cnt_rate_illegal,
- falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail));
+ "cnt_parity_fail = %d, cnt_rate_illegal = %d, cnt_crc8_fail = %d, cnt_mcs_fail = %d\n",
+ falsealm_cnt->cnt_parity_fail,
+ falsealm_cnt->cnt_rate_illegal,
+ falsealm_cnt->cnt_crc8_fail, falsealm_cnt->cnt_mcs_fail);
RT_TRACE(COMP_DIG, DBG_TRACE,
- ("cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n",
- falsealm_cnt->cnt_ofdm_fail,
- falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all));
+ "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n",
+ falsealm_cnt->cnt_ofdm_fail,
+ falsealm_cnt->cnt_cck_fail, falsealm_cnt->cnt_all);
}
static void rtl92ee_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
@@ -341,7 +340,7 @@ static void rtl92ee_dm_dig(struct ieee80211_hw *hw)
} else {
dm_dig.rx_gain_range_max = dm_dig_max;
dig_dynamic_min = dm_dig_min;
- RT_TRACE(COMP_DIG, DBG_LOUD, ("no link\n"));
+ RT_TRACE(COMP_DIG, DBG_LOUD, "no link\n");
}
if (rtlpriv->falsealm_cnt.cnt_all > 10000) {
@@ -496,7 +495,7 @@ static void rtl92ee_dm_find_minimum_rssi(struct ieee80211_hw *hw)
(rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
rtl_dm_dig->min_undecorated_pwdb_for_dm = 0;
RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD,
- ("Not connected to any\n"));
+ "Not connected to any\n");
}
if (mac->link_state >= MAC80211_LINKED) {
if (mac->opmode == NL80211_IFTYPE_AP ||
@@ -504,24 +503,24 @@ static void rtl92ee_dm_find_minimum_rssi(struct ieee80211_hw *hw)
rtl_dm_dig->min_undecorated_pwdb_for_dm =
rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD,
- ("AP Client PWDB = 0x%lx\n",
- rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb));
+ "AP Client PWDB = 0x%lx\n",
+ rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb);
} else {
rtl_dm_dig->min_undecorated_pwdb_for_dm =
rtlpriv->dm.undecorated_smoothed_pwdb;
RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD,
- ("STA Default Port PWDB = 0x%x\n",
- rtl_dm_dig->min_undecorated_pwdb_for_dm));
+ "STA Default Port PWDB = 0x%x\n",
+ rtl_dm_dig->min_undecorated_pwdb_for_dm);
}
} else {
rtl_dm_dig->min_undecorated_pwdb_for_dm =
rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD,
- ("AP Ext Port or disconnet PWDB = 0x%x\n",
- rtl_dm_dig->min_undecorated_pwdb_for_dm));
+ "AP Ext Port or disconnet PWDB = 0x%x\n",
+ rtl_dm_dig->min_undecorated_pwdb_for_dm);
}
- RT_TRACE(COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n",
- rtl_dm_dig->min_undecorated_pwdb_for_dm));
+ RT_TRACE(COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n",
+ rtl_dm_dig->min_undecorated_pwdb_for_dm);
}
static void rtl92ee_dm_check_rssi_monitor(struct ieee80211_hw *hw)
@@ -842,8 +841,7 @@ static void rtl92ee_dm_dynamic_atc_switch(struct ieee80211_hw *hw)
if (rtlpriv->cfg->ops->get_btc_status()) {
if (!rtlpriv->btcoexist.btc_ops->btc_is_bt_disabled(rtlpriv)) {
RT_TRACE(COMP_BT_COEXIST, DBG_LOUD,
- ("odm_DynamicATCSwitch(): "
- "Disable CFO tracking for BT!!\n"));
+ "odm_DynamicATCSwitch(): Disable CFO tracking for BT!!\n");
return;
}
}
@@ -1003,7 +1001,8 @@ static bool _rtl92ee_dm_ra_state_check(struct ieee80211_hw *hw,
default:
RT_TRACE(COMP_RATR, DBG_DMESG,
- ("wrong rssi level setting %d !", *ratr_state));
+ "wrong rssi level setting %d !\n",
+ *ratr_state);
break;
}
@@ -1032,14 +1031,13 @@ static void rtl92ee_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
struct ieee80211_sta *sta = NULL;
if (is_hal_stop(rtlhal)) {
- RT_TRACE(COMP_RATE, DBG_LOUD,
- ("driver is going to unload\n"));
+ RT_TRACE(COMP_RATE, DBG_LOUD, "driver is going to unload\n");
return;
}
if (!rtlpriv->dm.b_useramask) {
RT_TRACE(COMP_RATE, DBG_LOUD,
- ("driver does not control rate adaptive mask\n"));
+ "driver does not control rate adaptive mask\n");
return;
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/fw.c b/drivers/staging/rtl8192ee/rtl8192ee/fw.c
index ea6cafa80f48..5b98c50c0644 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/fw.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/fw.c
@@ -115,7 +115,7 @@ static void _rtl92ee_write_fw(struct ieee80211_hw *hw,
u32 pageNums, remainSize;
u32 page, offset;
- RT_TRACE(COMP_FW, DBG_LOUD , ("FW size is %d bytes,\n", size));
+ RT_TRACE(COMP_FW, DBG_LOUD , "FW size is %d bytes\n", size);
_rtl92ee_fill_dummy(bufferPtr, &size);
@@ -124,7 +124,7 @@ static void _rtl92ee_write_fw(struct ieee80211_hw *hw,
if (pageNums > 8) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Page numbers should not greater then 8\n"));
+ "Page numbers should not greater then 8\n");
}
for (page = 0; page < pageNums; page++) {
@@ -157,13 +157,13 @@ static int _rtl92ee_fw_free_to_go(struct ieee80211_hw *hw)
if (counter >= FW_8192C_POLLING_TIMEOUT_COUNT) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("chksum report faill ! REG_MCUFWDL:0x%08x .\n",
- value32));
+ "chksum report faill ! REG_MCUFWDL:0x%08x\n",
+ value32);
goto exit;
}
RT_TRACE(COMP_FW, DBG_TRACE,
- ("Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32));
+ "Checksum report OK ! REG_MCUFWDL:0x%08x\n", value32);
value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
value32 |= MCUFWDL_RDY;
@@ -176,9 +176,9 @@ static int _rtl92ee_fw_free_to_go(struct ieee80211_hw *hw)
do {
value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL);
if (value32 & WINTINI_RDY) {
- RT_TRACE(COMP_FW, DBG_LOUD ,
- ("Polling FW ready success!! REG_MCUFWDL:"
- "0x%08x. count = %d\n", value32, counter));
+ RT_TRACE(COMP_FW, DBG_LOUD,
+ "Polling FW ready success!! REG_MCUFWDL:0x%08x. count = %d\n",
+ value32, counter);
err = 0;
goto exit;
}
@@ -188,8 +188,8 @@ static int _rtl92ee_fw_free_to_go(struct ieee80211_hw *hw)
} while (counter++ < FW_8192C_POLLING_TIMEOUT_COUNT);
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Polling FW ready fail!! REG_MCUFWDL:0x%08x. count = %d\n",
- value32, counter));
+ "Polling FW ready fail!! REG_MCUFWDL:0x%08x. count = %d\n",
+ value32, counter);
exit:
return err;
@@ -213,21 +213,20 @@ int rtl92ee_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw)
rtlhal->fw_subversion = pfwheader->subversion;
pfwdata = (u8 *) rtlhal->pfirmware;
fwsize = rtlhal->fwsize;
- RT_TRACE(COMP_FW, DBG_DMESG,
- ("normal Firmware SIZE %d\n" , fwsize));
+ RT_TRACE(COMP_FW, DBG_DMESG, "normal Firmware SIZE %d\n", fwsize);
if (IS_FW_HEADER_EXIST(pfwheader)) {
RT_TRACE(COMP_FW, DBG_DMESG,
- ("Firmware Version(%d), Signature(%#x), Size(%d)\n",
- pfwheader->version, pfwheader->signature,
- (int)sizeof(struct rtl92c_firmware_header)));
+ "Firmware Version(%d), Signature(%#x), Size(%d)\n",
+ pfwheader->version, pfwheader->signature,
+ (int)sizeof(struct rtl92c_firmware_header));
pfwdata = pfwdata + sizeof(struct rtl92c_firmware_header);
fwsize = fwsize - sizeof(struct rtl92c_firmware_header);
} else {
RT_TRACE(COMP_FW, DBG_DMESG,
- ("Firmware no Header, Signature(%#x)\n",
- pfwheader->signature));
+ "Firmware no Header, Signature(%#x)\n",
+ pfwheader->signature);
}
if (rtlhal->b_mac_func_enable) {
@@ -243,10 +242,9 @@ int rtl92ee_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw)
err = _rtl92ee_fw_free_to_go(hw);
if (err) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Firmware is not ready to run!\n"));
+ "Firmware is not ready to run!\n");
} else {
- RT_TRACE(COMP_FW, DBG_LOUD ,
- ("Firmware is ready to run!\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "Firmware is ready to run!\n");
}
return 0;
@@ -284,13 +282,12 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
if (ppsc->dot11_psmode != EACTIVE ||
ppsc->inactive_pwrstate == ERFOFF) {
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("FillH2CCommand8192E(): "
- "Return because RF is off!!!\n"));
+ RT_TRACE(COMP_CMD, DBG_LOUD,
+ "FillH2CCommand8192E(): Return because RF is off!!!\n");
return;
}
- RT_TRACE(COMP_CMD, DBG_LOUD , ("come in\n"));
+ RT_TRACE(COMP_CMD, DBG_LOUD, "come in\n");
/* 1. Prevent race condition in setting H2C cmd.
* (copy from MgntActSet_RF_State().)
@@ -299,16 +296,16 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
if (rtlhal->b_h2c_setinprogress) {
RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("H2C set in progress! Wait to set.."
- "element_id(%d).\n", element_id));
+ "H2C set in progress! Wait to set..element_id(%d)\n",
+ element_id);
while (rtlhal->b_h2c_setinprogress) {
spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock,
flag);
h2c_waitcounter++;
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("Wait 100 us (%d times)...\n",
- h2c_waitcounter));
+ RT_TRACE(COMP_CMD, DBG_LOUD,
+ "Wait 100 us (%d times)...\n",
+ h2c_waitcounter);
udelay(100);
if (h2c_waitcounter > 1000)
@@ -329,8 +326,7 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
/*wait_writeh2c_limmit--;
if (wait_writeh2c_limmit == 0) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Write H2C fail because no trigger "
- "for FW INT!\n"));
+ "Write H2C fail because no trigger for FW INT!\n");
break;
}
*/
@@ -355,7 +351,7 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ "switch case not processed\n");
break;
}
@@ -377,19 +373,18 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
while (!isfw_read) {
wait_h2c_limmit--;
if (wait_h2c_limmit == 0) {
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("Wating too long for FW"
- "read clear HMEBox(%d)!!!\n",
- boxnum));
+ RT_TRACE(COMP_CMD, DBG_LOUD,
+ "Wating too long for FW read clear HMEBox(%d)!!!\n",
+ boxnum);
break;
}
udelay(10);
isfw_read = _rtl92ee_check_fw_read_last_h2c(hw,
boxnum);
u1b_tmp = rtl_read_byte(rtlpriv, 0x130);
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("Wating for FW read clear HMEBox(%d)!!! 0x130 = %2x\n",
- boxnum, u1b_tmp));
+ RT_TRACE(COMP_CMD, DBG_LOUD,
+ "Waiting for FW read clear HMEBox(%d)!!! 0x130 = %2x\n",
+ boxnum, u1b_tmp);
}
}
@@ -397,17 +392,17 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
H2C cmd, break and give up this H2C. */
if (!isfw_read) {
RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("Write H2C reg BOX[%d] fail, Fw don't read.\n",
- boxnum));
+ "Write H2C reg BOX[%d] fail, Fw doesn't read\n",
+ boxnum);
break;
}
/* 4. Fill the H2C cmd into box */
memset(boxcontent, 0, sizeof(boxcontent));
memset(boxextcontent, 0, sizeof(boxextcontent));
boxcontent[0] = element_id;
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("Write element_id box_reg(%4x) = %2x\n",
- box_reg, element_id));
+ RT_TRACE(COMP_CMD, DBG_LOUD,
+ "Write element_id box_reg(%4x) = %2x\n",
+ box_reg, element_id);
switch (cmd_len) {
case 1:
@@ -444,7 +439,7 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ "switch case not processed\n");
break;
}
@@ -454,16 +449,15 @@ static void _rtl92ee_fill_h2c_command(struct ieee80211_hw *hw, u8 element_id,
if (rtlhal->last_hmeboxnum == 4)
rtlhal->last_hmeboxnum = 0;
- RT_TRACE(COMP_CMD, DBG_LOUD ,
- ("pHalData->last_hmeboxnum = %d\n",
- rtlhal->last_hmeboxnum));
+ RT_TRACE(COMP_CMD, DBG_LOUD, "pHalData->last_hmeboxnum = %d\n",
+ rtlhal->last_hmeboxnum);
}
spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag);
rtlhal->b_h2c_setinprogress = false;
spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag);
- RT_TRACE(COMP_CMD, DBG_LOUD , ("go out\n"));
+ RT_TRACE(COMP_CMD, DBG_LOUD, "go out\n");
}
void rtl92ee_fill_h2c_cmd(struct ieee80211_hw *hw,
@@ -504,8 +498,8 @@ void rtl92ee_firmware_selfreset(struct ieee80211_hw *hw)
u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN + 1);
rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN + 1, (u1b_tmp | BIT(2)));
- RT_TRACE(COMP_INIT, DBG_LOUD ,
- (" _8051Reset92E(): 8051 reset success .\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD,
+ " _8051Reset92E(): 8051 reset success\n");
}
void rtl92ee_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
@@ -514,7 +508,7 @@ void rtl92ee_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
u8 u1_h2c_set_pwrmode[H2C_92E_PWEMODE_LENGTH] = { 0 };
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
u8 rlbm , power_state = 0;
- RT_TRACE(COMP_POWER, DBG_LOUD , ("FW LPS mode = %d\n", mode));
+ RT_TRACE(COMP_POWER, DBG_LOUD, "FW LPS mode = %d\n", mode);
SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0));
rlbm = 0;/*YJ, temp, 120316. FW now not support RLBM = 2.*/
@@ -776,15 +770,15 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
b_dlok = true;
if (b_dlok) {
- RT_TRACE(COMP_POWER, DBG_LOUD ,
- ("Set RSVD page location to Fw.\n"));
+ RT_TRACE(COMP_POWER, DBG_LOUD,
+ "Set RSVD page location to Fw\n");
RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD ,
"H2C_RSVDPAGE:\n", u1RsvdPageLoc, 3);
rtl92ee_fill_h2c_cmd(hw, H2C_92E_RSVDPAGE,
sizeof(u1RsvdPageLoc), u1RsvdPageLoc);
} else
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("Set RSVD page location to Fw FAIL!!!!!!.\n"));
+ "Set RSVD page location to Fw FAIL!!!!!!\n");
}
/*Shoud check FW support p2p or not.*/
@@ -809,11 +803,11 @@ void rtl92ee_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
switch (p2p_ps_state) {
case P2P_PS_DISABLE:
- RT_TRACE(COMP_FW, DBG_LOUD , ("P2P_PS_DISABLE\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "P2P_PS_DISABLE\n");
memset(p2p_ps_offload, 0, 1);
break;
case P2P_PS_ENABLE:
- RT_TRACE(COMP_FW, DBG_LOUD , ("P2P_PS_ENABLE\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "P2P_PS_ENABLE\n");
/* update CTWindow value. */
if (p2pinfo->ctwindow > 0) {
p2p_ps_offload->CTWindow_En = 1;
@@ -864,11 +858,11 @@ void rtl92ee_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
}
break;
case P2P_PS_SCAN:
- RT_TRACE(COMP_FW, DBG_LOUD , ("P2P_PS_SCAN\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "P2P_PS_SCAN\n");
p2p_ps_offload->discovery = 1;
break;
case P2P_PS_SCAN_DONE:
- RT_TRACE(COMP_FW, DBG_LOUD , ("P2P_PS_SCAN_DONE\n"));
+ RT_TRACE(COMP_FW, DBG_LOUD, "P2P_PS_SCAN_DONE\n");
p2p_ps_offload->discovery = 0;
p2pinfo->p2p_ps_state = P2P_PS_ENABLE;
break;
@@ -897,28 +891,28 @@ static void _rtl92ee_c2h_content_parsing(struct ieee80211_hw *hw, u8 c2h_cmd_id,
switch (c2h_cmd_id) {
case C2H_8192E_DBG:
- RT_TRACE(COMP_FW, DBG_TRACE , ("[C2H], C2H_8723BE_DBG!!\n"));
+ RT_TRACE(COMP_FW, DBG_TRACE, "[C2H], C2H_8723BE_DBG!!\n");
break;
case C2H_8192E_TXBF:
- RT_TRACE(COMP_FW, DBG_TRACE , ("[C2H], C2H_8192E_TXBF!!\n"));
+ RT_TRACE(COMP_FW, DBG_TRACE, "[C2H], C2H_8192E_TXBF!!\n");
break;
case C2H_8192E_TX_REPORT:
- RT_TRACE(COMP_FW, DBG_TRACE , ("[C2H], C2H_8723BE_TX_REPORT!\n"));
+ RT_TRACE(COMP_FW, DBG_TRACE, "[C2H], C2H_8723BE_TX_REPORT!\n");
break;
case C2H_8192E_BT_INFO:
- RT_TRACE(COMP_FW, DBG_TRACE , ("[C2H], C2H_8723BE_BT_INFO!!\n"));
+ RT_TRACE(COMP_FW, DBG_TRACE, "[C2H], C2H_8723BE_BT_INFO!!\n");
rtlpriv->btcoexist.btc_ops->btc_btinfo_notify(rtlpriv, tmp_buf,
c2h_cmd_len);
break;
case C2H_8192E_BT_MP:
- RT_TRACE(COMP_FW, DBG_TRACE, ("[C2H], C2H_8723BE_BT_MP!!\n"));
+ RT_TRACE(COMP_FW, DBG_TRACE, "[C2H], C2H_8723BE_BT_MP!!\n");
break;
case C2H_8192E_RA_RPT:
_rtl92ee_c2h_ra_report_handler(hw, tmp_buf, c2h_cmd_len);
break;
default:
RT_TRACE(COMP_FW, DBG_TRACE,
- ("[C2H], Unkown packet!! CmdId(%#X)!\n", c2h_cmd_id));
+ "[C2H], Unkown packet!! CmdId(%#X)!\n", c2h_cmd_id);
break;
}
}
@@ -935,8 +929,8 @@ void rtl92ee_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer, u8 len)
tmp_buf = buffer + 2;
RT_TRACE(COMP_FW, DBG_TRACE,
- ("[C2H packet], c2hCmdId = 0x%x, c2hCmdSeq = 0x%x, c2hCmdLen =%d\n",
- c2h_cmd_id, c2h_cmd_seq, c2h_cmd_len));
+ "[C2H packet], c2hCmdId = 0x%x, c2hCmdSeq = 0x%x, c2hCmdLen =%d\n",
+ c2h_cmd_id, c2h_cmd_seq, c2h_cmd_len);
RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_TRACE,
"[C2H packet], Content Hex:\n", tmp_buf, c2h_cmd_len);
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/hw.c b/drivers/staging/rtl8192ee/rtl8192ee/hw.c
index 26af119e2ca4..780f6179c0d6 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/hw.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/hw.c
@@ -161,8 +161,8 @@ static void _rtl92ee_set_fw_clock_on(struct ieee80211_hw *hw,
rtl_write_word(rtlpriv , isr_regaddr, 0x0100);
rtlhal->fw_ps_state = FW_PS_STATE_RF_ON_92E;
RT_TRACE(COMP_POWER, DBG_LOUD,
- ("Receive CPWM INT!!! PSState = %X\n",
- rtlhal->fw_ps_state));
+ "Receive CPWM INT!!! PSState = %X\n",
+ rtlhal->fw_ps_state);
}
}
@@ -357,8 +357,8 @@ void rtl92ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
break; }
default:
- RT_TRACE(COMP_ERR, DBG_LOUD,
- ("switch case not process %x\n", variable));
+ RT_TRACE(COMP_ERR, DBG_LOUD, "switch case not processed %x\n",
+ variable);
break;
}
}
@@ -430,7 +430,7 @@ static void _rtl92ee_download_rsvd_page(struct ieee80211_hw *hw)
} while (!(bcnvalid_reg & BIT(0)) && dlbcn_count < 5);
if (!(bcnvalid_reg & BIT(0)))
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Download RSVD page failed!\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Download RSVD page failed!\n");
/* Enable Bcn */
_rtl92ee_set_bcn_ctrl_reg(hw, BIT(3), 0);
@@ -488,8 +488,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
case HW_VAR_SLOT_TIME:{
u8 e_aci;
- RT_TRACE(COMP_MLME, DBG_TRACE,
- ("HW_VAR_SLOT_TIME %x\n", val[0]));
+ RT_TRACE(COMP_MLME, DBG_TRACE, "HW_VAR_SLOT_TIME %x\n", val[0]);
rtl_write_byte(rtlpriv, REG_SLOT, val[0]);
@@ -533,7 +532,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
reg[i]);
}
RT_TRACE(COMP_MLME, DBG_LOUD,
- ("Set HW_VAR_AMPDU_FACTOR:%#x\n", fac));
+ "Set HW_VAR_AMPDU_FACTOR:%#x\n", fac);
}
break; }
case HW_VAR_AC_PARAM:{
@@ -565,8 +564,8 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
break;
default:
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("HW_VAR_ACM_CTRL acm set "
- "failed: eACI is %d\n", acm));
+ "HW_VAR_ACM_CTRL acm set failed: eACI is %d\n",
+ acm);
break;
}
} else {
@@ -582,14 +581,14 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
break;
default:
RT_TRACE(COMP_ERR, DBG_LOUD,
- ("switch case not process \n"));
+ "switch case not processed\n");
break;
}
}
RT_TRACE(COMP_QOS, DBG_TRACE,
- ("SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
- acm_ctrl));
+ "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n",
+ acm_ctrl);
rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl);
break; }
case HW_VAR_RCR:{
@@ -689,8 +688,8 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
rtl92ee_fill_h2c_cmd(hw, H2C_92E_KEEP_ALIVE_CTRL, 2, array);
break; }
default:
- RT_TRACE(COMP_ERR, DBG_LOUD,
- ("switch case not process %x\n", variable));
+ RT_TRACE(COMP_ERR, DBG_LOUD, "switch case not processed %x\n",
+ variable);
break;
}
}
@@ -795,7 +794,7 @@ static bool _rtl92ee_init_mac(struct ieee80211_hw *hw)
if (!rtl92e_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
PWR_INTF_PCI_MSK, Rtl8192E_NIC_ENABLE_FLOW)) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("init MAC Fail as rtl92e_hal_pwrseqcmdparsing\n"));
+ "init MAC Fail as rtl92e_hal_pwrseqcmdparsing\n");
return false;
}
@@ -818,8 +817,7 @@ static bool _rtl92ee_init_mac(struct ieee80211_hw *hw)
if (!rtlhal->b_mac_func_enable) {
if (_rtl92ee_llt_table_init(hw) == false) {
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("LLT table init fail \n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "LLT table init fail\n");
return false;
}
}
@@ -1112,12 +1110,12 @@ void rtl92ee_enable_hw_security_config(struct ieee80211_hw *hw)
u8 tmp;
RT_TRACE(COMP_INIT, DBG_DMESG,
- ("PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
- rtlpriv->sec.pairwise_enc_algorithm,
- rtlpriv->sec.group_enc_algorithm));
+ "PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n",
+ rtlpriv->sec.pairwise_enc_algorithm,
+ rtlpriv->sec.group_enc_algorithm);
if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
- RT_TRACE(COMP_SEC, DBG_DMESG, ("not open hw encryption\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "not open hw encryption\n");
return;
}
@@ -1133,8 +1131,7 @@ void rtl92ee_enable_hw_security_config(struct ieee80211_hw *hw)
tmp = rtl_read_byte(rtlpriv, REG_CR + 1);
rtl_write_byte(rtlpriv, REG_CR + 1, tmp | BIT(1));
- RT_TRACE(COMP_SEC, DBG_DMESG,
- ("The SECR-value %x \n", sec_reg_value));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "The SECR-value %x\n", sec_reg_value);
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value);
@@ -1152,7 +1149,7 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
u8 tmp_u1b , u1byte;
u32 tmp_u4b;
- RT_TRACE(COMP_INIT , DBG_LOUD , (" Rtl8192EE hw init\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, " Rtl8192EE hw init\n");
rtlpriv->rtlhal.being_init_adapter = true;
rtlpriv->intf_ops->disable_aspm(hw);
@@ -1180,7 +1177,7 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
rtl_write_byte(rtlpriv, 0x65, 1);
}
if (rtstatus != true) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("Init MAC failed\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Init MAC failed\n");
err = 1;
return err;
}
@@ -1189,7 +1186,7 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
err = rtl92ee_download_fw(hw , false);
if (err) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("Failed to download FW. Init HW without FW now..\n"));
+ "Failed to download FW. Init HW without FW now..\n");
err = 1;
rtlhal->bfw_ready = false;
return err;
@@ -1267,12 +1264,12 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
stg_efuse_one_byte_read(hw, 0x1FA, &tmp_u1b);
if (!(tmp_u1b & BIT(0))) {
rtl_set_rfreg(hw, RF90_PATH_A, 0x15, 0x0F, 0x05);
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path A\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "PA BIAS path A\n");
}
if ((!(tmp_u1b & BIT(1))) && (rtlphy->rf_type == RF_2T2R)) {
rtl_set_rfreg(hw, RF90_PATH_B, 0x15, 0x0F, 0x05);
- RT_TRACE(COMP_INIT, DBG_LOUD, ("PA BIAS path B\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "PA BIAS path B\n");
}
rtl_write_byte(rtlpriv, REG_NAV_UPPER, ((30000 + 127) / 128));
@@ -1287,7 +1284,7 @@ int rtl92ee_hw_init(struct ieee80211_hw *hw)
rtl_write_dword(rtlpriv, 0x4fc, 0);
- RT_TRACE(COMP_INIT , DBG_LOUD , ("end of Rtl8192EE hw init %x\n" , err));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "end of Rtl8192EE hw init %x\n", err);
return 0;
}
@@ -1306,9 +1303,8 @@ static enum version_8192e _rtl92ee_read_chip_version(struct ieee80211_hw *hw)
else
version = (enum version_8192e) VERSION_NORMAL_CHIP_2T2R_8192E;
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Chip RF Type: %s\n", (rtlphy->rf_type == RF_2T2R) ?
- "RF_2T2R" : "RF_1T1R"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Chip RF Type: %s\n",
+ rtlphy->rf_type == RF_2T2R ? "RF_2T2R" : "RF_1T1R");
return version;
}
@@ -1326,29 +1322,26 @@ static int _rtl92ee_set_media_status(struct ieee80211_hw *hw,
case NL80211_IFTYPE_UNSPECIFIED:
mode = MSR_NOLINK;
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Set Network type to NO LINK!\n"));
+ "Set Network type to NO LINK!\n");
break;
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_MESH_POINT:
mode = MSR_ADHOC;
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Set Network type to Ad Hoc!\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Set Network type to Ad Hoc!\n");
break;
case NL80211_IFTYPE_STATION:
mode = MSR_INFRA;
ledaction = LED_CTL_LINK;
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Set Network type to STA!\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Set Network type to STA!\n");
break;
case NL80211_IFTYPE_AP:
mode = MSR_AP;
ledaction = LED_CTL_LINK;
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Set Network type to AP!\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Set Network type to AP!\n");
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Network type %d not support!\n", type));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Network type %d not support!\n",
+ type);
return 1;
break;
}
@@ -1372,8 +1365,8 @@ static int _rtl92ee_set_media_status(struct ieee80211_hw *hw,
_rtl92ee_disable_bcn_sub_func(hw);
} else {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("Set HW_VAR_MEDIA_STATUS: "
- "No such media status(%x).\n", mode));
+ "Set HW_VAR_MEDIA_STATUS: No such media status(%x)\n",
+ mode);
}
rtl_write_byte(rtlpriv, (MSR), bt_msr | mode);
@@ -1494,7 +1487,7 @@ static void _rtl92ee_poweroff_adapter(struct ieee80211_hw *hw)
u8 u1b_tmp;
rtlhal->b_mac_func_enable = false;
- RT_TRACE(COMP_INIT , DBG_LOUD , ("POWER OFF adapter \n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "POWER OFF adapter\n");
/* Run LPS WL RFOFF flow */
rtl92e_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
@@ -1534,7 +1527,7 @@ void rtl92ee_card_disable(struct ieee80211_hw *hw)
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
enum nl80211_iftype opmode;
- RT_TRACE(COMP_INIT , DBG_LOUD , ("RTL8192ee card disable\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "RTL8192ee card disable\n");
RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
@@ -1593,8 +1586,7 @@ void rtl92ee_set_beacon_interval(struct ieee80211_hw *hw)
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
u16 bcn_interval = mac->beacon_interval;
- RT_TRACE(COMP_BEACON, DBG_DMESG,
- ("beacon_interval:%d\n", bcn_interval));
+ RT_TRACE(COMP_BEACON, DBG_DMESG, "beacon_interval:%d\n", bcn_interval);
rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval);
}
@@ -1604,8 +1596,8 @@ void rtl92ee_update_interrupt_mask(struct ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
- RT_TRACE(COMP_INTR, DBG_LOUD,
- ("add_msr:%x, rm_msr:%x\n", add_msr, rm_msr));
+ RT_TRACE(COMP_INTR, DBG_LOUD, "add_msr:%x, rm_msr:%x\n",
+ add_msr, rm_msr);
if (add_msr)
rtlpci->irq_mask[0] |= add_msr;
@@ -1672,14 +1664,14 @@ static void _rtl8192ee_read_power_value_fromprom(struct ieee80211_hw *hw,
u32 rf, addr = EEPROM_TX_PWR_INX, group, i = 0;
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("hal_ReadPowerValueFromPROM92E(): PROMContent[0x%x]= 0x%x\n",
- (addr + 1), hwinfo[addr + 1]));
+ "hal_ReadPowerValueFromPROM92E(): PROMContent[0x%x]= 0x%x\n",
+ (addr + 1), hwinfo[addr + 1]);
if (0xFF == hwinfo[addr+1]) /*YJ, add, 120316*/
autoload_fail = true;
if (autoload_fail) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("auto load fail : Use Default value!\n"));
+ "auto load fail : Use Default value!\n");
for (rf = 0 ; rf < MAX_RF_PATH ; rf++) {
/* 2.4G default value */
for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) {
@@ -1999,11 +1991,11 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw)
HWSET_MAX_SIZE);
} else if (rtlefuse->epromtype == EEPROM_93C46) {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("RTL819X Not boot from eeprom, check it !!"));
+ "RTL819X Not boot from eeprom, check it !!\n");
return;
} else {
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("boot from neither eeprom nor efuse, check it !!"));
+ "boot from neither eeprom nor efuse, check it !!\n");
return;
}
@@ -2012,11 +2004,11 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw)
eeprom_id = *((u16 *) &hwinfo[0]);
if (eeprom_id != RTL8192E_EEPROM_ID) {
- RT_TRACE(COMP_ERR, DBG_WARNING,
- ("EEPROM ID(%#x) is invalid!!\n", eeprom_id));
+ RT_TRACE(COMP_ERR, DBG_WARNING, "EEPROM ID(%#x) is invalid!!\n",
+ eeprom_id);
rtlefuse->autoload_failflag = true;
} else {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Autoload OK\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Autoload OK\n");
rtlefuse->autoload_failflag = false;
}
@@ -2027,22 +2019,22 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw)
rtlefuse->eeprom_did = *(u16 *) &hwinfo[EEPROM_DID];
rtlefuse->eeprom_svid = *(u16 *) &hwinfo[EEPROM_SVID];
rtlefuse->eeprom_smid = *(u16 *) &hwinfo[EEPROM_SMID];
- RT_TRACE(COMP_INIT, DBG_LOUD, ("EEPROMId = 0x%4x\n", eeprom_id));
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid));
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did));
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid));
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROMId = 0x%4x\n", eeprom_id);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROM VID = 0x%4x\n",
+ rtlefuse->eeprom_vid);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROM DID = 0x%4x\n",
+ rtlefuse->eeprom_did);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROM SVID = 0x%4x\n",
+ rtlefuse->eeprom_svid);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROM SMID = 0x%4x\n",
+ rtlefuse->eeprom_smid);
/*customer ID*/
rtlefuse->eeprom_oemid = *(u8 *) &hwinfo[EEPROM_CUSTOMER_ID];
if (rtlefuse->eeprom_oemid == 0xFF)
rtlefuse->eeprom_oemid = 0;
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "EEPROM Customer ID: 0x%2x\n",
+ rtlefuse->eeprom_oemid);
/*EEPROM version*/
rtlefuse->eeprom_version = *(u8 *) &hwinfo[EEPROM_VERSION];
/*mac address*/
@@ -2051,8 +2043,7 @@ static void _rtl92ee_read_adapter_info(struct ieee80211_hw *hw)
*((u16 *) (&rtlefuse->dev_addr[i])) = usvalue;
}
- RT_TRACE(COMP_INIT, DBG_DMESG,
- ("dev_addr: %pM\n", rtlefuse->dev_addr));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "dev_addr: %pM\n", rtlefuse->dev_addr);
/*channel plan */
rtlefuse->eeprom_channelplan = *(u8 *) &hwinfo[EEPROM_CHANNELPLAN];
/* set channel paln to world wide 13 */
@@ -2106,8 +2097,8 @@ static void _rtl92ee_hal_customized_behavior(struct ieee80211_hw *hw)
pcipriv->ledctl.bled_opendrain = true;
- RT_TRACE(COMP_INIT, DBG_DMESG,
- ("RT Customized ID: 0x%02X\n", rtlhal->oem_id));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "RT Customized ID: 0x%02X\n",
+ rtlhal->oem_id);
}
void rtl92ee_read_eeprom_info(struct ieee80211_hw *hw)
@@ -2124,22 +2115,22 @@ void rtl92ee_read_eeprom_info(struct ieee80211_hw *hw)
else
rtlpriv->dm.brfpath_rxenable[0] =
rtlpriv->dm.brfpath_rxenable[1] = true;
- RT_TRACE(COMP_INIT, DBG_LOUD, ("VersionID = 0x%4x\n",
- rtlhal->version));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "VersionID = 0x%4x\n",
+ rtlhal->version);
tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR);
if (tmp_u1b & BIT(4)) {
- RT_TRACE(COMP_INIT, DBG_DMESG, ("Boot from EEPROM\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "Boot from EEPROM\n");
rtlefuse->epromtype = EEPROM_93C46;
} else {
- RT_TRACE(COMP_INIT, DBG_DMESG, ("Boot from EFUSE\n"));
+ RT_TRACE(COMP_INIT, DBG_DMESG, "Boot from EFUSE\n");
rtlefuse->epromtype = EEPROM_BOOT_EFUSE;
}
if (tmp_u1b & BIT(5)) {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Autoload OK\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Autoload OK\n");
rtlefuse->autoload_failflag = false;
_rtl92ee_read_adapter_info(hw);
} else {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("Autoload ERR!!\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Autoload ERR!!\n");
}
_rtl92ee_hal_customized_behavior(hw);
@@ -2295,8 +2286,7 @@ static void rtl92ee_update_hal_rate_mask(struct ieee80211_hw *hw,
ratr_index = _rtl92ee_mrate_idx_to_arfr_id(hw, ratr_index);
sta_entry->ratr_index = ratr_index;
- RT_TRACE(COMP_RATR, DBG_DMESG,
- ("ratr_bitmap :%x\n", ratr_bitmap));
+ RT_TRACE(COMP_RATR, DBG_DMESG, "ratr_bitmap:%x\n", ratr_bitmap);
*(u32 *) &rate_mask = (ratr_bitmap & 0x0fffffff) |
(ratr_index << 28);
rate_mask[0] = macid;
@@ -2307,10 +2297,10 @@ static void rtl92ee_update_hal_rate_mask(struct ieee80211_hw *hw,
rate_mask[5] = (u8)((ratr_bitmap & 0x00ff0000) >> 16);
rate_mask[6] = (u8)((ratr_bitmap & 0xff000000) >> 24);
RT_TRACE(COMP_RATR, DBG_DMESG,
- ("Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x:%x:%x\n",
- ratr_index, ratr_bitmap, rate_mask[0], rate_mask[1],
- rate_mask[2], rate_mask[3], rate_mask[4],
- rate_mask[5], rate_mask[6]));
+ "Rate_index:%x, ratr_val:%x, %x:%x:%x:%x:%x:%x:%x\n",
+ ratr_index, ratr_bitmap, rate_mask[0], rate_mask[1],
+ rate_mask[2], rate_mask[3], rate_mask[4],
+ rate_mask[5], rate_mask[6]);
rtl92ee_fill_h2c_cmd(hw, H2C_92E_RA_MASK, 7, rate_mask);
_rtl92ee_set_bcn_ctrl_reg(hw, BIT(3), 0);
}
@@ -2372,7 +2362,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
u8 cam_offset = 0;
u8 clear_number = 5;
- RT_TRACE(COMP_SEC, DBG_DMESG, ("clear_all\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "clear_all\n");
for (idx = 0; idx < clear_number; idx++) {
stg_rtl_cam_mark_invalid(hw, cam_offset + idx);
@@ -2401,7 +2391,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
break;
default:
RT_TRACE(COMP_ERR, DBG_LOUD,
- ("switch case not process \n"));
+ "switch case not processed\n");
enc_algo = CAM_TKIP;
break;
}
@@ -2420,7 +2410,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
p_macaddr);
if (entry_id >= TOTAL_CAM_ENTRY) {
RT_TRACE(COMP_SEC, DBG_EMERG,
- ("Can not find free hw security cam entry\n"));
+ "Can not find free hw security cam entry\n");
return;
}
} else {
@@ -2434,17 +2424,17 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
if (rtlpriv->sec.key_len[key_index] == 0) {
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("delete one entry, entry_id is %d\n",
- entry_id));
+ "delete one entry, entry_id is %d\n",
+ entry_id);
if (mac->opmode == NL80211_IFTYPE_AP ||
mac->opmode == NL80211_IFTYPE_MESH_POINT)
stg_rtl_cam_del_entry(hw, p_macaddr);
stg_rtl_cam_delete_one_entry(hw, p_macaddr, entry_id);
} else {
- RT_TRACE(COMP_SEC, DBG_DMESG, ("add one entry\n"));
+ RT_TRACE(COMP_SEC, DBG_DMESG, "add one entry\n");
if (is_pairwise) {
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set Pairwiase key\n"));
+ "set Pairwise key\n");
stg_rtl_cam_add_one_entry(hw, macaddr, key_index,
entry_id, enc_algo,
@@ -2452,7 +2442,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index,
rtlpriv->sec.key_buf[key_index]);
} else {
RT_TRACE(COMP_SEC, DBG_DMESG,
- ("set group key\n"));
+ "set group key\n");
if (mac->opmode == NL80211_IFTYPE_ADHOC) {
stg_rtl_cam_add_one_entry(hw,
@@ -2539,6 +2529,6 @@ void rtl92ee_allow_all_destaddr(struct ieee80211_hw *hw,
rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config);
RT_TRACE(COMP_TURBO | COMP_INIT, DBG_LOUD,
- ("receive_config = 0x%08X, write_into_reg =%d\n",
- rtlpci->receive_config, write_into_reg));
+ "receive_config = 0x%08X, write_into_reg =%d\n",
+ rtlpci->receive_config, write_into_reg);
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/led.c b/drivers/staging/rtl8192ee/rtl8192ee/led.c
index 3b459c93a843..aa471bb2de73 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/led.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/led.c
@@ -41,8 +41,8 @@ void rtl92ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
u32 ledcfg;
struct rtl_priv *rtlpriv = rtl_priv(hw);
- RT_TRACE(COMP_LED, DBG_LOUD,
- ("LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin));
+ RT_TRACE(COMP_LED, DBG_LOUD, "LedAddr:%X ledpin =%d\n",
+ REG_LEDCFG2, pled->ledpin);
switch (pled->ledpin) {
case LED_PIN_GPIO0:
@@ -55,8 +55,7 @@ void rtl92ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
case LED_PIN_LED1:
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not processed\n");
break;
}
pled->b_ledon = true;
@@ -67,8 +66,8 @@ void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 ledcfg;
- RT_TRACE(COMP_LED, DBG_LOUD,
- ("LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin));
+ RT_TRACE(COMP_LED, DBG_LOUD, "LedAddr:%X ledpin =%d\n",
+ REG_LEDCFG2, pled->ledpin);
switch (pled->ledpin) {
case LED_PIN_GPIO0:
@@ -81,8 +80,7 @@ void rtl92ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
case LED_PIN_LED1:
break;
default:
- RT_TRACE(COMP_ERR, DBG_LOUD,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_LOUD, "switch case not processed\n");
break;
}
pled->b_ledon = false;
@@ -129,6 +127,6 @@ void rtl92ee_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction)
ledaction == LED_CTL_POWER_ON)) {
return;
}
- RT_TRACE(COMP_LED, DBG_TRACE, ("ledaction %d,\n", ledaction));
+ RT_TRACE(COMP_LED, DBG_TRACE, "ledaction %d\n", ledaction);
_rtl92ee_sw_led_control(hw, ledaction);
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/phy.c b/drivers/staging/rtl8192ee/rtl8192ee/phy.c
index beef284615e5..1c5c0e8ffd29 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/phy.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/phy.c
@@ -65,15 +65,14 @@ u32 rtl92ee_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask)
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 returnvalue, originalvalue, bitshift;
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), bitmask(%#x)\n", regaddr, bitmask));
+ RT_TRACE(COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x)\n",
+ regaddr, bitmask);
originalvalue = rtl_read_dword(rtlpriv, regaddr);
bitshift = _rtl92ee_phy_calculate_bit_shift(bitmask);
returnvalue = (originalvalue & bitmask) >> bitshift;
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("BBR MASK = 0x%x Addr[0x%x]= 0x%x\n",
- bitmask, regaddr, originalvalue));
+ RT_TRACE(COMP_RF, DBG_TRACE, "BBR MASK = 0x%x Addr[0x%x]= 0x%x\n",
+ bitmask, regaddr, originalvalue);
return returnvalue;
}
@@ -84,9 +83,8 @@ void rtl92ee_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
struct rtl_priv *rtlpriv = rtl_priv(hw);
u32 originalvalue, bitshift;
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), bitmask(%#x), data(%#x)\n",
- regaddr, bitmask, data));
+ RT_TRACE(COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x), data(%#x)\n",
+ regaddr, bitmask, data);
if (bitmask != MASKDWORD) {
originalvalue = rtl_read_dword(rtlpriv, regaddr);
@@ -96,9 +94,8 @@ void rtl92ee_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr,
rtl_write_dword(rtlpriv, regaddr, data);
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), bitmask(%#x), data(%#x)\n",
- regaddr, bitmask, data));
+ RT_TRACE(COMP_RF, DBG_TRACE, "regaddr(%#x), bitmask(%#x), data(%#x)\n",
+ regaddr, bitmask, data);
}
u32 rtl92ee_phy_query_rf_reg(struct ieee80211_hw *hw,
@@ -109,8 +106,8 @@ u32 rtl92ee_phy_query_rf_reg(struct ieee80211_hw *hw,
unsigned long flags;
RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
- regaddr, rfpath, bitmask));
+ "regaddr(%#x), rfpath(%#x), bitmask(%#x)\n",
+ regaddr, rfpath, bitmask);
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
@@ -122,8 +119,8 @@ u32 rtl92ee_phy_query_rf_reg(struct ieee80211_hw *hw,
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
- regaddr, rfpath, bitmask, original_value));
+ "regaddr(%#x), rfpath(%#x), bitmask(%#x), original_value(%#x)\n",
+ regaddr, rfpath, bitmask, original_value);
return readback_value;
}
@@ -137,8 +134,8 @@ void rtl92ee_phy_set_rf_reg(struct ieee80211_hw *hw,
unsigned long flags;
RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
- addr, bitmask, data, rfpath));
+ "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
+ addr, bitmask, data, rfpath);
spin_lock_irqsave(&rtlpriv->locks.rf_lock, flags);
@@ -153,8 +150,8 @@ void rtl92ee_phy_set_rf_reg(struct ieee80211_hw *hw,
spin_unlock_irqrestore(&rtlpriv->locks.rf_lock, flags);
RT_TRACE(COMP_RF, DBG_TRACE,
- ("regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
- addr, bitmask, data, rfpath));
+ "regaddr(%#x), bitmask(%#x), data(%#x), rfpath(%#x)\n",
+ addr, bitmask, data, rfpath);
}
static u32 _rtl92ee_phy_rf_serial_read(struct ieee80211_hw *hw,
@@ -171,7 +168,7 @@ static u32 _rtl92ee_phy_rf_serial_read(struct ieee80211_hw *hw,
offset &= 0xff;
newoffset = offset;
if (RT_CANNOT_IO(hw)) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("return all one\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "return all one\n");
return 0xFFFFFFFF;
}
tmplong = rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, MASKDWORD);
@@ -199,9 +196,8 @@ static u32 _rtl92ee_phy_rf_serial_read(struct ieee80211_hw *hw,
else
retvalue = rtl_get_bbreg(hw, pphyreg->rflssi_readback,
BLSSIREADBACKDATA);
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("RFR-%d Addr[0x%x]= 0x%x\n",
- rfpath, pphyreg->rflssi_readback, retvalue));
+ RT_TRACE(COMP_RF, DBG_TRACE, "RFR-%d Addr[0x%x]= 0x%x\n",
+ rfpath, pphyreg->rflssi_readback, retvalue);
return retvalue;
}
@@ -216,16 +212,15 @@ static void _rtl92ee_phy_rf_serial_write(struct ieee80211_hw *hw,
struct bb_reg_def *pphyreg = &rtlphy->phyreg_def[rfpath];
if (RT_CANNOT_IO(hw)) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("stop\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "stop\n");
return;
}
offset &= 0xff;
newoffset = offset;
data_and_addr = ((newoffset << 20) | (data & 0x000fffff)) & 0x0fffffff;
rtl_set_bbreg(hw, pphyreg->rf3wire_offset, MASKDWORD, data_and_addr);
- RT_TRACE(COMP_RF, DBG_TRACE,
- ("RFW-%d Addr[0x%x]= 0x%x\n", rfpath,
- pphyreg->rf3wire_offset, data_and_addr));
+ RT_TRACE(COMP_RF, DBG_TRACE, "RFW-%d Addr[0x%x]= 0x%x\n",
+ rfpath, pphyreg->rf3wire_offset, data_and_addr);
}
static u32 _rtl92ee_phy_calculate_bit_shift(u32 bitmask)
@@ -423,7 +418,7 @@ static void _rtl92ee_phy_set_txpower_by_rate_base(struct ieee80211_hw *hw,
struct rtl_phy *rtlphy = &(rtlpriv->phy);
if (path > RF90_PATH_D) {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Invalid Rf Path %d\n", path));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Invalid Rf Path %d\n", path);
return;
}
if (band == BAND_ON_2_4G) {
@@ -442,12 +437,12 @@ static void _rtl92ee_phy_set_txpower_by_rate_base(struct ieee80211_hw *hw,
break;
default:
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Invalid RateSection %d in 2.4G, Rf %d,%dTx\n",
- rate_section, path, txnum));
+ "Invalid RateSection %d in 2.4G, Rf %d,%dTx\n",
+ rate_section, path, txnum);
break;
};
} else {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Invalid Band %d\n", band));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Invalid Band %d\n", band);
}
}
@@ -458,7 +453,7 @@ static u8 _rtl92ee_phy_get_txpower_by_rate_base(struct ieee80211_hw *hw, u8 band
struct rtl_phy *rtlphy = &(rtlpriv->phy);
u8 value = 0;
if (path > RF90_PATH_D) {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Invalid Rf Path %d\n", path));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Invalid Rf Path %d\n", path);
return 0;
}
if (band == BAND_ON_2_4G) {
@@ -477,12 +472,12 @@ static u8 _rtl92ee_phy_get_txpower_by_rate_base(struct ieee80211_hw *hw, u8 band
break;
default:
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Invalid RateSection %d in 2.4G, Rf %d,%dTx\n",
- rate_section, path, txnum));
+ "Invalid RateSection %d in 2.4G, Rf %d,%dTx\n",
+ rate_section, path, txnum);
break;
};
} else {
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Invalid Band %d()\n", band));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Invalid Band %d()\n", band);
}
return value;
}
@@ -608,7 +603,7 @@ static void _rtl92ee_phy_convert_txpower_dbm_to_relative_value(struct ieee80211_
0, 3, base);
}
RT_TRACE(COMP_POWER, DBG_TRACE,
- ("<== _rtl92ee_phy_convert_txpower_dbm_to_relative_value()\n"));
+ "<== _rtl92ee_phy_convert_txpower_dbm_to_relative_value()\n");
}
static void _rtl92ee_phy_txpower_by_rate_configuration(struct ieee80211_hw *hw)
@@ -627,7 +622,7 @@ static bool _rtl92ee_phy_bb8192ee_config_parafile(struct ieee80211_hw *hw)
rtstatus = _rtl92ee_phy_config_bb_with_headerfile(hw,
BASEBAND_CONFIG_PHY_REG);
if (!rtstatus) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("Write BB Reg Fail!!"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Write BB Reg Fail!!\n");
return false;
}
@@ -639,13 +634,13 @@ static bool _rtl92ee_phy_bb8192ee_config_parafile(struct ieee80211_hw *hw)
}
_rtl92ee_phy_txpower_by_rate_configuration(hw);
if (!rtstatus) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("BB_PG Reg Fail!!"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "BB_PG Reg Fail!!\n");
return false;
}
rtstatus = _rtl92ee_phy_config_bb_with_headerfile(hw,
BASEBAND_CONFIG_AGC_TAB);
if (!rtstatus) {
- RT_TRACE(COMP_ERR, DBG_EMERG, ("AGC Table Fail\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "AGC Table Fail\n");
return false;
}
rtlphy->bcck_high_power = (bool) (rtl_get_bbreg(hw,
@@ -662,11 +657,11 @@ static bool _rtl92ee_phy_config_mac_with_headerfile(struct ieee80211_hw *hw)
u32 arraylength;
u32 *ptrarray;
- RT_TRACE(COMP_INIT, DBG_TRACE, ("Read Rtl8192EMACPHY_Array\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Read Rtl8192EMACPHY_Array\n");
arraylength = RTL8192EE_MAC_ARRAY_LEN;
ptrarray = RTL8192EE_MAC_ARRAY;
- RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Img:RTL8192EE_MAC_ARRAY LEN %d\n" , arraylength));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Img:RTL8192EE_MAC_ARRAY LEN %d\n",
+ arraylength);
for (i = 0; i < arraylength; i = i + 2)
rtl_write_byte(rtlpriv, ptrarray[i], (u8) ptrarray[i + 1]);
return true;
@@ -773,9 +768,9 @@ static bool _rtl92ee_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
}
}
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("The agctab_array_table[0] is %x Rtl818EEPHY_REGArray[1] is %x\n",
+ "The agctab_array_table[0] is %x Rtl818EEPHY_REGArray[1] is %x\n",
array[i],
- array[i + 1]));
+ array[i + 1]);
}
}
return true;
@@ -853,16 +848,16 @@ static void _rtl92ee_store_tx_power_by_rate(struct ieee80211_hw *hw,
u8 section = _rtl92ee_get_rate_section_index(regaddr);
if (band != BAND_ON_2_4G && band != BAND_ON_5G) {
- RT_TRACE(FPHY, PHY_TXPWR, ("Invalid Band %d\n", band));
+ RT_TRACE(FPHY, PHY_TXPWR, "Invalid Band %d\n", band);
return;
}
if (rfpath > MAX_RF_PATH - 1) {
- RT_TRACE(FPHY, PHY_TXPWR, ("Invalid RfPath %d\n", rfpath));
+ RT_TRACE(FPHY, PHY_TXPWR, "Invalid RfPath %d\n", rfpath);
return;
}
if (txnum > MAX_RF_PATH - 1) {
- RT_TRACE(FPHY, PHY_TXPWR, ("Invalid TxNum %d\n", txnum));
+ RT_TRACE(FPHY, PHY_TXPWR, "Invalid TxNum %d\n", txnum);
return;
}
@@ -898,7 +893,7 @@ static bool _rtl92ee_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
}
} else {
RT_TRACE(COMP_SEND, DBG_TRACE,
- ("configtype != BaseBand_Config_PHY_REG\n"));
+ "configtype != BaseBand_Config_PHY_REG\n");
}
return true;
}
@@ -924,8 +919,8 @@ bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
len = RTL8192EE_RADIOA_ARRAY_LEN;
array = RTL8192EE_RADIOA_ARRAY;
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Radio_A:RTL8192EE_RADIOA_ARRAY %d\n" , len));
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Radio No %x\n", rfpath));
+ "Radio_A:RTL8192EE_RADIOA_ARRAY %d\n", len);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Radio No %x\n", rfpath);
for (i = 0; i < len; i = i + 2) {
v1 = array[i];
v2 = array[i+1];
@@ -968,8 +963,8 @@ bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
len = RTL8192EE_RADIOB_ARRAY_LEN;
array = RTL8192EE_RADIOB_ARRAY;
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("Radio_A:RTL8192EE_RADIOB_ARRAY %d\n" , len));
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Radio No %x\n", rfpath));
+ "Radio_A:RTL8192EE_RADIOB_ARRAY %d\n", len);
+ RT_TRACE(COMP_INIT, DBG_LOUD, "Radio No %x\n", rfpath);
for (i = 0; i < len; i = i + 2) {
v1 = array[i];
v2 = array[i+1];
@@ -1008,12 +1003,10 @@ bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
}
break;
case RF90_PATH_C:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not processed\n");
break;
case RF90_PATH_D:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not processed\n");
break;
}
return true;
@@ -1034,20 +1027,19 @@ void rtl92ee_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw)
(u8) rtl_get_bbreg(hw, ROFDM0_XDAGCCORE1, MASKBYTE0);
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Default initial gain (c50 = 0x%x, c58 = 0x%x, c60 = 0x%x, c68 = 0x%x\n",
- rtlphy->default_initialgain[0],
- rtlphy->default_initialgain[1],
- rtlphy->default_initialgain[2],
- rtlphy->default_initialgain[3]));
+ "Default initial gain (c50 = 0x%x, c58 = 0x%x, c60 = 0x%x, c68 = 0x%x\n",
+ rtlphy->default_initialgain[0],
+ rtlphy->default_initialgain[1],
+ rtlphy->default_initialgain[2],
+ rtlphy->default_initialgain[3]);
rtlphy->framesync = (u8) rtl_get_bbreg(hw,
ROFDM0_RXDETECTOR3, MASKBYTE0);
rtlphy->framesync_c34 = rtl_get_bbreg(hw,
ROFDM0_RXDETECTOR2, MASKDWORD);
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Default framesync (0x%x) = 0x%x\n",
- ROFDM0_RXDETECTOR3, rtlphy->framesync));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Default framesync (0x%x) = 0x%x\n",
+ ROFDM0_RXDETECTOR3, rtlphy->framesync);
}
static void _rtl92ee_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw)
@@ -1313,8 +1305,7 @@ static u8 _rtl92ee_get_txpower_index(struct ieee80211_hw *hw,
if (channel < 1 || channel > 14) {
index = 0;
- RT_TRACE(COMP_POWER_TRACKING, DBG_DMESG,
- ("Illegal channel!!\n"));
+ RT_TRACE(COMP_POWER_TRACKING, DBG_DMESG, "Illegal channel!!\n");
}
if (IS_CCK_RATE(rate))
@@ -1472,7 +1463,7 @@ static void _rtl92ee_set_txpower_index(struct ieee80211_hw *hw, u8 pwr_idx,
MASKBYTE3, pwr_idx);
break;
default:
- RT_TRACE(COMP_POWER, DBG_LOUD, ("Invalid Rate!!\n"));
+ RT_TRACE(COMP_POWER, DBG_LOUD, "Invalid Rate!!\n");
break;
}
} else if (rfpath == RF90_PATH_B) {
@@ -1590,11 +1581,11 @@ static void _rtl92ee_set_txpower_index(struct ieee80211_hw *hw, u8 pwr_idx,
MASKBYTE3, pwr_idx);
break;
default:
- RT_TRACE(COMP_POWER, DBG_LOUD, ("Invalid Rate!!\n"));
+ RT_TRACE(COMP_POWER, DBG_LOUD, "Invalid Rate!!\n");
break;
}
} else {
- RT_TRACE(COMP_POWER, DBG_LOUD, ("Invalid RFPath!!\n"));
+ RT_TRACE(COMP_POWER, DBG_LOUD, "Invalid RFPath!!\n");
}
}
@@ -1652,8 +1643,7 @@ static void rtl92ee_phy_set_txpower_index_by_rate_section(struct ieee80211_hw *h
rtlphy->current_chan_bw,
channel, ht_rates2t, 8);
} else
- RT_TRACE(FPHY, PHY_TXPWR,
- ("Invalid RateSection %d\n", section));
+ RT_TRACE(FPHY, PHY_TXPWR, "Invalid RateSection %d\n", section);
}
void rtl92ee_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
@@ -1724,7 +1714,7 @@ void rtl92ee_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Unknown Scan Backup operation.\n"));
+ "Unknown Scan Backup operation\n");
break;
}
}
@@ -1739,10 +1729,8 @@ void rtl92ee_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
u8 reg_bw_opmode;
u8 reg_prsr_rsc;
- RT_TRACE(COMP_SCAN, DBG_TRACE,
- ("Switch to %s bandwidth\n",
- rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
- "20MHz" : "40MHz"));
+ RT_TRACE(COMP_SCAN, DBG_TRACE, "Switch to %sMHz bandwidth\n",
+ rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? "20" : "40");
if (is_hal_stop(rtlhal)) {
rtlphy->set_bwmode_inprogress = false;
@@ -1765,8 +1753,8 @@ void rtl92ee_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "unknown bandwidth: %#X\n",
+ rtlphy->current_chan_bw);
break;
}
@@ -1790,13 +1778,13 @@ void rtl92ee_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "unknown bandwidth: %#X\n",
+ rtlphy->current_chan_bw);
break;
}
rtl92ee_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
rtlphy->set_bwmode_inprogress = false;
- RT_TRACE(COMP_SCAN, DBG_LOUD, ("\n"));
+ RT_TRACE(COMP_SCAN, DBG_LOUD, "\n");
}
void rtl92ee_phy_set_bw_mode(struct ieee80211_hw *hw,
@@ -1814,7 +1802,7 @@ void rtl92ee_phy_set_bw_mode(struct ieee80211_hw *hw,
rtl92ee_phy_set_bw_mode_callback(hw);
} else {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("false driver sleep or unload\n"));
+ "false driver sleep or unload\n");
rtlphy->set_bwmode_inprogress = false;
rtlphy->current_chan_bw = tmp_bw;
}
@@ -1827,8 +1815,8 @@ void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw)
struct rtl_phy *rtlphy = &(rtlpriv->phy);
u32 delay;
- RT_TRACE(COMP_SCAN, DBG_TRACE,
- ("switch to channel%d\n", rtlphy->current_channel));
+ RT_TRACE(COMP_SCAN, DBG_TRACE, "switch to channel%d\n",
+ rtlphy->current_channel);
if (is_hal_stop(rtlhal))
return;
do {
@@ -1846,7 +1834,7 @@ void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw)
}
break;
} while (true);
- RT_TRACE(COMP_SCAN, DBG_TRACE, ("\n"));
+ RT_TRACE(COMP_SCAN, DBG_TRACE, "\n");
}
u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw)
@@ -1867,12 +1855,12 @@ u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw)
if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
rtl92ee_phy_sw_chnl_callback(hw);
RT_TRACE(COMP_CHAN, DBG_LOUD,
- ("sw_chnl_inprogress false schdule workitem current channel %d\n",
- rtlphy->current_channel));
+ "sw_chnl_inprogress false schedule workitem current channel %d\n",
+ rtlphy->current_channel);
rtlphy->sw_chnl_inprogress = false;
} else {
RT_TRACE(COMP_CHAN, DBG_LOUD,
- ("sw_chnl_inprogress false driver sleep or unload\n"));
+ "sw_chnl_inprogress false driver sleep or unload\n");
rtlphy->sw_chnl_inprogress = false;
}
return 1;
@@ -1933,8 +1921,7 @@ static bool _rtl92ee_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Invalid 'stage' = %d, Check it!\n" ,
- *stage));
+ "Invalid 'stage' = %d, Check it!\n", *stage);
return true;
break;
}
@@ -1979,7 +1966,7 @@ static bool _rtl92ee_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ "switch case not processed\n");
break;
}
@@ -2325,7 +2312,7 @@ static u8 _rtl92ee_phy_path_b_rx_iqk(struct ieee80211_hw *hw, bool config_pathb)
(((reg_ecc & 0x03FF0000) >> 16) != 0x36))
result |= 0x02;
else
- RT_TRACE(COMP_RF, DBG_LOUD, ("Path B Rx IQK fail!!\n"));
+ RT_TRACE(COMP_RF, DBG_LOUD, "Path B Rx IQK fail!!\n");
return result;
}
@@ -2637,7 +2624,7 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
if (patha_ok == 0x01) {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path A Tx IQK Success!!\n"));
+ "Path A Tx IQK Success!!\n");
result[t][0] = (rtl_get_bbreg(hw,
RTx_Power_Before_IQK_A,
MASKDWORD) & 0x3FF0000)
@@ -2648,8 +2635,8 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
break;
} else {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path A Tx IQK Fail!!, ret = 0x%x\n",
- patha_ok));
+ "Path A Tx IQK Fail!!, ret = 0x%x\n",
+ patha_ok);
}
}
@@ -2658,7 +2645,7 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
if (patha_ok == 0x03) {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path A Rx IQK Success!!\n"));
+ "Path A Rx IQK Success!!\n");
result[t][2] = (rtl_get_bbreg(hw,
RRx_Power_Before_IQK_A_2,
MASKDWORD) & 0x3FF0000)
@@ -2670,13 +2657,13 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
break;
} else {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path A Rx IQK Fail!!, ret = 0x%x\n",
- patha_ok));
+ "Path A Rx IQK Fail!!, ret = 0x%x\n",
+ patha_ok);
}
}
if (0x00 == patha_ok)
- RT_TRACE(COMP_RF, DBG_LOUD, ("Path A IQK failed!!, ret = 0\n"));
+ RT_TRACE(COMP_RF, DBG_LOUD, "Path A IQK failed!!, ret = 0\n");
if (is2t) {
_rtl92ee_phy_path_a_standby(hw);
@@ -2692,7 +2679,7 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
pathb_ok = _rtl92ee_phy_path_b_iqk(hw);
if (pathb_ok == 0x01) {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path B Tx IQK Success!!\n"));
+ "Path B Tx IQK Success!!\n");
result[t][4] = (rtl_get_bbreg(hw,
RTx_Power_Before_IQK_B,
MASKDWORD) & 0x3FF0000)
@@ -2704,8 +2691,8 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
break;
} else {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path B Tx IQK Fail!!, ret = 0x%x\n",
- pathb_ok));
+ "Path B Tx IQK Fail!!, ret = 0x%x\n",
+ pathb_ok);
}
}
@@ -2713,7 +2700,7 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
pathb_ok = _rtl92ee_phy_path_b_rx_iqk(hw, is2t);
if (pathb_ok == 0x03) {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path B Rx IQK Success!!\n"));
+ "Path B Rx IQK Success!!\n");
result[t][6] = (rtl_get_bbreg(hw,
RRx_Power_Before_IQK_B_2,
MASKDWORD) & 0x3FF0000)
@@ -2725,18 +2712,18 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
break;
} else {
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path B Rx IQK Fail!!, ret = 0x%x\n",
- pathb_ok));
+ "Path B Rx IQK Fail!!, ret = 0x%x\n",
+ pathb_ok);
}
}
if (0x00 == pathb_ok)
RT_TRACE(COMP_RF, DBG_LOUD,
- ("Path B IQK failed!!, ret = 0\n"));
+ "Path B IQK failed!!, ret = 0\n");
}
/* Back to BB mode, load original value */
RT_TRACE(COMP_RF, DBG_LOUD,
- ("IQK:Back to BB mode, load original value!\n"));
+ "IQK:Back to BB mode, load original value!\n");
rtl_set_bbreg(hw, RFPGA0_IQK, MASKDWORD, 0);
if (t != 0) {
@@ -2765,7 +2752,7 @@ static void _rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw,
rtl_set_bbreg(hw, RTx_IQK_Tone_A, MASKDWORD, 0x01008c00);
rtl_set_bbreg(hw, RRx_IQK_Tone_A, MASKDWORD, 0x01008c00);
}
- RT_TRACE(COMP_RF, DBG_LOUD, ("_rtl92ee_phy_iq_calibrate() <==\n"));
+ RT_TRACE(COMP_RF, DBG_LOUD, "_rtl92ee_phy_iq_calibrate() <==\n");
}
static void _rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
@@ -2811,7 +2798,7 @@ static void _rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
} else {
rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00);
}
- RT_TRACE(COMP_INIT , DBG_LOUD , ("\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "\n");
}
static void _rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw,
@@ -2820,7 +2807,7 @@ static void _rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw,
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
- RT_TRACE(COMP_INIT , DBG_LOUD , ("\n"));
+ RT_TRACE(COMP_INIT, DBG_LOUD, "\n");
if (is_hal_stop(rtlhal)) {
u8 u1btmp;
@@ -3059,24 +3046,23 @@ bool rtl92ee_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
struct rtl_phy *rtlphy = &(rtlpriv->phy);
bool b_postprocessing = false;
- RT_TRACE(COMP_CMD, DBG_TRACE,
- ("-->IO Cmd(%#x), set_io_inprogress(%d)\n",
- iotype, rtlphy->set_io_inprogress));
+ RT_TRACE(COMP_CMD, DBG_TRACE, "-->IO Cmd(%#x), set_io_inprogress(%d)\n",
+ iotype, rtlphy->set_io_inprogress);
do {
switch (iotype) {
case IO_CMD_RESUME_DM_BY_SCAN:
RT_TRACE(COMP_CMD, DBG_TRACE,
- ("[IO CMD] Resume DM after scan.\n"));
+ "[IO CMD] Resume DM after scan\n");
b_postprocessing = true;
break;
case IO_CMD_PAUSE_BAND0_DM_BY_SCAN:
RT_TRACE(COMP_CMD, DBG_TRACE,
- ("[IO CMD] Pause DM before scan.\n"));
+ "[IO CMD] Pause DM before scan\n");
b_postprocessing = true;
break;
default:
RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ "switch case not processed\n");
break;
}
} while (false);
@@ -3087,7 +3073,7 @@ bool rtl92ee_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype)
return false;
}
rtl92ee_phy_set_io(hw);
- RT_TRACE(COMP_CMD, DBG_TRACE, ("IO Type(%#x)\n", iotype));
+ RT_TRACE(COMP_CMD, DBG_TRACE, "IO Type(%#x)\n", iotype);
return true;
}
@@ -3097,13 +3083,13 @@ static void rtl92ee_phy_set_io(struct ieee80211_hw *hw)
struct rtl_phy *rtlphy = &(rtlpriv->phy);
RT_TRACE(COMP_CMD, DBG_TRACE,
- ("--->Cmd(%#x), set_io_inprogress(%d)\n",
- rtlphy->current_io_type, rtlphy->set_io_inprogress));
+ "--->Cmd(%#x), set_io_inprogress(%d)\n",
+ rtlphy->current_io_type, rtlphy->set_io_inprogress);
switch (rtlphy->current_io_type) {
case IO_CMD_RESUME_DM_BY_SCAN:
rtl92ee_dm_write_dig(hw , rtlphy->initgain_backup.xaagccore1);
rtl92ee_dm_write_cck_cca_thres(hw, rtlphy->initgain_backup.cca);
- RT_TRACE(COMP_CMD, DBG_TRACE , ("no set txpower\n"));
+ RT_TRACE(COMP_CMD, DBG_TRACE, "no set txpower\n");
rtl92ee_phy_set_txpower_level(hw, rtlphy->current_channel);
break;
case IO_CMD_PAUSE_BAND0_DM_BY_SCAN:
@@ -3114,13 +3100,11 @@ static void rtl92ee_phy_set_io(struct ieee80211_hw *hw)
rtl92ee_dm_write_cck_cca_thres(hw, 0x40);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not processed\n");
break;
}
rtlphy->set_io_inprogress = false;
- RT_TRACE(COMP_CMD, DBG_TRACE,
- ("(%#x)\n", rtlphy->current_io_type));
+ RT_TRACE(COMP_CMD, DBG_TRACE, "(%#x)\n", rtlphy->current_io_type);
}
static void rtl92ee_phy_set_rf_on(struct ieee80211_hw *hw)
@@ -3166,15 +3150,15 @@ static bool _rtl92ee_phy_set_rf_power_state(struct ieee80211_hw *hw,
do {
init_count++;
RT_TRACE(COMP_RF, DBG_DMESG,
- ("IPS Set eRf nic enable\n"));
+ "IPS Set eRf nic enable\n");
rtstatus = stg_rtl_ps_enable_nic(hw);
} while (!rtstatus && (init_count < 10));
RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
} else {
RT_TRACE(COMP_RF, DBG_DMESG,
- ("Set ERFON sleeped:%d ms\n",
- jiffies_to_msecs(jiffies -
- ppsc->last_sleep_jiffies)));
+ "Set ERFON sleeped:%d ms\n",
+ jiffies_to_msecs(jiffies -
+ ppsc->last_sleep_jiffies));
ppsc->last_awake_jiffies = jiffies;
rtl92ee_phy_set_rf_on(hw);
}
@@ -3192,26 +3176,26 @@ static bool _rtl92ee_phy_set_rf_power_state(struct ieee80211_hw *hw,
continue;
} else {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before "
- "doze!\n", (i + 1), queue_id,
- skb_queue_len(&ring->queue)));
+ "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
+ i + 1, queue_id,
+ skb_queue_len(&ring->queue));
udelay(10);
i++;
}
if (i >= MAX_DOZE_WAITING_TIMES_9x) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("\n ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
- MAX_DOZE_WAITING_TIMES_9x,
- queue_id,
- skb_queue_len(&ring->queue)));
+ "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
+ MAX_DOZE_WAITING_TIMES_9x,
+ queue_id,
+ skb_queue_len(&ring->queue));
break;
}
}
if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) {
RT_TRACE(COMP_RF, DBG_DMESG,
- ("IPS Set eRf nic disable\n"));
+ "IPS Set eRf nic disable\n");
stg_rtl_ps_disable_nic(hw);
RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC);
} else {
@@ -3235,31 +3219,28 @@ static bool _rtl92ee_phy_set_rf_power_state(struct ieee80211_hw *hw,
continue;
} else {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
- (i + 1), queue_id,
- skb_queue_len(&ring->queue)));
+ "eRf Off/Sleep: %d times TcbBusyQueue[%d] =%d before doze!\n",
+ i + 1, queue_id,
+ skb_queue_len(&ring->queue));
udelay(10);
i++;
}
if (i >= MAX_DOZE_WAITING_TIMES_9x) {
RT_TRACE(COMP_ERR, DBG_WARNING,
- ("\n ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
- MAX_DOZE_WAITING_TIMES_9x,
- queue_id,
- skb_queue_len(&ring->queue)));
+ "ERFSLEEP: %d times TcbBusyQueue[%d] = %d !\n",
+ MAX_DOZE_WAITING_TIMES_9x,
+ queue_id,
+ skb_queue_len(&ring->queue));
break;
}
}
- RT_TRACE(COMP_RF, DBG_DMESG,
- ("Set ERFSLEEP awaked:%d ms\n",
- jiffies_to_msecs(jiffies -
- ppsc->last_awake_jiffies)));
+ RT_TRACE(COMP_RF, DBG_DMESG, "Set ERFSLEEP awaked:%d ms\n",
+ jiffies_to_msecs(jiffies - ppsc->last_awake_jiffies));
ppsc->last_sleep_jiffies = jiffies;
_rtl92ee_phy_set_rf_sleep(hw);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("switch case not process\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "switch case not processed\n");
bresult = false;
break;
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/pwrseqcmd.c b/drivers/staging/rtl8192ee/rtl8192ee/pwrseqcmd.c
index efb00f622361..d55234678d6b 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/pwrseqcmd.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/pwrseqcmd.c
@@ -51,15 +51,15 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
do {
pwr_cfg_cmd = pwrcfgcmd[ary_idx];
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("offset(%#x), cut_msk(%#x), fab_msk(%#x), interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), value(%#x)\n",
- GET_PWR_CFG_OFFSET(pwr_cfg_cmd),
- GET_PWR_CFG_CUT_MASK(pwr_cfg_cmd),
- GET_PWR_CFG_FAB_MASK(pwr_cfg_cmd),
- GET_PWR_CFG_INTF_MASK(pwr_cfg_cmd),
- GET_PWR_CFG_BASE(pwr_cfg_cmd),
- GET_PWR_CFG_CMD(pwr_cfg_cmd),
- GET_PWR_CFG_MASK(pwr_cfg_cmd),
- GET_PWR_CFG_VALUE(pwr_cfg_cmd)));
+ "offset(%#x), cut_msk(%#x), fab_msk(%#x), interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), value(%#x)\n",
+ GET_PWR_CFG_OFFSET(pwr_cfg_cmd),
+ GET_PWR_CFG_CUT_MASK(pwr_cfg_cmd),
+ GET_PWR_CFG_FAB_MASK(pwr_cfg_cmd),
+ GET_PWR_CFG_INTF_MASK(pwr_cfg_cmd),
+ GET_PWR_CFG_BASE(pwr_cfg_cmd),
+ GET_PWR_CFG_CMD(pwr_cfg_cmd),
+ GET_PWR_CFG_MASK(pwr_cfg_cmd),
+ GET_PWR_CFG_VALUE(pwr_cfg_cmd));
if ((GET_PWR_CFG_FAB_MASK(pwr_cfg_cmd)&fab_version) &&
(GET_PWR_CFG_CUT_MASK(pwr_cfg_cmd)&cut_version) &&
@@ -67,12 +67,12 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
switch (GET_PWR_CFG_CMD(pwr_cfg_cmd)) {
case PWR_CMD_READ:
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("PWR_CMD_READ\n"));
+ "PWR_CMD_READ\n");
break;
case PWR_CMD_WRITE:
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("PWR_CMD_WRITE\n"));
+ "PWR_CMD_WRITE\n");
offset = GET_PWR_CFG_OFFSET(pwr_cfg_cmd);
/*Read the value from system register*/
@@ -87,7 +87,7 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
case PWR_CMD_POLLING:
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("PWR_CMD_POLLING\n"));
+ "PWR_CMD_POLLING\n");
b_polling_bit = false;
offset = GET_PWR_CFG_OFFSET(pwr_cfg_cmd);
@@ -104,7 +104,7 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
if (polling_count++ > max_polling_cnt) {
RT_TRACE(COMP_INIT, DBG_LOUD,
- ("polling fail\n"));
+ "polling fail\n");
return false;
}
} while (!b_polling_bit);
@@ -113,7 +113,7 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
case PWR_CMD_DELAY:
RT_TRACE(COMP_INIT, DBG_TRACE,
- ("PWR_CMD_DELAY\n"));
+ "PWR_CMD_DELAY\n");
if (GET_PWR_CFG_VALUE(pwr_cfg_cmd) ==
PWRSEQ_DELAY_US)
udelay(GET_PWR_CFG_OFFSET(pwr_cfg_cmd));
@@ -122,8 +122,7 @@ bool rtl92e_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
break;
case PWR_CMD_END:
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("PWR_CMD_END\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "PWR_CMD_END\n");
return true;
break;
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/rf.c b/drivers/staging/rtl8192ee/rtl8192ee/rf.c
index 4f5a49ebca10..5dcb9116db1d 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/rf.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/rf.c
@@ -55,8 +55,8 @@ void rtl92ee_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth)
rtlphy->rfreg_chnlval[0]);
break;
default:
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("unknown bandwidth: %#X\n", bandwidth));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "unknown bandwidth: %#X\n",
+ bandwidth);
break;
}
}
@@ -139,12 +139,12 @@ static bool _rtl92ee_phy_rf6052_config_parafile(struct ieee80211_hw *hw)
break;
}
if (!rtstatus) {
- RT_TRACE(COMP_INIT, DBG_TRACE,
- ("Radio[%d] Fail!!", rfpath));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "Radio[%d] Fail!!\n",
+ rfpath);
return false;
}
}
- RT_TRACE(COMP_INIT, DBG_TRACE, ("\n"));
+ RT_TRACE(COMP_INIT, DBG_TRACE, "\n");
return rtstatus;
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/sw.c b/drivers/staging/rtl8192ee/rtl8192ee/sw.c
index f9c5729e2cd9..74f402d701ce 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/sw.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/sw.c
@@ -171,8 +171,7 @@ int rtl92ee_init_sw_vars(struct ieee80211_hw *hw)
/* for firmware buf */
rtlpriv->rtlhal.pfirmware = vmalloc(0x8000);
if (!rtlpriv->rtlhal.pfirmware) {
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Can't alloc buffer for fw.\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Can't alloc buffer for fw\n");
return 1;
}
@@ -180,13 +179,11 @@ int rtl92ee_init_sw_vars(struct ieee80211_hw *hw)
err = request_firmware(&firmware, fw_name, rtlpriv->io.dev);
if (err) {
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Failed to request firmware!\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Failed to request firmware!\n");
return 1;
}
if (firmware->size > 0x8000) {
- RT_TRACE(COMP_ERR, DBG_EMERG,
- ("Firmware is too big!\n"));
+ RT_TRACE(COMP_ERR, DBG_EMERG, "Firmware is too big!\n");
release_firmware(firmware);
return 1;
}
diff --git a/drivers/staging/rtl8192ee/rtl8192ee/trx.c b/drivers/staging/rtl8192ee/rtl8192ee/trx.c
index 1190c8bdb0d3..71f1b9f394bc 100644
--- a/drivers/staging/rtl8192ee/rtl8192ee/trx.c
+++ b/drivers/staging/rtl8192ee/rtl8192ee/trx.c
@@ -531,9 +531,9 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw,
else
status->wake_match = 0;
if (status->wake_match)
- RT_TRACE(COMP_RXDESC , DBG_LOUD,
- ("GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch =%d\n",
- status->wake_match));
+ RT_TRACE(COMP_RXDESC, DBG_LOUD,
+ "GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch =%d\n",
+ status->wake_match);
rx_status->freq = hw->conf.chandef.chan->center_freq;
rx_status->band = hw->conf.chandef.chan->band;
@@ -645,8 +645,8 @@ u16 rtl92ee_rx_desc_buff_remained_cnt(struct ieee80211_hw *hw , u8 queue_index)
if (write_point != rtlpci->rx_ring[queue_index].next_rx_rp) {
RT_TRACE(COMP_RXDESC, DBG_DMESG,
- ("!!!write point is 0x%x, reg 0x3B4 value is 0x%x\n",
- write_point, tmp_4byte));
+ "!!!write point is 0x%x, reg 0x3B4 value is 0x%x\n",
+ write_point, tmp_4byte);
tmp_4byte = rtl_read_dword(rtlpriv, REG_RXQ_TXBD_IDX);
read_point = (u16)((tmp_4byte>>16) & 0x7ff);
write_point = (u16)(tmp_4byte & 0x7ff);
@@ -868,8 +868,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len,
PCI_DMA_TODEVICE);
if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
- RT_TRACE(COMP_SEND, DBG_TRACE,
- ("DMA mapping error"));
+ RT_TRACE(COMP_SEND, DBG_TRACE, "DMA mapping error\n");
return;
}
if (pbd_desc_tx != NULL)
@@ -887,8 +886,8 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
USB_HWDESC_HEADER_LEN + EM_HDR_LEN);
if (ptcb_desc->empkt_num) {
RT_TRACE(COMP_SEND, DBG_TRACE,
- ("Insert 8 byte.pTcb->EMPktNum:%d\n",
- ptcb_desc->empkt_num));
+ "Insert 8 byte.pTcb->EMPktNum:%d\n",
+ ptcb_desc->empkt_num);
_rtl92ee_insert_emcontent(ptcb_desc,
(u8 *)(skb->data));
}
@@ -990,7 +989,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
if (ieee80211_is_data_qos(fc)) {
if (mac->rdg_en) {
RT_TRACE(COMP_SEND, DBG_TRACE,
- ("Enable RDG function.\n"));
+ "Enable RDG function\n");
SET_TX_DESC_RDG_ENABLE(pdesc, 1);
SET_TX_DESC_HTC(pdesc, 1);
}
@@ -1013,7 +1012,7 @@ void rtl92ee_tx_fill_desc(struct ieee80211_hw *hw,
is_broadcast_ether_addr(ieee80211_get_DA(hdr))) {
SET_TX_DESC_BMC(pdesc, 1);
}
- RT_TRACE(COMP_SEND, DBG_TRACE, ("\n"));
+ RT_TRACE(COMP_SEND, DBG_TRACE, "\n");
}
void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
@@ -1032,8 +1031,7 @@ void rtl92ee_tx_fill_cmddesc(struct ieee80211_hw *hw,
u8 txdesc_len = 40;
if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
- RT_TRACE(COMP_SEND, DBG_TRACE,
- ("DMA mapping error"));
+ RT_TRACE(COMP_SEND, DBG_TRACE, "DMA mapping error\n");
return;
}
CLEAR_PCI_TX_DESC_CONTENT(pdesc, txdesc_len);
@@ -1278,7 +1276,7 @@ u32 rtl92ee_rx_command_packet(struct ieee80211_hw *hw,
result = 1;
break;
default:
- RT_TRACE(COMP_RECV, DBG_TRACE, ("No this packet type!!\n"));
+ RT_TRACE(COMP_RECV, DBG_TRACE, "No this packet type!!\n");
break;
}
diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile
index eefc657ce99e..703c1505ea5f 100644
--- a/drivers/staging/rtl8192u/Makefile
+++ b/drivers/staging/rtl8192u/Makefile
@@ -6,9 +6,6 @@ ccflags-y += -O2
ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y
ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX
ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO
-#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE
-#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT
-ccflags-y += -DUSE_ONE_PIPE
ccflags-y += -Idrivers/staging/rtl8192u/ieee80211
r8192u_usb-y := r8192U_core.o r8180_93cx6.o r8192U_wx.o \
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index 1040bab9702a..c118551066c8 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -2485,6 +2485,10 @@ extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_reques
extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
+/* ieee80211_module.c */
+extern int ieee80211_debug_init(void);
+extern void ieee80211_debug_exit(void);
+
//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee);
extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 76403864644c..eb96bedb1c53 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -56,29 +56,6 @@ double __extendsfdf2(float a)
}
#endif
-#undef LOOP_TEST
-#undef DUMP_RX
-#undef DUMP_TX
-#undef DEBUG_TX_DESC2
-#undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
-#undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
#define CONFIG_RTL8192_IO_MAP
#include <asm/uaccess.h>
@@ -665,15 +642,6 @@ static void tx_timeout(struct net_device *dev)
schedule_work(&priv->reset_wq);
}
-
-/* this is only for debug */
-void dump_eprom(struct net_device *dev)
-{
- int i;
- for (i = 0; i < 63; i++)
- RT_TRACE(COMP_EPROM, "EEPROM addr %x : %x", i, eprom_read(dev, i));
-}
-
void rtl8192_update_msr(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
@@ -711,13 +679,11 @@ void rtl8192_set_chan(struct net_device *dev, short ch)
/* this hack should avoid frame TX during channel setting*/
-#ifndef LOOP_TEST
//need to implement rf set channel here WB
if (priv->rf_set_chan)
priv->rf_set_chan(dev, priv->chan);
mdelay(10);
-#endif
}
static void rtl8192_rx_isr(struct urb *urb);
@@ -725,14 +691,8 @@ static void rtl8192_rx_isr(struct urb *urb);
static u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats)
{
-#ifdef USB_RX_AGGREGATION_SUPPORT
- if (pstats->bisrxaggrsubframe)
- return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize
- + pstats->RxBufShift + 8);
- else
-#endif
- return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize
- + pstats->RxBufShift);
+ return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize
+ + pstats->RxBufShift);
}
static int rtl8192_rx_initiate(struct net_device *dev)
@@ -1046,194 +1006,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
void rtl8192_try_wake_queue(struct net_device *dev, int pri);
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
-u16 DrvAggr_PaddingAdd(struct net_device *dev, struct sk_buff *skb)
-{
- u16 PaddingNum = 256 - ((skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES) % 256);
- return PaddingNum & 0xff;
-}
-
-u8 MRateToHwRate8190Pci(u8 rate);
-u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc);
-u8 MapHwQueueToFirmwareQueue(u8 QueueID);
-struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList)
-{
- struct ieee80211_device *ieee = netdev_priv(dev);
- struct r8192_priv *priv = ieee80211_priv(dev);
- cb_desc *tcb_desc = NULL;
- u8 i;
- u32 TotalLength;
- struct sk_buff *skb;
- struct sk_buff *agg_skb;
- tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL;
- tx_fwinfo_819x_usb *tx_fwinfo = NULL;
-
- //
- // Local variable initialization.
- //
- /* first skb initialization */
- skb = pSendList->tx_agg_frames[0];
- TotalLength = skb->len;
-
- /* Get the total aggregation length including the padding space and
- * sub frame header.
- */
- for (i = 1; i < pSendList->nr_drv_agg_frames; i++) {
- TotalLength += DrvAggr_PaddingAdd(dev, skb);
- skb = pSendList->tx_agg_frames[i];
- TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES);
- }
-
- /* allocate skb to contain the aggregated packets */
- agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom);
- memset(agg_skb->data, 0, agg_skb->len);
- skb_reserve(agg_skb, ieee->tx_headroom);
-
- /* reserve info for first subframe Tx descriptor to be set in the tx function */
- skb = pSendList->tx_agg_frames[0];
- tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- tcb_desc->drv_agg_enable = 1;
- tcb_desc->pkt_size = skb->len;
- tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames;
- netdev_dbg(dev, "DrvAggNum = %d\n", tcb_desc->DrvAggrNum);
- memcpy(agg_skb->cb, skb->cb, sizeof(skb->cb));
- memcpy(skb_put(agg_skb, skb->len), skb->data, skb->len);
-
- for (i = 1; i < pSendList->nr_drv_agg_frames; i++) {
- /* push the next sub frame to be 256 byte aline */
- skb_put(agg_skb, DrvAggr_PaddingAdd(dev, skb));
-
- /* Subframe drv Tx descriptor and firmware info setting */
- skb = pSendList->tx_agg_frames[i];
- tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- tx_agg_desc = (tx_desc_819x_usb_aggr_subframe *)skb_tail_pointer(agg_skb);
- tx_fwinfo = (tx_fwinfo_819x_usb *)(skb_tail_pointer(agg_skb) + sizeof(tx_desc_819x_usb_aggr_subframe));
-
- memset(tx_fwinfo, 0, sizeof(tx_fwinfo_819x_usb));
- /* DWORD 0 */
- tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80) ? 1 : 0;
- tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate);
- tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;
- tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc);
- if (tcb_desc->bAMPDUEnable) { /* AMPDU enabled */
- tx_fwinfo->AllowAggregation = 1;
- /* DWORD 1 */
- tx_fwinfo->RxMF = tcb_desc->ampdu_factor;
- tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity
- } else {
- tx_fwinfo->AllowAggregation = 0;
- /* DWORD 1 */
- tx_fwinfo->RxMF = 0;
- tx_fwinfo->RxAMD = 0;
- }
-
- /* Protection mode related */
- tx_fwinfo->RtsEnable = (tcb_desc->bRTSEnable) ? 1 : 0;
- tx_fwinfo->CtsEnable = (tcb_desc->bCTSEnable) ? 1 : 0;
- tx_fwinfo->RtsSTBC = (tcb_desc->bRTSSTBC) ? 1 : 0;
- tx_fwinfo->RtsHT = (tcb_desc->rts_rate&0x80) ? 1 : 0;
- tx_fwinfo->RtsRate = MRateToHwRate8190Pci((u8)tcb_desc->rts_rate);
- tx_fwinfo->RtsSubcarrier = (tx_fwinfo->RtsHT == 0) ? (tcb_desc->RTSSC) : 0;
- tx_fwinfo->RtsBandwidth = (tx_fwinfo->RtsHT == 1) ? ((tcb_desc->bRTSBW) ? 1 : 0) : 0;
- tx_fwinfo->RtsShort = (tx_fwinfo->RtsHT == 0) ? (tcb_desc->bRTSUseShortPreamble ? 1 : 0) :
- (tcb_desc->bRTSUseShortGI ? 1 : 0);
-
- /* Set Bandwidth and sub-channel settings. */
- if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20_40) {
- if (tcb_desc->bPacketBW) {
- tx_fwinfo->TxBandwidth = 1;
- tx_fwinfo->TxSubCarrier = 0; //By SD3's Jerry suggestion, use duplicated mode
- } else {
- tx_fwinfo->TxBandwidth = 0;
- tx_fwinfo->TxSubCarrier = priv->nCur40MhzPrimeSC;
- }
- } else {
- tx_fwinfo->TxBandwidth = 0;
- tx_fwinfo->TxSubCarrier = 0;
- }
-
- /* Fill Tx descriptor */
- memset(tx_agg_desc, 0, sizeof(tx_desc_819x_usb_aggr_subframe));
- /* DWORD 0 */
- tx_agg_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8;
- /* already raw data, need not to subtract header length */
- tx_agg_desc->PktSize = skb->len & 0xffff;
-
- /*DWORD 1*/
- tx_agg_desc->SecCAMID = 0;
- tx_agg_desc->RATid = tcb_desc->RATRIndex;
- tx_agg_desc->NoEnc = 1;
- tx_agg_desc->SecType = 0x0;
-
- if (tcb_desc->bHwSec) {
- switch (priv->ieee80211->pairwise_key_type) {
- case KEY_TYPE_WEP40:
- case KEY_TYPE_WEP104:
- tx_agg_desc->SecType = 0x1;
- tx_agg_desc->NoEnc = 0;
- break;
- case KEY_TYPE_TKIP:
- tx_agg_desc->SecType = 0x2;
- tx_agg_desc->NoEnc = 0;
- break;
- case KEY_TYPE_CCMP:
- tx_agg_desc->SecType = 0x3;
- tx_agg_desc->NoEnc = 0;
- break;
- case KEY_TYPE_NA:
- tx_agg_desc->SecType = 0x0;
- tx_agg_desc->NoEnc = 1;
- break;
- }
- }
-
- tx_agg_desc->QueueSelect = MapHwQueueToFirmwareQueue(tcb_desc->queue_index);
- tx_agg_desc->TxFWInfoSize = sizeof(tx_fwinfo_819x_usb);
-
- tx_agg_desc->DISFB = tcb_desc->bTxDisableRateFallBack;
- tx_agg_desc->USERATE = tcb_desc->bTxUseDriverAssingedRate;
-
- tx_agg_desc->OWN = 1;
-
- //DWORD 2
- /* According windows driver, it seems that there no need to fill this field */
-
- /* to fill next packet */
- skb_put(agg_skb, TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES);
- memcpy(skb_put(agg_skb, skb->len), skb->data, skb->len);
- }
-
- for (i = 0; i < pSendList->nr_drv_agg_frames; i++)
- dev_kfree_skb_any(pSendList->tx_agg_frames[i]);
-
- return agg_skb;
-}
-
-/* NOTE:
- This function return a list of PTCB which is proper to be aggregate with the input TCB.
- If no proper TCB is found to do aggregation, SendList will only contain the input TCB.
-*/
-u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
- struct ieee80211_drv_agg_txb *pSendList)
-{
- struct ieee80211_device *ieee = netdev_priv(dev);
- PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
- u16 nMaxAggrNum = pHTInfo->UsbTxAggrNum;
- cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
- u8 QueueID = tcb_desc->queue_index;
-
- do {
- pSendList->tx_agg_frames[pSendList->nr_drv_agg_frames++] = skb;
- if (pSendList->nr_drv_agg_frames >= nMaxAggrNum)
- break;
-
- } while ((skb = skb_dequeue(&ieee->skb_drv_aggQ[QueueID])));
-
- RT_TRACE(COMP_AMSDU, "DrvAggr_GetAggregatibleList, nAggrTcbNum = %d \n", pSendList->nr_drv_agg_frames);
- return pSendList->nr_drv_agg_frames;
-}
-#endif
-
static void rtl8192_tx_isr(struct urb *tx_urb)
{
struct sk_buff *skb = (struct sk_buff *)tx_urb->context;
@@ -1285,37 +1057,6 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
return; //modified by david to avoid further processing AMSDU
}
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
- else if ((skb_queue_len(&priv->ieee80211->skb_drv_aggQ[queue_index]) != 0) &&
- (!(priv->ieee80211->queue_stop))) {
- // Tx Driver Aggregation process
- /* The driver will aggregation the packets according to the following stats
- * 1. check whether there's tx irq available, for it's a completion return
- * function, it should contain enough tx irq;
- * 2. check packet type;
- * 3. initialize sendlist, check whether the to-be send packet no greater than 1
- * 4. aggregates the packets, and fill firmware info and tx desc into it, etc.
- * 5. check whether the packet could be sent, otherwise just insert into wait head
- * */
- skb = skb_dequeue(&priv->ieee80211->skb_drv_aggQ[queue_index]);
- if (!check_nic_enough_desc(dev, queue_index)) {
- skb_queue_head(&(priv->ieee80211->skb_drv_aggQ[queue_index]), skb);
- return;
- }
-
- /*TODO*/
- {
- struct ieee80211_drv_agg_txb SendList;
-
- memset(&SendList, 0, sizeof(struct ieee80211_drv_agg_txb));
- if (DrvAggr_GetAggregatibleList(dev, skb, &SendList) > 1) {
- skb = DrvAggr_Aggregation(dev, &SendList);
-
- }
- }
- priv->ieee80211->softmac_hard_start_xmit(skb, dev);
- }
-#endif
}
}
@@ -1486,28 +1227,6 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate)
u16 N_DBPSOfRate(u16 DataRate);
-u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
- u8 bShortPreamble)
-{
- u16 FrameTime;
- u16 N_DBPS;
- u16 Ceiling;
-
- if (rtl8192_IsWirelessBMode(DataRate)) {
- if (bManagementFrame || !bShortPreamble || DataRate == 10) /* long preamble */
- FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));
- else // Short preamble
- FrameTime = (u16)(72+24+(FrameLength*8/(DataRate/10)));
- if ((FrameLength*8 % (DataRate/10)) != 0) /* Get the Ceilling */
- FrameTime++;
- } else { //802.11g DSSS-OFDM PLCP length field calculation.
- N_DBPS = N_DBPSOfRate(DataRate);
- Ceiling = (16 + 8*FrameLength + 6) / N_DBPS
- + (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0);
- FrameTime = (u16)(16 + 4 + 4*Ceiling + 6);
- }
- return FrameTime;
-}
u16 N_DBPSOfRate(u16 DataRate)
{
@@ -1553,15 +1272,6 @@ u16 N_DBPSOfRate(u16 DataRate)
return N_DBPS;
}
-unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue)
-{
- if (tx_queue >= 9) {
- RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__);
- return 0x04;
- }
- return priv->txqueue_to_outpipemap[tx_queue];
-}
-
short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
{
struct r8192_priv *priv = ieee80211_priv(dev);
@@ -1591,12 +1301,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
//----------------------------------------------------------------------------
// Fill up USB_OUT_CONTEXT.
//----------------------------------------------------------------------------
- // Get index to out pipe from specified QueueID.
-#ifndef USE_ONE_PIPE
- idx_pipe = txqueue2outpipe(priv, queue_index);
-#else
idx_pipe = 0x04;
-#endif
usb_fill_bulk_urb(tx_urb, priv->udev, usb_sndbulkpipe(priv->udev, idx_pipe),
skb->data, skb->len, rtl8192_tx_isr, skb);
@@ -1857,25 +1562,13 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)
tx_fwinfo->TxSubCarrier = 0;
}
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
- if (tcb_desc->drv_agg_enable)
- tx_fwinfo->Tx_INFO_RSVD = (tcb_desc->DrvAggrNum & 0x1f) << 1;
-#endif
/* Fill Tx descriptor */
memset(tx_desc, 0, sizeof(tx_desc_819x_usb));
/* DWORD 0 */
tx_desc->LINIP = 0;
tx_desc->CmdInit = 1;
tx_desc->Offset = sizeof(tx_fwinfo_819x_usb) + 8;
-
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
- if (tcb_desc->drv_agg_enable)
- tx_desc->PktSize = tcb_desc->pkt_size;
- else
-#endif
- {
- tx_desc->PktSize = (skb->len - TX_PACKET_SHIFT_BYTES) & 0xffff;
- }
+ tx_desc->PktSize = (skb->len - TX_PACKET_SHIFT_BYTES) & 0xffff;
/*DWORD 1*/
tx_desc->SecCAMID = 0;
@@ -1916,21 +1609,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)
tx_desc->LastSeg = 1;
tx_desc->OWN = 1;
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
- if (tcb_desc->drv_agg_enable) {
- tx_desc->TxBufferSize = tcb_desc->pkt_size + sizeof(tx_fwinfo_819x_usb);
- } else
-#endif
- {
- //DWORD 2
- tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN);
- }
- /* Get index to out pipe from specified QueueID */
-#ifndef USE_ONE_PIPE
- idx_pipe = txqueue2outpipe(priv, tcb_desc->queue_index);
-#else
+ /* DWORD 2 */
+ tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN);
idx_pipe = 0x5;
-#endif
/* To submit bulk urb */
usb_fill_bulk_urb(tx_urb, udev,
@@ -2869,9 +2550,6 @@ static short rtl8192_init(struct net_device *dev)
return -ENOMEM;
}
-#ifdef DEBUG_EPROM
- dump_eprom(dev);
-#endif
return 0;
}
@@ -3066,22 +2744,6 @@ static bool rtl8192_adapter_start(struct net_device *dev)
for (i = 0; i < QOS_QUEUE_NUM; i++)
write_nic_dword(dev, WDCAPARA_ADD[i], DEFAULT_EDCA);
}
-#ifdef USB_RX_AGGREGATION_SUPPORT
- //3 For usb rx firmware aggregation control
- if (priv->ResetProgress == RESET_TYPE_NORESET) {
- u32 ulValue;
- PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo;
- ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) |
- (pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout);
- /*
- * If usb rx firmware aggregation is enabled,
- * when anyone of three threshold conditions above is reached,
- * firmware will send aggregated packet to driver.
- */
- write_nic_dword(dev, 0x1a8, ulValue);
- priv->bCurrentRxAggrEnable = true;
- }
-#endif
rtl8192_phy_configmac(dev);
@@ -3235,12 +2897,8 @@ static RESET_TYPE TxCheckStuck(struct net_device *dev)
for (QueueID = 0; QueueID <= BEACON_QUEUE; QueueID++) {
if (QueueID == TXCMD_QUEUE)
continue;
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
- if ((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0))
-#else
if ((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0))
-#endif
- continue;
+ continue;
bCheckFwTxCnt = true;
}
@@ -4771,30 +4429,16 @@ static void query_rxdesc_status(struct sk_buff *skb,
//
//Get Rx Descriptor Information
//
-#ifdef USB_RX_AGGREGATION_SUPPORT
- if (bIsRxAggrSubframe) {
- rx_desc_819x_usb_aggr_subframe *desc = (rx_desc_819x_usb_aggr_subframe *)skb->data;
- stats->Length = desc->Length;
- stats->RxDrvInfoSize = desc->RxDrvInfoSize;
- stats->RxBufShift = 0; //RxBufShift = 2 in RxDesc, but usb didn't shift bytes in fact.
- stats->bICV = desc->ICV;
- stats->bCRC = desc->CRC32;
- stats->bHwError = stats->bCRC|stats->bICV;
- stats->Decrypted = !desc->SWDec;//RTL8190 set this bit to indicate that Hw does not decrypt packet
- } else
-#endif
- {
- rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data;
+ rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data;
- stats->Length = desc->Length;
- stats->RxDrvInfoSize = desc->RxDrvInfoSize;
- stats->RxBufShift = 0;
- stats->bICV = desc->ICV;
- stats->bCRC = desc->CRC32;
- stats->bHwError = stats->bCRC|stats->bICV;
- //RTL8190 set this bit to indicate that Hw does not decrypt packet
- stats->Decrypted = !desc->SWDec;
- }
+ stats->Length = desc->Length;
+ stats->RxDrvInfoSize = desc->RxDrvInfoSize;
+ stats->RxBufShift = 0;
+ stats->bICV = desc->ICV;
+ stats->bCRC = desc->CRC32;
+ stats->bHwError = stats->bCRC|stats->bICV;
+ /* RTL8190 set this bit to indicate that Hw does not decrypt packet */
+ stats->Decrypted = !desc->SWDec;
if ((priv->ieee80211->pHTInfo->bCurrentHTSupport == true) && (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP))
stats->bHwError = false;
@@ -4859,11 +4503,6 @@ static void query_rxdesc_status(struct sk_buff *skb,
skb_pull(skb, stats->RxBufShift + stats->RxDrvInfoSize);
}
-#ifdef USB_RX_AGGREGATION_SUPPORT
- /* for the rx aggregated sub frame, the redundant space truly contained in the packet */
- if (bIsRxAggrSubframe)
- skb_pull(skb, 8);
-#endif
/* for debug 2008.5.29 */
//added by vivi, for MP, 20080108
@@ -4873,18 +4512,6 @@ static void query_rxdesc_status(struct sk_buff *skb,
}
-u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats *Status, bool bIsRxAggrSubframe)
-{
-#ifdef USB_RX_AGGREGATION_SUPPORT
- if (bIsRxAggrSubframe)
- return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize
- + Status->RxBufShift + 8);
- else
-#endif
- return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize
- + Status->RxBufShift);
-}
-
static void rtl8192_rx_nomal(struct sk_buff *skb)
{
rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
@@ -4899,42 +4526,13 @@ static void rtl8192_rx_nomal(struct sk_buff *skb)
u32 rx_pkt_len = 0;
struct ieee80211_hdr_1addr *ieee80211_hdr = NULL;
bool unicast_packet = false;
-#ifdef USB_RX_AGGREGATION_SUPPORT
- struct sk_buff *agg_skb = NULL;
- u32 TotalLength = 0;
- u32 TempDWord = 0;
- u32 PacketLength = 0;
- u32 PacketOccupiedLendth = 0;
- u8 TempByte = 0;
- u32 PacketShiftBytes = 0;
- rx_desc_819x_usb_aggr_subframe *RxDescr = NULL;
- u8 PaddingBytes = 0;
- //add just for testing
- u8 testing;
-
-#endif
/* 20 is for ps-poll */
if ((skb->len >= (20 + sizeof(rx_desc_819x_usb))) && (skb->len < RX_URB_SIZE)) {
-#ifdef USB_RX_AGGREGATION_SUPPORT
- TempByte = *(skb->data + sizeof(rx_desc_819x_usb));
-#endif
/* first packet should not contain Rx aggregation header */
query_rxdesc_status(skb, &stats, false);
/* TODO */
/* hardware related info */
-#ifdef USB_RX_AGGREGATION_SUPPORT
- if (TempByte & BIT0) {
- agg_skb = skb;
- TotalLength = stats.Length - 4; /*sCrcLng*/
- /* though the head pointer has passed this position */
- TempDWord = *(u32 *)(agg_skb->data - 4);
- PacketLength = (u16)(TempDWord & 0x3FFF); /*sCrcLng*/
- skb = dev_alloc_skb(PacketLength);
- memcpy(skb_put(skb, PacketLength), agg_skb->data, PacketLength);
- PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, false);
- }
-#endif
/* Process the MPDU received */
skb_trim(skb, skb->len - 4/*sCrcLng*/);
@@ -4957,76 +4555,6 @@ static void rtl8192_rx_nomal(struct sk_buff *skb)
if (unicast_packet)
priv->stats.rxbytesunicast += rx_pkt_len;
}
-#ifdef USB_RX_AGGREGATION_SUPPORT
- testing = 1;
- if (TotalLength > 0) {
- PacketOccupiedLendth = PacketLength + (PacketShiftBytes + 8);
- if ((PacketOccupiedLendth & 0xFF) != 0)
- PacketOccupiedLendth = (PacketOccupiedLendth & 0xFFFFFF00) + 256;
- PacketOccupiedLendth -= 8;
- TempDWord = PacketOccupiedLendth - PacketShiftBytes; /*- PacketLength */
- if (agg_skb->len > TempDWord)
- skb_pull(agg_skb, TempDWord);
- else
- agg_skb->len = 0;
-
- while (agg_skb->len >= GetRxPacketShiftBytes819xUsb(&stats, true)) {
- u8 tmpCRC = 0, tmpICV = 0;
- RxDescr = (rx_desc_819x_usb_aggr_subframe *)(agg_skb->data);
- tmpCRC = RxDescr->CRC32;
- tmpICV = RxDescr->ICV;
- memcpy(agg_skb->data, &agg_skb->data[44], 2);
- RxDescr->CRC32 = tmpCRC;
- RxDescr->ICV = tmpICV;
-
- memset(&stats, 0, sizeof(struct ieee80211_rx_stats));
- stats.signal = 0;
- stats.noise = -98;
- stats.rate = 0;
- stats.freq = IEEE80211_24GHZ_BAND;
- query_rxdesc_status(agg_skb, &stats, true);
- PacketLength = stats.Length;
-
- if (PacketLength > agg_skb->len)
- break;
- /* Process the MPDU received */
- skb = dev_alloc_skb(PacketLength);
- memcpy(skb_put(skb, PacketLength), agg_skb->data, PacketLength);
- skb_trim(skb, skb->len - 4/*sCrcLng*/);
-
- rx_pkt_len = skb->len;
- ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data;
- unicast_packet = false;
- if (is_broadcast_ether_addr(ieee80211_hdr->addr1)) {
- //TODO
- } else if (is_multicast_ether_addr(ieee80211_hdr->addr1)) {
- //TODO
- } else {
- /* unicast packet */
- unicast_packet = true;
- }
- if (!ieee80211_rx(priv->ieee80211, skb, &stats)) {
- dev_kfree_skb_any(skb);
- } else {
- priv->stats.rxoktotal++;
- if (unicast_packet)
- priv->stats.rxbytesunicast += rx_pkt_len;
- }
- /* should trim the packet which has been copied to target skb */
- skb_pull(agg_skb, PacketLength);
- PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, true);
- PacketOccupiedLendth = PacketLength + PacketShiftBytes;
- if ((PacketOccupiedLendth & 0xFF) != 0) {
- PaddingBytes = 256 - (PacketOccupiedLendth & 0xFF);
- if (agg_skb->len > PaddingBytes)
- skb_pull(agg_skb, PaddingBytes);
- else
- agg_skb->len = 0;
- }
- }
- dev_kfree_skb(agg_skb);
- }
-#endif
} else {
priv->stats.rxurberr++;
netdev_dbg(dev, "actual_length: %d\n", skb->len);
@@ -5277,8 +4805,6 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf)
}
/* fun with the built-in ieee80211 stack... */
-extern int ieee80211_debug_init(void);
-extern void ieee80211_debug_exit(void);
extern int ieee80211_crypto_init(void);
extern void ieee80211_crypto_deinit(void);
extern int ieee80211_crypto_tkip_init(void);
diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
index 6808e872296e..a404ed47aa4d 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -22,9 +22,10 @@
#include "r8192U_hw.h"
#include "dot11d.h"
+#include "r8192U_wx.h"
#define RATE_COUNT 12
-u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
+static const u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h b/drivers/staging/rtl8192u/r819xU_phyreg.h
index 64285d6a33f8..b855627e9816 100644
--- a/drivers/staging/rtl8192u/r819xU_phyreg.h
+++ b/drivers/staging/rtl8192u/r819xU_phyreg.h
@@ -2,10 +2,11 @@
#define _R819XU_PHYREG_H
-#define RF_DATA 0x1d4 // FW will write RF data in the register.
+#define RF_DATA 0x1d4 /* FW will write RF data in the register.*/
-//Register //duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
-//page 1
+/* Register duplicate register due to connection: RF_Mode, TRxRN, NumOf L-STF
+ * page 1
+ */
#define rPMAC_Reset 0x100
#define rPMAC_TxStart 0x104
#define rPMAC_TxLegacySIG 0x108
@@ -34,15 +35,16 @@
#define rPMAC_CCKCRxRC32OK 0x188
#define rPMAC_TxStatus 0x18c
-//page8
-#define rFPGA0_RFMOD 0x800 //RF mode & CCK TxSC
+/* page8 */
+#define rFPGA0_RFMOD 0x800 /* RF mode & CCK TxSC */
#define rFPGA0_TxInfo 0x804
#define rFPGA0_PSDFunction 0x808
#define rFPGA0_TxGainStage 0x80c
#define rFPGA0_RFTiming1 0x810
#define rFPGA0_RFTiming2 0x814
-//#define rFPGA0_XC_RFTiming 0x818
-//#define rFPGA0_XD_RFTiming 0x81c
+/* #define rFPGA0_XC_RFTiming 0x818
+ * #define rFPGA0_XD_RFTiming 0x81c
+ */
#define rFPGA0_XA_HSSIParameter1 0x820
#define rFPGA0_XA_HSSIParameter2 0x824
#define rFPGA0_XB_HSSIParameter1 0x828
@@ -79,51 +81,51 @@
#define rFPGA0_XAB_RFInterfaceRB 0x8e0
#define rFPGA0_XCD_RFInterfaceRB 0x8e4
-//page 9
-#define rFPGA1_RFMOD 0x900 //RF mode & OFDM TxSC
+/* page 9 */
+#define rFPGA1_RFMOD 0x900 /* RF mode & OFDM TxSC */
#define rFPGA1_TxBlock 0x904
#define rFPGA1_DebugSelect 0x908
#define rFPGA1_TxInfo 0x90c
-//page a
+/* page a */
#define rCCK0_System 0xa00
#define rCCK0_AFESetting 0xa04
#define rCCK0_CCA 0xa08
-#define rCCK0_RxAGC1 0xa0c //AGC default value, saturation level
-#define rCCK0_RxAGC2 0xa10 //AGC & DAGC
+#define rCCK0_RxAGC1 0xa0c /* AGC default value, saturation level */
+#define rCCK0_RxAGC2 0xa10 /* AGC & DAGC */
#define rCCK0_RxHP 0xa14
-#define rCCK0_DSPParameter1 0xa18 //Timing recovery & Channel estimation threshold
-#define rCCK0_DSPParameter2 0xa1c //SQ threshold
+#define rCCK0_DSPParameter1 0xa18 /* Timing recovery & Channel estimation threshold */
+#define rCCK0_DSPParameter2 0xa1c /* SQ threshold */
#define rCCK0_TxFilter1 0xa20
#define rCCK0_TxFilter2 0xa24
-#define rCCK0_DebugPort 0xa28 //debug port and Tx filter3
-#define rCCK0_FalseAlarmReport 0xa2c //0xa2d
+#define rCCK0_DebugPort 0xa28 /* debug port and Tx filter3 */
+#define rCCK0_FalseAlarmReport 0xa2c /* 0xa2d */
#define rCCK0_TRSSIReport 0xa50
-#define rCCK0_RxReport 0xa54 //0xa57
-#define rCCK0_FACounterLower 0xa5c //0xa5b
-#define rCCK0_FACounterUpper 0xa58 //0xa5c
+#define rCCK0_RxReport 0xa54 /* 0xa57 */
+#define rCCK0_FACounterLower 0xa5c /* 0xa5b */
+#define rCCK0_FACounterUpper 0xa58 /* 0xa5c */
-//page c
+/* page c */
#define rOFDM0_LSTF 0xc00
#define rOFDM0_TRxPathEnable 0xc04
#define rOFDM0_TRMuxPar 0xc08
#define rOFDM0_TRSWIsolation 0xc0c
-#define rOFDM0_XARxAFE 0xc10 //RxIQ DC offset, Rx digital filter, DC notch filter
-#define rOFDM0_XARxIQImbalance 0xc14 //RxIQ imblance matrix
+#define rOFDM0_XARxAFE 0xc10 /* RxIQ DC offset, Rx digital filter, DC notch filter */
+#define rOFDM0_XARxIQImbalance 0xc14 /* RxIQ imblance matrix */
#define rOFDM0_XBRxAFE 0xc18
#define rOFDM0_XBRxIQImbalance 0xc1c
#define rOFDM0_XCRxAFE 0xc20
#define rOFDM0_XCRxIQImbalance 0xc24
#define rOFDM0_XDRxAFE 0xc28
#define rOFDM0_XDRxIQImbalance 0xc2c
-#define rOFDM0_RxDetector1 0xc30 //PD,BW & SBD
-#define rOFDM0_RxDetector2 0xc34 //SBD & Fame Sync.
-#define rOFDM0_RxDetector3 0xc38 //Frame Sync.
-#define rOFDM0_RxDetector4 0xc3c //PD, SBD, Frame Sync & Short-GI
-#define rOFDM0_RxDSP 0xc40 //Rx Sync Path
-#define rOFDM0_CFOandDAGC 0xc44 //CFO & DAGC
-#define rOFDM0_CCADropThreshold 0xc48 //CCA Drop threshold
-#define rOFDM0_ECCAThreshold 0xc4c // energy CCA
+#define rOFDM0_RxDetector1 0xc30 /* PD,BW & SBD */
+#define rOFDM0_RxDetector2 0xc34 /* SBD & Fame Sync.*/
+#define rOFDM0_RxDetector3 0xc38 /* Frame Sync.*/
+#define rOFDM0_RxDetector4 0xc3c /* PD, SBD, Frame Sync & Short-GI */
+#define rOFDM0_RxDSP 0xc40 /* Rx Sync Path */
+#define rOFDM0_CFOandDAGC 0xc44 /* CFO & DAGC */
+#define rOFDM0_CCADropThreshold 0xc48 /* CCA Drop threshold */
+#define rOFDM0_ECCAThreshold 0xc4c /* energy CCA */
#define rOFDM0_XAAGCCore1 0xc50
#define rOFDM0_XAAGCCore2 0xc54
#define rOFDM0_XBAGCCore1 0xc58
@@ -156,7 +158,7 @@
#define rOFDM0_TxCoeff6 0xcb8
-//page d
+/* page d */
#define rOFDM1_LSTF 0xd00
#define rOFDM1_TRxPathEnable 0xd04
#define rOFDM1_CFO 0xd08
@@ -169,9 +171,10 @@
#define rOFDM1_PseudoNoiseStateAB 0xd50
#define rOFDM1_PseudoNoiseStateCD 0xd54
#define rOFDM1_RxPseudoNoiseWgt 0xd58
-#define rOFDM_PHYCounter1 0xda0 //cca, parity fail
-#define rOFDM_PHYCounter2 0xda4 //rate illegal, crc8 fail
-#define rOFDM_PHYCounter3 0xda8 //MCS not support
+#define rOFDM_PHYCounter1 0xda0 /* cca, parity fail */
+#define rOFDM_PHYCounter2 0xda4 /* rate illegal, crc8 fail */
+
+#define rOFDM_PHYCounter3 0xda8 /* MCS not support */
#define rOFDM_ShortCFOAB 0xdac
#define rOFDM_ShortCFOCD 0xdb0
#define rOFDM_LongCFOAB 0xdb4
@@ -186,7 +189,7 @@
#define rOFDM_RxEVMCSI 0xdd8
#define rOFDM_SIGReport 0xddc
-//page e
+/* page e */
#define rTxAGC_Rate18_06 0xe00
#define rTxAGC_Rate54_24 0xe04
#define rTxAGC_CCK_Mcs32 0xe08
@@ -196,8 +199,9 @@
#define rTxAGC_Mcs15_Mcs12 0xe1c
-//RF
-//Zebra1
+/* RF
+ * Zebra1
+ */
#define rZebra1_HSSIEnable 0x0
#define rZebra1_TRxEnable1 0x1
#define rZebra1_TRxEnable2 0x2
@@ -209,18 +213,19 @@
#define rZebra1_RxLPF 0xb
#define rZebra1_RxHPFCorner 0xc
-//Zebra4
+/* Zebra4 */
#define rGlobalCtrl 0
#define rRTL8256_TxLPF 19
#define rRTL8256_RxLPF 11
-//RTL8258
+/* RTL8258 */
#define rRTL8258_TxLPF 0x11
#define rRTL8258_RxLPF 0x13
#define rRTL8258_RSSILPF 0xa
-//Bit Mask
-//page-1
+/* Bit Mask
+ * page-1
+ */
#define bBBResetB 0x100
#define bGlobalResetB 0x200
#define bOFDMTxStart 0x4
@@ -266,7 +271,7 @@
#define bCCKTxStatus 0x1
#define bOFDMTxStatus 0x2
-//page-8
+/* page-8 */
#define bRFMOD 0x1
#define bJapanMode 0x2
#define bCCKTxSC 0x30
@@ -283,14 +288,14 @@
#define bRFStart 0x0000f000
#define bBBStart 0x000000f0
#define bBBCCKStart 0x0000000f
-#define bPAEnd 0xf //Reg0x814
+#define bPAEnd 0xf /* Reg0x814 */
#define bTREnd 0x0f000000
#define bRFEnd 0x000f0000
-#define bCCAMask 0x000000f0 //T2R
+#define bCCAMask 0x000000f0 /* T2R */
#define bR2RCCAMask 0x00000f00
#define bHSSI_R2TDelay 0xf8000000
#define bHSSI_T2RDelay 0xf80000
-#define bContTxHSSI 0x400 //chane gain at continue Tx
+#define bContTxHSSI 0x400 /* chane gain at continue Tx */
#define bIGFromCCK 0x200
#define bAGCAddress 0x3f
#define bRxHPTx 0x7000
@@ -301,7 +306,7 @@
#define b3WireDataLength 0x800
#define b3WireAddressLength 0x400
#define b3WireRFPowerDown 0x1
-//#define bHWSISelect 0x8
+/* #define bHWSISelect 0x8 */
#define b5GPAPEPolarity 0x40000000
#define b2GPAPEPolarity 0x80000000
#define bRFSW_TxDefaultAnt 0x3
@@ -312,7 +317,7 @@
#define bRFSI_3WireClock 0x2
#define bRFSI_3WireLoad 0x4
#define bRFSI_3WireRW 0x8
-#define bRFSI_3Wire 0xf //3-wire total control
+#define bRFSI_3Wire 0xf /* 3-wire total control */
#define bRFSI_RFENV 0x10
#define bRFSI_TRSW 0x20
#define bRFSI_TRSWB 0x40
@@ -337,12 +342,11 @@
#define bLSIG_Length 0x1fffe
#define bLSIG_Parity 0x20
#define bCCKRxPhase 0x4
-#define bLSSIReadAddress 0x3f000000 //LSSI "Read" Address
-#define bLSSIReadEdge 0x80000000 //LSSI "Read" edge signal
+#define bLSSIReadAddress 0x3f000000 /* LSSI "Read" Address */
+#define bLSSIReadEdge 0x80000000 /* LSSI "Read" edge signal */
#define bLSSIReadBackData 0xfff
#define bLSSIReadOKFlag 0x1000
-#define bCCKSampleRate 0x8 //0: 44MHz, 1:88MHz
-
+#define bCCKSampleRate 0x8 /* 0: 44MHz, 1:88MHz */
#define bRegulator0Standby 0x1
#define bRegulatorPLLStandby 0x2
#define bRegulator1Standby 0x4
@@ -395,12 +399,12 @@
#define bPSDSineToneScale 0x7f000000
#define bPSDReport 0xffff
-//page-9
+/* page-9 */
#define bOFDMTxSC 0x30000000
#define bCCKTxOn 0x1
#define bOFDMTxOn 0x2
-#define bDebugPage 0xfff //reset debug page and also HWord, LWord
-#define bDebugItem 0xff //reset debug page and LWord
+#define bDebugPage 0xfff /* reset debug page and also HWord, LWord */
+#define bDebugItem 0xff /* reset debug page and LWord */
#define bAntL 0x10
#define bAntNonHT 0x100
#define bAntHT1 0x1000
@@ -408,7 +412,7 @@
#define bAntHT1S1 0x100000
#define bAntNonHTS1 0x1000000
-//page-a
+/* page-a */
#define bCCKBBMode 0x3
#define bCCKTxPowerSaving 0x80
#define bCCKRxPowerSaving 0x40
@@ -429,7 +433,7 @@
#define bCCKBistMode 0x80000000
#define bCCKCCAMask 0x40000000
#define bCCKTxDACPhase 0x4
-#define bCCKRxADCPhase 0x20000000 //r_rx_clk
+#define bCCKRxADCPhase 0x20000000 /* r_rx_clk */
#define bCCKr_cp_mode0 0x0100
#define bCCKTxDCOffset 0xf0
#define bCCKRxDCOffset 0xf
@@ -443,12 +447,12 @@
#define bCCKRxIG 0x7f00
#define bCCKLNAPolarity 0x800000
#define bCCKRx1stGain 0x7f0000
-#define bCCKRFExtend 0x20000000 //CCK Rx initial gain polarity
+#define bCCKRFExtend 0x20000000 /* CCK Rx initial gain polarity */
#define bCCKRxAGCSatLevel 0x1f000000
#define bCCKRxAGCSatCount 0xe0
-#define bCCKRxRFSettle 0x1f //AGCsamp_dly
+#define bCCKRxRFSettle 0x1f /* AGCsamp_dly */
#define bCCKFixedRxAGC 0x8000
-//#define bCCKRxAGCFormat 0x4000 //remove to HSSI register 0x824
+/* #define bCCKRxAGCFormat 0x4000 */ /* remove to HSSI register 0x824 */
#define bCCKAntennaPolarity 0x2000
#define bCCKTxFilterType 0x0c00
#define bCCKRxAGCReportType 0x0300
@@ -489,7 +493,7 @@
#define bCCKDefaultRxPath 0xc000000
#define bCCKOptionRxPath 0x3000000
-//page c
+/* page c */
#define bNumOfSTF 0x3
#define bShift_L 0xc0
#define bGI_TH 0xc
@@ -591,8 +595,8 @@
#define bRxHP_BBP1 0x7000
#define bRxHP_BBP2 0x70000
#define bRxHP_BBP3 0x700000
-#define bRSSI_H 0x7f0000 //the threshold for high power
-#define bRSSI_Gen 0x7f000000 //the threshold for ant diversity
+#define bRSSI_H 0x7f0000 /* the threshold for high power */
+#define bRSSI_Gen 0x7f000000 /* the threshold for ant diversity */
#define bRxSettle_TRSW 0x7
#define bRxSettle_LNA 0x38
#define bRxSettle_RSSI 0x1c0
@@ -626,7 +630,7 @@
#define bRxPD_Delay_TH1 0x38
#define bRxPD_Delay_TH2 0x1c0
#define bRxPD_DC_COUNT_MAX 0x600
-//#define bRxMF_Hold 0x3800
+/* #define bRxMF_Hold 0x3800 */
#define bRxPD_Delay_TH 0x8000
#define bRxProcess_Delay 0xf0000
#define bRxSearchrange_GI2_Early 0x700000
@@ -652,7 +656,7 @@
#define bExtLNAGain 0x7c00
-//page d
+/* page d */
#define bSTBCEn 0x4
#define bAntennaMapping 0x10
#define bNss 0x20
@@ -662,12 +666,13 @@
#define bOFDMContinueTx 0x10000000
#define bOFDMSingleCarrier 0x20000000
#define bOFDMSingleTone 0x40000000
-//#define bRxPath1 0x01
-//#define bRxPath2 0x02
-//#define bRxPath3 0x04
-//#define bRxPath4 0x08
-//#define bTxPath1 0x10
-//#define bTxPath2 0x20
+/* #define bRxPath1 0x01
+ * #define bRxPath2 0x02
+ * #define bRxPath3 0x04
+ * #define bRxPath4 0x08
+ * #define bTxPath1 0x10
+ * #define bTxPath2 0x20
+ */
#define bHTDetect 0x100
#define bCFOEn 0x10000
#define bCFOValue 0xfff00000
@@ -680,8 +685,8 @@
#define bCounter_MCSNoSupport 0xffff
#define bCounter_FastSync 0xffff
#define bShortCFO 0xfff
-#define bShortCFOTLength 12 //total
-#define bShortCFOFLength 11 //fraction
+#define bShortCFOTLength 12 /* total */
+#define bShortCFOFLength 11 /* fraction */
#define bLongCFO 0x7ff
#define bLongCFOTLength 11
#define bLongCFOFLength 11
@@ -758,7 +763,7 @@
#define bUChCfg 0x7000000
#define bUpdEqz 0x8000000
-//page e
+/* page e */
#define bTxAGCRate18_06 0x7f7f7f7f
#define bTxAGCRate54_24 0x7f7f7f7f
#define bTxAGCRateMCS32 0x7f
@@ -769,7 +774,7 @@
#define bTxAGCRateMCS15_MCS12 0x7f7f7f7f
-//Rx Pseduo noise
+/* Rx Pseduo noise */
#define bRxPesudoNoiseOn 0x20000000
#define bRxPesudoNoise_A 0xff
#define bRxPesudoNoise_B 0xff00
@@ -780,8 +785,9 @@
#define bPesudoNoiseState_C 0xffff
#define bPesudoNoiseState_D 0xffff0000
-//RF
-//Zebra1
+/* RF
+ * Zebra1
+ */
#define bZebra1_HSSIEnable 0x8
#define bZebra1_TRxControl 0xc00
#define bZebra1_TRxGainSetting 0x07f
@@ -792,18 +798,18 @@
#define bZebra1_TxLPFBW 0x400
#define bZebra1_RxLPFBW 0x600
-//Zebra4
+/* Zebra4 */
#define bRTL8256RegModeCtrl1 0x100
#define bRTL8256RegModeCtrl0 0x40
#define bRTL8256_TxLPFBW 0x18
#define bRTL8256_RxLPFBW 0x600
-//RTL8258
+/* RTL8258 */
#define bRTL8258_TxLPFBW 0xc
#define bRTL8258_RxLPFBW 0xc00
#define bRTL8258_RSSILPFBW 0xc0
-//byte endable for sb_write
+/* byte endable for sb_write */
#define bByte0 0x1
#define bByte1 0x2
#define bByte2 0x4
@@ -812,7 +818,7 @@
#define bWord1 0xc
#define bDWord 0xf
-//for PutRegsetting & GetRegSetting BitMask
+/* for PutRegsetting & GetRegSetting BitMask */
#define bMaskByte0 0xff
#define bMaskByte1 0xff00
#define bMaskByte2 0xff0000
@@ -821,7 +827,7 @@
#define bMaskLWord 0x0000ffff
#define bMaskDWord 0xffffffff
-//for PutRFRegsetting & GetRFRegSetting BitMask
+/* for PutRFRegsetting & GetRFRegSetting BitMask */
#define bMask12Bits 0xfff
#define bEnable 0x1
@@ -830,14 +836,14 @@
#define LeftAntenna 0x0
#define RightAntenna 0x1
-#define tCheckTxStatus 500 //500ms
-#define tUpdateRxCounter 100 //100ms
+#define tCheckTxStatus 500 /* 500ms */
+#define tUpdateRxCounter 100 /* 100ms */
#define rateCCK 0
#define rateOFDM 1
#define rateHT 2
-//define Register-End
+/* define Register-End */
#define bPMAC_End 0x1ff
#define bFPGAPHY0_End 0x8ff
#define bFPGAPHY1_End 0x9ff
@@ -845,12 +851,13 @@
#define bOFDMPHY0_End 0xcff
#define bOFDMPHY1_End 0xdff
-//define max debug item in each debug page
-//#define bMaxItem_FPGA_PHY0 0x9
-//#define bMaxItem_FPGA_PHY1 0x3
-//#define bMaxItem_PHY_11B 0x16
-//#define bMaxItem_OFDM_PHY0 0x29
-//#define bMaxItem_OFDM_PHY1 0x0
+/* define max debug item in each debug page
+ * #define bMaxItem_FPGA_PHY0 0x9
+ * #define bMaxItem_FPGA_PHY1 0x3
+ * #define bMaxItem_PHY_11B 0x16
+ * #define bMaxItem_OFDM_PHY0 0x29
+ * #define bMaxItem_OFDM_PHY1 0x0
+ */
#define bPMACControl 0x0
#define bWMACControl 0x1
@@ -868,4 +875,4 @@
#define rRTL8256TxBBBW 19
#define bRTL8256TxBBBW 0x18
-#endif //__INC_HAL8190PCIPHYREG_H
+#endif /* __INC_HAL8190PCIPHYREG_H */
diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c
index fe092c5defa6..abc5d3cefecf 100644
--- a/drivers/staging/rtl8723au/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723au/core/rtw_efuse.c
@@ -156,9 +156,7 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
/* Check bit 32 read-ready */
retry = 0;
value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
- /* while(!(((value32 >> 24) & 0xff) & 0x80) && (retry<10)) */
- while(!(((value32 >> 24) & 0xff) & 0x80) && (retry<10000))
- {
+ while (!((value32 >> 24) & 0x80) && retry < 10000) {
value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
retry++;
}
@@ -285,8 +283,7 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
TYPE_EFUSE_REAL_CONTENT_LEN,
(void *)&contentLen);
- if (Address < contentLen) /* E-fuse 512Byte */
- {
+ if (Address < contentLen) { /* E-fuse 512Byte */
/* Write E-fuse Register address bit0~7 */
temp = Address & 0xFF;
rtl8723au_write8(Adapter, EFUSE_CTRL+1, temp);
@@ -302,12 +299,10 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
/* Wait Write-ready (0x30[31]= 1) */
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
- while(!(Bytetemp & 0x80))
- {
+ while (!(Bytetemp & 0x80)) {
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
k++;
- if (k == 1000)
- {
+ if (k == 1000) {
k = 0;
break;
}
@@ -357,8 +352,7 @@ EFUSE_Write1Byte(
TYPE_EFUSE_REAL_CONTENT_LEN,
(void *)&contentLen);
- if (Address < contentLen) /* E-fuse 512Byte */
- {
+ if (Address < contentLen) { /* E-fuse 512Byte */
rtl8723au_write8(Adapter, EFUSE_CTRL, Value);
/* Write E-fuse Register address bit0~7 */
@@ -377,12 +371,10 @@ EFUSE_Write1Byte(
/* Wait Write-ready (0x30[31]= 0) */
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
- while(Bytetemp & 0x80)
- {
+ while (Bytetemp & 0x80) {
Bytetemp = rtl8723au_read8(Adapter, EFUSE_CTRL+3);
k++;
- if (k == 100)
- {
+ if (k == 100) {
k = 0;
break;
}
@@ -472,23 +464,19 @@ efuse_WordEnableDataRead23a(u8 word_en,
u8 *sourdata,
u8 *targetdata)
{
- if (!(word_en&BIT(0)))
- {
+ if (!(word_en&BIT(0))) {
targetdata[0] = sourdata[0];
targetdata[1] = sourdata[1];
}
- if (!(word_en&BIT(1)))
- {
+ if (!(word_en&BIT(1))) {
targetdata[2] = sourdata[2];
targetdata[3] = sourdata[3];
}
- if (!(word_en&BIT(2)))
- {
+ if (!(word_en&BIT(2))) {
targetdata[4] = sourdata[4];
targetdata[5] = sourdata[5];
}
- if (!(word_en&BIT(3)))
- {
+ if (!(word_en&BIT(3))) {
targetdata[6] = sourdata[6];
targetdata[7] = sourdata[7];
}
diff --git a/drivers/staging/rtl8821ae/pci.c b/drivers/staging/rtl8821ae/pci.c
index 26d7b2fc852a..b8187887d85f 100644
--- a/drivers/staging/rtl8821ae/pci.c
+++ b/drivers/staging/rtl8821ae/pci.c
@@ -662,7 +662,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio)
RT_TRACE(COMP_ERR, DBG_LOUD,
("more desc left, wake"
"skb_queue@%d,ring->idx = %d,"
- "skb_queue_len = 0x%d\n",
+ "skb_queue_len = 0x%x\n",
prio, ring->idx,
skb_queue_len(&ring->queue)));
@@ -1650,7 +1650,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
if ((own == 1) && (hw_queue != BEACON_QUEUE)) {
RT_TRACE(COMP_ERR, DBG_WARNING,
("No more TX desc@%d, ring->idx = %d,"
- "idx = %d, skb_queue_len = 0x%d\n",
+ "idx = %d, skb_queue_len = 0x%x\n",
hw_queue, ring->idx, idx,
skb_queue_len(&ring->queue)));
@@ -1695,7 +1695,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw,
RT_TRACE(COMP_ERR, DBG_LOUD,
("less desc left, stop skb_queue@%d, "
"ring->idx = %d,"
- "idx = %d, skb_queue_len = 0x%d\n",
+ "idx = %d, skb_queue_len = 0x%x\n",
hw_queue, ring->idx, idx,
skb_queue_len(&ring->queue)));
diff --git a/drivers/staging/rts5208/Kconfig b/drivers/staging/rts5208/Kconfig
index 055655cecaf7..05c990f654a4 100644
--- a/drivers/staging/rts5208/Kconfig
+++ b/drivers/staging/rts5208/Kconfig
@@ -6,10 +6,3 @@ config RTS5208
PCI-E card reader rts5208/rts5288.
If this driver is compiled as a module, it will be named rts5208.
-
-config RTS5208_DEBUG
- bool "Realtek PCI-E Card Reader RTS5208/5288 verbose debug"
- depends on RTS5208
- help
- Say Y here in order to have the rts5208 code generate
- verbose debugging messages.
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 390b1f83ebc2..db8e22166db8 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -305,7 +305,8 @@ static int ms_read_bytes(struct rtsx_chip *chip,
if ((tpc == PRO_READ_SHORT_DATA) && (data_len == 8)) {
dev_dbg(rtsx_dev(chip), "Read format progress:\n");
- RTSX_DUMP(ptr, cnt);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, ptr,
+ cnt);
}
return STATUS_SUCCESS;
@@ -1913,7 +1914,7 @@ RE_SEARCH:
ptr = rtsx_get_cmd_data(chip);
dev_dbg(rtsx_dev(chip), "Boot block data:\n");
- RTSX_DUMP(ptr, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 16, ptr);
/* Block ID error
* HEADER_ID0, HEADER_ID1
diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index fe98309b7de6..1db534aeb12d 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -1309,8 +1309,10 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,
}
}
- RTSX_DUMP(mask, dw_len * 4);
- RTSX_DUMP(data, dw_len * 4);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, mask,
+ dw_len * 4);
+ print_hex_dump_bytes(KBUILD_MODNAME ": ", DUMP_PREFIX_NONE, data,
+ dw_len * 4);
for (i = 0; i < dw_len; i++) {
retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
index 5f5f512714e5..7e6c7c043a52 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -39,7 +39,7 @@ void scsi_show_command(struct rtsx_chip *chip)
{
struct scsi_cmnd *srb = chip->srb;
char *what = NULL;
- int i, unknown_cmd = 0;
+ int unknown_cmd = 0, len;
switch (srb->cmnd[0]) {
case TEST_UNIT_READY:
@@ -319,9 +319,8 @@ void scsi_show_command(struct rtsx_chip *chip)
what, srb->cmd_len);
if (unknown_cmd) {
- for (i = 0; i < srb->cmd_len && i < 16; i++)
- dev_dbg(rtsx_dev(chip), " %02x", srb->cmnd[i]);
- dev_dbg(rtsx_dev(chip), "\n");
+ len = min_t(unsigned short, srb->cmd_len, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", len, srb->cmnd);
}
}
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index c79bea808698..21c3b3cd61f2 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -427,7 +427,7 @@ static int sd_check_csd(struct rtsx_chip *chip, char check_wp)
memcpy(sd_card->raw_csd, rsp + 1, 15);
dev_dbg(rtsx_dev(chip), "CSD Response:\n");
- RTSX_DUMP(sd_card->raw_csd, 16);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 16, sd_card->raw_csd);
csd_ver = (rsp[1] & 0xc0) >> 6;
dev_dbg(rtsx_dev(chip), "csd_ver = %d\n", csd_ver);
@@ -812,12 +812,10 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
PHASE_NOT_RESET);
RTSX_WRITE_REG(chip, CLK_CTL, CHANGE_CLK, 0);
} else {
-#ifdef CONFIG_RTS5208_DEBUG
rtsx_read_register(chip, SD_VP_CTL, &val);
dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val);
-#endif
if (ddr_rx) {
RTSX_WRITE_REG(chip, SD_VP_CTL, PHASE_CHANGE,
@@ -863,12 +861,11 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 sample_point, u8 tune_dir)
return STATUS_SUCCESS;
Fail:
-#ifdef CONFIG_RTS5208_DEBUG
rtsx_read_register(chip, SD_VP_CTL, &val);
dev_dbg(rtsx_dev(chip), "SD_VP_CTL: 0x%x\n", val);
rtsx_read_register(chip, SD_DCMPS_CTL, &val);
dev_dbg(rtsx_dev(chip), "SD_DCMPS_CTL: 0x%x\n", val);
-#endif
+
rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0);
rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0);
wait_timeout(10);
@@ -1060,7 +1057,7 @@ static int sd_check_switch_mode(struct rtsx_chip *chip, u8 mode,
TRACE_RET(chip, STATUS_FAIL);
}
- RTSX_DUMP(buf, 64);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf);
if (func_group == NO_ARGUMENT) {
sd_card->func_group1_mask = buf[0x0D];
@@ -2119,7 +2116,7 @@ static int sd_check_wp_state(struct rtsx_chip *chip)
}
dev_dbg(rtsx_dev(chip), "ACMD13:\n");
- RTSX_DUMP(buf, 64);
+ dev_dbg(rtsx_dev(chip), "%*ph\n", 64, buf);
sd_card_type = ((u16)buf[2] << 8) | buf[3];
dev_dbg(rtsx_dev(chip), "sd_card_type = 0x%04x\n", sd_card_type);
diff --git a/drivers/staging/rts5208/trace.h b/drivers/staging/rts5208/trace.h
index fbb304a54acc..a9ab4077b283 100644
--- a/drivers/staging/rts5208/trace.h
+++ b/drivers/staging/rts5208/trace.h
@@ -84,12 +84,4 @@ static inline char *filename(char *path)
#define TRACE_GOTO(chip, label) goto label
#endif
-#ifdef CONFIG_RTS5208_DEBUG
-#define RTSX_DUMP(buf, buf_len) \
- print_hex_dump(KERN_DEBUG, KBUILD_MODNAME ": ", \
- DUMP_PREFIX_NONE, 16, 1, (buf), (buf_len), false)
-#else
-#define RTSX_DUMP(buf, buf_len)
-#endif
-
#endif /* __REALTEK_RTSX_TRACE_H */
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index f35fa3dfe22c..841facee3bc2 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2455,6 +2455,7 @@ static void slic_entry_remove(struct pci_dev *pcidev)
adapter->allocated = 0;
if (!card->adapters_allocated) {
struct sliccard *curr_card = slic_global.slic_card;
+
if (curr_card == card) {
slic_global.slic_card = card->next;
} else {
@@ -2551,6 +2552,7 @@ static int slic_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case SIOCSLICTRACEDUMP:
{
u32 value;
+
DBG_IOCTL("slic_ioctl SIOCSLIC_TRACE_DUMP\n");
if (copy_from_user(data, rq->ifr_data, 28)) {
diff --git a/drivers/staging/unisys/channels/channel.c b/drivers/staging/unisys/channels/channel.c
index b9bf8e81677c..b4bdee4b575b 100644
--- a/drivers/staging/unisys/channels/channel.c
+++ b/drivers/staging/unisys/channels/channel.c
@@ -73,9 +73,9 @@ visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal)
*/
psignal = (char __iomem *)pqhdr + readq(&pqhdr->oSignalBase) +
(head * readl(&pqhdr->SignalSize));
- MEMCPY_TOIO(psignal, pSignal, readl(&pqhdr->SignalSize));
+ memcpy_toio(psignal, pSignal, readl(&pqhdr->SignalSize));
- VolatileBarrier();
+ mb(); /* channel synch */
writel(head, &pqhdr->Head);
writeq(readq(&pqhdr->NumSignalsSent) + 1, &pqhdr->NumSignalsSent);
@@ -126,9 +126,9 @@ visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal)
/* copy signal from tail location to the area pointed to by pSignal */
psource = (char __iomem *) pqhdr + readq(&pqhdr->oSignalBase) +
(tail * readl(&pqhdr->SignalSize));
- MEMCPY_FROMIO(pSignal, psource, readl(&pqhdr->SignalSize));
+ memcpy_fromio(pSignal, psource, readl(&pqhdr->SignalSize));
- VolatileBarrier();
+ mb(); /* channel synch */
writel(tail, &pqhdr->Tail);
writeq(readq(&pqhdr->NumSignalsReceived) + 1,
@@ -183,10 +183,10 @@ SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal)
psource =
(char *) pqhdr + pqhdr->oSignalBase +
(tail * pqhdr->SignalSize);
- MEMCPY((char *) pSignal + (pqhdr->SignalSize * signalCount),
+ memcpy((char *) pSignal + (pqhdr->SignalSize * signalCount),
psource, pqhdr->SignalSize);
- VolatileBarrier();
+ mb(); /* channel synch */
pqhdr->Tail = tail;
signalCount++;
diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h b/drivers/staging/unisys/common-spar/include/channels/channel.h
index 15a8d6b35dac..2004cfe1890d 100644
--- a/drivers/staging/unisys/common-spar/include/channels/channel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/channel.h
@@ -16,6 +16,8 @@
#ifndef __CHANNEL_H__
#define __CHANNEL_H__
+#include <linux/types.h>
+#include <linux/io.h>
#include <linux/uuid.h>
/*
@@ -30,8 +32,6 @@
*/
#define __SUPERVISOR_CHANNEL_H__
-#include "commontypes.h"
-
#define SIGNATURE_16(A, B) ((A) | (B<<8))
#define SIGNATURE_32(A, B, C, D) \
(SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
@@ -50,6 +50,37 @@
#define ULTRA_CHANNEL_PROTOCOL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L')
+#define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
+ lin, logCtx) \
+ do { \
+ pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d\n", \
+ chName, &chType, field, \
+ &expected, &actual, \
+ fil, lin); \
+ } while (0)
+#define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
+ lin, logCtx) \
+ do { \
+ pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \
+ chName, &chType, field, \
+ (unsigned long)expected, (unsigned long)actual, \
+ fil, lin); \
+ } while (0)
+
+#define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
+ lin, logCtx) \
+ do { \
+ pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \
+ chName, &chType, field, \
+ (unsigned long long)expected, \
+ (unsigned long long)actual, \
+ fil, lin); \
+ } while (0)
+
+#define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
+ LineNumber, Str, args...) \
+ pr_info(Str, ## args)
+
typedef enum {
CHANNELSRV_UNINITIALIZED = 0, /* channel is in an undefined state */
CHANNELSRV_READY = 1 /* channel has been initialized by server */
@@ -157,7 +188,7 @@ ULTRA_CHANNELCLI_STRING(u32 v)
PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \
writel(newstate, &((CHANNEL_HEADER __iomem *) \
(pChan))->CliStateOS); \
- MEMORYBARRIER; \
+ mb(); /* required for channel synch */ \
} while (0)
#define ULTRA_CHANNEL_CLIENT_ACQUIRE_OS(pChan, chanId, logCtx) \
@@ -458,7 +489,7 @@ ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId,
CHANNELCLI_OWNED,
PathName_Last_N_Nodes((u8 *) file, 4), line);
writel(CHANNELCLI_OWNED, &pChan->CliStateOS);
- MEMORYBARRIER;
+ mb(); /* required for channel synch */
}
if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED) {
if (readb(&pChan->CliErrorOS) != 0) {
@@ -502,7 +533,7 @@ ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId,
return 0;
}
writel(CHANNELCLI_BUSY, &pChan->CliStateOS);
- MEMORYBARRIER;
+ mb(); /* required for channel synch */
if (readl(&pChan->CliStateBoot) == CHANNELCLI_BUSY) {
if ((readb(&pChan->CliErrorOS)
& ULTRA_CLIERROROS_THROTTLEMSG_BUSY) == 0) {
@@ -521,7 +552,7 @@ ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId,
}
/* reset busy */
writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS);
- MEMORYBARRIER;
+ mb(); /* required for channel synch */
return 0;
}
if (readb(&pChan->CliErrorOS) != 0) {
diff --git a/drivers/staging/unisys/common-spar/include/channels/controlframework.h b/drivers/staging/unisys/common-spar/include/channels/controlframework.h
index b0a49e0c37a2..fd4726e754ea 100644
--- a/drivers/staging/unisys/common-spar/include/channels/controlframework.h
+++ b/drivers/staging/unisys/common-spar/include/channels/controlframework.h
@@ -25,7 +25,7 @@
#ifndef _CONTROL_FRAMEWORK_H_
#define _CONTROL_FRAMEWORK_H_
-#include "commontypes.h"
+#include <linux/types.h>
#include "channel.h"
#define ULTRA_MEMORY_COUNT_Ki 1024
diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
index 153f57ce908f..d08c198e0de3 100644
--- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h
@@ -17,9 +17,11 @@
#define __CONTROLVMCHANNEL_H__
#include <linux/uuid.h>
-#include "commontypes.h"
#include "channel.h"
#include "controlframework.h"
+
+typedef u64 GUEST_PHYSICAL_ADDRESS;
+
enum { INVALID_GUEST_FIRMWARE, SAMPLE_GUEST_FIRMWARE,
TIANO32_GUEST_FIRMWARE, TIANO64_GUEST_FIRMWARE
};
diff --git a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h
index c01649a985c7..9912e51b89b5 100644
--- a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h
@@ -33,7 +33,7 @@
#ifndef _DIAG_CHANNEL_H_
#define _DIAG_CHANNEL_H_
-#include "commontypes.h"
+#include <linux/uuid.h>
#include "channel.h"
/* {EEA7A573-DB82-447c-8716-EFBEAAAE4858} */
diff --git a/drivers/staging/unisys/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h
index 24e11858e0ee..ed66c27cd491 100644
--- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h
@@ -31,7 +31,6 @@
#include <linux/uuid.h>
-#include "commontypes.h"
#include "vmcallinterface.h"
#define _ULTRA_CONTROLVM_CHANNEL_INLINE_
@@ -711,24 +710,24 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
/* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
/* define offsets to members of struct uiscmdrsp */
-#define OFFSET_CMDTYPE OFFSETOF(struct uiscmdrsp, cmdtype)
-#define OFFSET_SCSI OFFSETOF(struct uiscmdrsp, scsi)
-#define OFFSET_NET OFFSETOF(struct uiscmdrsp, net)
-#define OFFSET_SCSITASKMGMT OFFSETOF(struct uiscmdrsp, scsitaskmgmt)
-#define OFFSET_NEXT OFFSETOF(struct uiscmdrsp, next)
+#define OFFSET_CMDTYPE offsetof(struct uiscmdrsp, cmdtype)
+#define OFFSET_SCSI offsetof(struct uiscmdrsp, scsi)
+#define OFFSET_NET offsetof(struct uiscmdrsp, net)
+#define OFFSET_SCSITASKMGMT offsetof(struct uiscmdrsp, scsitaskmgmt)
+#define OFFSET_NEXT offsetof(struct uiscmdrsp, next)
/* define offsets to members of struct uiscmdrsp_net */
-#define OFFSET_TYPE OFFSETOF(struct uiscmdrsp_net, type)
-#define OFFSET_BUF OFFSETOF(struct uiscmdrsp_net, buf)
-#define OFFSET_XMT OFFSETOF(struct uiscmdrsp_net, xmt)
-#define OFFSET_XMT_DONE_RESULT OFFSETOF(struct uiscmdrsp_net, xmtdone)
-#define OFFSET_RCVPOST OFFSETOF(struct uiscmdrsp_net, rcvpost)
-#define OFFSET_RCV_DONE_LEN OFFSETOF(struct uiscmdrsp_net, rcv)
-#define OFFSET_ENBDIS OFFSETOF(struct uiscmdrsp_net, enbdis)
+#define OFFSET_TYPE offsetof(struct uiscmdrsp_net, type)
+#define OFFSET_BUF offsetof(struct uiscmdrsp_net, buf)
+#define OFFSET_XMT offsetof(struct uiscmdrsp_net, xmt)
+#define OFFSET_XMT_DONE_RESULT offsetof(struct uiscmdrsp_net, xmtdone)
+#define OFFSET_RCVPOST offsetof(struct uiscmdrsp_net, rcvpost)
+#define OFFSET_RCV_DONE_LEN offsetof(struct uiscmdrsp_net, rcv)
+#define OFFSET_ENBDIS offsetof(struct uiscmdrsp_net, enbdis)
/* define offsets to members of struct net_pkt_rcvpost */
-#define OFFSET_TOTALLEN OFFSETOF(struct net_pkt_rcvpost, totallen)
-#define OFFSET_FRAG OFFSETOF(struct net_pkt_rcvpost, frag)
+#define OFFSET_TOTALLEN offsetof(struct net_pkt_rcvpost, totallen)
+#define OFFSET_FRAG offsetof(struct net_pkt_rcvpost, frag)
/*
* INLINE functions for initializing and accessing I/O data channels
@@ -753,7 +752,7 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
do { \
x->cmdQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \
x->cmdQ.oSignalBase = SIZEOF_PROTOCOL - \
- OFFSETOF(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \
+ offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \
x->cmdQ.SignalSize = SIZEOF_CMDRSP; \
x->cmdQ.MaxSignalSlots = \
QSLOTSFROMBYTES(x->ChannelHeader.Size); \
@@ -761,21 +760,21 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
x->rspQ.Size = QSIZEFROMBYTES(x->ChannelHeader.Size); \
x->rspQ.oSignalBase = \
(SIZEOF_PROTOCOL + x->cmdQ.Size) - \
- OFFSETOF(ULTRA_IO_CHANNEL_PROTOCOL, rspQ); \
+ offsetof(ULTRA_IO_CHANNEL_PROTOCOL, rspQ); \
x->rspQ.SignalSize = SIZEOF_CMDRSP; \
x->rspQ.MaxSignalSlots = \
QSLOTSFROMBYTES(x->ChannelHeader.Size); \
x->rspQ.MaxSignals = x->rspQ.MaxSignalSlots - 1; \
x->ChannelHeader.oChannelSpace = \
- OFFSETOF(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \
+ offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ); \
} while (0)
#define INIT_CLIENTSTRING(chan, type, clientStr, clientStrLen) \
do { \
if (clientStr) { \
chan->ChannelHeader.oClientString = \
- OFFSETOF(type, clientString); \
- MEMCPY(chan->clientString, clientStr, \
+ offsetof(type, clientString); \
+ memcpy(chan->clientString, clientStr, \
MINNUM(clientStrLen, \
(u32) (MAX_CLIENTSTRING_LEN - 1))); \
chan->clientString[MINNUM(clientStrLen, \
@@ -846,7 +845,7 @@ static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x,
x->ChannelHeader.Size = COVER(bytes, 4096);
x->ChannelHeader.Type = UltraVnicChannelProtocolGuid;
x->ChannelHeader.ZoneGuid = NULL_UUID_LE;
- MEMCPY(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN);
+ memcpy(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN);
x->vnic.num_rcv_bufs = num_rcv_bufs;
x->vnic.mtu = mtu;
x->vnic.zoneGuid = zoneGuid;
@@ -882,7 +881,7 @@ static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x,
/* returns next non-zero index on success or zero on failure (i.e. out of
* room)
*/
-static INLINE u16
+static inline u16
add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used
* to add entries */
u16 inp_off, /* input - specifies the off to be used
diff --git a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
index 8facb51143ae..1231c454176f 100644
--- a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
@@ -24,7 +24,6 @@
* the client devices and client drivers for the server end to see.
*/
#include <linux/uuid.h>
-#include "commontypes.h"
#include "vbusdeviceinfo.h"
#include "channel.h"
diff --git a/drivers/staging/unisys/common-spar/include/controlvmcompletionstatus.h b/drivers/staging/unisys/common-spar/include/controlvmcompletionstatus.h
index db77d6f626a1..f74f5d8c2820 100644
--- a/drivers/staging/unisys/common-spar/include/controlvmcompletionstatus.h
+++ b/drivers/staging/unisys/common-spar/include/controlvmcompletionstatus.h
@@ -62,14 +62,16 @@
* DEVICE_CREATE,
* DEVICE_DESTROY */
/* Unable to invoke VIRTPCI callback */
-#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605 /* BUS_CREATE,
- * BUS_DESTROY,
- * DEVICE_CREATE,
- * DEVICE_DESTROY */
+#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605
+ /* BUS_CREATE,
+ * BUS_DESTROY,
+ * DEVICE_CREATE,
+ * DEVICE_DESTROY */
/* VIRTPCI Callback returned error */
-#define CONTROLVM_RESP_ERROR_GENERIC_DRIVER_CALLBACK_ERROR 606 /* SWITCH_ATTACHEXTPORT,
- * SWITCH_DETACHEXTPORT
- * DEVICE_CONFIGURE */
+#define CONTROLVM_RESP_ERROR_GENERIC_DRIVER_CALLBACK_ERROR 606
+ /* SWITCH_ATTACHEXTPORT,
+ * SWITCH_DETACHEXTPORT
+ * DEVICE_CONFIGURE */
/* generic device callback returned error */
/* Bus Related------------------------------------------------------[700-799] */
diff --git a/drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h b/drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h
index fe9598c941a6..57dd93e0cc83 100644
--- a/drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h
+++ b/drivers/staging/unisys/common-spar/include/iovmcall_gnuc.h
@@ -19,16 +19,14 @@ __unisys_vmcall_gnuc(unsigned long tuple, unsigned long reg_ebx,
unsigned long reg_ecx)
{
unsigned long result = 0;
-
unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
+
cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
- if (cpuid_ecx & 0x80000000) {
- __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
- "a"(tuple), "b"(reg_ebx), "c"(reg_ecx)
- );
- } else {
- result = -1;
- }
+ if (!(cpuid_ecx & 0x80000000))
+ return -1;
+
+ __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
+ "a"(tuple), "b"(reg_ebx), "c"(reg_ecx));
return result;
}
@@ -39,15 +37,13 @@ __unisys_extended_vmcall_gnuc(unsigned long long tuple,
unsigned long long reg_edx)
{
unsigned long result = 0;
-
unsigned int cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
+
cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx);
- if (cpuid_ecx & 0x80000000) {
- __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
- "a"(tuple), "b"(reg_ebx), "c"(reg_ecx),
- "d"(reg_edx));
- } else {
- result = -1;
- }
+ if (!(cpuid_ecx & 0x80000000))
+ return -1;
+
+ __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) :
+ "a"(tuple), "b"(reg_ebx), "c"(reg_ecx), "d"(reg_edx));
return result;
- }
+}
diff --git a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
index 5e0d98cd422e..3bbdc2bb7ebf 100644
--- a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
@@ -16,7 +16,7 @@
#ifndef __VBUSDEVICEINFO_H__
#define __VBUSDEVICEINFO_H__
-#include "commontypes.h"
+#include <linux/types.h>
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
@@ -54,6 +54,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, int srcmax)
{
int chars = 0;
int nonprintable_streak = 0;
+
while (srcmax > 0) {
if ((*src >= ' ') && (*src < 0x7f)) {
if (nonprintable_streak) {
diff --git a/drivers/staging/unisys/include/commontypes.h b/drivers/staging/unisys/include/commontypes.h
deleted file mode 100644
index 4311e9f6200f..000000000000
--- a/drivers/staging/unisys/include/commontypes.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT. See the GNU General Public License for more
- * details.
- */
-
-#ifndef _COMMONTYPES_H_
-#define _COMMONTYPES_H_
-
-/* define the following to prevent include nesting in kernel header files of
- * similar abbreviated content */
-#define _SUPERVISOR_COMMONTYPES_H_
-
-#include <linux/types.h>
-#include <linux/version.h>
-#include <linux/io.h>
-#include <linux/uuid.h>
-
-typedef u64 GUEST_PHYSICAL_ADDRESS;
-
-#define INLINE inline
-#define OFFSETOF offsetof
-
-#define MEMORYBARRIER mb()
-#define MEMCPY(dest, src, len) memcpy(dest, src, len)
-#define MEMCPY_TOIO(dest, src, len) memcpy_toio(dest, src, len)
-#define MEMCPY_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
-
-#define CHANNEL_GUID_MISMATCH(chType, chName, field, expected, actual, fil, \
- lin, logCtx) \
- do { \
- pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=%pUL actual=%pUL @%s:%d\n", \
- chName, &chType, field, \
- &expected, &actual, \
- fil, lin); \
- } while (0)
-#define CHANNEL_U32_MISMATCH(chType, chName, field, expected, actual, fil, \
- lin, logCtx) \
- do { \
- pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8lx actual=0x%-8.8lx @%s:%d\n", \
- chName, &chType, field, \
- (unsigned long)expected, (unsigned long)actual, \
- fil, lin); \
- } while (0)
-
-#define CHANNEL_U64_MISMATCH(chType, chName, field, expected, actual, fil, \
- lin, logCtx) \
- do { \
- pr_err("Channel mismatch on channel=%s(%pUL) field=%s expected=0x%-8.8Lx actual=0x%-8.8Lx @%s:%d\n", \
- chName, &chType, field, \
- (unsigned long long)expected, \
- (unsigned long long)actual, \
- fil, lin); \
- } while (0)
-
-#define UltraLogEvent(logCtx, EventId, Severity, SubsystemMask, pFunctionName, \
- LineNumber, Str, args...) \
- pr_info(Str, ## args)
-
-#define VolatileBarrier() MEMORYBARRIER
-
-#endif
-
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h
index ecf1a6fac7a1..e5e4ecd96495 100644
--- a/drivers/staging/unisys/include/timskmod.h
+++ b/drivers/staging/unisys/include/timskmod.h
@@ -62,8 +62,6 @@
#if !defined SUCCESS
#define SUCCESS 0
#endif
-#define FAILURE (-1)
-#define DRIVERNAMEMAX 50
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define STRUCTSEQUAL(x, y) (memcmp(&x, &y, sizeof(x)) == 0)
@@ -71,57 +69,6 @@
#define HOSTADDRESS unsigned long long
#endif
-typedef long VMMIO; /**< Virtual MMIO address (returned from ioremap), which
- * is a virtual address pointer to a memory-mapped region.
- * These are declared as "long" instead of u32* to force you to
- * use readb()/writeb()/memcpy_fromio()/etc to access them.
- * (On x86 we could probably get away with treating them as
- * pointers.)
- */
-typedef long VMMIO8; /**< #VMMIO pointing to 8-bit data */
-typedef long VMMIO16;/**< #VMMIO pointing to 16-bit data */
-typedef long VMMIO32;/**< #VMMIO pointing to 32-bit data */
-
-#define LOCKSEM(sem) down_interruptible(sem)
-#define LOCKSEM_UNINTERRUPTIBLE(sem) down(sem)
-#define UNLOCKSEM(sem) up(sem)
-
-/** lock read/write semaphore for reading.
- Note that all read/write semaphores are of the "uninterruptible" variety.
- @param sem (rw_semaphore *) points to semaphore to lock
- */
-#define LOCKREADSEM(sem) down_read(sem)
-
-/** unlock read/write semaphore for reading.
- Note that all read/write semaphores are of the "uninterruptible" variety.
- @param sem (rw_semaphore *) points to semaphore to unlock
- */
-#define UNLOCKREADSEM(sem) up_read(sem)
-
-/** lock read/write semaphore for writing.
- Note that all read/write semaphores are of the "uninterruptible" variety.
- @param sem (rw_semaphore *) points to semaphore to lock
- */
-#define LOCKWRITESEM(sem) down_write(sem)
-
-/** unlock read/write semaphore for writing.
- Note that all read/write semaphores are of the "uninterruptible" variety.
- @param sem (rw_semaphore *) points to semaphore to unlock
- */
-#define UNLOCKWRITESEM(sem) up_write(sem)
-
-#ifdef ENABLE_RETURN_TRACE
-#define RETTRACE(x) \
- do { \
- if (1) { \
- INFODRV("RET 0x%lx in %s", \
- (ulong)(x), __func__); \
- } \
- } while (0)
-#else
-#define RETTRACE(x)
-#endif
-
/** Try to evaulate the provided expression, and do a RETINT(x) iff
* the expression evaluates to < 0.
* @param x the expression to try
@@ -304,6 +251,7 @@ static inline struct cdev *cdev_alloc_init(struct module *owner,
const struct file_operations *fops)
{
struct cdev *cdev = NULL;
+
cdev = cdev_alloc();
if (!cdev)
return NULL;
diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h
index a2abfa8c82fd..8983407592a9 100644
--- a/drivers/staging/unisys/include/uisqueue.h
+++ b/drivers/staging/unisys/include/uisqueue.h
@@ -423,19 +423,4 @@ struct guest_msgs {
};
-#ifndef __xg
-#define __xg(x) ((volatile long *)(x))
-#endif
-
-/*
-* Below code is a copy of Linux kernel's cmpxchg function located at
-* this place
-* http://tcsxeon:8080/source/xref/00trunk-AppOS-linux/include/asm-x86/cmpxchg_64.h#84
-* Reason for creating our own version of cmpxchg along with
-* UISLIB_LOCK_PREFIX is to make the operation atomic even for non SMP
-* guests.
-*/
-
-#define uislibcmpxchg64(p, o, n, s) cmpxchg(p, o, n)
-
#endif /* __UISQUEUE_H__ */
diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h
index a1c193c5827e..f1a1b0d2c899 100644
--- a/drivers/staging/unisys/include/uisutils.h
+++ b/drivers/staging/unisys/include/uisutils.h
@@ -84,6 +84,7 @@ static inline void __iomem *
dbg_ioremap_cache(u64 addr, unsigned long size, char *file, int line)
{
void __iomem *new;
+
new = ioremap_cache(addr, size);
return new;
}
@@ -94,6 +95,7 @@ static inline void *
dbg_ioremap(u64 addr, unsigned long size, char *file, int line)
{
void *new;
+
new = ioremap(addr, size);
return new;
}
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c
index 63c91cd6fdcc..4cb3487b58df 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -25,7 +25,8 @@
#include <linux/module.h>
#include <linux/debugfs.h>
-#include "commontypes.h"
+#include <linux/types.h>
+#include <linux/uuid.h>
#include <linux/version.h>
#include "uniklog.h"
@@ -1361,18 +1362,18 @@ Process_Incoming(void *v)
struct device_info *dev = NULL;
/* poll each channel for input */
- LOCKSEM_UNINTERRUPTIBLE(&Lock_Polling_Device_Channels);
+ down(&Lock_Polling_Device_Channels);
new_tail = NULL;
list_for_each_safe(lelt, tmp, &List_Polling_Device_Channels) {
int rc = 0;
dev = list_entry(lelt, struct device_info,
list_polling_device_channels);
- LOCKSEM_UNINTERRUPTIBLE(&dev->interrupt_callback_lock);
+ down(&dev->interrupt_callback_lock);
if (dev->interrupt)
rc = dev->interrupt(dev->interrupt_context);
else
continue;
- UNLOCKSEM(&dev->interrupt_callback_lock);
+ up(&dev->interrupt_callback_lock);
if (rc) {
/* dev->interrupt returned, but there
* is still more work to do.
@@ -1399,7 +1400,7 @@ Process_Incoming(void *v)
tot_moved_to_tail_cnt++;
list_move_tail(new_tail, &List_Polling_Device_Channels);
}
- UNLOCKSEM(&Lock_Polling_Device_Channels);
+ up(&Lock_Polling_Device_Channels);
cur_cycles = get_cycles();
delta_cycles = cur_cycles - old_cycles;
old_cycles = cur_cycles;
@@ -1469,14 +1470,14 @@ uislib_enable_channel_interrupts(u32 busNo, u32 devNo,
(int) (devNo));
return;
}
- LOCKSEM_UNINTERRUPTIBLE(&Lock_Polling_Device_Channels);
+ down(&Lock_Polling_Device_Channels);
Initialize_incoming_thread();
dev->interrupt = interrupt;
dev->interrupt_context = interrupt_context;
dev->polling = TRUE;
list_add_tail(&(dev->list_polling_device_channels),
&List_Polling_Device_Channels);
- UNLOCKSEM(&Lock_Polling_Device_Channels);
+ up(&Lock_Polling_Device_Channels);
}
EXPORT_SYMBOL_GPL(uislib_enable_channel_interrupts);
@@ -1493,11 +1494,11 @@ uislib_disable_channel_interrupts(u32 busNo, u32 devNo)
(int) (devNo));
return;
}
- LOCKSEM_UNINTERRUPTIBLE(&Lock_Polling_Device_Channels);
+ down(&Lock_Polling_Device_Channels);
list_del(&dev->list_polling_device_channels);
dev->polling = FALSE;
dev->interrupt = NULL;
- UNLOCKSEM(&Lock_Polling_Device_Channels);
+ up(&Lock_Polling_Device_Channels);
}
EXPORT_SYMBOL_GPL(uislib_disable_channel_interrupts);
diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c
index 84eafca5e45c..f52bca1d95b1 100644
--- a/drivers/staging/unisys/uislib/uisqueue.c
+++ b/drivers/staging/unisys/uislib/uisqueue.c
@@ -43,8 +43,7 @@ uisqueue_InterlockedOr(unsigned long long __iomem *Target,
j = readq(Target);
do {
i = j;
- j = uislibcmpxchg64((__force unsigned long long *)Target,
- i, i | Set, sizeof(*(Target)));
+ j = cmpxchg((__force unsigned long long *)Target, i, i | Set);
} while (i != j);
@@ -62,8 +61,7 @@ uisqueue_InterlockedAnd(unsigned long long __iomem *Target,
j = readq(Target);
do {
i = j;
- j = uislibcmpxchg64((__force unsigned long long *)Target,
- i, i & Set, sizeof(*(Target)));
+ j = cmpxchg((__force unsigned long long *)Target, i, i & Set);
} while (i != j);
diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c
index ee26e009b400..423cbc4b72f9 100644
--- a/drivers/staging/unisys/uislib/uisutils.c
+++ b/drivers/staging/unisys/uislib/uisutils.c
@@ -17,7 +17,8 @@
#include <linux/string.h>
#include <linux/slab.h>
-#include <commontypes.h>
+#include <linux/types.h>
+#include <linux/uuid.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include "uniklog.h"
@@ -117,6 +118,7 @@ uisctrl_register_req_handler_ex(uuid_le switchTypeGuid,
{
ReqHandlerInfo_t *pReqHandlerInfo;
int rc = 0; /* assume failure */
+
LOGINF("type=%pUL, controlfunc=0x%p.\n",
&switchTypeGuid, controlfunc);
if (!controlfunc) {
@@ -161,6 +163,7 @@ int
uisctrl_unregister_req_handler_ex(uuid_le switchTypeGuid)
{
int rc = 0; /* assume failure */
+
LOGINF("type=%pUL.\n", &switchTypeGuid);
if (ReqHandlerDel(switchTypeGuid) < 0) {
LOGERR("failed to remove %pUL from server list\n",
@@ -249,6 +252,7 @@ uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx, void *skb_in,
if (skb_shinfo(skb)->frag_list) {
struct sk_buff *skbinlist;
int c;
+
for (skbinlist = skb_shinfo(skb)->frag_list; skbinlist;
skbinlist = skbinlist->next) {
@@ -306,6 +310,7 @@ ReqHandlerFind(uuid_le switchTypeGuid)
{
struct list_head *lelt, *tmp;
ReqHandlerInfo_t *entry = NULL;
+
spin_lock(&ReqHandlerInfo_list_lock);
list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) {
entry = list_entry(lelt, ReqHandlerInfo_t, list_link);
@@ -324,6 +329,7 @@ ReqHandlerDel(uuid_le switchTypeGuid)
struct list_head *lelt, *tmp;
ReqHandlerInfo_t *entry = NULL;
int rc = -1;
+
spin_lock(&ReqHandlerInfo_list_lock);
list_for_each_safe(lelt, tmp, &ReqHandlerInfo_list) {
entry = list_entry(lelt, ReqHandlerInfo_t, list_link);
diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
index d9443a968ddf..261a52f20ba7 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -24,9 +24,11 @@
#include "uniklog.h"
#include "diagnostics/appos_subsystems.h"
#include "uisutils.h"
-#include "commontypes.h"
#include "vbuschannel.h"
#include "vbushelper.h"
+#include <linux/types.h>
+#include <linux/io.h>
+#include <linux/uuid.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h b/drivers/staging/unisys/visorchannel/visorchannel.h
index aa17a842381b..9a4d7b6755d1 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel.h
+++ b/drivers/staging/unisys/visorchannel/visorchannel.h
@@ -20,7 +20,6 @@
#include <linux/uuid.h>
-#include "commontypes.h"
#include "memregion.h"
#include "channel.h"
#ifndef HOSTADDRESS
diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index 62ec9280cb3a..947b23c1e478 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -424,7 +424,7 @@ visorchannel_signalremove(VISORCHANNEL *channel, u32 queue, void *msg)
/* For each data field in SIGNAL_QUEUE_HEADER that was modified,
* update host memory.
*/
- MEMORYBARRIER;
+ mb(); /* required for channel synch */
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Tail)) {
ERRDRV("visor_memregion_write of Tail failed: (status=%d)\n",
rc);
@@ -477,7 +477,7 @@ visorchannel_signalinsert(VISORCHANNEL *channel, u32 queue, void *msg)
/* For each data field in SIGNAL_QUEUE_HEADER that was modified,
* update host memory.
*/
- MEMORYBARRIER;
+ mb(); /* required for channel synch */
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, Head)) {
ERRDRV("visor_memregion_write of Head failed: (status=%d)\n",
rc);
diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c
index bf2e546d76bf..2f26de2fa8a4 100644
--- a/drivers/staging/unisys/visorchipset/file.c
+++ b/drivers/staging/unisys/visorchipset/file.c
@@ -28,6 +28,8 @@
#define CURRENT_FILE_PC VISOR_CHIPSET_PC_file_c
+typedef u64 GUEST_PHYSICAL_ADDRESS;
+
static struct cdev Cdev;
static VISORCHANNEL **PControlVm_channel;
static dev_t MajorDev = -1; /**< indicates major num for device */
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index fe3c0127d255..e860512f1100 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -594,7 +594,7 @@ visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers,
VISORCHIPSET_BUSDEV_RESPONDERS *responders,
ULTRA_VBUS_DEVICEINFO *driverInfo)
{
- LOCKSEM_UNINTERRUPTIBLE(&NotifierLock);
+ down(&NotifierLock);
if (notifiers == NULL) {
memset(&BusDev_Server_Notifiers, 0,
sizeof(BusDev_Server_Notifiers));
@@ -609,7 +609,7 @@ visorchipset_register_busdev_server(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers,
BusDeviceInfo_Init(driverInfo, "chipset", "visorchipset",
VERSION, NULL);
- UNLOCKSEM(&NotifierLock);
+ up(&NotifierLock);
}
EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server);
@@ -618,7 +618,7 @@ visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers,
VISORCHIPSET_BUSDEV_RESPONDERS *responders,
ULTRA_VBUS_DEVICEINFO *driverInfo)
{
- LOCKSEM_UNINTERRUPTIBLE(&NotifierLock);
+ down(&NotifierLock);
if (notifiers == NULL) {
memset(&BusDev_Client_Notifiers, 0,
sizeof(BusDev_Client_Notifiers));
@@ -632,7 +632,7 @@ visorchipset_register_busdev_client(VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers,
if (driverInfo)
BusDeviceInfo_Init(driverInfo, "chipset(bolts)", "visorchipset",
VERSION, NULL);
- UNLOCKSEM(&NotifierLock);
+ up(&NotifierLock);
}
EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client);
@@ -944,7 +944,7 @@ bus_epilog(u32 busNo,
} else
pBusInfo->pendingMsgHdr.Id = CONTROLVM_INVALID;
- LOCKSEM_UNINTERRUPTIBLE(&NotifierLock);
+ down(&NotifierLock);
if (response == CONTROLVM_RESP_SUCCESS) {
switch (cmd) {
case CONTROLVM_BUS_CREATE:
@@ -989,7 +989,7 @@ bus_epilog(u32 busNo,
;
else
bus_responder(cmd, busNo, response);
- UNLOCKSEM(&NotifierLock);
+ up(&NotifierLock);
}
static void
@@ -1021,7 +1021,7 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd,
} else
pDevInfo->pendingMsgHdr.Id = CONTROLVM_INVALID;
- LOCKSEM_UNINTERRUPTIBLE(&NotifierLock);
+ down(&NotifierLock);
if (response >= 0) {
switch (cmd) {
case CONTROLVM_DEVICE_CREATE:
@@ -1087,7 +1087,7 @@ device_epilog(u32 busNo, u32 devNo, ULTRA_SEGMENT_STATE state, u32 cmd,
;
else
device_responder(cmd, busNo, devNo, response);
- UNLOCKSEM(&NotifierLock);
+ up(&NotifierLock);
}
static void
diff --git a/drivers/staging/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c
index 96b0d61623e4..7d2c6472ec9a 100644
--- a/drivers/staging/vt6655/80211mgr.c
+++ b/drivers/staging/vt6655/80211mgr.c
@@ -63,10 +63,6 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-
-static int msglevel = MSG_LEVEL_INFO;
-/* static int msglevel =MSG_LEVEL_DEBUG; */
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -91,7 +87,7 @@ vMgrEncodeBeacon(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
@@ -125,7 +121,7 @@ vMgrDecodeBeacon(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_BEACON_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
@@ -218,9 +214,8 @@ vMgrDecodeBeacon(
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Unrecognized EID=%dd in beacon decode.\n",
- pItem->byElementID);
+ pr_debug("Unrecognized EID=%dd in beacon decode\n",
+ pItem->byElementID);
break;
}
@@ -406,9 +401,8 @@ vMgrDecodeAssocRequest(
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Unrecognized EID=%dd in assocreq decode.\n",
- pItem->byElementID);
+ pr_debug("Unrecognized EID=%dd in assocreq decode\n",
+ pItem->byElementID);
break;
}
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
@@ -489,9 +483,7 @@ vMgrDecodeAssocResponse(
if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
(pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "pFrame->pExtSuppRates=[%p].\n",
- pItem);
+ pr_debug("pFrame->pExtSuppRates=[%p]\n", pItem);
} else {
pFrame->pExtSuppRates = NULL;
}
@@ -594,9 +586,8 @@ vMgrDecodeReassocRequest(
(PWLAN_IE_SUPP_RATES)pItem;
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Unrecognized EID=%dd in reassocreq decode.\n",
- pItem->byElementID);
+ pr_debug("Unrecognized EID=%dd in reassocreq decode\n",
+ pItem->byElementID);
break;
}
pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
@@ -666,9 +657,8 @@ vMgrDecodeProbeRequest(
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Bad EID=%dd in probereq\n",
- pItem->byElementID);
+ pr_debug("Bad EID=%dd in probereq\n",
+ pItem->byElementID);
break;
}
@@ -695,7 +685,7 @@ vMgrEncodeProbeResponse(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
@@ -730,7 +720,7 @@ vMgrDecodeProbeResponse(
pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
/* Fixed Fields */
- pFrame->pqwTimestamp = (PQWORD)
+ pFrame->pqwTimestamp = (__le64 *)
(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) +
WLAN_PROBERESP_OFF_TS);
pFrame->pwBeaconInterval = (unsigned short *)
@@ -819,9 +809,8 @@ vMgrDecodeProbeResponse(
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Bad EID=%dd in proberesp\n",
- pItem->byElementID);
+ pr_debug("Bad EID=%dd in proberesp\n",
+ pItem->byElementID);
break;
}
diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h
index 8b126bbd9fa5..94fb93d54bfd 100644
--- a/drivers/staging/vt6655/80211mgr.h
+++ b/drivers/staging/vt6655/80211mgr.h
@@ -31,6 +31,8 @@
#ifndef __80211MGR_H__
#define __80211MGR_H__
+#include <linux/types.h>
+
#include "ttype.h"
#include "80211hdr.h"
@@ -464,7 +466,7 @@ typedef struct tagWLAN_FR_BEACON {
unsigned int len;
unsigned char *pBuf;
PUWLAN_80211HDR pHdr;
- PQWORD pqwTimestamp;
+ __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID;
@@ -577,7 +579,7 @@ typedef struct tagWLAN_FR_PROBERESP {
unsigned int len;
unsigned char *pBuf;
PUWLAN_80211HDR pHdr;
- PQWORD pqwTimestamp;
+ __le64 *pqwTimestamp;
unsigned short *pwBeaconInterval;
unsigned short *pwCapInfo;
PWLAN_IE_SSID pSSID;
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index f212b88c8cec..c1025ff542ed 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -56,10 +56,6 @@
#include "srom.h"
#include "rf.h"
-/*--------------------- Static Definitions -------------------------*/
-/* static int msglevel =MSG_LEVEL_DEBUG; */
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -1711,18 +1707,18 @@ static const unsigned short awcFrameTime[MAX_RATE] =
static
unsigned long
-s_ulGetRatio(PSDevice pDevice);
+s_ulGetRatio(struct vnt_private *pDevice);
static
void
s_vChangeAntenna(
- PSDevice pDevice
+ struct vnt_private *pDevice
);
static
void
s_vChangeAntenna(
- PSDevice pDevice
+ struct vnt_private *pDevice
)
{
if (pDevice->dwRxAntennaSel == 0) {
@@ -1827,7 +1823,7 @@ BBuGetFrameTime(
*/
void
BBvCalculateParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int cbFrameLength,
unsigned short wRate,
unsigned char byPacketType,
@@ -2009,7 +2005,7 @@ bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x30);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x30)\n");
+ pr_debug(" DBG_PORT80(0x30)\n");
return false;
}
return true;
@@ -2050,7 +2046,7 @@ bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned c
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x31);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x31)\n");
+ pr_debug(" DBG_PORT80(0x31)\n");
return false;
}
return true;
@@ -2115,7 +2111,7 @@ bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch
*
*/
-bool BBbVT3253Init(PSDevice pDevice)
+bool BBbVT3253Init(struct vnt_private *pDevice)
{
bool bResult = true;
int ii;
@@ -2310,7 +2306,7 @@ void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs)
*
*/
-void BBvLoopbackOn(PSDevice pDevice)
+void BBvLoopbackOn(struct vnt_private *pDevice)
{
unsigned char byData;
void __iomem *dwIoBase = pDevice->PortOffset;
@@ -2363,7 +2359,7 @@ void BBvLoopbackOn(PSDevice pDevice)
* Return Value: none
*
*/
-void BBvLoopbackOff(PSDevice pDevice)
+void BBvLoopbackOff(struct vnt_private *pDevice)
{
unsigned char byData;
void __iomem *dwIoBase = pDevice->PortOffset;
@@ -2398,7 +2394,7 @@ void BBvLoopbackOff(PSDevice pDevice)
*
*/
void
-BBvSetShortSlotTime(PSDevice pDevice)
+BBvSetShortSlotTime(struct vnt_private *pDevice)
{
unsigned char byBBRxConf = 0;
unsigned char byBBVGA = 0;
@@ -2418,7 +2414,7 @@ BBvSetShortSlotTime(PSDevice pDevice)
BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf); /* CR10 */
}
-void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData)
+void BBvSetVGAGainOffset(struct vnt_private *pDevice, unsigned char byData)
{
unsigned char byBBRxConf = 0;
@@ -2594,7 +2590,7 @@ BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID)
static
unsigned long
-s_ulGetRatio(PSDevice pDevice)
+s_ulGetRatio(struct vnt_private *pDevice)
{
unsigned long ulRatio = 0;
unsigned long ulMaxPacket;
@@ -2689,7 +2685,7 @@ s_ulGetRatio(PSDevice pDevice)
}
void
-BBvClearAntDivSQ3Value(PSDevice pDevice)
+BBvClearAntDivSQ3Value(struct vnt_private *pDevice)
{
unsigned int ii;
@@ -2713,8 +2709,8 @@ BBvClearAntDivSQ3Value(PSDevice pDevice)
*
*/
-void
-BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3)
+void BBvAntennaDiversity(struct vnt_private *pDevice,
+ unsigned char byRxRate, unsigned char bySQ3)
{
if ((byRxRate >= MAX_RATE) || (pDevice->wAntDiversityMaxRate >= MAX_RATE))
return;
@@ -2725,18 +2721,22 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ
if (pDevice->byAntennaState == 0) {
if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ulDiversityNValue=[%d],54M-[%d]\n",
- (int)pDevice->ulDiversityNValue, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]);
+ pr_debug("ulDiversityNValue=[%d],54M-[%d]\n",
+ (int)pDevice->ulDiversityNValue,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]);
if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) {
pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0);
+ pr_debug("SQ3_State0, rate = [%08x]\n",
+ (int)pDevice->ulRatio_State0);
if (pDevice->byTMax == 0)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1.[%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ pr_debug("1.[%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0,
+ (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate],
+ (int)pDevice->uDiversityCnt);
s_vChangeAntenna(pDevice);
pDevice->byAntennaState = 1;
@@ -2758,14 +2758,17 @@ BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ
del_timer(&pDevice->TimerSQ3Tmax1);
pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1);
+ pr_debug("RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n",
+ (int)pDevice->ulRatio_State0,
+ (int)pDevice->ulRatio_State1);
if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
- (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ pr_debug("2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0,
+ (int)pDevice->ulRatio_State1,
+ (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate],
+ (int)pDevice->uDiversityCnt);
s_vChangeAntenna(pDevice);
pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
@@ -2798,12 +2801,14 @@ TimerSQ3CallBack(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TimerSQ3CallBack...");
+ pr_debug("TimerSQ3CallBack...\n");
spin_lock_irq(&pDevice->lock);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.[%08x][%08x], %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt);
+ pr_debug("3.[%08x][%08x], %d\n",
+ (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
+ (int)pDevice->uDiversityCnt);
s_vChangeAntenna(pDevice);
pDevice->byAntennaState = 0;
@@ -2840,9 +2845,9 @@ TimerState1CallBack(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TimerState1CallBack...");
+ pr_debug("TimerState1CallBack...\n");
spin_lock_irq(&pDevice->lock);
if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) {
@@ -2853,14 +2858,17 @@ TimerState1CallBack(
add_timer(&pDevice->TimerSQ3Tmax2);
} else {
pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State1, rate0 = %08x,rate1 = %08x\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1);
+ pr_debug("SQ3_State1, rate0 = %08x,rate1 = %08x\n",
+ (int)pDevice->ulRatio_State0,
+ (int)pDevice->ulRatio_State1);
if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
- (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ pr_debug("2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0,
+ (int)pDevice->ulRatio_State1,
+ (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate],
+ (int)pDevice->uDiversityCnt);
s_vChangeAntenna(pDevice);
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index fcf1f9373672..6b4388504f5c 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -78,7 +78,7 @@ BBuGetFrameTime(
void
BBvCalculateParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int cbFrameLength,
unsigned short wRate,
unsigned char byPacketType,
@@ -91,15 +91,15 @@ bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch
bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData);
void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs);
-void BBvLoopbackOn(PSDevice pDevice);
-void BBvLoopbackOff(PSDevice pDevice);
-void BBvSetShortSlotTime(PSDevice pDevice);
+void BBvLoopbackOn(struct vnt_private *pDevice);
+void BBvLoopbackOff(struct vnt_private *pDevice);
+void BBvSetShortSlotTime(struct vnt_private *pDevice);
bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
-void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData);
+void BBvSetVGAGainOffset(struct vnt_private *pDevice, unsigned char byData);
// VT3253 Baseband
-bool BBbVT3253Init(PSDevice pDevice);
+bool BBbVT3253Init(struct vnt_private *pDevice);
void BBvSoftwareReset(void __iomem *dwIoBase);
void BBvPowerSaveModeON(void __iomem *dwIoBase);
void BBvPowerSaveModeOFF(void __iomem *dwIoBase);
@@ -120,8 +120,9 @@ TimerState1CallBack(
void *hDeviceContext
);
-void BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3);
+void BBvAntennaDiversity(struct vnt_private *pDevice,
+ unsigned char byRxRate, unsigned char bySQ3);
void
-BBvClearAntDivSQ3Value(PSDevice pDevice);
+BBvClearAntDivSQ3Value(struct vnt_private *pDevice);
#endif // __BASEBAND_H__
diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
index 9569f43a3ed7..996d3302ce3d 100644
--- a/drivers/staging/vt6655/bssdb.c
+++ b/drivers/staging/vt6655/bssdb.c
@@ -63,8 +63,6 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
static const unsigned short awHWRetry0[5][5] = {
{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
@@ -117,7 +115,7 @@ BSSpSearchBSSList(
CARD_PHY_TYPE ePhyType
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned char *pbyBSSID = NULL;
PWLAN_IE_SSID pSSID = NULL;
@@ -127,8 +125,7 @@ BSSpSearchBSSList(
unsigned int ii = 0;
if (pbyDesireBSSID != NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
+ pr_debug("BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
pbyBSSID = pbyDesireBSSID;
@@ -194,7 +191,9 @@ BSSpSearchBSSList(
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
) {
/* Type not match skip this BSS */
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSS type mismatch.... Config[%d] BSS[0x%04x]\n", pMgmt->eConfigMode, pCurrBSS->wCapInfo);
+ pr_debug("BSS type mismatch.... Config[%d] BSS[0x%04x]\n",
+ pMgmt->eConfigMode,
+ pCurrBSS->wCapInfo);
continue;
}
@@ -202,7 +201,9 @@ BSSpSearchBSSList(
if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) {
/* PhyType not match skip this BSS */
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
+ pr_debug("Physical type mismatch.... ePhyType[%d] BSS[%d]\n",
+ ePhyType,
+ pCurrBSS->eNetworkTypeInUse);
continue;
}
}
@@ -240,7 +241,7 @@ BSSvClearBSSList(
bool bKeepCurrBSSID
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
@@ -280,7 +281,7 @@ BSSpAddrIsInBSSList(
PWLAN_IE_SSID pSSID
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PKnownBSS pBSSList = NULL;
unsigned int ii;
@@ -316,7 +317,7 @@ bool
BSSbInsertToBSSList(
void *hDeviceContext,
unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
@@ -333,7 +334,7 @@ BSSbInsertToBSSList(
void *pRxPacketContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
PKnownBSS pBSSList = NULL;
@@ -350,14 +351,13 @@ BSSbInsertToBSSList(
}
if (ii == MAX_BSS_NUM) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get free KnowBSS node failed.\n");
+ pr_debug("Get free KnowBSS node failed\n");
return false;
}
/* save the BSS info */
pBSSList->bActive = true;
memcpy(pBSSList->abyBSSID, abyBSSIDAddr, WLAN_BSSID_LEN);
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
+ pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0;
@@ -376,7 +376,8 @@ BSSbInsertToBSSList(
if (pExtSuppRates->len > WLAN_RATES_MAXLEN)
pExtSuppRates->len = WLAN_RATES_MAXLEN;
memcpy(pBSSList->abyExtSuppRates, pExtSuppRates, pExtSuppRates->len + WLAN_IEHDR_LEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSbInsertToBSSList: pExtSuppRates->len = %d\n", pExtSuppRates->len);
+ pr_debug("BSSbInsertToBSSList: pExtSuppRates->len = %d\n",
+ pExtSuppRates->len);
} else {
memset(pBSSList->abyExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
@@ -521,7 +522,7 @@ BSSbInsertToBSSList(
bool
BSSbUpdateToBSSList(
void *hDeviceContext,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
@@ -541,7 +542,7 @@ BSSbUpdateToBSSList(
)
{
int ii;
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
long ldBm;
@@ -551,8 +552,7 @@ BSSbUpdateToBSSList(
if (pBSSList == NULL)
return false;
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
+ pBSSList->qwBSSTimestamp = le64_to_cpu(qwTimestamp);
pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
pBSSList->uClearCount = 0;
@@ -717,7 +717,7 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr,
void
BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
unsigned int BigestCount = 0;
@@ -742,7 +742,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
/* if not found replace uInActiveCount is largest one */
if (ii == (MAX_NODE_NUM + 1)) {
*puNodeIndex = SelectIndex;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
+ pr_info("Replace inactive node = %d\n", SelectIndex);
/* clear ps buffer */
if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
@@ -759,7 +759,7 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue);
pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0;
pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii);
+ pr_debug("Create node index = %d\n", ii);
return;
};
@@ -779,7 +779,7 @@ BSSvRemoveOneNode(
unsigned int uNodeIndex
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
struct sk_buff *skb;
@@ -812,7 +812,7 @@ BSSvUpdateAPNode(
PWLAN_IE_SUPP_RATES pExtSuppRates
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uRateLen = WLAN_RATES_MAXLEN;
@@ -844,7 +844,8 @@ BSSvUpdateAPNode(
netdev_dbg(pDevice->dev, "BSSvUpdateAPNode:MaxSuppRate is %d\n",
pMgmt->sNodeDBTable[0].wMaxSuppRate);
/* auto rate fallback function initiation */
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
+ pr_debug("pMgmt->sNodeDBTable[0].wTxDataRate = %d\n",
+ pMgmt->sNodeDBTable[0].wTxDataRate);
};
/*+
@@ -863,7 +864,7 @@ BSSvAddMulticastNode(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
if (!pDevice->bEnableHostWEP)
@@ -906,7 +907,7 @@ BSSvSecondCallBack(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
PWLAN_IE_SSID pItemSSID, pCurrSSID;
@@ -961,8 +962,8 @@ BSSvSecondCallBack(
if (ii > 0) {
if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) {
BSSvRemoveOneNode(pDevice, ii);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii);
+ pr_debug("Inactive timeout [%d] sec, STA index = [%d] remove\n",
+ MAX_INACTIVE_COUNT, ii);
continue;
}
@@ -1012,11 +1013,13 @@ BSSvSecondCallBack(
/* check if pending PS queue */
if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending\n",
- ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
+ pr_debug("Index= %d, Queue = %d pending\n",
+ ii,
+ pMgmt->sNodeDBTable[ii].wEnQueueCnt);
if ((ii > 0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) {
BSSvRemoveOneNode(pDevice, ii);
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove\n", ii);
+ pr_info("Pending many queues PS STA Index = %d remove\n",
+ ii);
continue;
}
}
@@ -1100,7 +1103,8 @@ BSSvSecondCallBack(
netif_stop_queue(pDevice->dev);
pDevice->bLinkPass = false;
pDevice->bRoaming = true;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+ pr_info("Lost AP beacon [%d] sec, disconnected !\n",
+ pMgmt->sNodeDBTable[0].uInActiveCount);
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
wpahdr = (viawget_wpa_header *)pDevice->skb->data;
wpahdr->type = VIAWGET_DISASSOC_MSG;
@@ -1145,7 +1149,7 @@ BSSvSecondCallBack(
if (pDevice->bWPADEVUp)
pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming ...\n");
+ pr_debug("Roaming ...\n");
BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
@@ -1161,7 +1165,7 @@ BSSvSecondCallBack(
if (pDevice->uAutoReConnectTime < 10) {
pDevice->uAutoReConnectTime++;
} else {
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
+ pr_info("Adhoc re-scanning ...\n");
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
@@ -1172,7 +1176,8 @@ BSSvSecondCallBack(
if (pDevice->bUpdateBBVGA)
s_vCheckPreEDThreshold((void *)pDevice);
if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) {
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+ pr_info("Lost other STA beacon [%d] sec, started !\n",
+ pMgmt->sNodeDBTable[0].uInActiveCount);
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
pMgmt->eCurrState = WMAC_STATE_STARTED;
netif_stop_queue(pDevice->dev);
@@ -1209,7 +1214,7 @@ BSSvUpdateNodeTxCounter(
unsigned int uFIFOHeaderSize
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex = 0;
unsigned char byTxRetry = (byTsr0 & TSR0_NCR);
@@ -1231,7 +1236,8 @@ BSSvUpdateNodeTxCounter(
/* Only Unicast using support rates */
if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1);
+ pr_debug("wRate %04X, byTsr0 %02X, byTsr1 %02X\n",
+ wRate, byTsr0, byTsr1);
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
pMgmt->sNodeDBTable[0].uTxAttempts += 1;
if ((byTsr1 & TSR1_TERR) == 0) {
@@ -1362,7 +1368,7 @@ BSSvClearNodeDBTable(
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
struct sk_buff *skb;
unsigned int ii;
@@ -1372,7 +1378,7 @@ BSSvClearNodeDBTable(
/* check if sTxPSQueue has been initial */
if (pMgmt->sNodeDBTable[ii].sTxPSQueue.next != NULL) {
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
+ pr_debug("PS skb != NULL %d\n", ii);
dev_kfree_skb(skb);
}
}
@@ -1387,7 +1393,7 @@ void s_vCheckSensitivity(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PKnownBSS pBSSList = NULL;
PSMgmtObject pMgmt = pDevice->pMgmt;
int ii;
@@ -1414,7 +1420,10 @@ void s_vCheckSensitivity(
if (uNumofdBm > 0) {
LocalldBmAverage = LocalldBmAverage/uNumofdBm;
for (ii = 0; ii < BB_VGA_LEVEL; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LocalldBmAverage:%ld, %ld %02x\n", LocalldBmAverage, pDevice->ldBmThreshold[ii], pDevice->abyBBVGA[ii]);
+ pr_debug("LocalldBmAverage:%ld, %ld %02x\n",
+ LocalldBmAverage,
+ pDevice->ldBmThreshold[ii],
+ pDevice->abyBBVGA[ii]);
if (LocalldBmAverage < pDevice->ldBmThreshold[ii]) {
pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
break;
@@ -1437,7 +1446,7 @@ BSSvClearAnyBSSJoinRecord(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii;
@@ -1450,7 +1459,7 @@ void s_uCalculateLinkQual(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
unsigned long TxOkRatio, TxCnt;
unsigned long RxOkRatio, RxCnt;
unsigned long RssiRatio;
@@ -1490,7 +1499,7 @@ void s_vCheckPreEDThreshold(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PKnownBSS pBSSList = NULL;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h
index bf299e3b8acf..5d4dd28b6223 100644
--- a/drivers/staging/vt6655/bssdb.h
+++ b/drivers/staging/vt6655/bssdb.h
@@ -131,8 +131,8 @@ typedef struct tagKnownBSS {
unsigned int uClearCount;
unsigned int uIELength;
- QWORD qwBSSTimestamp;
- QWORD qwLocalTSF;
+ u64 qwBSSTimestamp;
+ u64 qwLocalTSF;
CARD_PHY_TYPE eNetworkTypeInUse;
@@ -233,7 +233,7 @@ bool
BSSbInsertToBSSList(
void *hDeviceContext,
unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
@@ -253,7 +253,7 @@ BSSbInsertToBSSList(
bool
BSSbUpdateToBSSList(
void *hDeviceContext,
- QWORD qwTimestamp,
+ __le64 qwTimestamp,
unsigned short wBeaconInterval,
unsigned short wCapInfo,
unsigned char byCurrChannel,
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 4ae8d9362edf..9807374b33f4 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -59,8 +59,6 @@
/*--------------------- Static Definitions -------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
#define C_SIFS_A 16 // micro sec.
#define C_SIFS_BG 10
@@ -224,7 +222,8 @@ s_vCalculateOFDMRParameter(
*/
static
void
-s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
+s_vSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
+ void *pvSupportRateIEs, void *pvExtSupportRateIEs)
{
unsigned char byServ = 0, bySignal = 0; // For CCK
unsigned short wLen = 0;
@@ -348,9 +347,8 @@ s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, v
* Return Value: true if short preamble; otherwise false
*
*/
-bool CARDbIsShortPreamble(void *pDeviceHandler)
+bool CARDbIsShortPreamble(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
if (pDevice->byPreambleType == 0)
return false;
@@ -370,9 +368,8 @@ bool CARDbIsShortPreamble(void *pDeviceHandler)
* Return Value: true if short slot time; otherwise false
*
*/
-bool CARDbIsShorSlotTime(void *pDeviceHandler)
+bool CARDbIsShorSlotTime(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
return pDevice->bShortSlotTime;
}
@@ -389,9 +386,10 @@ bool CARDbIsShorSlotTime(void *pDeviceHandler)
* Return Value: None.
*
*/
-bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
+bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
+ unsigned short wCapInfo, unsigned char byERPField,
+ void *pvSupportRateIEs, void *pvExtSupportRateIEs)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned char byCWMaxMin = 0;
unsigned char bySlot = 0;
unsigned char bySIFS = 0;
@@ -573,21 +571,17 @@ bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned
* Return Value: none
*
*/
-bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF)
+bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate,
+ u64 qwBSSTimestamp, u64 qwLocalTSF)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- QWORD qwTSFOffset;
-
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
+ u64 qwTSFOffset = 0;
- if ((HIDWORD(qwBSSTimestamp) != HIDWORD(qwLocalTSF)) ||
- (LODWORD(qwBSSTimestamp) != LODWORD(qwLocalTSF))) {
+ if (qwBSSTimestamp != qwLocalTSF) {
qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
// adjust TSF
// HW's TSF add TSF Offset reg
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, LODWORD(qwTSFOffset));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, HIDWORD(qwTSFOffset));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
}
return true;
@@ -607,40 +601,21 @@ bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTim
* Return Value: true if succeed; otherwise false
*
*/
-bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval)
+bool CARDbSetBeaconPeriod(struct vnt_private *pDevice,
+ unsigned short wBeaconInterval)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int uBeaconInterval = 0;
- unsigned int uLowNextTBTT = 0;
- unsigned int uHighRemain = 0;
- unsigned int uLowRemain = 0;
- QWORD qwNextTBTT;
-
- HIDWORD(qwNextTBTT) = 0;
- LODWORD(qwNextTBTT) = 0;
+ u64 qwNextTBTT = 0;
+
CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter
- uBeaconInterval = wBeaconInterval * 1024;
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
- uLowNextTBTT = (LODWORD(qwNextTBTT) >> 10) << 10;
- uLowRemain = (uLowNextTBTT) % uBeaconInterval;
- // high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT))
- % uBeaconInterval;
- uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
- uLowRemain = uBeaconInterval - uLowRemain;
-
- // check if carry when add one beacon interval
- if ((~uLowNextTBTT) < uLowRemain)
- HIDWORD(qwNextTBTT)++;
-
- LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain;
+
+ qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
// set HW beacon interval
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval);
pDevice->wBeaconInterval = wBeaconInterval;
// Set NextTBTT
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
return true;
@@ -659,9 +634,8 @@ bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval)
* Return Value: true if all data packet complete; otherwise false.
*
*/
-bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
+bool CARDbStopTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
if (ePktType == PKT_TYPE_802_11_ALL) {
pDevice->bStopBeacon = true;
@@ -713,9 +687,8 @@ bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
* Return Value: true if success; false if failed.
*
*/
-bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
+bool CARDbStartTxPacket(struct vnt_private *pDevice, CARD_PKT_TYPE ePktType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
if (ePktType == PKT_TYPE_802_11_ALL) {
pDevice->bStopBeacon = false;
@@ -752,9 +725,9 @@ bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
* Return Value: true if success; false if failed.
*
*/
-bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode)
+bool CARDbSetBSSID(struct vnt_private *pDevice,
+ unsigned char *pbyBSSID, CARD_OP_MODE eOPMode)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID);
memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN);
@@ -772,14 +745,14 @@ bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE e
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
pDevice->bBSSIDFilter = false;
pDevice->byRxMode &= ~RCR_BSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode);
+ pr_debug("wcmd: rx_mode = %x\n", pDevice->byRxMode);
} else {
if (is_zero_ether_addr(pDevice->abyBSSID) == false) {
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
pDevice->bBSSIDFilter = true;
pDevice->byRxMode |= RCR_BSSID;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode);
+ pr_debug("wmgr: rx_mode = %x\n", pDevice->byRxMode);
}
// Adopt BSS state in Adapter Device Object
pDevice->eOPMode = eOPMode;
@@ -818,11 +791,10 @@ bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE e
*
*/
bool CARDbSetTxDataRate(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
unsigned short wDataRate
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
pDevice->wCurrentRate = wDataRate;
return true;
@@ -844,10 +816,9 @@ bool CARDbSetTxDataRate(
-*/
bool
CARDbPowerDown(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice)pDeviceHandler;
unsigned int uIdx;
// check if already in Doze mode
@@ -865,7 +836,7 @@ CARDbPowerDown(
}
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n");
+ pr_debug("Go to Doze ZZZZZZZZZZZZZZZ\n");
return true;
}
@@ -881,9 +852,8 @@ CARDbPowerDown(
* Return Value: true if success; otherwise false
*
*/
-bool CARDbRadioPowerOff(void *pDeviceHandler)
+bool CARDbRadioPowerOff(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice)pDeviceHandler;
bool bResult = true;
if (pDevice->bRadioOff == true)
@@ -927,9 +897,8 @@ bool CARDbRadioPowerOff(void *pDeviceHandler)
* Return Value: true if success; otherwise false
*
*/
-bool CARDbRadioPowerOn(void *pDeviceHandler)
+bool CARDbRadioPowerOn(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
pr_debug("chester power on\n");
@@ -970,9 +939,8 @@ bool CARDbRadioPowerOn(void *pDeviceHandler)
return bResult;
}
-bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID)
+bool CARDbRemoveKey(struct vnt_private *pDevice, unsigned char *pbyBSSID)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
KeybRemoveAllKey(&(pDevice->sKey), pbyBSSID, pDevice->PortOffset);
return true;
@@ -996,27 +964,27 @@ bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID)
-*/
bool
CARDbAdd_PMKID_Candidate(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
unsigned char *pbyBSSID,
bool bRSNCapExist,
unsigned short wRSNCap
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
struct pmkid_candidate *pCandidateList;
unsigned int ii = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
+ pr_debug("bAdd_PMKID_Candidate START: (%d)\n",
+ (int)pDevice->gsPMKIDCandidate.NumCandidates);
if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 3\n");
+ pr_debug("vFlush_PMKID_Candidate: 3\n");
memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent));
}
for (ii = 0; ii < 6; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02X ", *(pbyBSSID + ii));
+ pr_debug("%02X ", *(pbyBSSID + ii));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
// Update Old Candidate
for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
@@ -1040,16 +1008,16 @@ CARDbAdd_PMKID_Candidate(
memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN);
pDevice->gsPMKIDCandidate.NumCandidates++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
+ pr_debug("NumCandidates:%d\n",
+ (int)pDevice->gsPMKIDCandidate.NumCandidates);
return true;
}
void *
CARDpGetCurrentAddress(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
return pDevice->abyCurrentNetAddr;
}
@@ -1070,15 +1038,14 @@ CARDpGetCurrentAddress(
-*/
bool
CARDbStartMeasure(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
void *pvMeasureEIDs,
unsigned int uNumOfMeasureEIDs
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs;
- QWORD qwCurrTSF;
- QWORD qwStartTSF;
+ u64 qwCurrTSF;
+ u64 qwStartTSF;
bool bExpired = true;
unsigned short wDuration = 0;
@@ -1109,32 +1076,22 @@ CARDbStartMeasure(
pDevice->uNumOfMeasureEIDs--;
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
- HIDWORD(qwStartTSF) = HIDWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
- LODWORD(qwStartTSF) = LODWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
+ qwStartTSF = *((u64 *)(pDevice->pCurrMeasureEID->sReq.abyStartTime));
wDuration = *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration));
wDuration += 1; // 1 TU for channel switching
- if ((LODWORD(qwStartTSF) == 0) && (HIDWORD(qwStartTSF) == 0)) {
+ if (qwStartTSF == 0) {
// start immediately by setting start TSF == current TSF + 2 TU
- LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048;
- HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
- if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF))
- HIDWORD(qwStartTSF)++;
+ qwStartTSF = qwCurrTSF + 2048;
bExpired = false;
break;
} else {
// start at setting start TSF - 1TU(for channel switching)
- if (LODWORD(qwStartTSF) < 1024)
- HIDWORD(qwStartTSF)--;
-
- LODWORD(qwStartTSF) -= 1024;
+ qwStartTSF -= 1024;
}
- if ((HIDWORD(qwCurrTSF) < HIDWORD(qwStartTSF)) ||
- ((HIDWORD(qwCurrTSF) == HIDWORD(qwStartTSF)) &&
- (LODWORD(qwCurrTSF) < LODWORD(qwStartTSF)))
-) {
+ if (qwCurrTSF < qwStartTSF) {
bExpired = false;
break;
}
@@ -1161,8 +1118,8 @@ CARDbStartMeasure(
if (!bExpired) {
MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, (u32)qwStartTSF);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, (u32)(qwStartTSF >> 32));
VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration);
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
MACvSelectPage0(pDevice->PortOffset);
@@ -1196,13 +1153,12 @@ CARDbStartMeasure(
-*/
bool
CARDbChannelSwitch(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
unsigned char byMode,
unsigned char byNewChannel,
unsigned char byCount
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
if (byCount == 0) {
@@ -1238,7 +1194,7 @@ CARDbChannelSwitch(
-*/
bool
CARDbSetQuiet(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
bool bResetQuiet,
unsigned char byQuietCount,
unsigned char byQuietPeriod,
@@ -1246,7 +1202,6 @@ CARDbSetQuiet(
unsigned short wQuietOffset
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int ii = 0;
if (bResetQuiet) {
@@ -1291,10 +1246,9 @@ CARDbSetQuiet(
-*/
bool
CARDbStartQuiet(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int ii = 0;
unsigned long dwStartTime = 0xFFFFFFFF;
unsigned int uCurrentQuietIndex = 0;
@@ -1391,12 +1345,11 @@ CARDbStartQuiet(
-*/
void
CARDvSetPowerConstraint(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
unsigned char byChannel,
char byPower
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
if (byChannel > CB_MAX_CHANNEL_24G) {
if (pDevice->bCountryInfo5G == true)
@@ -1425,12 +1378,11 @@ CARDvSetPowerConstraint(
-*/
void
CARDvGetPowerCapability(
- void *pDeviceHandler,
+ struct vnt_private *pDevice,
unsigned char *pbyMinPower,
unsigned char *pbyMaxPower
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned char byDec = 0;
*pbyMaxPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh];
@@ -1460,10 +1412,9 @@ CARDvGetPowerCapability(
*/
char
CARDbyGetTransmitPower(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
return pDevice->byCurPwrdBm;
}
@@ -1471,10 +1422,9 @@ CARDbyGetTransmitPower(
//xxx
void
CARDvSafeResetTx(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int uu;
PSTxDesc pCurrTD;
@@ -1524,10 +1474,9 @@ CARDvSafeResetTx(
-*/
void
CARDvSafeResetRx(
- void *pDeviceHandler
+ struct vnt_private *pDevice
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int uu;
PSRxDesc pDesc;
@@ -1578,9 +1527,9 @@ CARDvSafeResetRx(
* Return Value: response Control frame rate
*
*/
-static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx)
+static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice,
+ unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int ui = (unsigned int) wRateIdx;
while (ui > RATE_1M) {
@@ -1605,27 +1554,27 @@ static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned shor
* Return Value: response Control frame rate
*
*/
-static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx)
+static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice,
+ unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned int ui = (unsigned int) wRateIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BASIC RATE: %X\n", pDevice->wBasicRate);
+ pr_debug("BASIC RATE: %X\n", pDevice->wBasicRate);
if (!CARDbIsOFDMinBasicRate((void *)pDevice)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
+ pr_debug("CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
if (wRateIdx > RATE_24M)
wRateIdx = RATE_24M;
return wRateIdx;
}
while (ui > RATE_11M) {
if (pDevice->wBasicRate & ((unsigned short)1 << ui)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate : %d\n", ui);
+ pr_debug("CARDwGetOFDMControlRate : %d\n", ui);
return (unsigned short)ui;
}
ui--;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate: 6M\n");
+ pr_debug("CARDwGetOFDMControlRate: 6M\n");
return (unsigned short)RATE_24M;
}
@@ -1641,9 +1590,8 @@ static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned sho
* Return Value: None.
*
*/
-void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
+void CARDvSetRSPINF(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned char byServ = 0x00, bySignal = 0x00; //For CCK
unsigned short wLen = 0x0000;
unsigned char byTxRate, byRsvTime; //For OFDM
@@ -1766,10 +1714,9 @@ void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
* Return Value: None.
*
*/
-void vUpdateIFS(void *pDeviceHandler)
+void vUpdateIFS(struct vnt_private *pDevice)
{
- //Set SIFS, DIFS, EIFS, SlotTime, CwMin
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ /* Set SIFS, DIFS, EIFS, SlotTime, CwMin */
unsigned char byMaxMin = 0;
@@ -1818,9 +1765,8 @@ void vUpdateIFS(void *pDeviceHandler)
VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, (unsigned char)byMaxMin);
}
-void CARDvUpdateBasicTopRate(void *pDeviceHandler)
+void CARDvUpdateBasicTopRate(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M;
unsigned char ii;
@@ -1844,9 +1790,8 @@ void CARDvUpdateBasicTopRate(void *pDeviceHandler)
pDevice->byTopCCKBasicRate = byTopCCK;
}
-bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx)
+bool CARDbAddBasicRate(struct vnt_private *pDevice, unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
unsigned short wRate = (unsigned short)(1<<wRateIdx);
pDevice->wBasicRate |= wRate;
@@ -1857,9 +1802,8 @@ bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx)
return true;
}
-bool CARDbIsOFDMinBasicRate(void *pDeviceHandler)
+bool CARDbIsOFDMinBasicRate(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice)pDeviceHandler;
int ii;
for (ii = RATE_54M; ii >= RATE_6M; ii--) {
@@ -1869,9 +1813,8 @@ bool CARDbIsOFDMinBasicRate(void *pDeviceHandler)
return false;
}
-unsigned char CARDbyGetPktType(void *pDeviceHandler)
+unsigned char CARDbyGetPktType(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B)
return (unsigned char)pDevice->byBBType;
@@ -1922,9 +1865,8 @@ void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode)
* Return Value: none
*
*/
-bool CARDbSoftwareReset(void *pDeviceHandler)
+bool CARDbSoftwareReset(struct vnt_private *pDevice)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
// reset MAC
if (!MACbSafeSoftwareReset(pDevice->PortOffset))
@@ -1948,25 +1890,17 @@ bool CARDbSoftwareReset(void *pDeviceHandler)
* Return Value: TSF Offset value
*
*/
-QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
+u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)
{
- QWORD qwTSFOffset;
+ u64 qwTSFOffset = 0;
unsigned short wRxBcnTSFOffst = 0;
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE];
- (qwTSF2).u.dwLowDword += (unsigned long)(wRxBcnTSFOffst);
- if ((qwTSF2).u.dwLowDword < (unsigned long)(wRxBcnTSFOffst))
- (qwTSF2).u.dwHighDword++;
-
- LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2);
- if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) {
- // if borrow needed
- HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1;
- } else {
- HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2);
- }
+
+ qwTSF2 += (u64)wRxBcnTSFOffst;
+
+ qwTSFOffset = qwTSF1 - qwTSF2;
+
return qwTSFOffset;
}
@@ -1983,7 +1917,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
* Return Value: true if success; otherwise false
*
*/
-bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
+bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF)
{
unsigned short ww;
unsigned char byData;
@@ -1996,8 +1930,8 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
}
if (ww == W_MAX_TIMEOUT)
return false;
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, &LODWORD(*pqwCurrTSF));
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, &HIDWORD(*pqwCurrTSF));
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
return true;
}
@@ -2016,28 +1950,20 @@ bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
* Return Value: TSF value of next Beacon
*
*/
-QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
+u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval)
{
- unsigned int uLowNextTBTT;
- unsigned int uHighRemain, uLowRemain;
- unsigned int uBeaconInterval;
-
- uBeaconInterval = wBeaconInterval * 1024;
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
- uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10;
- // low dword (mod) bcn
- uLowRemain = (uLowNextTBTT) % uBeaconInterval;
- // high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF))
- % uBeaconInterval;
- uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
- uLowRemain = uBeaconInterval - uLowRemain;
-
- // check if carry when add one beacon interval
- if ((~uLowNextTBTT) < uLowRemain)
- HIDWORD(qwTSF)++;
-
- LODWORD(qwTSF) = uLowNextTBTT + uLowRemain;
+ u32 beacon_int;
+
+ beacon_int = wBeaconInterval * 1024;
+
+ /* Next TBTT =
+ * ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+ */
+ if (beacon_int) {
+ do_div(qwTSF, beacon_int);
+ qwTSF += 1;
+ qwTSF *= beacon_int;
+ }
return qwTSF;
}
@@ -2058,15 +1984,14 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
*/
void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval)
{
- QWORD qwNextTBTT;
+ u64 qwNextTBTT = 0;
- HIDWORD(qwNextTBTT) = 0;
- LODWORD(qwNextTBTT) = 0;
CARDbGetCurrentTSF(dwIoBase, &qwNextTBTT); //Get Local TSF counter
+
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
// Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
}
@@ -2085,13 +2010,12 @@ void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterva
* Return Value: none
*
*/
-void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
+void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval)
{
qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
// Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, (u32)qwTSF);
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, (u32)(qwTSF >> 32));
MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh]\n",
- (unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
+ pr_debug("Card:Update Next TBTT[%8llx]\n", qwTSF);
}
diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h
index 2f1a05ef44a1..f7fd83404f34 100644
--- a/drivers/staging/vt6655/card.h
+++ b/drivers/staging/vt6655/card.h
@@ -77,49 +77,48 @@ typedef enum _CARD_OP_MODE {
OP_MODE_UNKNOWN
} CARD_OP_MODE, *PCARD_OP_MODE;
-void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
-void vUpdateIFS(void *pDeviceHandler);
-void CARDvUpdateBasicTopRate(void *pDeviceHandler);
-bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
-bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
+struct vnt_private;
+
+void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
+void vUpdateIFS(struct vnt_private *);
+void CARDvUpdateBasicTopRate(struct vnt_private *);
+bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
+bool CARDbIsOFDMinBasicRate(struct vnt_private *);
void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
-bool CARDbSoftwareReset(void *pDeviceHandler);
+bool CARDbSoftwareReset(struct vnt_private *);
void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
-void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
-bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF);
-QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
-QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
-bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
-unsigned char CARDbyGetPktType(void *pDeviceHandler);
-void CARDvSafeResetTx(void *pDeviceHandler);
-void CARDvSafeResetRx(void *pDeviceHandler);
-
-bool CARDbRadioPowerOff(void *pDeviceHandler);
-bool CARDbRadioPowerOn(void *pDeviceHandler);
-bool CARDbIsShortPreamble(void *pDeviceHandler);
-bool CARDbIsShorSlotTime(void *pDeviceHandler);
-bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
-bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
-bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
-bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
-bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
-bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
-
-bool
-CARDbPowerDown(
- void *pDeviceHandler
-);
-
-bool CARDbSetTxDataRate(
- void *pDeviceHandler,
- unsigned short wDataRate
-);
-
-bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
+void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
+bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
+u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
+u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
+bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
+unsigned char CARDbyGetPktType(struct vnt_private *);
+void CARDvSafeResetTx(struct vnt_private *);
+void CARDvSafeResetRx(struct vnt_private *);
+bool CARDbRadioPowerOff(struct vnt_private *);
+bool CARDbRadioPowerOn(struct vnt_private *);
+bool CARDbIsShortPreamble(struct vnt_private *);
+bool CARDbIsShorSlotTime(struct vnt_private *);
+bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
+ unsigned short wCapInfo, unsigned char byERPField,
+ void *pvSupportRateIEs, void *pvExtSupportRateIEs);
+bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
+ u64 qwBSSTimestamp, u64 qwLocalTSF);
+bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
+bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
+bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
+bool CARDbSetBSSID(struct vnt_private *,
+ unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
+
+bool CARDbPowerDown(struct vnt_private *);
+
+bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
+
+bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
bool
CARDbAdd_PMKID_Candidate(
- void *pDeviceHandler,
+ struct vnt_private *,
unsigned char *pbyBSSID,
bool bRSNCapExist,
unsigned short wRSNCap
@@ -127,19 +126,19 @@ CARDbAdd_PMKID_Candidate(
void *
CARDpGetCurrentAddress(
- void *pDeviceHandler
+ struct vnt_private *
);
bool
CARDbStartMeasure(
- void *pDeviceHandler,
+ struct vnt_private *,
void *pvMeasureEIDs,
unsigned int uNumOfMeasureEIDs
);
bool
CARDbChannelSwitch(
- void *pDeviceHandler,
+ struct vnt_private *,
unsigned char byMode,
unsigned char byNewChannel,
unsigned char byCount
@@ -147,7 +146,7 @@ CARDbChannelSwitch(
bool
CARDbSetQuiet(
- void *pDeviceHandler,
+ struct vnt_private *,
bool bResetQuiet,
unsigned char byQuietCount,
unsigned char byQuietPeriod,
@@ -157,26 +156,26 @@ CARDbSetQuiet(
bool
CARDbStartQuiet(
- void *pDeviceHandler
+ struct vnt_private *
);
void
CARDvSetPowerConstraint(
- void *pDeviceHandler,
+ struct vnt_private *,
unsigned char byChannel,
char byPower
);
void
CARDvGetPowerCapability(
- void *pDeviceHandler,
+ struct vnt_private *,
unsigned char *pbyMinPower,
unsigned char *pbyMaxPower
);
char
CARDbyGetTransmitPower(
- void *pDeviceHandler
+ struct vnt_private *
);
#endif // __CARD_H__
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index d5b89b7aaf23..4ce964ba14b7 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -30,8 +30,6 @@
#define CARD_MAX_CHANNEL_TBL 56
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Variables --------------------------*/
static SChannelTblElement sChannelTbl[CARD_MAX_CHANNEL_TBL + 1] =
@@ -416,7 +414,7 @@ bool channel_get_list(unsigned int uCountryCodeIdx, unsigned char *pbyChannelTab
void init_channel_table(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
bool bMultiBand = false;
unsigned int ii;
@@ -480,7 +478,10 @@ void init_channel_table(void *pDeviceHandler)
}
}
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Zone=[%d][%c][%c]!!\n", pDevice->byZoneType, ChannelRuleTab[pDevice->byZoneType].chCountryCode[0], ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]);
+ pr_info("Zone=[%d][%c][%c]!!\n",
+ pDevice->byZoneType,
+ ChannelRuleTab[pDevice->byZoneType].chCountryCode[0],
+ ChannelRuleTab[pDevice->byZoneType].chCountryCode[1]);
for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) {
if (pDevice->abyRegPwr[ii + 1] == 0)
@@ -521,7 +522,7 @@ unsigned char get_channel_number(void *pDeviceHandler, unsigned char byChannelIn
*/
bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
bool bResult = true;
if (pDevice->byCurrentCh == uConnectionChannel)
@@ -583,7 +584,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
unsigned int ii = 0;
unsigned int uu = 0;
unsigned int step = 0;
@@ -632,7 +633,7 @@ void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE)
unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
unsigned int ii;
unsigned char byCount;
PWLAN_IE_SUPP_CH pIE = (PWLAN_IE_SUPP_CH) pbyIEs;
@@ -703,7 +704,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
void set_country_IE(void *pDeviceHandler, void *pIE)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
unsigned int ii;
PWLAN_IE_COUNTRY pIECountry = (PWLAN_IE_COUNTRY) pIE;
diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c
index 565028c4ab03..52907a4fae9d 100644
--- a/drivers/staging/vt6655/datarate.c
+++ b/drivers/staging/vt6655/datarate.c
@@ -49,7 +49,6 @@
extern unsigned short TxRate_iwconfig; /* 2008-5-8 <add> by chester */
/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
static const unsigned char acbyIERate[MAX_RATE] = {
0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C
};
@@ -195,7 +194,7 @@ RATEvParseMaxRate(
unsigned char *pbyTopOFDMRate
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
unsigned int ii;
unsigned char byHighSuppRate = 0;
unsigned char byRate = 0;
@@ -208,7 +207,7 @@ RATEvParseMaxRate(
*pwSuppRate = 0;
uRateLen = pItemRates->len;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate Len: %d\n", uRateLen);
+ pr_debug("ParseMaxRate Len: %d\n", uRateLen);
if (pDevice->eCurrentPHYType != PHY_TYPE_11B) {
if (uRateLen > WLAN_RATES_MAXLEN)
uRateLen = WLAN_RATES_MAXLEN;
@@ -222,7 +221,8 @@ RATEvParseMaxRate(
if (WLAN_MGMT_IS_BASICRATE(byRate) && bUpdateBasicRate) {
/* Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate */
CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
+ pr_debug("ParseMaxRate AddBasicRate: %d\n",
+ wGetRateIdx(byRate));
}
byRate = (unsigned char)(pItemRates->abyRates[ii]&0x7F);
if (byHighSuppRate == 0)
@@ -244,7 +244,8 @@ RATEvParseMaxRate(
if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) {
/* Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate */
CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
+ pr_debug("ParseMaxRate AddBasicRate: %d\n",
+ wGetRateIdx(byRate));
}
byRate = (unsigned char)(pItemExtRates->abyRates[ii]&0x7F);
if (byHighSuppRate == 0)
@@ -268,7 +269,7 @@ RATEvParseMaxRate(
if (wOldBasicRate != pDevice->wBasicRate)
CARDvSetRSPINF((void *)pDevice, pDevice->eCurrentPHYType);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Exit ParseMaxRate\n");
+ pr_debug("Exit ParseMaxRate\n");
}
/*+
@@ -295,7 +296,7 @@ RATEvTxRateFallBack(
PKnownNodeDB psNodeDBTable
)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ struct vnt_private *pDevice = pDeviceHandler;
unsigned short wIdxDownRate = 0;
unsigned int ii;
bool bAutoRate[MAX_RATE] = {true, true, true, true, false, false, true, true, true, true, true, true};
diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 05efa4e1b682..d3c9b0c4329f 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -550,17 +550,6 @@ typedef struct tagSTxDataHead_a_FB {
STxDataHead_a_FB, *PSTxDataHead_a_FB;
typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
-//
-// MICHDR data header
-//
-typedef struct tagSMICHDRHead {
- u32 adwHDR0[4];
- u32 adwHDR1[4];
- u32 adwHDR2[4];
-} __attribute__ ((__packed__))
-SMICHDRHead, *PSMICHDRHead;
-typedef const SMICHDRHead *PCSMICHDRHead;
-
typedef struct tagSBEACONCtl {
u32 BufReady:1;
u32 TSF:15;
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 9bf0ea9af66e..e4c52925a112 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -148,12 +148,6 @@
/*--------------------- Export Types ------------------------------*/
-#define DBG_PRT(l, p, args...) \
-do { \
- if (l <= msglevel) \
- printk(p, ##args); \
-} while (0)
-
#define PRINT_K(p, args...) \
do { \
if (PRIVATE_Message) \
@@ -337,9 +331,9 @@ typedef struct __device_opt {
u32 flags;
} OPTIONS, *POPTIONS;
-typedef struct __device_info {
- struct __device_info *next;
- struct __device_info *prev;
+struct vnt_private {
+ struct vnt_private *next;
+ struct vnt_private *prev;
struct pci_dev *pcid;
@@ -566,7 +560,7 @@ typedef struct __device_info {
SKeyManagement sKey;
unsigned long dwIVCounter;
- QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes)
+ u64 qwPacketNumber; /* For CCMP and TKIP as TSC(6 bytes) */
unsigned int uCurrentWEPMode;
RC4Ext SBox;
@@ -643,12 +637,10 @@ typedef struct __device_info {
// command timer
struct timer_list sTimerCommand;
-#ifdef TxInSleep
struct timer_list sTimerTxData;
unsigned long nTxDataTimeCout;
bool fTxDataInSleep;
bool IsTxDataTrigger;
-#endif
#ifdef WPA_SM_Transtatus
bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
@@ -744,9 +736,10 @@ typedef struct __device_info {
struct iw_statistics wstats; // wireless stats
bool bCommit;
-} DEVICE_INFO, *PSDevice;
+};
-static inline bool device_get_ip(PSDevice pInfo) {
+static inline bool device_get_ip(struct vnt_private *pInfo)
+{
struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
struct in_ifaddr *ifa;
@@ -772,7 +765,10 @@ static inline PDEVICE_TD_INFO alloc_td_info(void)
/*--------------------- Export Functions --------------------------*/
-bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex);
-bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
-int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter);
+bool device_dma0_xmit(struct vnt_private *pDevice,
+ struct sk_buff *skb, unsigned int uNodeIndex);
+bool device_alloc_frag_buf(struct vnt_private *pDevice,
+ PSDeFragControlBlock pDeF);
+int Config_FileOperation(struct vnt_private *pDevice,
+ bool fwrite, unsigned char *Parameter);
#endif
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 0b583a37f5b3..a44233c2dd29 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -89,8 +89,6 @@
#include <linux/slab.h>
/*--------------------- Static Definitions -------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
//
// Define module options
//
@@ -249,7 +247,7 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");
//
static int device_nics = 0;
-static PSDevice pDevice_Infos = NULL;
+static struct vnt_private *pDevice_Infos = NULL;
static struct net_device *root_device_dev = NULL;
static CHIP_INFO chip_info_table[] = {
@@ -266,12 +264,13 @@ static const struct pci_device_id vt6655_pci_id_table[] = {
/*--------------------- Static Functions --------------------------*/
static int vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent);
-static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, PCHIP_INFO);
-static void device_free_info(PSDevice pDevice);
-static bool device_get_pci_info(PSDevice, struct pci_dev *pcid);
-static void device_print_info(PSDevice pDevice);
+static void vt6655_init_info(struct pci_dev *pcid,
+ struct vnt_private **ppDevice, PCHIP_INFO);
+static void device_free_info(struct vnt_private *pDevice);
+static bool device_get_pci_info(struct vnt_private *, struct pci_dev *pcid);
+static void device_print_info(struct vnt_private *pDevice);
static struct net_device_stats *device_get_stats(struct net_device *dev);
-static void device_init_diversity_timer(PSDevice pDevice);
+static void device_init_diversity_timer(struct vnt_private *pDevice);
static int device_open(struct net_device *dev);
static int device_xmit(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t device_intr(int irq, void *dev_instance);
@@ -290,28 +289,28 @@ static struct notifier_block device_notifier = {
};
#endif
-static void device_init_rd0_ring(PSDevice pDevice);
-static void device_init_rd1_ring(PSDevice pDevice);
-static void device_init_defrag_cb(PSDevice pDevice);
-static void device_init_td0_ring(PSDevice pDevice);
-static void device_init_td1_ring(PSDevice pDevice);
+static void device_init_rd0_ring(struct vnt_private *pDevice);
+static void device_init_rd1_ring(struct vnt_private *pDevice);
+static void device_init_defrag_cb(struct vnt_private *pDevice);
+static void device_init_td0_ring(struct vnt_private *pDevice);
+static void device_init_td1_ring(struct vnt_private *pDevice);
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev);
//2008-0714<Add>by Mike Liu
-static bool device_release_WPADEV(PSDevice pDevice);
+static bool device_release_WPADEV(struct vnt_private *pDevice);
static int ethtool_ioctl(struct net_device *dev, void __user *useraddr);
-static int device_rx_srv(PSDevice pDevice, unsigned int uIdx);
-static int device_tx_srv(PSDevice pDevice, unsigned int uIdx);
-static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pDesc);
-static void device_init_registers(PSDevice pDevice);
-static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc);
-static void device_free_td0_ring(PSDevice pDevice);
-static void device_free_td1_ring(PSDevice pDevice);
-static void device_free_rd0_ring(PSDevice pDevice);
-static void device_free_rd1_ring(PSDevice pDevice);
-static void device_free_rings(PSDevice pDevice);
-static void device_free_frag_buf(PSDevice pDevice);
+static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx);
+static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx);
+static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pDesc);
+static void device_init_registers(struct vnt_private *pDevice);
+static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc);
+static void device_free_td0_ring(struct vnt_private *pDevice);
+static void device_free_td1_ring(struct vnt_private *pDevice);
+static void device_free_rd0_ring(struct vnt_private *pDevice);
+static void device_free_rd1_ring(struct vnt_private *pDevice);
+static void device_free_rings(struct vnt_private *pDevice);
+static void device_free_frag_buf(struct vnt_private *pDevice);
static int Config_FileGetParameter(unsigned char *string,
unsigned char *dest, unsigned char *source);
@@ -331,14 +330,15 @@ static char *get_chip_name(int chip_id)
static void vt6655_remove(struct pci_dev *pcid)
{
- PSDevice pDevice = pci_get_drvdata(pcid);
+ struct vnt_private *pDevice = pci_get_drvdata(pcid);
if (pDevice == NULL)
return;
device_free_info(pDevice);
}
-static void device_get_options(PSDevice pDevice, int index, char *devname)
+static void device_get_options(struct vnt_private *pDevice,
+ int index, char *devname)
{
POPTIONS pOpts = &(pDevice->sOpts);
@@ -363,7 +363,8 @@ static void device_get_options(PSDevice pDevice, int index, char *devname)
}
static void
-device_set_options(PSDevice pDevice) {
+device_set_options(struct vnt_private *pDevice)
+{
unsigned char abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
unsigned char abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
unsigned char abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8};
@@ -397,21 +398,23 @@ device_set_options(PSDevice pDevice) {
pDevice->wCTSDuration = 0;
pDevice->byPreambleType = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uChannel= %d\n", (int)pDevice->uChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byOpMode= %d\n", (int)pDevice->byOpMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ePSMode= %d\n", (int)pDevice->ePSMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " wRTSThreshold= %d\n", (int)pDevice->wRTSThreshold);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortRetryLimit= %d\n", (int)pDevice->byShortRetryLimit);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byLongRetryLimit= %d\n", (int)pDevice->byLongRetryLimit);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byPreambleType= %d\n", (int)pDevice->byPreambleType);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortPreamble= %d\n", (int)pDevice->byShortPreamble);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uConnectionRate= %d\n", (int)pDevice->uConnectionRate);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byBBType= %d\n", (int)pDevice->byBBType);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->b11hEnable= %d\n", (int)pDevice->b11hEnable);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->bDiversityRegCtlON= %d\n", (int)pDevice->bDiversityRegCtlON);
+ pr_debug(" uChannel= %d\n", (int)pDevice->uChannel);
+ pr_debug(" byOpMode= %d\n", (int)pDevice->byOpMode);
+ pr_debug(" ePSMode= %d\n", (int)pDevice->ePSMode);
+ pr_debug(" wRTSThreshold= %d\n", (int)pDevice->wRTSThreshold);
+ pr_debug(" byShortRetryLimit= %d\n", (int)pDevice->byShortRetryLimit);
+ pr_debug(" byLongRetryLimit= %d\n", (int)pDevice->byLongRetryLimit);
+ pr_debug(" byPreambleType= %d\n", (int)pDevice->byPreambleType);
+ pr_debug(" byShortPreamble= %d\n", (int)pDevice->byShortPreamble);
+ pr_debug(" uConnectionRate= %d\n", (int)pDevice->uConnectionRate);
+ pr_debug(" byBBType= %d\n", (int)pDevice->byBBType);
+ pr_debug(" pDevice->b11hEnable= %d\n", (int)pDevice->b11hEnable);
+ pr_debug(" pDevice->bDiversityRegCtlON= %d\n",
+ (int)pDevice->bDiversityRegCtlON);
}
-static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult)
+static void s_vCompleteCurrentMeasure(struct vnt_private *pDevice,
+ unsigned char byResult)
{
unsigned int ii;
unsigned long dwDuration = 0;
@@ -453,7 +456,7 @@ static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult)
// Initialisation of MAC & BBP registers
//
-static void device_init_registers(PSDevice pDevice)
+static void device_init_registers(struct vnt_private *pDevice)
{
unsigned int ii;
unsigned char byValue;
@@ -561,10 +564,10 @@ static void device_init_registers(PSDevice pDevice)
}
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
- "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
- pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue,
- (int)pDevice->ulDiversityMValue, pDevice->byTMax, pDevice->byTMax2);
+ pr_debug("bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
+ pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue,
+ (int)pDevice->ulDiversityMValue, pDevice->byTMax,
+ pDevice->byTMax2);
/* zonetype initial */
pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
@@ -577,7 +580,7 @@ static void device_init_registers(PSDevice pDevice)
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n");
+ pr_debug("Init Zone Type :USA\n");
} else if ((zonetype == 1) &&
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) {
/* for Japan */
@@ -589,7 +592,7 @@ static void device_init_registers(PSDevice pDevice)
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n");
+ pr_debug("Init Zone Type :Europe\n");
} else {
if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
pr_debug("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",
@@ -612,12 +615,12 @@ static void device_init_registers(PSDevice pDevice)
pDevice->byRevId = 0x80;
pDevice->byRFType &= RF_MASK;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType);
+ pr_debug("pDevice->byRFType = %x\n", pDevice->byRFType);
if (!pDevice->bZoneRegExist)
pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType);
+ pr_debug("pDevice->byZoneType = %x\n", pDevice->byZoneType);
/* Init RF module */
RFbInit(pDevice);
@@ -740,8 +743,7 @@ static void device_init_registers(PSDevice pDevice)
/* get Permanent network address */
SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Network address = %pM\n",
- pDevice->abyCurrentNetAddr);
+ pr_debug("Network address = %pM\n", pDevice->abyCurrentNetAddr);
/* reset Tx pointer */
CARDvSafeResetRx(pDevice);
@@ -763,7 +765,7 @@ static void device_init_registers(PSDevice pDevice)
netif_stop_queue(pDevice->dev);
}
-static void device_init_diversity_timer(PSDevice pDevice)
+static void device_init_diversity_timer(struct vnt_private *pDevice)
{
init_timer(&pDevice->TimerSQ3Tmax1);
pDevice->TimerSQ3Tmax1.data = (unsigned long) pDevice;
@@ -781,7 +783,7 @@ static void device_init_diversity_timer(PSDevice pDevice)
pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ);
}
-static bool device_release_WPADEV(PSDevice pDevice)
+static bool device_release_WPADEV(struct vnt_private *pDevice)
{
viawget_wpa_header *wpahdr;
int ii = 0;
@@ -827,7 +829,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
static bool bFirst = true;
struct net_device *dev = NULL;
PCHIP_INFO pChip_info = (PCHIP_INFO)ent->driver_data;
- PSDevice pDevice;
+ struct vnt_private *pDevice;
int rc;
if (device_nics++ >= MAX_UINTS) {
@@ -835,9 +837,9 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
return -ENODEV;
}
- dev = alloc_etherdev(sizeof(DEVICE_INFO));
+ dev = alloc_etherdev(sizeof(*pDevice));
- pDevice = (PSDevice) netdev_priv(dev);
+ pDevice = netdev_priv(dev);
if (dev == NULL) {
pr_err(DEVICE_NAME ": allocate net device failed\n");
@@ -977,23 +979,23 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
return 0;
}
-static void device_print_info(PSDevice pDevice)
+static void device_print_info(struct vnt_private *pDevice)
{
struct net_device *dev = pDevice->dev;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n", dev->name, get_chip_name(pDevice->chip_id));
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%pM", dev->name, dev->dev_addr);
-
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx Mem=0x%lx ",
- (unsigned long)pDevice->ioaddr, (unsigned long)pDevice->PortOffset);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d\n", pDevice->dev->irq);
+ pr_info("%s: %s\n", dev->name, get_chip_name(pDevice->chip_id));
+ pr_info("%s: MAC=%pM IO=0x%lx Mem=0x%lx IRQ=%d\n",
+ dev->name, dev->dev_addr, (unsigned long)pDevice->ioaddr,
+ (unsigned long)pDevice->PortOffset, pDevice->dev->irq);
}
-static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice,
- PCHIP_INFO pChip_info) {
- PSDevice p;
+static void vt6655_init_info(struct pci_dev *pcid,
+ struct vnt_private **ppDevice,
+ PCHIP_INFO pChip_info)
+{
+ struct vnt_private *p;
- memset(*ppDevice, 0, sizeof(DEVICE_INFO));
+ memset(*ppDevice, 0, sizeof(**ppDevice));
if (pDevice_Infos == NULL) {
pDevice_Infos = *ppDevice;
@@ -1013,7 +1015,8 @@ static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice,
spin_lock_init(&((*ppDevice)->lock));
}
-static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid)
+static bool device_get_pci_info(struct vnt_private *pDevice,
+ struct pci_dev *pcid)
{
u16 pci_cmd;
u8 b;
@@ -1061,9 +1064,9 @@ static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid)
return true;
}
-static void device_free_info(PSDevice pDevice)
+static void device_free_info(struct vnt_private *pDevice)
{
- PSDevice ptr;
+ struct vnt_private *ptr;
struct net_device *dev = pDevice->dev;
ASSERT(pDevice);
@@ -1087,7 +1090,7 @@ static void device_free_info(PSDevice pDevice)
else
ptr->prev->next = ptr->next;
} else {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n");
+ pr_err("info struct not found\n");
return;
}
#ifdef HOSTAP
@@ -1106,7 +1109,7 @@ static void device_free_info(PSDevice pDevice)
free_netdev(dev);
}
-static bool device_init_rings(PSDevice pDevice)
+static bool device_init_rings(struct vnt_private *pDevice)
{
void *vir_pool;
@@ -1118,7 +1121,8 @@ static bool device_init_rings(PSDevice pDevice)
pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
&pDevice->pool_dma);
if (vir_pool == NULL) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name);
+ pr_err("%s : allocate desc dma memory failed\n",
+ pDevice->dev->name);
return false;
}
@@ -1137,7 +1141,8 @@ static bool device_init_rings(PSDevice pDevice)
CB_MAX_BUF_SIZE,
&pDevice->tx_bufs_dma0);
if (pDevice->tx0_bufs == NULL) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name);
+ pr_err("%s: allocate buf dma memory failed\n",
+ pDevice->dev->name);
pci_free_consistent(pDevice->pcid,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
@@ -1182,7 +1187,7 @@ static bool device_init_rings(PSDevice pDevice)
return true;
}
-static void device_free_rings(PSDevice pDevice)
+static void device_free_rings(struct vnt_private *pDevice)
{
pci_free_consistent(pDevice->pcid,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
@@ -1203,7 +1208,7 @@ static void device_free_rings(PSDevice pDevice)
);
}
-static void device_init_rd0_ring(PSDevice pDevice)
+static void device_init_rd0_ring(struct vnt_private *pDevice)
{
int i;
dma_addr_t curr = pDevice->rd0_pool_dma;
@@ -1215,8 +1220,8 @@ static void device_init_rd0_ring(PSDevice pDevice)
pDesc->pRDInfo = alloc_rd_info();
ASSERT(pDesc->pRDInfo);
if (!device_alloc_rx_buf(pDevice, pDesc)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc rx bufs\n",
+ pDevice->dev->name);
}
pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]);
pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
@@ -1228,7 +1233,7 @@ static void device_init_rd0_ring(PSDevice pDevice)
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
}
-static void device_init_rd1_ring(PSDevice pDevice)
+static void device_init_rd1_ring(struct vnt_private *pDevice)
{
int i;
dma_addr_t curr = pDevice->rd1_pool_dma;
@@ -1240,8 +1245,8 @@ static void device_init_rd1_ring(PSDevice pDevice)
pDesc->pRDInfo = alloc_rd_info();
ASSERT(pDesc->pRDInfo);
if (!device_alloc_rx_buf(pDevice, pDesc)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc rx bufs\n",
+ pDevice->dev->name);
}
pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]);
pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
@@ -1253,7 +1258,7 @@ static void device_init_rd1_ring(PSDevice pDevice)
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
}
-static void device_init_defrag_cb(PSDevice pDevice)
+static void device_init_defrag_cb(struct vnt_private *pDevice)
{
int i;
PSDeFragControlBlock pDeF;
@@ -1262,15 +1267,15 @@ static void device_init_defrag_cb(PSDevice pDevice)
for (i = 0; i < CB_MAX_RX_FRAG; i++) {
pDeF = &(pDevice->sRxDFCB[i]);
if (!device_alloc_frag_buf(pDevice, pDeF)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc frag bufs\n",
+ pDevice->dev->name);
}
}
pDevice->cbDFCB = CB_MAX_RX_FRAG;
pDevice->cbFreeDFCB = pDevice->cbDFCB;
}
-static void device_free_rd0_ring(PSDevice pDevice)
+static void device_free_rd0_ring(struct vnt_private *pDevice)
{
int i;
@@ -1287,7 +1292,7 @@ static void device_free_rd0_ring(PSDevice pDevice)
}
}
-static void device_free_rd1_ring(PSDevice pDevice)
+static void device_free_rd1_ring(struct vnt_private *pDevice)
{
int i;
@@ -1304,7 +1309,7 @@ static void device_free_rd1_ring(PSDevice pDevice)
}
}
-static void device_free_frag_buf(PSDevice pDevice)
+static void device_free_frag_buf(struct vnt_private *pDevice)
{
PSDeFragControlBlock pDeF;
int i;
@@ -1318,7 +1323,7 @@ static void device_free_frag_buf(PSDevice pDevice)
}
}
-static void device_init_td0_ring(PSDevice pDevice)
+static void device_init_td0_ring(struct vnt_private *pDevice)
{
int i;
dma_addr_t curr;
@@ -1343,7 +1348,7 @@ static void device_init_td0_ring(PSDevice pDevice)
pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
}
-static void device_init_td1_ring(PSDevice pDevice)
+static void device_init_td1_ring(struct vnt_private *pDevice)
{
int i;
dma_addr_t curr;
@@ -1369,7 +1374,7 @@ static void device_init_td1_ring(PSDevice pDevice)
pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
}
-static void device_free_td0_ring(PSDevice pDevice)
+static void device_free_td0_ring(struct vnt_private *pDevice)
{
int i;
@@ -1388,7 +1393,7 @@ static void device_free_td0_ring(PSDevice pDevice)
}
}
-static void device_free_td1_ring(PSDevice pDevice)
+static void device_free_td1_ring(struct vnt_private *pDevice)
{
int i;
@@ -1409,7 +1414,7 @@ static void device_free_td1_ring(PSDevice pDevice)
/*-----------------------------------------------------------------*/
-static int device_rx_srv(PSDevice pDevice, unsigned int uIdx)
+static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx)
{
PSRxDesc pRD;
int works = 0;
@@ -1421,8 +1426,8 @@ static int device_rx_srv(PSDevice pDevice, unsigned int uIdx)
break;
if (device_receive_frame(pDevice, pRD)) {
if (!device_alloc_rx_buf(pDevice, pRD)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
- "%s: can not allocate rx buf\n", pDevice->dev->name);
+ pr_err("%s: can not allocate rx buf\n",
+ pDevice->dev->name);
break;
}
}
@@ -1435,7 +1440,7 @@ static int device_rx_srv(PSDevice pDevice, unsigned int uIdx)
return works;
}
-static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD)
+static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD)
{
PDEVICE_RD_INFO pRDInfo = pRD->pRDInfo;
@@ -1456,7 +1461,8 @@ static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD)
return true;
}
-bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF)
+bool device_alloc_frag_buf(struct vnt_private *pDevice,
+ PSDeFragControlBlock pDeF)
{
pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
if (pDeF->skb == NULL)
@@ -1467,7 +1473,7 @@ bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF)
return true;
}
-static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
+static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx)
{
PSTxDesc pTD;
bool bFull = false;
@@ -1512,8 +1518,9 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
if (!(byTsr1 & TSR1_TERR)) {
if (byTsr0 != 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
+ pr_debug(" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X]\n",
+ (int)uIdx, byTsr1,
+ byTsr0);
}
if ((pTxBufHead->wFragCtl & FRAGCTL_ENDFRAG) != FRAGCTL_NONFRAG)
pDevice->s802_11Counter.TransmittedFragmentCount++;
@@ -1521,8 +1528,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
pStats->tx_packets++;
pStats->tx_bytes += pTD->pTDInfo->skb->len;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
+ pr_debug(" Tx[%d] dropped & tsr1[%02X] tsr0[%02X]\n",
+ (int)uIdx, byTsr1, byTsr0);
pStats->tx_errors++;
pStats->tx_dropped++;
}
@@ -1530,7 +1537,7 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
if (pDevice->bEnableHostapd) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif..\n");
+ pr_debug("tx call back netif..\n");
skb = pTD->pTDInfo->skb;
skb->dev = pDevice->apdev;
skb_reset_mac_header(skb);
@@ -1542,8 +1549,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
if (byTsr1 & TSR1_TERR) {
if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
+ pr_debug(" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X]\n",
+ (int)uIdx, byTsr1, byTsr0);
}
@@ -1561,8 +1568,9 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID;
pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7];
pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n"
- , (int)uNodeIndex, pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt);
+ pr_debug("tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n",
+ (int)uNodeIndex,
+ pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt);
pStats->tx_errors--;
pStats->tx_dropped--;
}
@@ -1579,7 +1587,8 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
if (AVAIL_TD(pDevice, uIdx) < RESERV_AC0DMA) {
bFull = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]);
+ pr_debug(" AC0DMA is Full = %d\n",
+ pDevice->iTDUsed[uIdx]);
}
if (netif_queue_stopped(pDevice->dev) && !bFull)
netif_wake_queue(pDevice->dev);
@@ -1591,12 +1600,10 @@ static int device_tx_srv(PSDevice pDevice, unsigned int uIdx)
return works;
}
-static void device_error(PSDevice pDevice, unsigned short status)
+static void device_error(struct vnt_private *pDevice, unsigned short status)
{
if (status & ISR_FETALERR) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
- "%s: Hardware fatal error.\n",
- pDevice->dev->name);
+ pr_err("%s: Hardware fatal error\n", pDevice->dev->name);
netif_stop_queue(pDevice->dev);
del_timer(&pDevice->sTimerCommand);
del_timer(&(pDevice->pMgmt->sTimerSecondCallback));
@@ -1606,7 +1613,7 @@ static void device_error(PSDevice pDevice, unsigned short status)
}
}
-static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc)
+static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc)
{
PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
struct sk_buff *skb = pTDInfo->skb;
@@ -1627,7 +1634,7 @@ static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc)
static int device_open(struct net_device *dev)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int i;
#ifdef WPA_SM_Transtatus
extern SWPAResult wpa_Result;
@@ -1650,7 +1657,7 @@ static int device_open(struct net_device *dev)
wpa_Result.authenticated = false;
pDevice->fWPA_Authened = false;
#endif
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n");
+ pr_debug("call device init rd0 ring\n");
device_init_rd0_ring(pDevice);
device_init_rd1_ring(pDevice);
device_init_defrag_cb(pDevice);
@@ -1663,7 +1670,7 @@ static int device_open(struct net_device *dev)
vMgrObjectInit(pDevice);
vMgrTimerInit(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
+ pr_debug("call device_init_registers\n");
device_init_registers(pDevice);
MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
@@ -1694,7 +1701,7 @@ static int device_open(struct net_device *dev)
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n");
+ pr_debug("call MACvIntEnable\n");
MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) {
@@ -1705,13 +1712,13 @@ static int device_open(struct net_device *dev)
}
pDevice->flags |= DEVICE_FLAGS_OPENED;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n");
+ pr_debug("device_open success..\n");
return 0;
}
static int device_close(struct net_device *dev)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = pDevice->pMgmt;
//PLICE_DEBUG->
//PLICE_DEBUG<-
@@ -1720,9 +1727,8 @@ static int device_close(struct net_device *dev)
bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
mdelay(30);
}
-#ifdef TxInSleep
+
del_timer(&pDevice->sTimerTxData);
-#endif
del_timer(&pDevice->sTimerCommand);
del_timer(&pMgmt->sTimerSecondCallback);
if (pDevice->bDiversityRegCtlON) {
@@ -1752,21 +1758,21 @@ static int device_close(struct net_device *dev)
//2008-0714-01<Add>by chester
device_release_WPADEV(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close..\n");
+ pr_debug("device_close..\n");
return 0;
}
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev)
{
- PSDevice pDevice = netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
unsigned char *pbMPDU;
unsigned int cbMPDULen = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n");
+ pr_debug("device_dma0_tx_80211\n");
spin_lock_irq(&pDevice->lock);
if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n");
+ pr_debug("device_dma0_tx_80211, td0 <=0\n");
dev_kfree_skb_irq(skb);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -1788,7 +1794,8 @@ static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev)
return 0;
}
-bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex)
+bool device_dma0_xmit(struct vnt_private *pDevice,
+ struct sk_buff *skb, unsigned int uNodeIndex)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxDesc pHeadTD, pLastTD;
@@ -1808,14 +1815,14 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI
if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
dev_kfree_skb_irq(skb);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n");
+ pr_debug("device_dma0_xmit, td0 <=0\n");
return false;
}
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (pDevice->uAssocCount == 0) {
dev_kfree_skb_irq(skb);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n");
+ pr_debug("device_dma0_xmit, assocCount = 0\n");
return false;
}
}
@@ -1861,7 +1868,7 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI
else
pDevice->byPreambleType = PREAMBLE_LONG;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d\n", pDevice->wCurrentRate);
+ pr_debug("dma0: pDevice->wCurrentRate = %d\n", pDevice->wCurrentRate);
if (pDevice->wCurrentRate <= RATE_11M) {
byPktType = PK_TYPE_11B;
@@ -1928,10 +1935,8 @@ bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeI
}
//TYPE_AC0DMA data tx
-static int device_xmit(struct sk_buff *skb, struct net_device *dev)
-{
- PSDevice pDevice = netdev_priv(dev);
-
+static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxDesc pHeadTD, pLastTD;
unsigned int uNodeIndex = 0;
@@ -1988,8 +1993,9 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
// set tx map
wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID;
pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set:pMgmt->abyPSTxMap[%d]= %d\n",
- (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]);
+ pr_debug("Set:pMgmt->abyPSTxMap[%d]= %d\n",
+ (wAID >> 3),
+ pMgmt->abyPSTxMap[wAID >> 3]);
spin_unlock_irq(&pDevice->lock);
return 0;
}
@@ -2005,7 +2011,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
}
if (!bNodeExist) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Unknown STA not found in node DB\n");
+ pr_debug("Unknown STA not found in node DB\n");
dev_kfree_skb_irq(skb);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -2034,19 +2040,19 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
// get group key
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) {
bTKIP_UseGTK = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n");
+ pr_debug("Get GTK\n");
break;
}
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get PTK.\n");
+ pr_debug("Get PTK\n");
break;
}
} else if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS Serach Key:\n");
+ pr_debug("IBSS Serach Key:\n");
for (ii = 0; ii < 6; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "%x\n", *(pbyBSSID+ii));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "\n");
+ pr_debug("%x\n", *(pbyBSSID+ii));
+ pr_debug("\n");
// get pairwise key
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == true)
@@ -2057,18 +2063,20 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) {
pTransmitKey = NULL;
if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
+ pr_debug("IBSS and KEY is NULL. [%d]\n",
+ pDevice->pMgmt->eCurrMode);
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "NOT IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
+ pr_debug("NOT IBSS and KEY is NULL. [%d]\n",
+ pDevice->pMgmt->eCurrMode);
} else {
bTKIP_UseGTK = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n");
+ pr_debug("Get GTK\n");
}
} while (false);
}
if (pDevice->bEnableHostWEP) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "acdma0: STA index %d\n", uNodeIndex);
+ pr_debug("acdma0: STA index %d\n", uNodeIndex);
if (pDevice->bEncryptionEnable) {
pTransmitKey = &STempKey;
pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite;
@@ -2086,7 +2094,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum);
+ pr_debug("uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n",
+ uMACfragNum);
dev_kfree_skb_irq(skb);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -2164,18 +2173,21 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
}
if (bNeedEncryption) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType));
+ pr_debug("ntohs Pkt Type=%04x\n",
+ ntohs(pDevice->sTxEthHeader.wType));
if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) {
bNeedEncryption = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType));
+ pr_debug("Pkt Type=%04x\n",
+ (pDevice->sTxEthHeader.wType));
if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
if (pTransmitKey == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Don't Find TX KEY\n");
+ pr_debug("Don't Find TX KEY\n");
} else {
if (bTKIP_UseGTK) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "error: KEY is GTK!!~~\n");
+ pr_debug("error: KEY is GTK!!~~\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
+ pr_debug("Find PTK [%lX]\n",
+ pTransmitKey->dwKeyIndex);
bNeedEncryption = true;
}
}
@@ -2189,13 +2201,14 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
if (pDevice->bEnableHostWEP) {
if ((uNodeIndex != 0) &&
(pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
+ pr_debug("Find PTK [%lX]\n",
+ pTransmitKey->dwKeyIndex);
bNeedEncryption = true;
}
}
} else {
if (pTransmitKey == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return no tx key\n");
+ pr_debug("return no tx key\n");
dev_kfree_skb_irq(skb);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -2232,9 +2245,8 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
pLastTD->pTDInfo->skb = skb;
pLastTD->pTDInfo->byFlags = 0;
pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
-#ifdef TxInSleep
pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet
-#endif
+
if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 1)
netif_stop_queue(dev);
@@ -2284,8 +2296,7 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev)
static irqreturn_t device_intr(int irq, void *dev_instance)
{
struct net_device *dev = dev_instance;
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
-
+ struct vnt_private *pDevice = netdev_priv(dev);
int max_count = 0;
unsigned long dwMIBCounter = 0;
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -2301,7 +2312,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
return IRQ_RETVAL(handled);
if (pDevice->dwIsr == 0xffffffff) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n");
+ pr_debug("dwIsr = 0xffff\n");
return IRQ_RETVAL(handled);
}
@@ -2328,7 +2339,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
if (pDevice->dwIsr & ISR_FETALERR) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR\n");
+ pr_debug(" ISR_FETALERR\n");
VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
device_error(pDevice, pDevice->dwIsr);
@@ -2438,12 +2449,18 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
if (pDevice->uBBVGADiffCount == 1) {
// first VGA diff gain
BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
- (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
+ pr_debug("First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
+ (int)ldBm,
+ pDevice->byBBVGANew,
+ pDevice->byBBVGACurrent,
+ (int)pDevice->uBBVGADiffCount);
}
if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
- (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
+ pr_debug("RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
+ (int)ldBm,
+ pDevice->byBBVGANew,
+ pDevice->byBBVGACurrent,
+ (int)pDevice->uBBVGADiffCount);
BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
}
} else {
@@ -2577,7 +2594,8 @@ static int Config_FileGetParameter(unsigned char *string,
return true;
}
-int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter)
+int Config_FileOperation(struct vnt_private *pDevice,
+ bool fwrite, unsigned char *Parameter)
{
unsigned char *buffer = kmalloc(1024, GFP_KERNEL);
unsigned char tmpbuffer[20];
@@ -2624,10 +2642,8 @@ error1:
return result;
}
-static void device_set_multi(struct net_device *dev)
-{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
-
+static void device_set_multi(struct net_device *dev) {
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = pDevice->pMgmt;
u32 mc_filter[2];
struct netdev_hw_addr *ha;
@@ -2635,7 +2651,7 @@ static void device_set_multi(struct net_device *dev)
VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
- DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
+ pr_notice("%s: Promiscuous mode enabled\n", dev->name);
/* Unconditionally log net taps. */
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
} else if ((netdev_mc_count(dev) > pDevice->multicast_limit)
@@ -2667,20 +2683,19 @@ static void device_set_multi(struct net_device *dev)
}
VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byRxMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode);
+ pr_debug("pDevice->byRxMode = %x\n", pDevice->byRxMode);
}
static struct net_device_stats *device_get_stats(struct net_device *dev)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
return &pDevice->stats;
}
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
-
+ struct vnt_private *pDevice = netdev_priv(dev);
struct iwreq *wrq = (struct iwreq *)rq;
int rc = 0;
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -2758,13 +2773,13 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
// Set desired station name
case SIOCSIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN\n");
+ pr_debug(" SIOCSIWNICKN\n");
rc = -EOPNOTSUPP;
break;
// Get current station name
case SIOCGIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN\n");
+ pr_debug(" SIOCGIWNICKN\n");
rc = -EOPNOTSUPP;
break;
@@ -2861,12 +2876,12 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
// Get the current Tx-Power
case SIOCGIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW\n");
+ pr_debug(" SIOCGIWTXPOW\n");
rc = -EOPNOTSUPP;
break;
case SIOCSIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW\n");
+ pr_debug(" SIOCSIWTXPOW\n");
rc = -EOPNOTSUPP;
break;
@@ -2909,7 +2924,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break;
case SIOCSIWSENS:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS\n");
+ pr_debug(" SIOCSIWSENS\n");
rc = -EOPNOTSUPP;
break;
@@ -2933,50 +2948,50 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
// Set the spy list
case SIOCSIWSPY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY\n");
+ pr_debug(" SIOCSIWSPY\n");
rc = -EOPNOTSUPP;
break;
// Get the spy list
case SIOCGIWSPY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY\n");
+ pr_debug(" SIOCGIWSPY\n");
rc = -EOPNOTSUPP;
break;
#endif // WIRELESS_SPY
case SIOCGIWPRIV:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV\n");
+ pr_debug(" SIOCGIWPRIV\n");
rc = -EOPNOTSUPP;
break;
//2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
case SIOCSIWAUTH:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
+ pr_debug(" SIOCSIWAUTH\n");
rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL);
break;
case SIOCGIWAUTH:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH\n");
+ pr_debug(" SIOCGIWAUTH\n");
rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL);
break;
case SIOCSIWGENIE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE\n");
+ pr_debug(" SIOCSIWGENIE\n");
rc = iwctl_siwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
case SIOCGIWGENIE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE\n");
+ pr_debug(" SIOCGIWGENIE\n");
rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
case SIOCSIWENCODEEXT: {
char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT\n");
+ pr_debug(" SIOCSIWENCODEEXT\n");
if (wrq->u.encoding.pointer) {
memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN + 1);
if (wrq->u.encoding.length > (sizeof(struct iw_encode_ext) + MAX_KEY_LEN)) {
@@ -2996,12 +3011,12 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break;
case SIOCGIWENCODEEXT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT\n");
+ pr_debug(" SIOCGIWENCODEEXT\n");
rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL);
break;
case SIOCSIWMLME:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME\n");
+ pr_debug(" SIOCSIWMLME\n");
rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
@@ -3059,7 +3074,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
default:
rc = -EOPNOTSUPP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd);
+ pr_debug("Ioctl command not support..%x\n", cmd);
}
@@ -3070,7 +3085,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
spin_unlock_irq(&pDevice->lock);
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
+ pr_debug("Commit the settings\n");
spin_lock_irq(&pDevice->lock);
pDevice->bLinkPass = false;
memset(pMgmt->abyCurrBSSID, 0, 6);
@@ -3177,7 +3192,7 @@ viawget_suspend(struct pci_dev *pcid, pm_message_t state)
{
int power_status; // to silence the compiler
- PSDevice pDevice = pci_get_drvdata(pcid);
+ struct vnt_private *pDevice = pci_get_drvdata(pcid);
PSMgmtObject pMgmt = pDevice->pMgmt;
netif_stop_queue(pDevice->dev);
@@ -3203,7 +3218,7 @@ viawget_suspend(struct pci_dev *pcid, pm_message_t state)
static int
viawget_resume(struct pci_dev *pcid)
{
- PSDevice pDevice = pci_get_drvdata(pcid);
+ struct vnt_private *pDevice = pci_get_drvdata(pcid);
PSMgmtObject pMgmt = pDevice->pMgmt;
int power_status; // to silence the compiler
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 0bcf6c7472fe..7589cb4805f9 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -61,8 +61,6 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
static const unsigned char acbyRxRate[MAX_RATE] =
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
@@ -79,18 +77,18 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
PSEthernetHeader psEthHeader);
static void
-s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr,
+s_vProcessRxMACHeader(struct vnt_private *pDevice, unsigned char *pbyRxBufferAddr,
unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
unsigned int *pcbHeadSize);
static bool s_bAPModeRxCtl(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
int iSANodeIndex
);
static bool s_bAPModeRxData(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
struct sk_buff *skb,
unsigned int FrameSize,
unsigned int cbHeaderOffset,
@@ -99,7 +97,7 @@ static bool s_bAPModeRxData(
);
static bool s_bHandleRxEncryption(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
unsigned int FrameSize,
unsigned char *pbyRsr,
@@ -112,7 +110,7 @@ static bool s_bHandleRxEncryption(
static bool s_bHostWepRxEncryption(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
unsigned int FrameSize,
unsigned char *pbyRsr,
@@ -145,7 +143,8 @@ static bool s_bHostWepRxEncryption(
*
-*/
static void
-s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr,
+s_vProcessRxMACHeader(struct vnt_private *pDevice,
+ unsigned char *pbyRxBufferAddr,
unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
unsigned int *pcbHeadSize)
{
@@ -270,7 +269,7 @@ s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
bool
device_receive_frame(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSRxDesc pCurrRD
)
{
@@ -283,7 +282,7 @@ device_receive_frame(
unsigned char *pbyRsr;
unsigned char *pbyNewRsr;
unsigned char *pbyRSSI;
- PQWORD pqwTSFTime;
+ __le64 *pqwTSFTime;
unsigned short *pwFrameSize;
unsigned char *pbyFrame;
bool bDeFragRx = false;
@@ -324,7 +323,7 @@ device_receive_frame(
// Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
if ((FrameSize > 2364) || (FrameSize <= 32)) {
// Frame Size error drop this packet.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 1\n");
+ pr_debug("---------- WRONG Length 1\n");
return false;
}
@@ -334,7 +333,7 @@ device_receive_frame(
pbyRSSI = (unsigned char *)(skb->data + FrameSize - 2);
pbyNewRsr = (unsigned char *)(skb->data + FrameSize - 3);
pbySQ = (unsigned char *)(skb->data + FrameSize - 4);
- pqwTSFTime = (PQWORD)(skb->data + FrameSize - 12);
+ pqwTSFTime = (__le64 *)(skb->data + FrameSize - 12);
pbyFrame = (unsigned char *)(skb->data + 4);
// get packet size
@@ -342,7 +341,7 @@ device_receive_frame(
if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC
// Min: 14 bytes ACK
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n");
+ pr_debug("---------- WRONG Length 2\n");
return false;
}
//PLICE_DEBUG->
@@ -420,7 +419,7 @@ device_receive_frame(
if (IS_FC_WEP(pbyFrame)) {
bool bRxDecryOK = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx WEP pkt\n");
+ pr_debug("rx WEP pkt\n");
bIsWEP = true;
if ((pDevice->bEnableHostWEP) && (iSANodeIndex >= 0)) {
pKey = &STempKey;
@@ -458,7 +457,7 @@ device_receive_frame(
if (bRxDecryOK) {
if ((*pbyNewRsr & NEWRSR_DECRYPTOK) == 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV Fail\n");
+ pr_debug("ICV Fail\n");
if ((pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
(pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
(pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) ||
@@ -472,7 +471,7 @@ device_receive_frame(
return false;
}
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP Func Fail\n");
+ pr_debug("WEP Func Fail\n");
return false;
}
if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP))
@@ -515,8 +514,7 @@ device_receive_frame(
pRxPacket->cbMPDULen = FrameSize;
pRxPacket->uRSSI = *pbyRSSI;
pRxPacket->bySQ = *pbySQ;
- HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime));
- LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime));
+ pRxPacket->qwLocalTSF = le64_to_cpu(*pqwTSFTime);
if (bIsWEP) {
// strip IV
pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4);
@@ -554,8 +552,8 @@ device_receive_frame(
if (!(*pbyRsr & RSR_BSSIDOK)) {
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
}
return false;
@@ -565,8 +563,8 @@ device_receive_frame(
if (!pDevice->bLinkPass || !(*pbyRsr & RSR_BSSIDOK)) {
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
}
return false;
@@ -642,7 +640,7 @@ device_receive_frame(
wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) |
skb->data[cbIVOffset + 4 + 24 + 6 + 1];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wEtherType = %04x\n", wEtherType);
+ pr_debug("wEtherType = %04x\n", wEtherType);
if (wEtherType == ETH_P_PAE) {
skb->dev = pDevice->apdev;
@@ -717,13 +715,13 @@ device_receive_frame(
if ((le32_to_cpu(*pdwMIC_L) != dwLocalMIC_L) ||
(le32_to_cpu(*pdwMIC_R) != dwLocalMIC_R) ||
pDevice->bRxMICFail) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC comparison is fail!\n");
+ pr_debug("MIC comparison is fail!\n");
pDevice->bRxMICFail = false;
pDevice->s802_11Counter.TKIPLocalMICFailures++;
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
}
//2008-0409-07, <Add> by Einsn Liu
@@ -796,7 +794,7 @@ device_receive_frame(
RSC = dwRxTSC47_16;
RSC <<= 16;
RSC += wRxTSC15_0;
- memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD));
+ pKey->KeyRSC = RSC;
if ((pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) &&
(pDevice->sMgmtObj.eCurrState == WMAC_STATE_ASSOC)) {
@@ -804,7 +802,7 @@ device_receive_frame(
if ((wRxTSC15_0 < wLocalTSC15_0) &&
(dwRxTSC47_16 <= dwLocalTSC47_16) &&
!((dwRxTSC47_16 == 0) && (dwLocalTSC47_16 == 0xFFFFFFFF))) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC is illegal~~!\n ");
+ pr_debug("TSC is illegal~~!\n ");
if (pKey->byCipherSuite == KEY_CTL_TKIP)
pDevice->s802_11Counter.TKIPReplays++;
else
@@ -812,8 +810,8 @@ device_receive_frame(
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
}
return false;
@@ -840,8 +838,8 @@ device_receive_frame(
)) {
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
}
return false;
@@ -862,8 +860,8 @@ device_receive_frame(
if (bDeFragRx) {
if (!device_alloc_frag_buf(pDevice, &pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx])) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc more frag bufs\n",
- pDevice->dev->name);
+ pr_err("%s: can not alloc more frag bufs\n",
+ pDevice->dev->name);
}
return false;
}
@@ -872,7 +870,7 @@ device_receive_frame(
}
static bool s_bAPModeRxCtl(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
int iSANodeIndex
)
@@ -897,7 +895,7 @@ static bool s_bAPModeRxCtl(
(WLAN_MGMT_REASON_CLASS2_NONAUTH),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 1\n");
+ pr_debug("dpc: send vMgrDeAuthenBeginSta 1\n");
return true;
}
if (pMgmt->sNodeDBTable[iSANodeIndex].eNodeState < NODE_ASSOC) {
@@ -909,7 +907,7 @@ static bool s_bAPModeRxCtl(
(WLAN_MGMT_REASON_CLASS3_NONASSOC),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDisassocBeginSta 2\n");
+ pr_debug("dpc: send vMgrDisassocBeginSta 2\n");
return true;
}
@@ -918,7 +916,7 @@ static bool s_bAPModeRxCtl(
if (IS_CTL_PSPOLL(pbyFrame)) {
pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true;
bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n");
+ pr_debug("dpc: WLAN_CMD_RX_PSPOLL 1\n");
} else {
// check Data PS state
// if PW bit off, send out all PS bufferring packets.
@@ -926,7 +924,7 @@ static bool s_bAPModeRxCtl(
pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false;
pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true;
bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n");
+ pr_debug("dpc: WLAN_CMD_RX_PSPOLL 2\n");
}
}
} else {
@@ -940,7 +938,7 @@ static bool s_bAPModeRxCtl(
pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false;
pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true;
bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 3\n");
+ pr_debug("dpc: WLAN_CMD_RX_PSPOLL 3\n");
}
}
@@ -952,16 +950,18 @@ static bool s_bAPModeRxCtl(
(WLAN_MGMT_REASON_CLASS2_NONAUTH),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n",
- p802_11Header->abyAddr3);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n",
- p802_11Header->abyAddr2);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n",
- p802_11Header->abyAddr1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl);
+ pr_debug("dpc: send vMgrDeAuthenBeginSta 3\n");
+ pr_debug("BSSID:%pM\n",
+ p802_11Header->abyAddr3);
+ pr_debug("ADDR2:%pM\n",
+ p802_11Header->abyAddr2);
+ pr_debug("ADDR1:%pM\n",
+ p802_11Header->abyAddr1);
+ pr_debug("dpc: wFrameCtl= %x\n",
+ p802_11Header->wFrameCtl);
VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode);
+ pr_debug("dpc:pDevice->byRxMode = %x\n",
+ pDevice->byRxMode);
return true;
}
}
@@ -970,7 +970,7 @@ static bool s_bAPModeRxCtl(
}
static bool s_bHandleRxEncryption(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
unsigned int FrameSize,
unsigned char *pbyRsr,
@@ -999,7 +999,7 @@ static bool s_bHandleRxEncryption(
}
byKeyIdx = (*(pbyIV+3) & 0xc0);
byKeyIdx >>= 6;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\nKeyIdx: %d\n", byKeyIdx);
+ pr_debug("\nKeyIdx: %d\n", byKeyIdx);
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
(pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
@@ -1009,14 +1009,14 @@ static bool s_bHandleRxEncryption(
if (((*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) &&
(pDevice->pMgmt->byCSSPK != KEY_CTL_NONE)) {
// unicast pkt use pairwise key
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "unicast pkt\n");
+ pr_debug("unicast pkt\n");
if (KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, 0xFFFFFFFF, &pKey) == true) {
if (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP)
byDecMode = KEY_CTL_TKIP;
else if (pDevice->pMgmt->byCSSPK == KEY_CTL_CCMP)
byDecMode = KEY_CTL_CCMP;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "unicast pkt: %d, %p\n", byDecMode, pKey);
+ pr_debug("unicast pkt: %d, %p\n", byDecMode, pKey);
} else {
// use group key
KeybGetKey(&(pDevice->sKey), pDevice->abyBSSID, byKeyIdx, &pKey);
@@ -1024,7 +1024,8 @@ static bool s_bHandleRxEncryption(
byDecMode = KEY_CTL_TKIP;
else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
byDecMode = KEY_CTL_CCMP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group pkt: %d, %d, %p\n", byKeyIdx, byDecMode, pKey);
+ pr_debug("group pkt: %d, %d, %p\n",
+ byKeyIdx, byDecMode, pKey);
}
}
// our WEP only support Default Key
@@ -1038,10 +1039,11 @@ static bool s_bHandleRxEncryption(
}
*pKeyOut = pKey;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
+ pr_debug("AES:%d %d %d\n",
+ pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
if (pKey == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey == NULL\n");
+ pr_debug("pKey == NULL\n");
return false;
}
@@ -1074,13 +1076,13 @@ static bool s_bHandleRxEncryption(
PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc
*pdwRxTSC47_16 = cpu_to_le32(*(unsigned long *)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16);
+ pr_debug("ExtIV: %lx\n", *pdwRxTSC47_16);
if (byDecMode == KEY_CTL_TKIP)
*pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV + 2), *pbyIV));
else
*pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)pbyIV);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0);
+ pr_debug("TSC0_15: %x\n", *pwRxTSC15_0);
if ((byDecMode == KEY_CTL_TKIP) &&
(pDevice->byLocalID <= REV_ID_VT3253_A1)) {
@@ -1093,10 +1095,10 @@ static bool s_bHandleRxEncryption(
rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) {
*pbyNewRsr |= NEWRSR_DECRYPTOK;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV OK!\n");
+ pr_debug("ICV OK!\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV FAIL!!!\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PayloadLen = %d\n", PayloadLen);
+ pr_debug("ICV FAIL!!!\n");
+ pr_debug("PayloadLen = %d\n", PayloadLen);
}
}
}// end of TKIP/AES
@@ -1107,7 +1109,7 @@ static bool s_bHandleRxEncryption(
}
static bool s_bHostWepRxEncryption(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyFrame,
unsigned int FrameSize,
unsigned char *pbyRsr,
@@ -1136,21 +1138,22 @@ static bool s_bHostWepRxEncryption(
}
byKeyIdx = (*(pbyIV+3) & 0xc0);
byKeyIdx >>= 6;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\nKeyIdx: %d\n", byKeyIdx);
+ pr_debug("\nKeyIdx: %d\n", byKeyIdx);
if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
byDecMode = KEY_CTL_TKIP;
else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
byDecMode = KEY_CTL_CCMP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
+ pr_debug("AES:%d %d %d\n",
+ pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
if (byDecMode != pKey->byCipherSuite)
return false;
if (byDecMode == KEY_CTL_WEP) {
// handle WEP
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byDecMode == KEY_CTL_WEP\n");
+ pr_debug("byDecMode == KEY_CTL_WEP\n");
if ((pDevice->byLocalID <= REV_ID_VT3253_A1) ||
(((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == true) ||
@@ -1176,31 +1179,32 @@ static bool s_bHostWepRxEncryption(
PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc
*pdwRxTSC47_16 = cpu_to_le32(*(unsigned long *)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16);
+ pr_debug("ExtIV: %lx\n", *pdwRxTSC47_16);
if (byDecMode == KEY_CTL_TKIP)
*pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
else
*pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)pbyIV);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TSC0_15: %x\n", *pwRxTSC15_0);
+ pr_debug("TSC0_15: %x\n", *pwRxTSC15_0);
if (byDecMode == KEY_CTL_TKIP) {
if ((pDevice->byLocalID <= REV_ID_VT3253_A1) || !bOnFly) {
// Software TKIP
// 1. 3253 A
// 2. NotOnFly
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_TKIP\n");
+ pr_debug("soft KEY_CTL_TKIP\n");
pMACHeader = (PS802_11Header)(pbyFrame);
TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
if (ETHbIsBufferCrc32Ok(pbyIV+8, PayloadLen)) {
*pbyNewRsr |= NEWRSR_DECRYPTOK;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV OK!\n");
+ pr_debug("ICV OK!\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ICV FAIL!!!\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PayloadLen = %d\n", PayloadLen);
+ pr_debug("ICV FAIL!!!\n");
+ pr_debug("PayloadLen = %d\n",
+ PayloadLen);
}
}
}
@@ -1209,12 +1213,12 @@ static bool s_bHostWepRxEncryption(
if (!bOnFly) {
// Software CCMP
// NotOnFly
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "soft KEY_CTL_CCMP\n");
+ pr_debug("soft KEY_CTL_CCMP\n");
if (AESbGenCCMP(pKey->abyKey, pbyFrame, FrameSize)) {
*pbyNewRsr |= NEWRSR_DECRYPTOK;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CCMP MIC compare OK!\n");
+ pr_debug("CCMP MIC compare OK!\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CCMP MIC fail!\n");
+ pr_debug("CCMP MIC fail!\n");
}
}
}
@@ -1227,7 +1231,7 @@ static bool s_bHostWepRxEncryption(
}
static bool s_bAPModeRxData(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
struct sk_buff *skb,
unsigned int FrameSize,
unsigned int cbHeaderOffset,
@@ -1252,7 +1256,7 @@ static bool s_bAPModeRxData(
// if any node in PS mode, buffer packet until DTIM.
if (skbcpy == NULL) {
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available\n");
+ pr_info("relay multicast no skb available\n");
} else {
skbcpy->dev = pDevice->dev;
skbcpy->len = FrameSize;
@@ -1280,8 +1284,9 @@ static bool s_bAPModeRxData(
pMgmt->sNodeDBTable[iDANodeIndex].wEnQueueCnt++;
wAID = pMgmt->sNodeDBTable[iDANodeIndex].wAID;
pMgmt->abyPSTxMap[wAID >> 3] |= byMask[wAID & 7];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n",
- iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]);
+ pr_debug("relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n",
+ iDANodeIndex, (wAID >> 3),
+ pMgmt->abyPSTxMap[wAID >> 3]);
return true;
} else {
bRelayOnly = true;
diff --git a/drivers/staging/vt6655/dpc.h b/drivers/staging/vt6655/dpc.h
index 4914890115e4..a068b846b1be 100644
--- a/drivers/staging/vt6655/dpc.h
+++ b/drivers/staging/vt6655/dpc.h
@@ -35,7 +35,7 @@
bool
device_receive_frame(
- PSDevice pDevice,
+ struct vnt_private *,
PSRxDesc pCurrRD
);
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index f105c2ac091b..0dd87d481280 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -47,9 +47,6 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -68,16 +65,16 @@ static int msglevel = MSG_LEVEL_INFO;
*
*/
-static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
+static int hostap_enable_hostapd(struct vnt_private *pDevice, int rtnl_locked)
{
- PSDevice apdev_priv;
+ struct vnt_private *apdev_priv;
struct net_device *dev = pDevice->dev;
int ret;
const struct net_device_ops apdev_netdev_ops = {
.ndo_start_xmit = pDevice->tx_80211,
};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
+ pr_debug("%s: Enabling hostapd mode\n", dev->name);
pDevice->apdev = alloc_etherdev(sizeof(*apdev_priv));
if (pDevice->apdev == NULL)
@@ -101,15 +98,15 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
else
ret = register_netdev(pDevice->apdev);
if (ret) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdevice(AP) failed!\n",
- dev->name);
+ pr_debug("%s: register_netdevice(AP) failed!\n",
+ dev->name);
free_netdev(pDevice->apdev);
pDevice->apdev = NULL;
return -1;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdevice %s for AP management\n",
- dev->name, pDevice->apdev->name);
+ pr_debug("%s: Registered netdevice %s for AP management\n",
+ dev->name, pDevice->apdev->name);
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
@@ -130,17 +127,17 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
*
*/
-static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
+static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked)
{
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: disabling hostapd mode\n", pDevice->dev->name);
+ pr_debug("%s: disabling hostapd mode\n", pDevice->dev->name);
if (pDevice->apdev && pDevice->apdev->name && pDevice->apdev->name[0]) {
if (rtnl_locked)
unregister_netdevice(pDevice->apdev);
else
unregister_netdev(pDevice->apdev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
- pDevice->dev->name, pDevice->apdev->name);
+ pr_debug("%s: Netdevice %s unregistered\n",
+ pDevice->dev->name, pDevice->apdev->name);
}
if (pDevice->apdev)
free_netdev(pDevice->apdev);
@@ -172,7 +169,8 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)
*
*/
-int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
+int vt6655_hostap_set_hostapd(struct vnt_private *pDevice,
+ int val, int rtnl_locked)
{
if (val < 0 || val > 1)
return -EINVAL;
@@ -201,7 +199,7 @@ int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
* Return Value:
*
*/
-static int hostap_remove_sta(PSDevice pDevice,
+static int hostap_remove_sta(struct vnt_private *pDevice,
struct viawget_hostapd_param *param)
{
unsigned int uNodeIndex;
@@ -227,14 +225,14 @@ static int hostap_remove_sta(PSDevice pDevice,
* Return Value:
*
*/
-static int hostap_add_sta(PSDevice pDevice,
+static int hostap_add_sta(struct vnt_private *pDevice,
struct viawget_hostapd_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex;
if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex))
- BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
+ BSSvCreateOneNode(pDevice, &uNodeIndex);
memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN);
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC;
@@ -256,17 +254,10 @@ static int hostap_add_sta(PSDevice pDevice,
pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer = jiffies;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
- param->sta_addr[0],
- param->sta_addr[1],
- param->sta_addr[2],
- param->sta_addr[3],
- param->sta_addr[4],
- param->sta_addr[5]
- );
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Max Support rate = %d\n",
- pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
+ pr_debug("Add STA AID= %d\n", pMgmt->sNodeDBTable[uNodeIndex].wAID);
+ pr_debug("MAC=%pM\n", param->sta_addr);
+ pr_debug("Max Support rate = %d\n",
+ pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
return 0;
}
@@ -285,7 +276,7 @@ static int hostap_add_sta(PSDevice pDevice,
*
*/
-static int hostap_get_info_sta(PSDevice pDevice,
+static int hostap_get_info_sta(struct vnt_private *pDevice,
struct viawget_hostapd_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -314,7 +305,7 @@ static int hostap_get_info_sta(PSDevice pDevice,
* Return Value:
*
*/
-static int hostap_set_flags_sta(PSDevice pDevice,
+static int hostap_set_flags_sta(struct vnt_private *pDevice,
struct viawget_hostapd_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -323,8 +314,8 @@ static int hostap_set_flags_sta(PSDevice pDevice,
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or;
pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x\n",
- (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
+ pr_debug(" dwFlags = %x\n",
+ (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
} else {
return -ENOENT;
}
@@ -345,7 +336,7 @@ static int hostap_set_flags_sta(PSDevice pDevice,
* Return Value:
*
*/
-static int hostap_set_generic_element(PSDevice pDevice,
+static int hostap_set_generic_element(struct vnt_private *pDevice,
struct viawget_hostapd_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -357,18 +348,18 @@ static int hostap_set_generic_element(PSDevice pDevice,
pMgmt->wWPAIELen = param->u.generic_elem.len;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen);
+ pr_debug("pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen);
// disable wpa
if (pMgmt->wWPAIELen == 0) {
pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " No WPAIE, Disable WPA\n");
+ pr_debug(" No WPAIE, Disable WPA\n");
} else {
// enable wpa
if ((pMgmt->abyWPAIE[0] == WLAN_EID_RSN_WPA) ||
(pMgmt->abyWPAIE[0] == WLAN_EID_RSN)) {
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set WPAIE enable WPA\n");
+ pr_debug("Set WPAIE enable WPA\n");
} else
return -EINVAL;
}
@@ -389,7 +380,7 @@ static int hostap_set_generic_element(PSDevice pDevice,
*
*/
-static void hostap_flush_sta(PSDevice pDevice)
+static void hostap_flush_sta(struct vnt_private *pDevice)
{
// reserved node index =0 for multicast node.
BSSvClearNodeDBTable(pDevice, 1);
@@ -409,7 +400,7 @@ static void hostap_flush_sta(PSDevice pDevice)
* Return Value:
*
*/
-static int hostap_set_encryption(PSDevice pDevice,
+static int hostap_set_encryption(struct vnt_private *pDevice,
struct viawget_hostapd_param *param,
int param_len)
{
@@ -417,7 +408,7 @@ static int hostap_set_encryption(PSDevice pDevice,
unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
- unsigned long long KeyRSC;
+ u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP;
int iNodeIndex = -1;
int ii;
@@ -431,7 +422,7 @@ static int hostap_set_encryption(PSDevice pDevice,
if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n");
+ pr_debug(" HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n");
return -EINVAL;
}
@@ -443,12 +434,12 @@ static int hostap_set_encryption(PSDevice pDevice,
} else {
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
+ pr_debug(" HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
return -EINVAL;
}
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: sta_index %d\n", iNodeIndex);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " hostap_set_encryption: alg %d\n", param->u.crypt.alg);
+ pr_debug(" hostap_set_encryption: sta_index %d\n", iNodeIndex);
+ pr_debug(" hostap_set_encryption: alg %d\n", param->u.crypt.alg);
if (param->u.crypt.alg == WPA_ALG_NONE) {
if (pMgmt->sNodeDBTable[iNodeIndex].bOnFly) {
@@ -456,7 +447,7 @@ static int hostap_set_encryption(PSDevice pDevice,
param->sta_addr,
pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex,
pDevice->PortOffset)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybRemoveKey fail\n");
+ pr_debug("KeybRemoveKey fail\n");
}
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false;
}
@@ -509,7 +500,7 @@ static int hostap_set_encryption(PSDevice pDevice,
&param->sta_addr[0],
dwKeyIndex & ~(USE_KEYRSC),
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
KEY_CTL_WEP,
pDevice->PortOffset,
@@ -534,7 +525,7 @@ static int hostap_set_encryption(PSDevice pDevice,
if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8);
for (ii = 0; ii < 8; ii++)
- KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);
+ KeyRSC |= (u64)abySeq[ii] << (ii * 8);
dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
@@ -563,7 +554,7 @@ static int hostap_set_encryption(PSDevice pDevice,
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
abyKey,
byKeyDecMode,
pDevice->PortOffset,
@@ -576,7 +567,7 @@ static int hostap_set_encryption(PSDevice pDevice,
&param->sta_addr[0],
dwKeyIndex,
param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
@@ -587,7 +578,7 @@ static int hostap_set_encryption(PSDevice pDevice,
// Key Table Full
pMgmt->sNodeDBTable[iNodeIndex].bOnFly = false;
bKeyTableFull = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Key Table Full\n");
+ pr_debug(" Key Table Full\n");
}
}
@@ -601,16 +592,15 @@ static int hostap_set_encryption(PSDevice pDevice,
MACvSetDefaultKeyCtl(pDevice->PortOffset, wKeyCtl, MAX_KEY_TABLE-1, pDevice->byLocalID);
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set key sta_index= %d\n", iNodeIndex);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " tx_index=%d len=%d\n", param->u.crypt.idx,
- param->u.crypt.key_len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx\n",
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]
-);
+ pr_debug(" Set key sta_index= %d\n", iNodeIndex);
+ pr_debug(" tx_index=%d len=%d\n",
+ param->u.crypt.idx, param->u.crypt.key_len);
+ pr_debug(" key=%x-%x-%x-%x-%x-xxxxx\n",
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[0],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[1],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[2],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[3],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[4]);
// set wep key
pDevice->bEncryptionEnable = true;
@@ -635,7 +625,7 @@ static int hostap_set_encryption(PSDevice pDevice,
* Return Value:
*
*/
-static int hostap_get_encryption(PSDevice pDevice,
+static int hostap_get_encryption(struct vnt_private *pDevice,
struct viawget_hostapd_param *param,
int param_len)
{
@@ -650,11 +640,11 @@ static int hostap_get_encryption(PSDevice pDevice,
} else {
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &iNodeIndex) == false) {
param->u.crypt.err = HOSTAP_CRYPT_ERR_UNKNOWN_ADDR;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
+ pr_debug("hostap_get_encryption: HOSTAP_CRYPT_ERR_UNKNOWN_ADDR\n");
return -EINVAL;
}
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex);
+ pr_debug("hostap_get_encryption: %d\n", iNodeIndex);
memset(param->u.crypt.seq, 0, 8);
for (ii = 0; ii < 8; ii++)
param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8);
@@ -675,7 +665,7 @@ static int hostap_get_encryption(PSDevice pDevice,
* Return Value:
*
*/
-int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
+int vt6655_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p)
{
struct viawget_hostapd_param *param;
int ret = 0;
@@ -696,67 +686,67 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) {
case VIAWGET_HOSTAPD_SET_ENCRYPTION:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION\n");
+ pr_debug("VIAWGET_HOSTAPD_SET_ENCRYPTION\n");
spin_lock_irq(&pDevice->lock);
ret = hostap_set_encryption(pDevice, param, p->length);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_HOSTAPD_GET_ENCRYPTION:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_ENCRYPTION\n");
+ pr_debug("VIAWGET_HOSTAPD_GET_ENCRYPTION\n");
spin_lock_irq(&pDevice->lock);
ret = hostap_get_encryption(pDevice, param, p->length);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n");
+ pr_debug("VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR\n");
ret = -EOPNOTSUPP;
goto out;
case VIAWGET_HOSTAPD_FLUSH:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH\n");
+ pr_debug("VIAWGET_HOSTAPD_FLUSH\n");
spin_lock_irq(&pDevice->lock);
hostap_flush_sta(pDevice);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_HOSTAPD_ADD_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_ADD_STA\n");
+ pr_debug("VIAWGET_HOSTAPD_ADD_STA\n");
spin_lock_irq(&pDevice->lock);
ret = hostap_add_sta(pDevice, param);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_HOSTAPD_REMOVE_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_REMOVE_STA\n");
+ pr_debug("VIAWGET_HOSTAPD_REMOVE_STA\n");
spin_lock_irq(&pDevice->lock);
ret = hostap_remove_sta(pDevice, param);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_HOSTAPD_GET_INFO_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_GET_INFO_STA\n");
+ pr_debug("VIAWGET_HOSTAPD_GET_INFO_STA\n");
ret = hostap_get_info_sta(pDevice, param);
ap_ioctl = 1;
break;
case VIAWGET_HOSTAPD_SET_FLAGS_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA\n");
+ pr_debug("VIAWGET_HOSTAPD_SET_FLAGS_STA\n");
ret = hostap_set_flags_sta(pDevice, param);
break;
case VIAWGET_HOSTAPD_MLME:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME\n");
+ pr_debug("VIAWGET_HOSTAPD_MLME\n");
ret = -EOPNOTSUPP;
goto out;
case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n");
+ pr_debug("VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT\n");
ret = hostap_set_generic_element(pDevice, param);
break;
case VIAWGET_HOSTAPD_SCAN_REQ:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ\n");
+ pr_debug("VIAWGET_HOSTAPD_SCAN_REQ\n");
ret = -EOPNOTSUPP;
goto out;
case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS\n");
+ pr_debug("VIAWGET_HOSTAPD_STA_CLEAR_STATS\n");
ret = -EOPNOTSUPP;
goto out;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n",
- (int)param->cmd);
+ pr_debug("vt6655_hostap_ioctl: unknown cmd=%d\n",
+ (int)param->cmd);
ret = -EOPNOTSUPP;
goto out;
}
diff --git a/drivers/staging/vt6655/hostap.h b/drivers/staging/vt6655/hostap.h
index 6e801a428183..17df4e403fcf 100644
--- a/drivers/staging/vt6655/hostap.h
+++ b/drivers/staging/vt6655/hostap.h
@@ -52,7 +52,7 @@
#define ARPHRD_IEEE80211 801
#endif
-int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked);
-int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p);
+int vt6655_hostap_set_hostapd(struct vnt_private *, int val, int rtnl_locked);
+int vt6655_hostap_ioctl(struct vnt_private *, struct iw_point *p);
#endif // __HOSTAP_H__
diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c
index 65e59336f03b..970e80d92fb9 100644
--- a/drivers/staging/vt6655/ioctl.c
+++ b/drivers/staging/vt6655/ioctl.c
@@ -38,13 +38,11 @@
#include "wpactl.h"
#include "rf.h"
-static int msglevel = MSG_LEVEL_INFO;
-
#ifdef WPA_SM_Transtatus
SWPAResult wpa_Result;
#endif
-int private_ioctl(PSDevice pDevice, struct ifreq *rq)
+int private_ioctl(struct vnt_private *pDevice, struct ifreq *rq)
{
PSCmdRequest pReq = (PSCmdRequest)rq;
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -74,7 +72,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
switch (pReq->wCmdCode) {
case WLAN_CMD_BSS_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n");
+ pr_debug("WLAN_CMD_BSS_SCAN..begin\n");
if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
result = -EFAULT;
break;
@@ -175,27 +173,27 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
if (sJoinCmd.wBSSType == ADHOC) {
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n");
+ pr_debug("ioct set to adhoc mode\n");
} else {
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
+ pr_debug("ioct set to STA mode\n");
}
if (sJoinCmd.bPSEnable == true) {
pDevice->ePSMode = WMAC_POWER_FAST;
pMgmt->wListenInterval = 2;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
+ pr_debug("Power Saving On\n");
} else {
pDevice->ePSMode = WMAC_POWER_CAM;
pMgmt->wListenInterval = 1;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n");
+ pr_debug("Power Saving Off\n");
}
if (sJoinCmd.bShareKeyAuth == true) {
pMgmt->bShareKeyAlgorithm = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
+ pr_debug("Share Key\n");
} else {
pMgmt->bShareKeyAlgorithm = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
+ pr_debug("Open System\n");
}
pDevice->uChannel = sJoinCmd.uChannel;
netif_stop_queue(pDevice->dev);
@@ -207,7 +205,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
break;
case WLAN_CMD_SET_WEP:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n");
+ pr_debug("WLAN_CMD_SET_WEP Key\n");
memset(&sWEPCmd, 0, sizeof(SCmdSetWEP));
if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
result = -EFAULT;
@@ -217,7 +215,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
pDevice->bEncryptionEnable = false;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
MACvDisableDefaultKey(pDevice->PortOffset);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n");
+ pr_debug("WEP function disable\n");
break;
}
@@ -247,7 +245,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
case WLAN_CMD_GET_LINK: {
SCmdLinkStatus sLinkStatus;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n");
+ pr_debug("WLAN_CMD_GET_LINK status\n");
memset(&sLinkStatus, 0, sizeof(sLinkStatus));
@@ -268,7 +266,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Link Success!\n");
+ pr_debug(" Link Success!\n");
} else {
sLinkStatus.bLink = false;
sLinkStatus.uLinkRate = 0;
@@ -364,7 +362,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
break;
case WLAN_CMD_STOP_MAC:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n");
+ pr_debug("WLAN_CMD_STOP_MAC\n");
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
@@ -383,7 +381,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
break;
case WLAN_CMD_START_MAC:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
+ pr_debug("WLAN_CMD_START_MAC\n");
if (pDevice->bMACSuspend == true) {
if (pDevice->bRadioOff == true)
@@ -396,7 +394,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
break;
case WLAN_CMD_SET_HOSTAPD:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n");
+ pr_debug("WLAN_CMD_SET_HOSTAPD\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT;
@@ -404,23 +402,23 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
if (sValue.dwValue == 1) {
if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n");
+ pr_debug("Enable HOSTAP\n");
} else {
result = -EFAULT;
break;
}
} else {
vt6655_hostap_set_hostapd(pDevice, 0, 1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n");
+ pr_debug("Disable HOSTAP\n");
}
break;
case WLAN_CMD_SET_HOSTAPD_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
+ pr_debug("WLAN_CMD_SET_HOSTAPD_STA\n");
break;
case WLAN_CMD_SET_802_1X:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n");
+ pr_debug("WLAN_CMD_SET_802_1X\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT;
break;
@@ -428,15 +426,15 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
if (sValue.dwValue == 1) {
pDevice->bEnable8021x = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n");
+ pr_debug("Enable 802.1x\n");
} else {
pDevice->bEnable8021x = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n");
+ pr_debug("Disable 802.1x\n");
}
break;
case WLAN_CMD_SET_HOST_WEP:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n");
+ pr_debug("WLAN_CMD_SET_HOST_WEP\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT;
break;
@@ -444,32 +442,32 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
if (sValue.dwValue == 1) {
pDevice->bEnableHostWEP = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n");
+ pr_debug("Enable HostWEP\n");
} else {
pDevice->bEnableHostWEP = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n");
+ pr_debug("Disable HostWEP\n");
}
break;
case WLAN_CMD_SET_WPA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n");
+ pr_debug("WLAN_CMD_SET_WPA\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT;
break;
}
if (sValue.dwValue == 1) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n");
+ pr_debug("up wpadev\n");
eth_hw_addr_inherit(pDevice->wpadev, pDevice->dev);
pDevice->bWPADEVUp = true;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n");
+ pr_debug("close wpadev\n");
pDevice->bWPADEVUp = false;
}
break;
case WLAN_CMD_AP_START:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n");
+ pr_debug("WLAN_CMD_AP_START\n");
if (pDevice->bRadioOff == true) {
CARDbRadioPowerOn(pDevice);
vMgrTimerInit(pDevice);
@@ -483,9 +481,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
if (sStartAPCmd.wBSSType == AP) {
pMgmt->eConfigMode = WMAC_CONFIG_AP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n");
+ pr_debug("ioct set to AP mode\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n");
+ pr_debug("ioct BSS type not set to AP mode\n");
result = -EFAULT;
break;
}
@@ -513,10 +511,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
if (sStartAPCmd.bShareKeyAuth == true) {
pMgmt->bShareKeyAlgorithm = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
+ pr_debug("Share Key\n");
} else {
pMgmt->bShareKeyAlgorithm = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
+ pr_debug("Open System\n");
}
memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6);
@@ -540,8 +538,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
pMgmt->abyIBSSSuppRates[3] |= BIT7;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %*ph\n",
- 4, pMgmt->abyIBSSSuppRates + 2);
+ pr_debug("Support Rate= %*ph\n",
+ 4, pMgmt->abyIBSSSuppRates + 2);
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
@@ -597,12 +595,12 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex;
pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength;
memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
- pNodeList->sNodeList[jj].abyWepKey[0],
- pNodeList->sNodeList[jj].abyWepKey[1],
- pNodeList->sNodeList[jj].abyWepKey[2],
- pNodeList->sNodeList[jj].abyWepKey[3],
- pNodeList->sNodeList[jj].abyWepKey[4]);
+ pr_debug("key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+ pNodeList->sNodeList[jj].abyWepKey[0],
+ pNodeList->sNodeList[jj].abyWepKey[1],
+ pNodeList->sNodeList[jj].abyWepKey[2],
+ pNodeList->sNodeList[jj].abyWepKey[3],
+ pNodeList->sNodeList[jj].abyWepKey[4]);
pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback;
pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures;
pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts;
@@ -653,7 +651,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
#endif
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n");
+ pr_debug("Private command not support..\n");
}
return result;
diff --git a/drivers/staging/vt6655/ioctl.h b/drivers/staging/vt6655/ioctl.h
index 187fc915fd12..2dc5a5743e8d 100644
--- a/drivers/staging/vt6655/ioctl.h
+++ b/drivers/staging/vt6655/ioctl.h
@@ -31,6 +31,6 @@
#include "device.h"
-int private_ioctl(PSDevice pDevice, struct ifreq *rq);
+int private_ioctl(struct vnt_private *, struct ifreq *rq);
#endif // __IOCTL_H__
diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h
index 772bc4c2a7b9..fe4b22ed49f4 100644
--- a/drivers/staging/vt6655/iowpa.h
+++ b/drivers/staging/vt6655/iowpa.h
@@ -75,7 +75,7 @@ struct viawget_wpa_param {
u8 bssid[6];
u8 ssid[32];
u8 ssid_len;
- u8 *wpa_ie;
+ u8 __user *wpa_ie;
u16 wpa_ie_len;
int pairwise_suite;
int group_suite;
@@ -102,7 +102,7 @@ struct viawget_wpa_param {
struct {
u16 scan_count;
- u8 *buf;
+ u8 __user *buf;
} scan_results;
} u;
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 7ce23b57e78d..6a6bdd31cfd7 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -66,9 +66,6 @@ static const long frequency_list[] = {
};
/*--------------------- Static Classes ----------------------------*/
-
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
@@ -76,7 +73,7 @@ static int msglevel = MSG_LEVEL_INFO;
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
{
- PSDevice pDevice = netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
long ldBm;
pDevice->wstats.status = pDevice->eOPMode;
@@ -108,7 +105,7 @@ static int iwctl_commit(struct net_device *dev,
void *wrq,
char *extra)
{
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT\n");
+ pr_debug(" SIOCSIWCOMMIT\n");
return 0;
}
@@ -134,13 +131,13 @@ static int iwctl_siwscan(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra;
unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
PWLAN_IE_SSID pItemSSID = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN\n");
+ pr_debug(" SIOCSIWSCAN\n");
if (pDevice->byReAssocCount > 0) { //reject scan when re-associating!
//send scan event to wpa_Supplicant
@@ -198,7 +195,7 @@ static int iwctl_giwscan(struct net_device *dev,
char *extra)
{
int ii, jj, kk;
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PKnownBSS pBSS;
PWLAN_IE_SSID pItemSSID;
@@ -210,7 +207,7 @@ static int iwctl_giwscan(struct net_device *dev,
long ldBm;
char buf[MAX_WPA_IE_LEN * 2 + 30];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n");
+ pr_debug(" SIOCGIWSCAN\n");
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning..
@@ -350,10 +347,10 @@ int iwctl_siwfreq(struct net_device *dev,
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n");
+ pr_debug(" SIOCSIWFREQ\n");
// If setting by frequency, convert to a channel
if ((wrq->e == 1) &&
@@ -374,11 +371,12 @@ int iwctl_siwfreq(struct net_device *dev,
int channel = wrq->m;
if ((channel < 1) || (channel > 14)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
+ pr_debug("%s: New channel value of %d is invalid!\n",
+ dev->name, wrq->m);
rc = -EINVAL;
} else {
// Yes ! We can set it !!!
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
+ pr_debug(" Set to channel = %d\n", channel);
pDevice->uChannel = channel;
//2007-0207-04,<Add> by EinsnLiu
//Make change effect at once
@@ -398,10 +396,10 @@ int iwctl_giwfreq(struct net_device *dev,
struct iw_freq *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n");
+ pr_debug(" SIOCGIWFREQ\n");
#ifdef WEXT_USECHANNELS
wrq->m = (int)pMgmt->uCurrChannel;
@@ -429,14 +427,14 @@ int iwctl_siwmode(struct net_device *dev,
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n");
+ pr_debug(" SIOCSIWMODE\n");
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running\n");
+ pr_debug("Can't set operation mode, hostapd is running\n");
return rc;
}
@@ -448,7 +446,7 @@ int iwctl_siwmode(struct net_device *dev,
pDevice->bCommit = true;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc\n");
+ pr_debug("set mode to ad-hoc\n");
break;
case IW_MODE_AUTO:
case IW_MODE_INFRA:
@@ -458,7 +456,7 @@ int iwctl_siwmode(struct net_device *dev,
pDevice->bCommit = true;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure\n");
+ pr_debug("set mode to infrastructure\n");
break;
case IW_MODE_MASTER:
@@ -472,7 +470,7 @@ int iwctl_siwmode(struct net_device *dev,
pDevice->bCommit = true;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point\n");
+ pr_debug("set mode to Access Point\n");
break;
case IW_MODE_REPEAT:
@@ -495,10 +493,10 @@ int iwctl_giwmode(struct net_device *dev,
__u32 *wmode,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n");
+ pr_debug(" SIOCGIWMODE\n");
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
case WMAC_CONFIG_ESS_STA:
@@ -533,7 +531,7 @@ int iwctl_giwrange(struct net_device *dev,
int i, k;
unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n");
+ pr_debug(" SIOCGIWRANGE\n");
if (wrq->pointer) {
wrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
@@ -635,12 +633,12 @@ int iwctl_siwap(struct net_device *dev,
struct sockaddr *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP\n");
+ pr_debug(" SIOCSIWAP\n");
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning..
pr_debug("SIOCSIWAP(??)-->In scanning..\n");
@@ -694,10 +692,10 @@ int iwctl_giwap(struct net_device *dev,
struct sockaddr *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n");
+ pr_debug(" SIOCGIWAP\n");
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
//2008-0410,<Modify> by Einsn Liu
@@ -728,10 +726,10 @@ int iwctl_giwaplist(struct net_device *dev,
struct iw_quality *q = NULL;
PKnownBSS pBSS = NULL;
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST\n");
+ pr_debug(" SIOCGIWAPLIST\n");
if (!capable(CAP_NET_ADMIN)) {
rc = -EPERM;
@@ -794,13 +792,13 @@ int iwctl_siwessid(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
//2008-0409-05, <Add> by Einsn Liu
unsigned char len;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID\n");
+ pr_debug(" SIOCSIWESSID\n");
pDevice->fWPA_Authened = false;
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning..
@@ -885,7 +883,7 @@ int iwctl_siwessid(struct net_device *dev,
}
#endif
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s\n", pItemSSID->abySSID);
+ pr_debug("set essid = %s\n", pItemSSID->abySSID);
}
if (pDevice->flags & DEVICE_FLAGS_OPENED)
@@ -903,11 +901,11 @@ int iwctl_giwessid(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n");
+ pr_debug(" SIOCGIWESSID\n");
// Note : if wrq->u.data.flags != 0, we should
// get the relevant SSID from the SSID list...
@@ -933,13 +931,13 @@ int iwctl_siwrate(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int rc = 0;
u8 brate = 0;
int i;
unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE\n");
+ pr_debug(" SIOCSIWRATE\n");
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
rc = -EINVAL;
return rc;
@@ -993,7 +991,8 @@ int iwctl_siwrate(struct net_device *dev,
pDevice->uConnectionRate = 3;
} else {
pDevice->uConnectionRate = brate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d\n", pDevice->uConnectionRate);
+ pr_debug("Fixed to Rate %d\n",
+ pDevice->uConnectionRate);
}
} else {
@@ -1014,12 +1013,12 @@ int iwctl_giwrate(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
//2007-0118-05,<Mark> by EinsnLiu
//Mark the unnecessary sentences.
// PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n");
+ pr_debug(" SIOCGIWRATE\n");
{
unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
int brate = 0;
@@ -1059,10 +1058,10 @@ int iwctl_siwrts(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS\n");
+ pr_debug(" SIOCSIWRTS\n");
{
int rthr = wrq->value;
@@ -1088,9 +1087,9 @@ int iwctl_giwrts(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n");
+ pr_debug(" SIOCGIWRTS\n");
wrq->value = pDevice->wRTSThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -1107,11 +1106,11 @@ int iwctl_siwfrag(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int rc = 0;
int fthr = wrq->value;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n");
+ pr_debug(" SIOCSIWFRAG\n");
if (wrq->disabled)
fthr = 2312;
@@ -1134,9 +1133,9 @@ int iwctl_giwfrag(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n");
+ pr_debug(" SIOCGIWFRAG\n");
wrq->value = pDevice->wFragmentationThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -1152,10 +1151,10 @@ int iwctl_siwretry(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n");
+ pr_debug(" SIOCSIWRETRY\n");
if (wrq->disabled) {
rc = -EINVAL;
@@ -1187,9 +1186,9 @@ int iwctl_giwretry(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n");
+ pr_debug(" SIOCGIWRETRY\n");
wrq->disabled = 0; // Can't be disabled
// Note : by default, display the min retry number
@@ -1217,7 +1216,7 @@ int iwctl_siwencode(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX);
int ii, uu, rc = 0;
@@ -1234,7 +1233,7 @@ int iwctl_siwencode(struct net_device *dev,
PSKeyTable pkeytab;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n");
+ pr_debug(" SIOCSIWENCODE\n");
if ((wrq->flags & IW_ENCODE_DISABLED) == 0) {
//Not disable encryption
@@ -1262,11 +1261,12 @@ int iwctl_siwencode(struct net_device *dev,
if (wrq->length > 0) {//have key
if (wrq->length == WLAN_WEP232_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
+ pr_debug("Set 232 bit wep key\n");
} else if (wrq->length == WLAN_WEP104_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
+ pr_debug("Set 104 bit wep key\n");
} else if (wrq->length == WLAN_WEP40_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
+ pr_debug("Set 40 bit wep key, index= %d\n",
+ (int)dwKeyIndex);
} else {//no support length
rc = -EINVAL;
return rc;
@@ -1274,9 +1274,9 @@ int iwctl_siwencode(struct net_device *dev,
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
memcpy(pDevice->abyKey, extra, wrq->length);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: ");
+ pr_debug("abyKey: ");
for (ii = 0; ii < wrq->length; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
+ pr_debug("%02x ", pDevice->abyKey[ii]);
if (pDevice->flags & DEVICE_FLAGS_OPENED) {
spin_lock_irq(&pDevice->lock);
@@ -1304,10 +1304,10 @@ int iwctl_siwencode(struct net_device *dev,
rc = -EINVAL;
return rc;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
+ pr_debug("Just set Default key Index:\n");
pkeytab = &(pDevice->sKey.KeyTable[MAX_KEY_TABLE - 1]);
if (pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength == 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
+ pr_debug("Default key len is 0\n");
rc = -EINVAL;
return rc;
}
@@ -1317,7 +1317,7 @@ int iwctl_siwencode(struct net_device *dev,
}
} else {//disable the key
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
+ pr_debug("Disable WEP function\n");
if (pDevice->bEncryptionEnable == false)
return 0;
pMgmt->bShareKeyAlgorithm = false;
@@ -1333,11 +1333,11 @@ int iwctl_siwencode(struct net_device *dev,
//End Modify,Einsn
if (wrq->flags & IW_ENCODE_RESTRICTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
+ pr_debug("Enable WEP & ShareKey System\n");
pMgmt->bShareKeyAlgorithm = true;
}
if (wrq->flags & IW_ENCODE_OPEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
+ pr_debug("Enable WEP & Open System\n");
pMgmt->bShareKeyAlgorithm = false;
}
return rc;
@@ -1348,14 +1348,14 @@ int iwctl_giwencode(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
char abyKey[WLAN_WEP232_KEYLEN];
unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
PSKeyItem pKey = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
+ pr_debug(" SIOCGIWENCODE\n");
if (index > WLAN_WEP_NKEYS)
return -EINVAL;
@@ -1410,11 +1410,11 @@ int iwctl_siwpower(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n");
+ pr_debug(" SIOCSIWPOWER\n");
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
rc = -EINVAL;
@@ -1436,14 +1436,14 @@ int iwctl_siwpower(struct net_device *dev,
}
switch (wrq->flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R\n");
+ pr_debug(" SIOCSIWPOWER: IW_POWER_UNICAST_R\n");
rc = -EINVAL;
break;
case IW_POWER_ALL_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R\n");
+ pr_debug(" SIOCSIWPOWER: IW_POWER_ALL_R\n");
rc = -EINVAL;
case IW_POWER_ON:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON\n");
+ pr_debug(" SIOCSIWPOWER: IW_POWER_ON\n");
break;
default:
rc = -EINVAL;
@@ -1460,11 +1460,11 @@ int iwctl_giwpower(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int mode = pDevice->ePSMode;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n");
+ pr_debug(" SIOCGIWPOWER\n");
wrq->disabled = (mode == WMAC_POWER_CAM);
if (wrq->disabled)
@@ -1490,10 +1490,10 @@ int iwctl_giwsens(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
long ldBm;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n");
+ pr_debug(" SIOCGIWSENS\n");
if (pDevice->bLinkPass == true) {
RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
wrq->value = ldBm;
@@ -1514,13 +1514,13 @@ int iwctl_siwauth(struct net_device *dev,
struct iw_param *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret = 0;
static int wpa_version = 0; //must be static to save the last value,einsn liu
static int pairwise = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
+ pr_debug(" SIOCSIWAUTH\n");
switch (wrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
wpa_version = wrq->value;
@@ -1623,7 +1623,7 @@ int iwctl_siwgenie(struct net_device *dev,
struct iw_point *wrq,
char __user *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret = 0;
char length;
@@ -1663,7 +1663,7 @@ int iwctl_giwgenie(struct net_device *dev,
struct iw_point *wrq,
char __user *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret = 0;
int space = wrq->length;
@@ -1688,7 +1688,7 @@ int iwctl_siwencodeext(struct net_device *dev,
struct iw_point *wrq,
char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct viawget_wpa_param *param = NULL;
//original member
@@ -1810,7 +1810,7 @@ int iwctl_siwmlme(struct net_device *dev,
struct iw_point *wrq,
char __user *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct vnt_private *pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_mlme mime;
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c
index 9339e2a4073a..211afae306c7 100644
--- a/drivers/staging/vt6655/key.c
+++ b/drivers/staging/vt6655/key.c
@@ -44,8 +44,6 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -134,7 +132,7 @@ bool KeybGetKey(
{
int i;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetKey()\n");
+ pr_debug("KeybGetKey()\n");
*pKey = NULL;
for (i = 0; i < MAX_KEY_TABLE; i++) {
@@ -184,7 +182,7 @@ bool KeybSetKey(
unsigned char *pbyBSSID,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
@@ -196,7 +194,7 @@ bool KeybSetKey(
PSKeyItem pKey;
unsigned int uKeyIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetKey: %lX\n", dwKeyIndex);
+ pr_debug("Enter KeybSetKey: %lX\n", dwKeyIndex);
j = (MAX_KEY_TABLE-1);
for (i = 0; i < (MAX_KEY_TABLE - 1); i++) {
@@ -221,7 +219,8 @@ bool KeybSetKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i);
+ pr_debug("Group transmit key(R)[%lX]: %d\n",
+ pTable->KeyTable[i].dwGTKeyIndex, i);
}
pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed
pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4);
@@ -245,24 +244,24 @@ bool KeybSetKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: ");
+ pr_debug("KeybSetKey(R):\n");
+ pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid);
+ pr_debug("pKey->abyKey: ");
for (ii = 0; ii < pKey->uKeyLength; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]);
+ pr_debug("%02x ", pKey->abyKey[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
+ pr_debug("pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
+ pr_debug("pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
+ pr_debug("pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
return true;
}
@@ -284,7 +283,8 @@ bool KeybSetKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j);
+ pr_debug("Group transmit key(N)[%lX]: %d\n",
+ pTable->KeyTable[j].dwGTKeyIndex, j);
}
pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed
pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4);
@@ -308,25 +308,25 @@ bool KeybSetKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(N):\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: ");
+ pr_debug("KeybSetKey(N):\n");
+ pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid);
+ pr_debug("pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength);
+ pr_debug("pKey->abyKey: ");
for (ii = 0; ii < pKey->uKeyLength; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]);
+ pr_debug("%02x ", pKey->abyKey[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
+ pr_debug("pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
+ pr_debug("pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
+ pr_debug("pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
return true;
}
@@ -511,48 +511,51 @@ bool KeybGetTransmitKey(
if (pTable->KeyTable[i].PairwiseKey.bKeyValid) {
*pKey = &(pTable->KeyTable[i].PairwiseKey);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PAIRWISE_KEY: KeyTable.abyBSSID: ");
+ pr_debug("KeybGetTransmitKey:");
+ pr_debug("PAIRWISE_KEY: KeyTable.abyBSSID: ");
for (ii = 0; ii < 6; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x ", pTable->KeyTable[i].abyBSSID[ii]);
+ pr_debug("%x ",
+ pTable->KeyTable[i].abyBSSID[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
return true;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PairwiseKey.bKeyValid == false\n");
+ pr_debug("PairwiseKey.bKeyValid == false\n");
return false;
}
} // End of Type == PAIRWISE
else {
if (pTable->KeyTable[i].dwGTKeyIndex == 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: dwGTKeyIndex == 0 !!!\n");
+ pr_debug("ERROR: dwGTKeyIndex == 0 !!!\n");
return false;
}
if (pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)].bKeyValid) {
*pKey = &(pTable->KeyTable[i].GroupKey[(pTable->KeyTable[i].dwGTKeyIndex&0x000000FF)]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybGetTransmitKey:");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP_KEY: KeyTable.abyBSSID\n");
+ pr_debug("KeybGetTransmitKey:");
+ pr_debug("GROUP_KEY: KeyTable.abyBSSID\n");
for (ii = 0; ii < 6; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x ", pTable->KeyTable[i].abyBSSID[ii]);
+ pr_debug("%x ",
+ pTable->KeyTable[i].abyBSSID[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex);
+ pr_debug("\n");
+ pr_debug("dwGTKeyIndex: %lX\n",
+ pTable->KeyTable[i].dwGTKeyIndex);
return true;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GroupKey.bKeyValid == false\n");
+ pr_debug("GroupKey.bKeyValid == false\n");
return false;
}
} // End of Type = GROUP
} // BSSID match
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ERROR: NO Match BSSID !!! ");
+ pr_debug("ERROR: NO Match BSSID !!! ");
for (ii = 0; ii < 6; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *(pbyBSSID+ii));
+ pr_debug("%02x ", *(pbyBSSID+ii));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
return false;
}
@@ -606,7 +609,7 @@ bool KeybSetDefaultKey(
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
@@ -617,7 +620,8 @@ bool KeybSetDefaultKey(
PSKeyItem pKey;
unsigned int uKeyIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d\n", (int)dwKeyIndex, (int)uKeyLength);
+ pr_debug("Enter KeybSetDefaultKey: %1x, %d\n",
+ (int)dwKeyIndex, (int)uKeyLength);
if ((dwKeyIndex & PAIRWISE_KEY) != 0) // Pairwise key
return false;
@@ -636,7 +640,9 @@ bool KeybSetDefaultKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1);
+ pr_debug("Group transmit key(R)[%lX]: %d\n",
+ pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex,
+ MAX_KEY_TABLE-1);
}
pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed
@@ -669,25 +675,25 @@ bool KeybSetDefaultKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n", pKey->bKeyValid);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n", (int)pKey->uKeyLength);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey:\n");
+ pr_debug("KeybSetKey(R):\n");
+ pr_debug("pKey->bKeyValid: %d\n", pKey->bKeyValid);
+ pr_debug("pKey->uKeyLength: %d\n", (int)pKey->uKeyLength);
+ pr_debug("pKey->abyKey:\n");
for (ii = 0; ii < pKey->uKeyLength; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%x", pKey->abyKey[ii]);
+ pr_debug("%x", pKey->abyKey[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->wTSC15_0: %x\n", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex);
+ pr_debug("pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16);
+ pr_debug("pKey->wTSC15_0: %x\n", pKey->wTSC15_0);
+ pr_debug("pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex);
return true;
}
@@ -712,7 +718,7 @@ bool KeybSetAllGroupKey(
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
@@ -724,7 +730,7 @@ bool KeybSetAllGroupKey(
PSKeyItem pKey;
unsigned int uKeyIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex);
+ pr_debug("Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex);
if ((dwKeyIndex & PAIRWISE_KEY) != 0) // Pairwise key
return false;
@@ -739,7 +745,8 @@ bool KeybSetAllGroupKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i);
+ pr_debug("Group transmit key(R)[%lX]: %d\n",
+ pTable->KeyTable[i].dwGTKeyIndex, i);
}
pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed
@@ -764,21 +771,22 @@ bool KeybSetAllGroupKey(
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ pKey->KeyRSC = 0;
} else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ pKey->KeyRSC = *pKeyRSC;
}
pKey->dwTSC47_16 = 0;
pKey->wTSC15_0 = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KeybSetKey(R):\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->bKeyValid: %d\n ", pKey->bKeyValid);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->uKeyLength: %d\n ", (int)pKey->uKeyLength);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey->abyKey: ");
+ pr_debug("KeybSetKey(R):\n");
+ pr_debug("pKey->bKeyValid: %d\n ", pKey->bKeyValid);
+ pr_debug("pKey->uKeyLength: %d\n ",
+ (int)pKey->uKeyLength);
+ pr_debug("pKey->abyKey: ");
for (ii = 0; ii < pKey->uKeyLength; ii++)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pKey->abyKey[ii]);
+ pr_debug("%02x ", pKey->abyKey[ii]);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ pr_debug("\n");
} // (pTable->KeyTable[i].bInUse == true)
}
diff --git a/drivers/staging/vt6655/key.h b/drivers/staging/vt6655/key.h
index 3eb881b69a55..44efe18315af 100644
--- a/drivers/staging/vt6655/key.h
+++ b/drivers/staging/vt6655/key.h
@@ -57,7 +57,7 @@ typedef struct tagSKeyItem {
bool bKeyValid;
unsigned long uKeyLength;
unsigned char abyKey[MAX_KEY_LEN];
- QWORD KeyRSC;
+ u64 KeyRSC;
unsigned long dwTSC47_16;
unsigned short wTSC15_0;
unsigned char byCipherSuite;
@@ -108,7 +108,7 @@ bool KeybSetKey(
unsigned char *pbyBSSID,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
@@ -119,7 +119,7 @@ bool KeybSetDefaultKey(
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
@@ -166,7 +166,7 @@ bool KeybSetAllGroupKey(
PSKeyManagement pTable,
unsigned long dwKeyIndex,
unsigned long uKeyLength,
- PQWORD pKeyRSC,
+ u64 *pKeyRSC,
unsigned char *pbyKey,
unsigned char byKeyDecMode,
void __iomem *dwIoBase,
diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 9bbc873de702..e3b0b7f7ca85 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -73,8 +73,6 @@
#include "mac.h"
unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester
-/*--------------------- Static Definitions -------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -837,7 +835,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x10);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x10)\n");
+ pr_debug(" DBG_PORT80(0x10)\n");
return false;
}
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
@@ -847,7 +845,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x11);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x11)\n");
+ pr_debug(" DBG_PORT80(0x11)\n");
return false;
}
@@ -861,7 +859,7 @@ bool MACbSafeRxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x12);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x12)\n");
+ pr_debug(" DBG_PORT80(0x12)\n");
return false;
}
return true;
@@ -899,7 +897,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x20);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x20)\n");
+ pr_debug(" DBG_PORT80(0x20)\n");
return false;
}
for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
@@ -909,7 +907,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x21);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x21)\n");
+ pr_debug(" DBG_PORT80(0x21)\n");
return false;
}
@@ -924,7 +922,7 @@ bool MACbSafeTxOff(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x24);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x24)\n");
+ pr_debug(" DBG_PORT80(0x24)\n");
return false;
}
return true;
@@ -949,13 +947,13 @@ bool MACbSafeStop(void __iomem *dwIoBase)
if (!MACbSafeRxOff(dwIoBase)) {
DBG_PORT80(0xA1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n");
+ pr_debug(" MACbSafeRxOff == false)\n");
MACbSafeSoftwareReset(dwIoBase);
return false;
}
if (!MACbSafeTxOff(dwIoBase)) {
DBG_PORT80(0xA2);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n");
+ pr_debug(" MACbSafeTxOff == false)\n");
MACbSafeSoftwareReset(dwIoBase);
return false;
}
@@ -1172,7 +1170,7 @@ void MACvSetCurrAC0DescAddrEx(void __iomem *dwIoBase, unsigned long dwCurrDescAd
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x26);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x26)\n");
+ pr_debug(" DBG_PORT80(0x26)\n");
}
VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr);
if (byOrgDMACtl & DMACTL_RUN)
@@ -1295,7 +1293,7 @@ bool MACbTxDMAOff(void __iomem *dwIoBase, unsigned int idx)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x29);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x29)\n");
+ pr_debug(" DBG_PORT80(0x29)\n");
return false;
}
return true;
@@ -1319,7 +1317,7 @@ void MACvClearBusSusInd(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x33);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ pr_debug(" DBG_PORT80(0x33)\n");
}
}
@@ -1341,7 +1339,7 @@ void MACvEnableBusSusEn(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x34);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x34)\n");
+ pr_debug(" DBG_PORT80(0x34)\n");
}
}
@@ -1364,7 +1362,7 @@ bool MACbFlushSYNCFifo(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x35);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ pr_debug(" DBG_PORT80(0x33)\n");
}
return true;
}
@@ -1388,7 +1386,7 @@ bool MACbPSWakeup(void __iomem *dwIoBase)
}
if (ww == W_MAX_TIMEOUT) {
DBG_PORT80(0x36);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ pr_debug(" DBG_PORT80(0x33)\n");
return false;
}
return true;
@@ -1419,7 +1417,7 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in
if (byLocalID <= 1)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
+ pr_debug("MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
@@ -1427,7 +1425,8 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in
dwData |= wKeyCtl;
dwData <<= 16;
dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %X, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
+ pr_debug("1. wOffset: %d, Data: %X, KeyCtl:%X\n",
+ wOffset, dwData, wKeyCtl);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
@@ -1442,7 +1441,7 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in
dwData |= *(pbyAddr+1);
dwData <<= 8;
dwData |= *(pbyAddr+0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2. wOffset: %d, Data: %X\n", wOffset, dwData);
+ pr_debug("2. wOffset: %d, Data: %X\n", wOffset, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
@@ -1452,7 +1451,8 @@ void MACvSetKeyEntry(void __iomem *dwIoBase, unsigned short wKeyCtl, unsigned in
wOffset += (uKeyIdx * 4);
for (ii = 0; ii < 4; ii++) {
// always push 128 bits
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.(%d) wOffset: %d, Data: %X\n", ii, wOffset+ii, *pdwKey);
+ pr_debug("3.(%d) wOffset: %d, Data: %X\n",
+ ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
@@ -1510,7 +1510,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
if (byLocalID <= 1)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultKeyEntry\n");
+ pr_debug("MACvSetDefaultKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
@@ -1519,7 +1519,8 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
wOffset += (uKeyIdx * 4);
// always push 128 bits
for (ii = 0; ii < 3; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
+ pr_debug("(%d) wOffset: %d, Data: %lX\n",
+ ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
@@ -1531,7 +1532,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
+ pr_debug("End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
}
/*
@@ -1564,7 +1565,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
+ pr_debug("MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
}
*/
@@ -1595,7 +1596,8 @@ void MACvDisableDefaultKey(void __iomem *dwIoBase)
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
+ pr_debug("MACvDisableDefaultKey: wOffset: %d, Data: %lX\n",
+ wOffset, dwData);
}
/*
@@ -1622,7 +1624,7 @@ void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
if (byLocalID <= 1)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultTKIPKeyEntry\n");
+ pr_debug("MACvSetDefaultTKIPKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
// Kyle test : change offset from 10 -> 0
wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
@@ -1640,10 +1642,12 @@ void MACvSetDefaultTKIPKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,
wOffset++;
wOffset += (uKeyIdx * 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx);
+ pr_debug("1. wOffset: %d, Data: %lX, idx:%d\n",
+ wOffset, *pdwKey, uKeyIdx);
// always push 128 bits
for (ii = 0; ii < 4; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
+ pr_debug("2.(%d) wOffset: %d, Data: %lX\n",
+ ii, wOffset+ii, *pdwKey);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
@@ -1673,7 +1677,7 @@ void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsign
if (byLocalID <= 1)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
+ pr_debug("MACvSetKeyEntry\n");
wOffset = MISCFIFO_KEYETRY0;
wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
@@ -1681,7 +1685,8 @@ void MACvSetDefaultKeyCtl(void __iomem *dwIoBase, unsigned short wKeyCtl, unsign
dwData |= wKeyCtl;
dwData <<= 16;
dwData |= 0xffff;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
+ pr_debug("1. wOffset: %d, Data: %lX, KeyCtl:%X\n",
+ wOffset, dwData, wKeyCtl);
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c
index 36895970a892..111c01877086 100644
--- a/drivers/staging/vt6655/mib.c
+++ b/drivers/staging/vt6655/mib.c
@@ -44,8 +44,6 @@
#include "wctl.h"
#include "baseband.h"
-/*--------------------- Static Definitions -------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -190,75 +188,101 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr11MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
+ pr_debug("11M: ALL[%d], OK[%d]:[%02x]\n",
+ (int)pStatistic->CustomStat.ullRsr11M,
+ (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
} else if (byRxRate == 11) {
pStatistic->CustomStat.ullRsr5M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr5MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
+ pr_debug(" 5M: ALL[%d], OK[%d]:[%02x]\n",
+ (int)pStatistic->CustomStat.ullRsr5M,
+ (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
} else if (byRxRate == 4) {
pStatistic->CustomStat.ullRsr2M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr2MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
+ pr_debug(" 2M: ALL[%d], OK[%d]:[%02x]\n",
+ (int)pStatistic->CustomStat.ullRsr2M,
+ (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
} else if (byRxRate == 2) {
pStatistic->CustomStat.ullRsr1M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr1MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
+ pr_debug(" 1M: ALL[%d], OK[%d]:[%02x]\n",
+ (int)pStatistic->CustomStat.ullRsr1M,
+ (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
} else if (byRxRate == 12) {
pStatistic->CustomStat.ullRsr6M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr6MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk);
+ pr_debug(" 6M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr6M,
+ (int)pStatistic->CustomStat.ullRsr6MCRCOk);
} else if (byRxRate == 18) {
pStatistic->CustomStat.ullRsr9M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr9MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk);
+ pr_debug(" 9M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr9M,
+ (int)pStatistic->CustomStat.ullRsr9MCRCOk);
} else if (byRxRate == 24) {
pStatistic->CustomStat.ullRsr12M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr12MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk);
+ pr_debug("12M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr12M,
+ (int)pStatistic->CustomStat.ullRsr12MCRCOk);
} else if (byRxRate == 36) {
pStatistic->CustomStat.ullRsr18M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr18MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk);
+ pr_debug("18M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr18M,
+ (int)pStatistic->CustomStat.ullRsr18MCRCOk);
} else if (byRxRate == 48) {
pStatistic->CustomStat.ullRsr24M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr24MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk);
+ pr_debug("24M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr24M,
+ (int)pStatistic->CustomStat.ullRsr24MCRCOk);
} else if (byRxRate == 72) {
pStatistic->CustomStat.ullRsr36M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr36MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk);
+ pr_debug("36M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr36M,
+ (int)pStatistic->CustomStat.ullRsr36MCRCOk);
} else if (byRxRate == 96) {
pStatistic->CustomStat.ullRsr48M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr48MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk);
+ pr_debug("48M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr48M,
+ (int)pStatistic->CustomStat.ullRsr48MCRCOk);
} else if (byRxRate == 108) {
pStatistic->CustomStat.ullRsr54M++;
if (byRSR & RSR_CRCOK)
pStatistic->CustomStat.ullRsr54MCRCOk++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk);
+ pr_debug("54M: ALL[%d], OK[%d]\n",
+ (int)pStatistic->CustomStat.ullRsr54M,
+ (int)pStatistic->CustomStat.ullRsr54MCRCOk);
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk);
+ pr_debug("Unknown: Total[%d], CRCOK[%d]\n",
+ (int)pStatistic->dwRsrRxPacket+1,
+ (int)pStatistic->dwRsrCRCOk);
}
if (byRSR & RSR_BSSIDOK)
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 2a21cbd1c6ac..93681b338c1b 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -50,8 +50,6 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -74,7 +72,7 @@ PSvEnablePowerSaving(
unsigned short wListenInterval
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned short wAID = pMgmt->wCurrAID | BIT14 | BIT15;
@@ -113,7 +111,7 @@ PSvEnablePowerSaving(
PSbSendNullPacket(pDevice);
pDevice->bPWBitOn = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable...\n");
+ pr_debug("PS:Power Saving Mode Enable...\n");
}
/*+
@@ -131,7 +129,7 @@ PSvDisablePowerSaving(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
// disable power saving hw function
MACbPSWakeup(pDevice->PortOffset);
@@ -167,7 +165,7 @@ PSbConsiderPowerDown(
bool bCheckCountToWakeUp
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uIdx;
@@ -210,7 +208,7 @@ PSbConsiderPowerDown(
// no Tx, no Rx isr, now go to Doze
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n");
+ pr_debug("Go to Doze ZZZZZZZZZZZZZZZ\n");
return true;
}
@@ -229,7 +227,7 @@ PSvSendPSPOLL(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxMgmtPacket pTxPacket = NULL;
@@ -249,7 +247,7 @@ PSvSendPSPOLL(
pTxPacket->cbPayloadLen = 0;
// send the frame
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n");
+ pr_debug("Send PS-Poll packet failed..\n");
}
/*+
@@ -266,7 +264,7 @@ PSbSendNullPacket(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSTxMgmtPacket pTxPacket = NULL;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uIdx;
@@ -274,13 +272,9 @@ PSbSendNullPacket(
if (!pDevice->bLinkPass)
return false;
-#ifdef TxInSleep
if (!pDevice->bEnablePSMode && !pDevice->fTxDataInSleep)
return false;
-#else
- if (!pDevice->bEnablePSMode)
- return false;
-#endif
+
if (pDevice->bEnablePSMode) {
for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx++) {
if (pDevice->iTDUsed[uIdx] != 0)
@@ -318,7 +312,7 @@ PSbSendNullPacket(
pTxPacket->cbPayloadLen = 0;
// send the frame
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n");
+ pr_debug("Send Null Packet failed !\n");
return false;
}
@@ -340,7 +334,7 @@ PSbIsNextTBTTWakeUp(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
bool bWakeUp = false;
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index 42b257f916d3..e505af91bfd0 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -746,7 +746,7 @@ static bool RFbAL2230SelectChannel(void __iomem *dwIoBase, unsigned char byChann
*
*/
bool RFbInit(
- PSDevice pDevice
+ struct vnt_private *pDevice
)
{
bool bResult = true;
@@ -897,7 +897,7 @@ bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigne
*
*/
bool RFbSetPower(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int uRATE,
unsigned int uCH
)
@@ -978,7 +978,7 @@ bool RFbSetPower(
*/
bool RFbRawSetPower(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPwr,
unsigned int uRATE
)
@@ -1042,7 +1042,7 @@ bool RFbRawSetPower(
-*/
void
RFvRSSITodBm(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byCurrRSSI,
long *pldBm
)
diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h
index ba55561c45d2..be4ef88b7666 100644
--- a/drivers/staging/vt6655/rf.h
+++ b/drivers/staging/vt6655/rf.h
@@ -77,19 +77,19 @@
bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData);
bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel);
bool RFbInit(
- PSDevice pDevice
+ struct vnt_private *
);
bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel);
-bool RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH);
+bool RFbSetPower(struct vnt_private *, unsigned int uRATE, unsigned int uCH);
bool RFbRawSetPower(
- PSDevice pDevice,
+ struct vnt_private *,
unsigned char byPwr,
unsigned int uRATE
);
void
RFvRSSITodBm(
- PSDevice pDevice,
+ struct vnt_private *,
unsigned char byCurrRSSI,
long *pldBm
);
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 0d45aa076fed..869555a99b8c 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -68,8 +68,6 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
#define PLICE_DEBUG
/*--------------------- Static Functions --------------------------*/
@@ -112,7 +110,7 @@ static const unsigned short wFB_Opt1[2][5] = {
static
void
s_vFillTxKey(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyBuf,
unsigned char *pbyIVHead,
PSKeyItem pTransmitKey,
@@ -124,7 +122,7 @@ s_vFillTxKey(
static
void
s_vFillRTSHead(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pvRTS,
unsigned int cbFrameLength,
@@ -138,7 +136,7 @@ s_vFillRTSHead(
static
void
s_vGenerateTxParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pTxBufHead,
void *pvRrvTime,
@@ -152,7 +150,7 @@ s_vGenerateTxParameter(
);
static void s_vFillFragParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyBuffer,
unsigned int uTxType,
void *pvtdCurr,
@@ -161,15 +159,17 @@ static void s_vFillFragParameter(
);
static unsigned int
-s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
- PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum);
+s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
+ unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
+ unsigned int uDMAIdx, PSTxDesc pHeadTD,
+ PSEthernetHeader psEthHeader, unsigned char *pPacket,
+ bool bNeedEncrypt, PSKeyItem pTransmitKey,
+ unsigned int uNodeIndex, unsigned int *puMACfragNum);
static
unsigned int
s_uFillDataHead(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pTxDataHead,
unsigned int cbFrameLength,
@@ -187,7 +187,7 @@ s_uFillDataHead(
static
void
s_vFillTxKey(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyBuf,
unsigned char *pbyIVHead,
PSKeyItem pTransmitKey,
@@ -196,9 +196,9 @@ s_vFillTxKey(
unsigned char *pMICHDR
)
{
+ struct vnt_mic_hdr *mic_hdr = (struct vnt_mic_hdr *)pMICHDR;
unsigned long *pdwIV = (unsigned long *)pbyIVHead;
unsigned long *pdwExtIV = (unsigned long *)((unsigned char *)pbyIVHead+4);
- unsigned short wValue;
PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf;
unsigned long dwRevIVCounter;
unsigned char byKeyIndex = 0;
@@ -246,7 +246,7 @@ s_vFillTxKey(
*(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
// Append IV&ExtIV after Mac Header
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV);
+ pr_debug("vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV);
} else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
pTransmitKey->wTSC15_0++;
@@ -262,47 +262,45 @@ s_vFillTxKey(
//Append IV&ExtIV after Mac Header
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
- //Fill MICHDR0
- *pMICHDR = 0x59;
- *((unsigned char *)(pMICHDR+1)) = 0; // TxPriority
- memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6);
- *((unsigned char *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0);
- *((unsigned char *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0);
- *((unsigned char *)(pMICHDR+14)) = HIBYTE(wPayloadLen);
- *((unsigned char *)(pMICHDR+15)) = LOBYTE(wPayloadLen);
-
- //Fill MICHDR1
- *((unsigned char *)(pMICHDR+16)) = 0; // HLEN[15:8]
+ /* MICHDR0 */
+ mic_hdr->id = 0x59;
+ mic_hdr->tx_priority = 0;
+ memcpy(mic_hdr->mic_addr2, pMACHeader->abyAddr2, ETH_ALEN);
+
+ /* ccmp pn big endian order */
+ mic_hdr->ccmp_pn[0] = (u8)(pTransmitKey->dwTSC47_16 >> 24);
+ mic_hdr->ccmp_pn[1] = (u8)(pTransmitKey->dwTSC47_16 >> 16);
+ mic_hdr->ccmp_pn[2] = (u8)(pTransmitKey->dwTSC47_16 >> 8);
+ mic_hdr->ccmp_pn[3] = (u8)pTransmitKey->dwTSC47_16;
+ mic_hdr->ccmp_pn[4] = (u8)(pTransmitKey->wTSC15_0 >> 8);
+ mic_hdr->ccmp_pn[5] = (u8)pTransmitKey->wTSC15_0;
+
+ /* MICHDR1 */
+ mic_hdr->payload_len = cpu_to_be16(wPayloadLen);
+
if (pDevice->bLongHeader)
- *((unsigned char *)(pMICHDR+17)) = 28; // HLEN[7:0]
+ mic_hdr->hlen = cpu_to_be16(28);
else
- *((unsigned char *)(pMICHDR+17)) = 22; // HLEN[7:0]
-
- wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F);
- memcpy(pMICHDR+18, (unsigned char *)&wValue, 2); // MSKFRACTL
- memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6);
- memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6);
-
- //Fill MICHDR2
- memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6);
- wValue = pMACHeader->wSeqCtl;
- wValue &= 0x000F;
- wValue = cpu_to_le16(wValue);
- memcpy(pMICHDR+38, (unsigned char *)&wValue, 2); // MSKSEQCTL
- if (pDevice->bLongHeader)
- memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6);
+ mic_hdr->hlen = cpu_to_be16(22);
+
+ memcpy(mic_hdr->addr1, pMACHeader->abyAddr1, ETH_ALEN);
+ memcpy(mic_hdr->addr2, pMACHeader->abyAddr2, ETH_ALEN);
+ /* MICHDR2 */
+ memcpy(mic_hdr->addr3, pMACHeader->abyAddr3, ETH_ALEN);
+ mic_hdr->frame_control =
+ cpu_to_le16(pMACHeader->wFrameCtl & 0xc78f);
+ mic_hdr->seq_ctrl = cpu_to_le16(pMACHeader->wSeqCtl & 0xf);
+
+ if (pDevice->bLongHeader)
+ memcpy(mic_hdr->addr4, pMACHeader->abyAddr4, ETH_ALEN);
}
}
static
void
s_vSWencryption(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSKeyItem pTransmitKey,
unsigned char *pbyPayloadHead,
unsigned short wPayloadSize
@@ -348,7 +346,7 @@ s_vSWencryption(
static
unsigned int
s_uGetTxRsvTime(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
unsigned int cbFrameLength,
unsigned short wRate,
@@ -373,7 +371,7 @@ s_uGetTxRsvTime(
static
unsigned int
s_uGetRTSCTSRsvTime(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byRTSRsvType,
unsigned char byPktType,
unsigned int cbFrameLength,
@@ -411,7 +409,7 @@ s_uGetRTSCTSRsvTime(
static
unsigned int
s_uGetDataDuration(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byDurType,
unsigned int cbFrameLength,
unsigned char byPktType,
@@ -570,7 +568,7 @@ s_uGetDataDuration(
static
unsigned int
s_uGetRTSCTSDuration(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byDurType,
unsigned int cbFrameLength,
unsigned char byPktType,
@@ -663,7 +661,7 @@ s_uGetRTSCTSDuration(
static
unsigned int
s_uFillDataHead(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pTxDataHead,
unsigned int cbFrameLength,
@@ -792,7 +790,7 @@ s_uFillDataHead(
static
void
s_vFillRTSHead(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pvRTS,
unsigned int cbFrameLength,
@@ -967,7 +965,7 @@ s_vFillRTSHead(
static
void
s_vFillCTSHead(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int uDMAIdx,
unsigned char byPktType,
void *pvCTS,
@@ -1065,7 +1063,7 @@ s_vFillCTSHead(
static
void
s_vGenerateTxParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byPktType,
void *pTxBufHead,
void *pvRrvTime,
@@ -1171,7 +1169,7 @@ s_vGenerateTxParameter(
static
void
s_vFillFragParameter(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyBuffer,
unsigned int uTxType,
void *pvtdCurr,
@@ -1207,10 +1205,12 @@ s_vFillFragParameter(
}
static unsigned int
-s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
- PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum)
+s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
+ unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
+ unsigned int uDMAIdx, PSTxDesc pHeadTD,
+ PSEthernetHeader psEthHeader, unsigned char *pPacket,
+ bool bNeedEncrypt, PSKeyItem pTransmitKey,
+ unsigned int uNodeIndex, unsigned int *puMACfragNum)
{
unsigned int cbMACHdLen;
unsigned int cbFrameSize;
@@ -1252,7 +1252,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
PSTxBufHead psTxBufHd = (PSTxBufHead) pbyTxBufferAddr;
unsigned int cbHeaderLength = 0;
void *pvRrvTime;
- PSMICHDRHead pMICHDR;
+ struct vnt_mic_hdr *pMICHDR;
void *pvRTS;
void *pvCTS;
void *pvTxDataHd;
@@ -1297,7 +1297,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
- cbMICHDR = sizeof(SMICHDRHead);
+ cbMICHDR = sizeof(struct vnt_mic_hdr);
}
if (pDevice->byLocalID > REV_ID_VT3253_A1) {
//MAC Header should be padding 0 to DW alignment.
@@ -1333,14 +1333,14 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {//RTS_need
pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
} else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvRTS = NULL;
pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
@@ -1350,14 +1350,14 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
// Auto Fall Back
if (bRTS == true) {//RTS_need
pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
} else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvRTS = NULL;
pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB));
@@ -1369,14 +1369,14 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
} else { //RTS_needless, need MICHDR
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = NULL;
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
@@ -1386,14 +1386,14 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
// Auto Fall Back
if (bRTS == true) {//RTS_need
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
} else { //RTS_needless
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = NULL;
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
@@ -1420,7 +1420,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
MIC_vAppend((unsigned char *)&(psEthHeader->abyDstAddr[0]), 12);
dwMIC_Priority = 0;
MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1);
+ pr_debug("MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1);
}
///////////////////////////////////////////////////////////////////
@@ -1450,7 +1450,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
//=========================
// Start Fragmentation
//=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start Fragmentation...\n");
+ pr_debug("Start Fragmentation...\n");
wFragType = FRAGCTL_STAFRAG;
//Fill FIFO,RrvTime,RTS,and CTS
@@ -1503,7 +1503,8 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len;
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start MIC: %d\n", cbFragPayloadSize);
+ pr_debug("Start MIC: %d\n",
+ cbFragPayloadSize);
MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize);
}
@@ -1538,7 +1539,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
//=========================
// Last Fragmentation
//=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last Fragmentation...\n");
+ pr_debug("Last Fragmentation...\n");
wFragType = FRAGCTL_ENDFRAG;
@@ -1588,8 +1589,10 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
}
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n",
- uMICFragLen, cbLastFragPayloadSize, uTmpLen);
+ pr_debug("LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n",
+ uMICFragLen,
+ cbLastFragPayloadSize,
+ uTmpLen);
if (bMIC2Frag == false) {
if (uTmpLen != 0)
@@ -1597,22 +1600,23 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
pdwMIC_L = (u32 *)(pbyBuffer + uLength + uTmpLen);
pdwMIC_R = (u32 *)(pbyBuffer + uLength + uTmpLen + 4);
MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last MIC:%X, %X\n", *pdwMIC_L, *pdwMIC_R);
+ pr_debug("Last MIC:%X, %X\n",
+ *pdwMIC_L, *pdwMIC_R);
} else {
if (uMICFragLen >= 4) {
memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
(cbMIClen - uMICFragLen));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen >= 4: %X, %d\n",
- *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
- (cbMIClen - uMICFragLen));
+ pr_debug("LAST: uMICFragLen >= 4: %X, %d\n",
+ *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
+ (cbMIClen - uMICFragLen));
} else {
memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_L + uMICFragLen),
(4 - uMICFragLen));
memcpy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen < 4: %X, %d\n",
- *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4),
- (cbMIClen - uMICFragLen));
+ pr_debug("LAST: uMICFragLen < 4: %X, %d\n",
+ *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4),
+ (cbMIClen - uMICFragLen));
}
}
MIC_vUnInit();
@@ -1653,7 +1657,7 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
//=========================
// Middle Fragmentation
//=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle Fragmentation...\n");
+ pr_debug("Middle Fragmentation...\n");
wFragType = FRAGCTL_MIDFRAG;
@@ -1713,12 +1717,17 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
dwSafeMIC_L = *pdwMIC_L;
dwSafeMIC_R = *pdwMIC_R;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n",
- uMICFragLen, cbFragPayloadSize, uTmpLen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fill MIC in Middle frag [%d]\n", uMICFragLen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get MIC:%X, %X\n", *pdwMIC_L, *pdwMIC_R);
+ pr_debug("MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n",
+ uMICFragLen,
+ cbFragPayloadSize,
+ uTmpLen);
+ pr_debug("Fill MIC in Middle frag [%d]\n",
+ uMICFragLen);
+ pr_debug("Get MIC:%X, %X\n",
+ *pdwMIC_L, *pdwMIC_R);
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle frag len: %d\n", uTmpLen);
+ pr_debug("Middle frag len: %d\n",
+ uTmpLen);
} else {
ASSERT(uTmpLen == (cbFragPayloadSize));
@@ -1812,7 +1821,8 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
);
if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength);
+ pr_debug("Length:%d, %d\n",
+ cbFrameBodySize - cb802_1_H_len, uLength);
MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize);
@@ -1828,9 +1838,10 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
pDevice->bTxMICFail = false;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "uLength: %d, %d\n", uLength, cbFrameBodySize);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderLength, uPadding, cbIVlen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R);
+ pr_debug("uLength: %d, %d\n", uLength, cbFrameBodySize);
+ pr_debug("cbReqCount:%d, %d, %d, %d\n",
+ cbReqCount, cbHeaderLength, uPadding, cbIVlen);
+ pr_debug("MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R);
}
@@ -1861,8 +1872,9 @@ s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyT
}
void
-vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx,
+vGenerateFIFOHeader(struct vnt_private *pDevice, unsigned char byPktType,
+ unsigned char *pbyTxBufferAddr, bool bNeedEncrypt,
+ unsigned int cbPayloadSize, unsigned int uDMAIdx,
PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, unsigned char *pPacket,
PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum,
unsigned int *pcbHeaderSize)
@@ -1988,7 +2000,7 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb
void
vGenerateMACHeader(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char *pbyBufferAddr,
unsigned short wDuration,
PSEthernetHeader psEthHeader,
@@ -2051,7 +2063,7 @@ vGenerateMACHeader(
pMACHeader->wFrameCtl |= FC_MOREFRAG;
}
-CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
+CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
{
PSTxDesc pFrstTD;
unsigned char byPktType;
@@ -2255,11 +2267,11 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, PAIRWISE_KEY, &pTransmitKey) == false) {
// get group key
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == true) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get GTK.\n");
+ pr_debug("Get GTK\n");
break;
}
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get PTK.\n");
+ pr_debug("Get PTK\n");
break;
}
}
@@ -2267,9 +2279,10 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
pbyBSSID = pDevice->abyBroadcastAddr;
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) {
pTransmitKey = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "KEY is NULL. OP Mode[%d]\n", pDevice->eOPMode);
+ pr_debug("KEY is NULL. OP Mode[%d]\n",
+ pDevice->eOPMode);
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get GTK.\n");
+ pr_debug("Get GTK\n");
}
} while (false);
//Fill TXKEY
@@ -2324,13 +2337,11 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
pDevice->iTDUsed[TYPE_TXDMA0]++;
if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
+ pr_debug(" available td0 <= 1\n");
pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
-#ifdef TxInSleep
pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet
-#endif
// Poll Transmit the adapter
MACvTransmit0(pDevice->PortOffset);
@@ -2338,7 +2349,7 @@ CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
return CMD_STATUS_PENDING;
}
-CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
+CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PSTxMgmtPacket pPacket)
{
unsigned char byPktType;
unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs;
@@ -2412,7 +2423,7 @@ CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket)
unsigned int
cbGetFragCount(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSKeyItem pTransmitKey,
unsigned int cbFrameBodySize,
PSEthernetHeader psEthHeader
@@ -2489,8 +2500,9 @@ cbGetFragCount(
return uMACfragNum;
}
-void
-vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen) {
+void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb,
+ unsigned char *pbMPDU, unsigned int cbMPDULen)
+{
PSTxDesc pFrstTD;
unsigned char byPktType;
unsigned char *pbyTxBufferAddr;
@@ -2577,7 +2589,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
}
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n", p80211Header->sA3.wFrameCtl);
+ pr_debug("vDMA0_tx_80211: p80211Header->sA3.wFrameCtl = %x\n",
+ p80211Header->sA3.wFrameCtl);
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
@@ -2656,7 +2669,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
} else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
- cbMICHDR = sizeof(SMICHDRHead);
+ cbMICHDR = sizeof(struct vnt_mic_hdr);
pTxBufHead->wFragCtl |= FRAGCTL_AES;
pDevice->bAES = true;
}
@@ -2676,7 +2689,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvRTS = NULL;
pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
@@ -2685,7 +2698,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
} else {//802.11a/b packet
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = NULL;
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
@@ -2764,7 +2777,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
MIC_vAppend((unsigned char *)&(sEthHeader.abyDstAddr[0]), 12);
dwMIC_Priority = 0;
MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "DMA0_tx_8021:MIC KEY: %X, %X\n", dwMICKey0, dwMICKey1);
+ pr_debug("DMA0_tx_8021:MIC KEY: %X, %X\n",
+ dwMICKey0, dwMICKey1);
uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen;
@@ -2782,9 +2796,10 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
pDevice->bTxMICFail = false;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "uLength: %d, %d\n", uLength, cbFrameBodySize);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R);
+ pr_debug("uLength: %d, %d\n", uLength, cbFrameBodySize);
+ pr_debug("cbReqCount:%d, %d, %d, %d\n",
+ cbReqCount, cbHeaderSize, uPadding, cbIVlen);
+ pr_debug("MIC:%x, %x\n", *pdwMIC_L, *pdwMIC_R);
}
@@ -2842,7 +2857,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
pDevice->iTDUsed[TYPE_TXDMA0]++;
if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
+ pr_debug(" available td0 <= 1\n");
pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index 601bedb211d6..26baf3b44b96 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -39,9 +39,26 @@
/*--------------------- Export Functions --------------------------*/
+/* MIC HDR data header */
+struct vnt_mic_hdr {
+ u8 id;
+ u8 tx_priority;
+ u8 mic_addr2[ETH_ALEN];
+ u8 ccmp_pn[6];
+ __be16 payload_len;
+ __be16 hlen;
+ __le16 frame_control;
+ u8 addr1[ETH_ALEN];
+ u8 addr2[ETH_ALEN];
+ u8 addr3[ETH_ALEN];
+ __le16 seq_ctrl;
+ u8 addr4[ETH_ALEN];
+ u16 packing; /* packing to 48 bytes */
+} __packed;
+
void
vGenerateMACHeader(
- PSDevice pDevice,
+ struct vnt_private *,
unsigned char *pbyBufferAddr,
unsigned short wDuration,
PSEthernetHeader psEthHeader,
@@ -53,20 +70,24 @@ vGenerateMACHeader(
unsigned int
cbGetFragCount(
- PSDevice pDevice,
+ struct vnt_private *,
PSKeyItem pTransmitKey,
unsigned int cbFrameBodySize,
PSEthernetHeader psEthHeader
);
void
-vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktTyp, unsigned char *pbyTxBufferAddr,
- bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey,
- unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize);
+vGenerateFIFOHeader(struct vnt_private *, unsigned char byPktTyp,
+ unsigned char *pbyTxBufferAddr, bool bNeedEncrypt,
+ unsigned int cbPayloadSize, unsigned int uDMAIdx,
+ PSTxDesc pHeadTD, PSEthernetHeader psEthHeader,
+ unsigned char *pPacket, PSKeyItem pTransmitKey,
+ unsigned int uNodeIndex, unsigned int *puMACfragNum,
+ unsigned int *pcbHeaderSize);
-void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen);
-CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket);
-CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket);
+void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb,
+ unsigned char *pbMPDU, unsigned int cbMPDULen);
+CMD_STATUS csMgmt_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
+CMD_STATUS csBeacon_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
#endif // __RXTX_H__
diff --git a/drivers/staging/vt6655/ttype.h b/drivers/staging/vt6655/ttype.h
index b1d8ae732774..747ef62ec9be 100644
--- a/drivers/staging/vt6655/ttype.h
+++ b/drivers/staging/vt6655/ttype.h
@@ -31,10 +31,6 @@
/******* Common definitions and typedefs ***********************************/
-#ifndef TxInSleep
-#define TxInSleep
-#endif
-
#ifndef WPA_SM_Transtatus
#define WPA_SM_Transtatus
#endif
@@ -43,27 +39,4 @@
#define Calcu_LinkQual
#endif
-/****** Simple typedefs ***************************************************/
-
-/* These lines assume that your compiler's longs are 32 bits and
- * shorts are 16 bits. It is already assumed that chars are 8 bits,
- * but it doesn't matter if they're signed or unsigned.
- */
-
-// QWORD is for those situation that we want
-// an 8-byte-aligned 8 byte long structure
-// which is NOT really a floating point number.
-typedef union tagUQuadWord {
- struct {
- unsigned int dwLowDword;
- unsigned int dwHighDword;
- } u;
- double DoNotUseThisField;
-} UQuadWord;
-typedef UQuadWord QWORD; // 64-bit
-
-/****** Common pointer types ***********************************************/
-
-typedef QWORD *PQWORD;
-
#endif // __TTYPE_H__
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index e262f1b00e66..c5c889cade25 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -40,61 +40,34 @@
#define VNSvInPortB(dwIOAddress, pbyData) \
do { \
- *(pbyData) = readb(dwIOAddress); \
+ *(pbyData) = ioread8(dwIOAddress); \
} while (0)
#define VNSvInPortW(dwIOAddress, pwData) \
do { \
- *(pwData) = readw(dwIOAddress); \
+ *(pwData) = ioread16(dwIOAddress); \
} while (0)
#define VNSvInPortD(dwIOAddress, pdwData) \
do { \
- *(pdwData) = readl(dwIOAddress); \
+ *(pdwData) = ioread32(dwIOAddress); \
} while (0)
#define VNSvOutPortB(dwIOAddress, byData) \
do { \
- writeb((unsigned char)byData, dwIOAddress); \
+ iowrite8((u8)byData, dwIOAddress); \
} while (0)
#define VNSvOutPortW(dwIOAddress, wData) \
do { \
- writew((unsigned short)wData, dwIOAddress); \
+ iowrite16((u16)wData, dwIOAddress); \
} while (0)
#define VNSvOutPortD(dwIOAddress, dwData) \
do { \
- writel((unsigned long)dwData, dwIOAddress); \
+ iowrite32((u32)dwData, dwIOAddress); \
} while (0)
-//
-// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
-//
-#define PCBvInPortB(dwIOAddress, pbyData) \
-do { \
- *(pbyData) = inb(dwIOAddress); \
-} while (0)
-
-#define PCBvInPortW(dwIOAddress, pwData) \
-do { \
- *(pwData) = inw(dwIOAddress); \
-} while (0)
-
-#define PCBvInPortD(dwIOAddress, pdwData) \
-do { \
- *(pdwData) = inl(dwIOAddress); \
-} while (0)
-
-#define PCBvOutPortB(dwIOAddress, byData) \
- outb(byData, dwIOAddress)
-
-#define PCBvOutPortW(dwIOAddress, wData) \
- outw(wData, dwIOAddress)
-
-#define PCBvOutPortD(dwIOAddress, dwData) \
- outl(dwData, dwIOAddress)
-
#define PCAvDelayByIO(uDelayUnit) \
do { \
unsigned char byData; \
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index f12eef064c45..7565073122de 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -58,20 +58,18 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
static
void
s_vProbeChannel(
- PSDevice pDevice
+ struct vnt_private *pDevice
);
static
PSTxMgmtPacket
s_MgrMakeProbeRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pScanBSSID,
PWLAN_IE_SSID pSSID,
@@ -82,7 +80,7 @@ s_MgrMakeProbeRequest(
static
bool
s_bCommandComplete(
- PSDevice pDevice
+ struct vnt_private *pDevice
);
/*--------------------- Export Variables --------------------------*/
@@ -104,7 +102,7 @@ s_bCommandComplete(
*/
static
void
-vAdHocBeaconStop(PSDevice pDevice)
+vAdHocBeaconStop(struct vnt_private *pDevice)
{
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
bool bStop;
@@ -151,7 +149,7 @@ vAdHocBeaconStop(PSDevice pDevice)
*/
static
void
-vAdHocBeaconRestart(PSDevice pDevice)
+vAdHocBeaconRestart(struct vnt_private *pDevice)
{
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
@@ -181,7 +179,7 @@ vAdHocBeaconRestart(PSDevice pDevice)
static
void
s_vProbeChannel(
- PSDevice pDevice
+ struct vnt_private *pDevice
)
{
//1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
@@ -216,9 +214,9 @@ s_vProbeChannel(
if (pTxPacket != NULL) {
for (ii = 0; ii < 2; ii++) {
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail..\n");
+ pr_debug("Probe request sending fail..\n");
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending..\n");
+ pr_debug("Probe request is sending..\n");
}
}
}
@@ -236,7 +234,7 @@ s_vProbeChannel(
static PSTxMgmtPacket
s_MgrMakeProbeRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pScanBSSID,
PWLAN_IE_SSID pSSID,
@@ -287,7 +285,7 @@ vCommandTimerWait(
unsigned int MSecond
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long) pDevice;
@@ -302,7 +300,7 @@ vCommandTimer(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PWLAN_IE_SSID pItemSSID;
PWLAN_IE_SSID pItemSSIDCurr;
@@ -335,7 +333,7 @@ vCommandTimer(
return;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SCAN_START\n");
+ pr_debug("eCommandState= WLAN_CMD_SCAN_START\n");
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID;
// wait all Data TD complete
if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
@@ -355,7 +353,8 @@ vCommandTimer(
// Set Baseband's sensitivity back.
// Set channel back
set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
+ pr_debug("Scanning, set back to channel: [%d]\n",
+ pMgmt->uCurrChannel);
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
else
@@ -367,7 +366,8 @@ vCommandTimer(
} else {
//2008-8-4 <add> by chester
if (!is_channel_valid(pMgmt->uScanChannel)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d\n", pMgmt->uScanChannel);
+ pr_debug("Invalid channel pMgmt->uScanChannel = %d\n",
+ pMgmt->uScanChannel);
s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock);
return;
@@ -387,9 +387,11 @@ vCommandTimer(
vAdHocBeaconStop(pDevice);
if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel))
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel);
+ pr_debug("SCAN Channel: %d\n",
+ pMgmt->uScanChannel);
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel);
+ pr_debug("SET SCAN Channel Fail: %d\n",
+ pMgmt->uScanChannel);
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN);
pMgmt->uScanChannel++;
@@ -422,7 +424,8 @@ vCommandTimer(
// Set Baseband's sensitivity back.
// Set channel back
set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
+ pr_debug("Scanning, set back to channel: [%d]\n",
+ pMgmt->uCurrChannel);
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
else
@@ -451,7 +454,7 @@ vCommandTimer(
spin_unlock_irq(&pDevice->lock);
return;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Disassociation Packet..\n");
+ pr_debug("Send Disassociation Packet..\n");
// reason = 8 : disassoc because sta has left
vMgrDisassocBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status);
pDevice->bLinkPass = false;
@@ -470,7 +473,7 @@ vCommandTimer(
spin_unlock_irq(&pDevice->lock);
return;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " CARDbRadioPowerOff\n");
+ pr_debug(" CARDbRadioPowerOff\n");
//2008-09-02 <mark> by chester
s_bCommandComplete(pDevice);
break;
@@ -496,15 +499,16 @@ vCommandTimer(
pr_debug("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID);
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: desire ssid = %s\n", pItemSSID->abySSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID);
+ pr_debug(" cmd: desire ssid = %s\n", pItemSSID->abySSID);
+ pr_debug(" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID);
if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSID->len =%d\n", pItemSSID->len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " desire ssid = %s\n", pItemSSID->abySSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " curr ssid = %s\n", pItemSSIDCurr->abySSID);
+ pr_debug(" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n");
+ pr_debug(" pItemSSID->len =%d\n", pItemSSID->len);
+ pr_debug(" pItemSSIDCurr->len = %d\n",
+ pItemSSIDCurr->len);
+ pr_debug(" desire ssid = %s\n", pItemSSID->abySSID);
+ pr_debug(" curr ssid = %s\n", pItemSSIDCurr->abySSID);
}
if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
@@ -541,7 +545,7 @@ vCommandTimer(
pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT;
vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT);
spin_unlock_irq(&pDevice->lock);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set eCommandState = WLAN_AUTHENTICATE_WAIT\n");
+ pr_debug(" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n");
return;
}
}
@@ -560,7 +564,7 @@ vCommandTimer(
// start own IBSS
vMgrCreateOwnIBSS((void *)pDevice, &Status);
if (Status != CMD_STATUS_SUCCESS)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n");
+ pr_debug(" WLAN_CMD_IBSS_CREATE fail !\n");
BSSvAddMulticastNode(pDevice);
}
@@ -572,7 +576,7 @@ vCommandTimer(
// start own IBSS
vMgrCreateOwnIBSS((void *)pDevice, &Status);
if (Status != CMD_STATUS_SUCCESS)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail !\n");
+ pr_debug(" WLAN_CMD_IBSS_CREATE fail !\n");
BSSvAddMulticastNode(pDevice);
if (netif_queue_stopped(pDevice->dev))
@@ -580,7 +584,7 @@ vCommandTimer(
pDevice->bLinkPass = true;
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n");
+ pr_debug("Disconnect SSID none\n");
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
{
union iwreq_data wrqu;
@@ -598,15 +602,15 @@ vCommandTimer(
break;
case WLAN_AUTHENTICATE_WAIT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_AUTHENTICATE_WAIT\n");
+ pr_debug("eCommandState == WLAN_AUTHENTICATE_WAIT\n");
if (pMgmt->eCurrState == WMAC_STATE_AUTH) {
// Call mgr to begin the association
pDevice->byLinkWaitCount = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_AUTH\n");
+ pr_debug("eCurrState == WMAC_STATE_AUTH\n");
vMgrAssocBeginSta((void *)pDevice, pMgmt, &Status);
if (Status == CMD_STATUS_SUCCESS) {
pDevice->byLinkWaitCount = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState = WLAN_ASSOCIATE_WAIT\n");
+ pr_debug("eCommandState = WLAN_ASSOCIATE_WAIT\n");
pDevice->eCommandState = WLAN_ASSOCIATE_WAIT;
vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT);
spin_unlock_irq(&pDevice->lock);
@@ -629,7 +633,7 @@ vCommandTimer(
case WLAN_ASSOCIATE_WAIT:
if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_ASSOC\n");
+ pr_debug("eCurrState == WMAC_STATE_ASSOC\n");
if (pDevice->ePSMode != WMAC_POWER_CAM)
PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
@@ -647,7 +651,6 @@ vCommandTimer(
if (netif_queue_stopped(pDevice->dev))
netif_wake_queue(pDevice->dev);
-#ifdef TxInSleep
if (pDevice->IsTxDataTrigger) { //TxDataTimer is not triggered at the first time
del_timer(&pDevice->sTimerTxData);
init_timer(&pDevice->sTimerTxData);
@@ -660,7 +663,7 @@ vCommandTimer(
pDevice->IsTxDataTrigger = true;
add_timer(&pDevice->sTimerTxData);
-#endif
+
} else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
} else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay!
@@ -676,7 +679,7 @@ vCommandTimer(
break;
case WLAN_CMD_AP_MODE_START:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_AP_MODE_START\n");
+ pr_debug("eCommandState == WLAN_CMD_AP_MODE_START\n");
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
del_timer(&pMgmt->sTimerSecondCallback);
@@ -693,12 +696,12 @@ vCommandTimer(
vMgrCreateOwnIBSS((void *)pDevice, &Status);
if (Status != CMD_STATUS_SUCCESS)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail !\n");
+ pr_debug(" vMgrCreateOwnIBSS fail !\n");
// alway turn off unicast bit
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST);
pDevice->byRxMode &= ~RCR_UNICAST;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode);
+ pr_debug("wcmd: rx_mode = %x\n", pDevice->byRxMode);
BSSvAddMulticastNode(pDevice);
if (netif_queue_stopped(pDevice->dev))
netif_wake_queue(pDevice->dev);
@@ -720,7 +723,7 @@ vCommandTimer(
pDevice->bMoreData = true;
}
if (!device_dma0_xmit(pDevice, skb, 0))
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail\n");
+ pr_debug("Multicast ps tx fail\n");
pMgmt->sNodeDBTable[0].wEnQueueCnt--;
}
@@ -730,8 +733,9 @@ vCommandTimer(
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
if (pMgmt->sNodeDBTable[ii].bActive &&
pMgmt->sNodeDBTable[ii].bRxPSPoll) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n",
- ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
+ pr_debug("Index=%d Enqueu Cnt= %d\n",
+ ii,
+ pMgmt->sNodeDBTable[ii].wEnQueueCnt);
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) {
// clear tx map
@@ -742,7 +746,7 @@ vCommandTimer(
pDevice->bMoreData = true;
}
if (!device_dma0_xmit(pDevice, skb, ii))
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail\n");
+ pr_debug("sta ps tx fail\n");
pMgmt->sNodeDBTable[ii].wEnQueueCnt--;
// check if sta ps enabled, and wait next pspoll.
@@ -754,7 +758,8 @@ vCommandTimer(
// clear tx map
pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear\n", ii);
+ pr_debug("Index=%d PS queue clear\n",
+ ii);
}
pMgmt->sNodeDBTable[ii].bRxPSPoll = false;
}
@@ -764,7 +769,7 @@ vCommandTimer(
break;
case WLAN_CMD_RADIO_START:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n");
+ pr_debug("eCommandState == WLAN_CMD_RADIO_START\n");
if (pDevice->bRadioCmd)
CARDbRadioPowerOn(pDevice);
else
@@ -787,7 +792,7 @@ vCommandTimer(
}
pDevice->byBBVGACurrent = pDevice->byBBVGANew;
BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent);
+ pr_debug("SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent);
s_bCommandComplete(pDevice);
break;
@@ -802,7 +807,7 @@ vCommandTimer(
static
bool
s_bCommandComplete(
- PSDevice pDevice
+ struct vnt_private *pDevice
)
{
PWLAN_IE_SSID pSSID;
@@ -825,7 +830,7 @@ s_bCommandComplete(
pDevice->bCmdRunning = true;
switch (pDevice->eCommand) {
case WLAN_CMD_BSSID_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_BSSID_SCAN\n");
+ pr_debug("eCommandState= WLAN_CMD_BSSID_SCAN\n");
pDevice->eCommandState = WLAN_CMD_SCAN_START;
pMgmt->uScanChannel = 0;
if (pSSID->len != 0)
@@ -840,7 +845,7 @@ s_bCommandComplete(
pSSID->len = WLAN_SSID_MAXLEN;
if (pSSID->len != 0)
memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SSID_START\n");
+ pr_debug("eCommandState= WLAN_CMD_SSID_START\n");
break;
case WLAN_CMD_DISASSOCIATE:
pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START;
@@ -876,7 +881,7 @@ bool bScheduleCommand(
unsigned char *pbyItem0
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
if (pDevice->cbFreeCmdQueue == 0)
return false;
@@ -945,7 +950,7 @@ bool bClearBSSID_SCAN(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx;
unsigned int ii;
@@ -967,7 +972,7 @@ vResetCommandTimer(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
//delete timer
del_timer(&pDevice->sTimerCommand);
@@ -984,13 +989,12 @@ vResetCommandTimer(
pDevice->bCmdClear = false;
}
-#ifdef TxInSleep
void
BSSvSecondTxData(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
pDevice->nTxDataTimeCout++;
@@ -1003,20 +1007,17 @@ BSSvSecondTxData(
}
spin_lock_irq(&pDevice->lock);
-#if 1
- if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
- pDevice->fWPA_Authened) { //wpa linking
-#else
- if (pDevice->bLinkPass == true) {
-#endif
- pDevice->fTxDataInSleep = true;
- PSbSendNullPacket(pDevice); //send null packet
- pDevice->fTxDataInSleep = false;
- }
- spin_unlock_irq(&pDevice->lock);
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- add_timer(&pDevice->sTimerTxData);
- return;
+ /* open && sharekey linking */
+ if ((pDevice->bLinkPass && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) ||
+ pDevice->fWPA_Authened) { /* wpa linking */
+ pDevice->fTxDataInSleep = true;
+ PSbSendNullPacket(pDevice); /* send null packet */
+ pDevice->fTxDataInSleep = false;
}
-#endif
+
+ spin_unlock_irq(&pDevice->lock);
+
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); /* 10s callback */
+ add_timer(&pDevice->sTimerTxData);
+}
diff --git a/drivers/staging/vt6655/wcmd.h b/drivers/staging/vt6655/wcmd.h
index 126b61c48791..6ef04de69f37 100644
--- a/drivers/staging/vt6655/wcmd.h
+++ b/drivers/staging/vt6655/wcmd.h
@@ -114,11 +114,10 @@ vCommandTimerWait(
void *hDeviceContext,
unsigned int MSecond
);
-#ifdef TxInSleep
+
void
BSSvSecondTxData(
void *hDeviceContext
);
-#endif
#endif //__WCMD_H__
diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c
index fddea9fc9cfe..5a54d98d985a 100644
--- a/drivers/staging/vt6655/wctl.c
+++ b/drivers/staging/vt6655/wctl.c
@@ -105,7 +105,8 @@ bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader)
* Return Value: index number in Defragment Database
*
*/
-unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
+unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice,
+ PS802_11Header pMACHeader)
{
unsigned int ii;
@@ -133,7 +134,7 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
* Return Value: index number in Defragment Database
*
*/
-unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
+unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, PS802_11Header pMACHeader)
{
unsigned int ii;
@@ -169,7 +170,8 @@ unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
* Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false
*
*/
-bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV)
+bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
+ unsigned int cbFrameLength, bool bWEP, bool bExtIV)
{
unsigned int uHeaderSize;
diff --git a/drivers/staging/vt6655/wctl.h b/drivers/staging/vt6655/wctl.h
index 1ffb2734cfae..f0995d86f71f 100644
--- a/drivers/staging/vt6655/wctl.h
+++ b/drivers/staging/vt6655/wctl.h
@@ -97,9 +97,9 @@ do { \
/*--------------------- Export Functions --------------------------*/
bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader);
-bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader,
+bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader,
unsigned int cbFrameLength, bool bWEP, bool bExtIV);
-unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
-unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
+unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader);
+unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader);
#endif // __WCTL_H__
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index e88e11606db0..c998a16ebd1d 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -86,13 +86,10 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Functions --------------------------*/
//2008-8-4 <add> by chester
static bool ChannelExceedZoneType(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byCurrChannel
);
@@ -100,7 +97,7 @@ static bool ChannelExceedZoneType(
static
PSTxMgmtPacket
s_MgrMakeAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pDAddr,
unsigned short wCurrCapInfo,
@@ -113,7 +110,7 @@ s_MgrMakeAssocRequest(
static
void
s_vMgrRxAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
unsigned int uNodeIndex
@@ -122,7 +119,7 @@ s_vMgrRxAssocRequest(
static
PSTxMgmtPacket
s_MgrMakeReAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pDAddr,
unsigned short wCurrCapInfo,
@@ -135,7 +132,7 @@ s_MgrMakeReAssocRequest(
static
void
s_vMgrRxAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
bool bReAssocType
@@ -144,7 +141,7 @@ s_vMgrRxAssocResponse(
static
void
s_vMgrRxDisassociation(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
);
@@ -153,7 +150,7 @@ s_vMgrRxDisassociation(
static
void
s_vMgrRxAuthenSequence_1(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
);
@@ -161,7 +158,7 @@ s_vMgrRxAuthenSequence_1(
static
void
s_vMgrRxAuthenSequence_2(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
);
@@ -169,7 +166,7 @@ s_vMgrRxAuthenSequence_2(
static
void
s_vMgrRxAuthenSequence_3(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
);
@@ -177,7 +174,7 @@ s_vMgrRxAuthenSequence_3(
static
void
s_vMgrRxAuthenSequence_4(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
);
@@ -185,7 +182,7 @@ s_vMgrRxAuthenSequence_4(
static
void
s_vMgrRxAuthentication(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
);
@@ -193,7 +190,7 @@ s_vMgrRxAuthentication(
static
void
s_vMgrRxDeauthentication(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
);
@@ -203,7 +200,7 @@ s_vMgrRxDeauthentication(
static
void
s_vMgrRxProbeRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
);
@@ -211,7 +208,7 @@ s_vMgrRxProbeRequest(
static
void
s_vMgrRxProbeResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
);
@@ -220,7 +217,7 @@ s_vMgrRxProbeResponse(
static
void
s_vMgrRxBeacon(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
bool bInScan
@@ -236,7 +233,7 @@ s_vMgrFormatTIM(
static
PSTxMgmtPacket
s_MgrMakeBeacon(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wCurrBeaconPeriod,
@@ -252,7 +249,7 @@ s_MgrMakeBeacon(
static
PSTxMgmtPacket
s_MgrMakeAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wAssocStatus,
@@ -266,7 +263,7 @@ s_MgrMakeAssocResponse(
static
PSTxMgmtPacket
s_MgrMakeReAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wAssocStatus,
@@ -280,7 +277,7 @@ s_MgrMakeReAssocResponse(
static
PSTxMgmtPacket
s_MgrMakeProbeResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wCurrBeaconPeriod,
@@ -305,7 +302,7 @@ s_vMgrLogStatus(
static
void
s_vMgrSynchBSS(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int uBSSMode,
PKnownBSS pCurr,
PCMD_STATUS pStatus
@@ -320,7 +317,7 @@ s_bCipherMatch(
);
static void Encyption_Rebuild(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PKnownBSS pCurr
);
@@ -343,7 +340,7 @@ vMgrObjectInit(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
int ii;
@@ -375,7 +372,7 @@ vMgrTimerInit(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
init_timer(&pMgmt->sTimerSecondCallback);
@@ -388,7 +385,6 @@ vMgrTimerInit(
pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
pDevice->sTimerCommand.expires = RUN_AT(HZ);
-#ifdef TxInSleep
init_timer(&pDevice->sTimerTxData);
pDevice->sTimerTxData.data = (unsigned long) pDevice;
pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
@@ -396,7 +392,6 @@ vMgrTimerInit(
pDevice->fTxDataInSleep = false;
pDevice->IsTxDataTrigger = false;
pDevice->nTxDataTimeCout = 0;
-#endif
pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
pDevice->uCmdDequeueIdx = 0;
@@ -418,7 +413,7 @@ vMgrObjectReset(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
pMgmt->eCurrMode = WMAC_MODE_STANDBY;
@@ -445,7 +440,7 @@ vMgrAssocBeginSta(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSTxMgmtPacket pTxPacket;
pMgmt->wCurrCapInfo = 0;
@@ -511,7 +506,7 @@ vMgrReAssocBeginSta(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSTxMgmtPacket pTxPacket;
pMgmt->wCurrCapInfo = 0;
@@ -553,9 +548,9 @@ vMgrReAssocBeginSta(
/* send the frame */
*pStatus = csMgmt_xmit(pDevice, pTxPacket);
if (*pStatus != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n");
+ pr_debug("Mgt:Reassociation tx failed\n");
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n");
+ pr_debug("Mgt:Reassociation tx sending\n");
}
}
@@ -578,7 +573,7 @@ vMgrDisassocBeginSta(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSTxMgmtPacket pTxPacket = NULL;
WLAN_FR_DISASSOC sFrame;
@@ -630,7 +625,7 @@ vMgrDisassocBeginSta(
static
void
s_vMgrRxAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
unsigned int uNodeIndex
@@ -720,8 +715,8 @@ s_vMgrRxAssocRequest(
if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble)
pDevice->bBarkerPreambleMd = true;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d\n", wAssocAID);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+ pr_info("Associate AID= %d\n", wAssocAID);
+ pr_info("MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
sFrame.pHdr->sA3.abyAddr2[0],
sFrame.pHdr->sA3.abyAddr2[1],
sFrame.pHdr->sA3.abyAddr2[2],
@@ -729,7 +724,7 @@ s_vMgrRxAssocRequest(
sFrame.pHdr->sA3.abyAddr2[4],
sFrame.pHdr->sA3.abyAddr2[5]
);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n",
+ pr_info("Max Support rate = %d\n",
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
} else {
/* TODO: received STA under state1 handle */
@@ -755,9 +750,9 @@ s_vMgrRxAssocRequest(
/* send the frame */
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n");
+ pr_debug("Mgt:Assoc response tx failed\n");
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n");
+ pr_debug("Mgt:Assoc response tx sending..\n");
}
}
@@ -780,7 +775,7 @@ s_vMgrRxAssocRequest(
static
void
s_vMgrRxReAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
unsigned int uNodeIndex
@@ -869,8 +864,8 @@ s_vMgrRxReAssocRequest(
if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble)
pDevice->bBarkerPreambleMd = true;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d\n", wAssocAID);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
+ pr_info("Rx ReAssociate AID= %d\n", wAssocAID);
+ pr_info("MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
sFrame.pHdr->sA3.abyAddr2[0],
sFrame.pHdr->sA3.abyAddr2[1],
sFrame.pHdr->sA3.abyAddr2[2],
@@ -878,7 +873,7 @@ s_vMgrRxReAssocRequest(
sFrame.pHdr->sA3.abyAddr2[4],
sFrame.pHdr->sA3.abyAddr2[5]
);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n",
+ pr_info("Max Support rate = %d\n",
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
}
@@ -903,9 +898,9 @@ s_vMgrRxReAssocRequest(
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n");
+ pr_debug("Mgt:ReAssoc response tx failed\n");
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n");
+ pr_debug("Mgt:ReAssoc response tx sending..\n");
}
}
@@ -922,7 +917,7 @@ s_vMgrRxReAssocRequest(
static
void
s_vMgrRxAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
bool bReAssocType
@@ -963,13 +958,14 @@ s_vMgrRxAssocResponse(
// set AID
pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid)));
if ((pMgmt->wCurrAID >> 14) != (BIT0 | BIT1))
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n");
+ pr_debug("AID from AP, has two msb clear\n");
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14 | BIT15));
+ pr_info("Association Successful, AID=%d\n",
+ pMgmt->wCurrAID & ~(BIT14 | BIT15));
pMgmt->eCurrState = WMAC_STATE_ASSOC;
BSSvUpdateAPNode((void *)pDevice, sFrame.pwCapInfo, sFrame.pSuppRates, sFrame.pExtSuppRates);
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID);
+ pr_info("Link with AP(SSID): %s\n", pItemSSID->abySSID);
pDevice->bLinkPass = true;
pDevice->uBBVGADiffCount = 0;
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
@@ -1075,7 +1071,7 @@ vMgrAuthenBeginSta(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
WLAN_FR_AUTHEN sFrame;
PSTxMgmtPacket pTxPacket = NULL;
@@ -1131,7 +1127,7 @@ vMgrDeAuthenBeginSta(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
WLAN_FR_DEAUTHEN sFrame;
PSTxMgmtPacket pTxPacket = NULL;
@@ -1175,7 +1171,7 @@ vMgrDeAuthenBeginSta(
static
void
s_vMgrRxAuthentication(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
)
@@ -1208,8 +1204,8 @@ s_vMgrRxAuthentication(
s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame);
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Auth Sequence error, seq = %d\n",
- cpu_to_le16((*(sFrame.pwAuthSequence))));
+ pr_debug("Auth Sequence error, seq = %d\n",
+ cpu_to_le16((*(sFrame.pwAuthSequence))));
break;
}
}
@@ -1229,7 +1225,7 @@ s_vMgrRxAuthentication(
static
void
s_vMgrRxAuthenSequence_1(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
)
@@ -1241,7 +1237,7 @@ s_vMgrRxAuthenSequence_1(
// Insert a Node entry
if (!BSSDBbIsSTAInNodeDB(pMgmt, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) {
- BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
+ BSSvCreateOneNode(pDevice, &uNodeIndex);
memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, pFrame->pHdr->sA3.abyAddr2,
WLAN_ADDR_LEN);
}
@@ -1308,9 +1304,9 @@ s_vMgrRxAuthenSequence_1(
if (pDevice->bEnableHostapd)
return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx..\n");
+ pr_debug("Mgt:Authreq_reply sequence_1 tx..\n");
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n");
+ pr_debug("Mgt:Authreq_reply sequence_1 tx failed\n");
}
/*+
@@ -1328,7 +1324,7 @@ s_vMgrRxAuthenSequence_1(
static
void
s_vMgrRxAuthenSequence_2(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
)
@@ -1339,11 +1335,11 @@ s_vMgrRxAuthenSequence_2(
switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) {
case WLAN_AUTH_ALG_OPENSYSTEM:
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n");
+ pr_info("802.11 Authen (OPEN) Successful\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
} else {
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n");
+ pr_info("802.11 Authen (OPEN) Failed\n");
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
@@ -1383,16 +1379,17 @@ s_vMgrRxAuthenSequence_2(
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
// send the frame
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n");
+ pr_debug("Mgt:Auth_reply sequence_2 tx failed\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n");
+ pr_debug("Mgt:Auth_reply sequence_2 tx ...\n");
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n");
+ pr_debug("Mgt:rx Auth_reply sequence_2 status error ...\n");
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
}
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n", cpu_to_le16((*(pFrame->pwAuthAlgorithm))));
+ pr_debug("Mgt: rx auth.seq = 2 unknown AuthAlgorithm=%d\n",
+ cpu_to_le16((*(pFrame->pwAuthAlgorithm))));
break;
}
}
@@ -1413,7 +1410,7 @@ s_vMgrRxAuthenSequence_2(
static
void
s_vMgrRxAuthenSequence_3(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
)
@@ -1446,7 +1443,7 @@ s_vMgrRxAuthenSequence_3(
pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 0;
}
uStatusCode = WLAN_MGMT_STATUS_SUCCESS;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n");
+ pr_debug("Challenge text check ok..\n");
reply:
// send auth reply
@@ -1479,7 +1476,7 @@ reply:
return;
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n");
+ pr_debug("Mgt:Authreq_reply sequence_4 tx failed\n");
}
/*+
@@ -1495,17 +1492,17 @@ reply:
static
void
s_vMgrRxAuthenSequence_4(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PWLAN_FR_AUTHEN pFrame
)
{
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n");
+ pr_info("802.11 Authen (SHAREDKEY) Successful\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
} else{
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n");
+ pr_info("802.11 Authen (SHAREDKEY) Failed\n");
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
@@ -1525,7 +1522,7 @@ s_vMgrRxAuthenSequence_4(
static
void
s_vMgrRxDisassociation(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
)
@@ -1542,13 +1539,14 @@ s_vMgrRxDisassociation(
if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
BSSvRemoveOneNode(pDevice, uNodeIndex);
else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n");
+ pr_debug("Rx disassoc, sta not found\n");
} else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeDisassociation(&sFrame);
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason)));
+ pr_info("AP disassociated me, reason=%d\n",
+ cpu_to_le16(*(sFrame.pwReason)));
//TODO: do something let upper layer know or
//try to send associate packet again because of inactivity timeout
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
@@ -1595,7 +1593,7 @@ s_vMgrRxDisassociation(
static
void
s_vMgrRxDeauthentication(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
)
@@ -1613,13 +1611,14 @@ s_vMgrRxDeauthentication(
if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
BSSvRemoveOneNode(pDevice, uNodeIndex);
else
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n");
+ pr_info("Rx deauth, sta not found\n");
} else {
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeDeauthen(&sFrame);
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason))));
+ pr_info("AP deauthed me, reason=%d\n",
+ cpu_to_le16((*(sFrame.pwReason))));
// TODO: update BSS list for specific BSSID if pre-authentication case
if (ether_addr_equal(sFrame.pHdr->sA3.abyAddr3,
pMgmt->abyCurrBSSID)) {
@@ -1678,7 +1677,7 @@ s_vMgrRxDeauthentication(
-*/
static bool
ChannelExceedZoneType(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned char byCurrChannel
)
{
@@ -1715,7 +1714,7 @@ ChannelExceedZoneType(
static
void
s_vMgrRxBeacon(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket,
bool bInScan
@@ -1723,7 +1722,7 @@ s_vMgrRxBeacon(
{
PKnownBSS pBSSList;
WLAN_FR_BEACON sFrame;
- QWORD qwTSFOffset;
+ u64 qwTSFOffset;
bool bIsBSSIDEqual = false;
bool bIsSSIDEqual = false;
bool bTSFLargeDiff = false;
@@ -1735,8 +1734,8 @@ s_vMgrRxBeacon(
unsigned char byTIMBitOn = 0;
unsigned short wAIDNumber = 0;
unsigned int uNodeIndex;
- QWORD qwTimestamp, qwLocalTSF;
- QWORD qwCurrTSF;
+ u64 qwTimestamp, qwLocalTSF;
+ u64 qwCurrTSF;
unsigned short wStartIndex = 0;
unsigned short wAIDIndex = 0;
unsigned char byCurrChannel = pRxPacket->byRxChannel;
@@ -1757,7 +1756,7 @@ s_vMgrRxBeacon(
(sFrame.pwCapInfo == NULL) ||
(sFrame.pSSID == NULL) ||
(sFrame.pSuppRates == NULL)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n");
+ pr_debug("Rx beacon frame error\n");
return;
}
@@ -1792,7 +1791,7 @@ s_vMgrRxBeacon(
pBSSList = BSSpAddrIsInBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID);
if (pBSSList == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon/insert: RxChannel = : %d\n", byCurrChannel);
+ pr_debug("Beacon/insert: RxChannel = : %d\n", byCurrChannel);
BSSbInsertToBSSList((void *)pDevice,
sFrame.pHdr->sA3.abyAddr3,
*sFrame.pqwTimestamp,
@@ -1966,7 +1965,7 @@ s_vMgrRxBeacon(
}
}
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2\n");
+// pr_debug("Beacon 2\n");
// check if CF field exists
if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) {
if (sFrame.pCFParms->wCFPDurRemaining > 0) {
@@ -1974,32 +1973,22 @@ s_vMgrRxBeacon(
}
}
- HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp));
- LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp));
- HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
- LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
+ qwTimestamp = le64_to_cpu(*sFrame.pqwTimestamp);
+ qwLocalTSF = pRxPacket->qwLocalTSF;
// check if beacon TSF larger or small than our local TSF
- if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) {
- if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF))
- bTSFOffsetPostive = true;
- else
- bTSFOffsetPostive = false;
- } else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
+ if (qwTimestamp >= qwLocalTSF)
bTSFOffsetPostive = true;
- } else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) {
+ else
bTSFOffsetPostive = false;
- }
if (bTSFOffsetPostive)
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
else
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
- if (HIDWORD(qwTSFOffset) != 0 ||
- (LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE)) {
+ if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE)
bTSFLargeDiff = true;
- }
// if infra mode
if (bIsAPBeacon) {
@@ -2038,18 +2027,18 @@ s_vMgrRxBeacon(
// send out ps-poll packet
if (pMgmt->bInTIM)
- PSvSendPSPOLL((PSDevice)pDevice);
+ PSvSendPSPOLL(pDevice);
} else {
pMgmt->bInTIMWake = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n");
+ pr_debug("BCN: Not In TIM..\n");
if (!pDevice->bPWBitOn) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Send Null Packet\n");
+ pr_debug("BCN: Send Null Packet\n");
if (PSbSendNullPacket(pDevice))
pDevice->bPWBitOn = true;
}
if (PSbConsiderPowerDown(pDevice, false, false))
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n");
+ pr_debug("BCN: Power down now...\n");
}
}
@@ -2089,7 +2078,7 @@ s_vMgrRxBeacon(
pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0;
} else {
// Todo, initial Node content
- BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
+ BSSvCreateOneNode(pDevice, &uNodeIndex);
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
@@ -2117,7 +2106,7 @@ s_vMgrRxBeacon(
// if other stations joined, indicate connection to upper layer..
if (pMgmt->eCurrState == WMAC_STATE_STARTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed]\n");
+ pr_debug("Current IBSS State: [Started]........to: [Jointed]\n");
pMgmt->eCurrState = WMAC_STATE_JOINTED;
pDevice->bLinkPass = true;
if (netif_queue_stopped(pDevice->dev))
@@ -2143,7 +2132,7 @@ s_vMgrRxBeacon(
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
WLAN_RATES_MAXLEN_11B);
// set HW beacon interval and re-synchronizing....
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n");
+ pr_debug("Rejoining to Other Adhoc group with same SSID........\n");
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod);
CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF);
CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
@@ -2190,20 +2179,20 @@ vMgrCreateOwnIBSS(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned short wMaxBasicRate;
unsigned short wMaxSuppRate;
unsigned char byTopCCKBasicRate;
unsigned char byTopOFDMBasicRate;
- QWORD qwCurrTSF;
+ u64 qwCurrTSF;
unsigned int ii;
unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
unsigned char abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
unsigned short wSuppRate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n");
+ pr_debug("Create Basic Service Set .......\n");
if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) &&
@@ -2312,18 +2301,18 @@ vMgrCreateOwnIBSS(
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
// AP mode BSSID = MAC addr
memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "AP beacon created BSSID:%pM\n",
+ pr_info("AP beacon created BSSID:%pM\n",
pMgmt->abyCurrBSSID);
}
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
// BSSID selected must be randomized as spec 11.1.3
- pMgmt->abyCurrBSSID[5] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff);
- pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8);
- pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00ff0000) >> 16);
- pMgmt->abyCurrBSSID[2] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00000ff0) >> 4);
- pMgmt->abyCurrBSSID[1] = (unsigned char)((LODWORD(qwCurrTSF) & 0x000ff000) >> 12);
- pMgmt->abyCurrBSSID[0] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0ff00000) >> 20);
+ pMgmt->abyCurrBSSID[5] = (u8) (qwCurrTSF & 0x000000ff);
+ pMgmt->abyCurrBSSID[4] = (u8) ((qwCurrTSF & 0x0000ff00) >> 8);
+ pMgmt->abyCurrBSSID[3] = (u8) ((qwCurrTSF & 0x00ff0000) >> 16);
+ pMgmt->abyCurrBSSID[2] = (u8) ((qwCurrTSF & 0x00000ff0) >> 4);
+ pMgmt->abyCurrBSSID[1] = (u8) ((qwCurrTSF & 0x000ff000) >> 12);
+ pMgmt->abyCurrBSSID[0] = (u8) ((qwCurrTSF & 0x0ff00000) >> 20);
pMgmt->abyCurrBSSID[5] ^= pMgmt->abyMACAddr[0];
pMgmt->abyCurrBSSID[4] ^= pMgmt->abyMACAddr[1];
pMgmt->abyCurrBSSID[3] ^= pMgmt->abyMACAddr[2];
@@ -2333,7 +2322,7 @@ vMgrCreateOwnIBSS(
pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP;
pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Adhoc beacon created bssid:%pM\n",
+ pr_info("Adhoc beacon created bssid:%pM\n",
pMgmt->abyCurrBSSID);
}
@@ -2426,7 +2415,7 @@ vMgrJoinBSSBegin(
PCMD_STATUS pStatus
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt;
PKnownBSS pCurr = NULL;
unsigned int ii, uu;
@@ -2447,7 +2436,7 @@ vMgrJoinBSSBegin(
if (ii == MAX_BSS_NUM) {
*pStatus = CMD_STATUS_RESOURCES;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "BSS finding:BSS list is empty.\n");
+ pr_info("BSS finding:BSS list is empty\n");
return;
}
@@ -2462,11 +2451,12 @@ vMgrJoinBSSBegin(
if (pCurr == NULL) {
*pStatus = CMD_STATUS_RESOURCES;
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Scanning [%s] not found, disconnected !\n", pItemSSID->abySSID);
+ pr_info("Scanning [%s] not found, disconnected !\n",
+ pItemSSID->abySSID);
return;
}
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n");
+ pr_info("AP(BSS) finding:Found a AP(BSS)..\n");
if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))) {
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) {
// patch for CISCO migration mode
@@ -2544,10 +2534,11 @@ vMgrJoinBSSBegin(
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
bool bResult = bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate: 1(%d)\n", bResult);
+ pr_debug("bAdd_PMKID_Candidate: 1(%d)\n",
+ bResult);
if (!bResult) {
vFlush_PMKID_Candidate((void *)pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 4\n");
+ pr_debug("vFlush_PMKID_Candidate: 4\n");
bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj);
}
}
@@ -2555,9 +2546,9 @@ vMgrJoinBSSBegin(
// Preamble type auto-switch: if AP can receive short-preamble cap,
// we can turn on too.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join ESS\n");
+ pr_debug("Join ESS\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n");
+ pr_debug("End of Join AP -- A/B/G Action\n");
} else {
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
@@ -2615,8 +2606,8 @@ vMgrJoinBSSBegin(
pMgmt->eCurrState = WMAC_STATE_STARTED;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join IBSS ok:%pM\n",
- pMgmt->abyCurrBSSID);
+ pr_debug("Join IBSS ok:%pM\n",
+ pMgmt->abyCurrBSSID);
// Preamble type auto-switch: if AP can receive short-preamble cap,
// and if registry setting is short preamble we can turn on too.
@@ -2641,7 +2632,7 @@ vMgrJoinBSSBegin(
static
void
s_vMgrSynchBSS(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
unsigned int uBSSMode,
PKnownBSS pCurr,
PCMD_STATUS pStatus
@@ -2663,7 +2654,7 @@ s_vMgrSynchBSS(
pDevice->eEncryptionStatus,
&(pMgmt->byCSSPK),
&(pMgmt->byCSSGK))) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n");
+ pr_debug("s_bCipherMatch Fail .......\n");
return;
}
@@ -2701,8 +2692,7 @@ s_vMgrSynchBSS(
MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = "
- "%pM\n", pMgmt->abyCurrBSSID);
+ pr_debug("Sync:set CurrBSSID address = %pM\n", pMgmt->abyCurrBSSID);
if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) {
if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) ||
@@ -2757,19 +2747,20 @@ s_vMgrSynchBSS(
pCurr->sERP.byERP,
pMgmt->abyCurrSuppRates,
pMgmt->abyCurrExtSuppRates)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType);
+ pr_debug("<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType);
return;
}
// set channel and clear NAV
if (!set_channel(pMgmt->pAdapter, pCurr->uChannel)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel);
+ pr_debug("<----s_bSynchBSS Set Channel [%d]\n",
+ pCurr->uChannel);
return;
}
pMgmt->uCurrChannel = pCurr->uChannel;
pMgmt->eCurrentPHYMode = ePhyType;
pMgmt->byERPContext = pCurr->sERP.byERP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (int)pCurr->uChannel);
+ pr_debug("Sync:Set to channel = [%d]\n", (int)pCurr->uChannel);
*pStatus = CMD_STATUS_SUCCESS;
@@ -2779,7 +2770,7 @@ s_vMgrSynchBSS(
//mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption
// ,need reset eAuthenMode and eEncryptionStatus
static void Encyption_Rebuild(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PKnownBSS pCurr
)
{
@@ -2894,7 +2885,7 @@ s_vMgrFormatTIM(
static
PSTxMgmtPacket
s_MgrMakeBeacon(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wCurrBeaconPeriod,
@@ -3113,7 +3104,7 @@ s_MgrMakeBeacon(
static PSTxMgmtPacket
s_MgrMakeProbeResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wCurrBeaconPeriod,
@@ -3295,7 +3286,7 @@ s_MgrMakeProbeResponse(
static PSTxMgmtPacket
s_MgrMakeAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pDAddr,
unsigned short wCurrCapInfo,
@@ -3555,7 +3546,7 @@ s_MgrMakeAssocRequest(
static PSTxMgmtPacket
s_MgrMakeReAssocRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned char *pDAddr,
unsigned short wCurrCapInfo,
@@ -3800,7 +3791,7 @@ s_MgrMakeReAssocRequest(
static PSTxMgmtPacket
s_MgrMakeAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wAssocStatus,
@@ -3871,7 +3862,7 @@ s_MgrMakeAssocResponse(
static PSTxMgmtPacket
s_MgrMakeReAssocResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
unsigned short wCurrCapInfo,
unsigned short wAssocStatus,
@@ -3943,7 +3934,7 @@ s_MgrMakeReAssocResponse(
static
void
s_vMgrRxProbeResponse(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
)
@@ -3966,13 +3957,14 @@ s_vMgrRxProbeResponse(
(sFrame.pwCapInfo == NULL) ||
(sFrame.pSSID == NULL) ||
(sFrame.pSuppRates == NULL)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", pRxPacket->p80211Header);
+ pr_debug("Probe resp:Fail addr:[%p]\n",
+ pRxPacket->p80211Header);
DBG_PORT80(0xCC);
return;
}
if (sFrame.pSSID->len == 0)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0\n");
+ pr_debug("Rx Probe resp: SSID len = 0\n");
if (sFrame.pDSParms != NULL) {
if (byCurrChannel > CB_MAX_CHANNEL_24G) {
@@ -4026,7 +4018,8 @@ s_vMgrRxProbeResponse(
(void *)pRxPacket
);
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp/insert: RxChannel = : %d\n", byCurrChannel);
+ pr_debug("Probe resp/insert: RxChannel = : %d\n",
+ byCurrChannel);
BSSbInsertToBSSList((void *)pDevice,
sFrame.pHdr->sA3.abyAddr3,
*sFrame.pqwTimestamp,
@@ -4062,7 +4055,7 @@ s_vMgrRxProbeResponse(
static
void
s_vMgrRxProbeRequest(
- PSDevice pDevice,
+ struct vnt_private *pDevice,
PSMgmtObject pMgmt,
PSRxMgmtPacket pRxPacket
)
@@ -4115,7 +4108,7 @@ s_vMgrRxProbeRequest(
/* send the frame */
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n");
+ pr_debug("Mgt:Probe response tx failed\n");
}
}
}
@@ -4141,7 +4134,7 @@ vMgrRxManagePacket(
PSRxMgmtPacket pRxPacket
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
bool bInScan = false;
unsigned int uNodeIndex = 0;
NODE_STATE eNodeState = 0;
@@ -4155,7 +4148,7 @@ vMgrRxManagePacket(
switch (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl))) {
case WLAN_FSTYPE_ASSOCREQ:
// Frame Clase = 2
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n");
+ pr_debug("rx assocreq\n");
if (eNodeState < NODE_AUTH) {
// send deauth notification
// reason = (6) class 2 received from nonauth sta
@@ -4165,7 +4158,7 @@ vMgrRxManagePacket(
(6),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n");
+ pr_debug("wmgr: send vMgrDeAuthenBeginSta 1\n");
} else {
s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex);
}
@@ -4173,14 +4166,14 @@ vMgrRxManagePacket(
case WLAN_FSTYPE_ASSOCRESP:
// Frame Clase = 2
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n");
+ pr_debug("rx assocresp1\n");
s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n");
+ pr_debug("rx assocresp2\n");
break;
case WLAN_FSTYPE_REASSOCREQ:
// Frame Clase = 2
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n");
+ pr_debug("rx reassocreq\n");
// Todo: reassoc
if (eNodeState < NODE_AUTH) {
// send deauth notification
@@ -4191,7 +4184,7 @@ vMgrRxManagePacket(
(6),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 2\n");
+ pr_debug("wmgr: send vMgrDeAuthenBeginSta 2\n");
}
s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex);
@@ -4199,7 +4192,7 @@ vMgrRxManagePacket(
case WLAN_FSTYPE_REASSOCRESP:
// Frame Clase = 2
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n");
+ pr_debug("rx reassocresp\n");
s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true);
break;
@@ -4210,7 +4203,7 @@ vMgrRxManagePacket(
case WLAN_FSTYPE_PROBERESP:
// Frame Clase = 0
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n");
+ pr_debug("rx proberesp\n");
s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket);
break;
@@ -4225,12 +4218,12 @@ vMgrRxManagePacket(
case WLAN_FSTYPE_ATIM:
// Frame Clase = 1
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n");
+ pr_debug("rx atim\n");
break;
case WLAN_FSTYPE_DISASSOC:
// Frame Clase = 2
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n");
+ pr_debug("rx disassoc\n");
if (eNodeState < NODE_AUTH) {
// send deauth notification
// reason = (6) class 2 received from nonauth sta
@@ -4240,25 +4233,25 @@ vMgrRxManagePacket(
(6),
&Status
);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 3\n");
+ pr_debug("wmgr: send vMgrDeAuthenBeginSta 3\n");
}
s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket);
break;
case WLAN_FSTYPE_AUTHEN:
// Frame Clase = 1
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n");
+ pr_debug("rx authen\n");
s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket);
break;
case WLAN_FSTYPE_DEAUTHEN:
// Frame Clase = 1
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n");
+ pr_debug("rx deauthen\n");
s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket);
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx unknown mgmt\n");
+ pr_debug("rx unknown mgmt\n");
}
}
@@ -4279,7 +4272,7 @@ bMgrPrepareBeaconToSend(
PSMgmtObject pMgmt
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
PSTxMgmtPacket pTxPacket;
if (pDevice->bEncryptionEnable || pDevice->bEnable8021x)
@@ -4331,46 +4324,46 @@ s_vMgrLogStatus(
{
switch (wStatus) {
case WLAN_MGMT_STATUS_UNSPEC_FAILURE:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Unspecified error.\n");
+ pr_info("Status code == Unspecified error\n");
break;
case WLAN_MGMT_STATUS_CAPS_UNSUPPORTED:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Can't support all requested capabilities.\n");
+ pr_info("Status code == Can't support all requested capabilities\n");
break;
case WLAN_MGMT_STATUS_REASSOC_NO_ASSOC:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Reassoc denied, can't confirm original Association.\n");
+ pr_info("Status code == Reassoc denied, can't confirm original Association\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, undefine in spec\n");
+ pr_info("Status code == Assoc denied, undefine in spec\n");
break;
case WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Peer doesn't support authen algorithm.\n");
+ pr_info("Status code == Peer doesn't support authen algorithm\n");
break;
case WLAN_MGMT_STATUS_RX_AUTH_NOSEQ:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen frame received out of sequence.\n");
+ pr_info("Status code == Authen frame received out of sequence\n");
break;
case WLAN_MGMT_STATUS_CHALLENGE_FAIL:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, challenge failure.\n");
+ pr_info("Status code == Authen rejected, challenge failure\n");
break;
case WLAN_MGMT_STATUS_AUTH_TIMEOUT:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Authen rejected, timeout waiting for next frame.\n");
+ pr_info("Status code == Authen rejected, timeout waiting for next frame\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, AP too busy.\n");
+ pr_info("Status code == Assoc denied, AP too busy\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_RATES:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we haven't enough basic rates.\n");
+ pr_info("Status code == Assoc denied, we haven't enough basic rates\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_SHORTPREAMBLE:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support short preamble.\n");
+ pr_info("Status code == Assoc denied, we do not support short preamble\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_PBCC:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support PBCC.\n");
+ pr_info("Status code == Assoc denied, we do not support PBCC\n");
break;
case WLAN_MGMT_STATUS_ASSOC_DENIED_AGILITY:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Status code == Assoc denied, we do not support channel agility.\n");
+ pr_info("Status code == Assoc denied, we do not support channel agility\n");
break;
default:
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Unknown status code %d.\n", wStatus);
+ pr_info("Unknown status code %d\n", wStatus);
break;
}
}
@@ -4398,11 +4391,12 @@ bAdd_PMKID_Candidate(
PSRSNCapObject psRSNCapObj
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
struct pmkid_candidate *pCandidateList;
unsigned int ii = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
+ pr_debug("bAdd_PMKID_Candidate START: (%d)\n",
+ (int)pDevice->gsPMKIDCandidate.NumCandidates);
if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL))
return false;
@@ -4432,7 +4426,8 @@ bAdd_PMKID_Candidate(
memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN);
pDevice->gsPMKIDCandidate.NumCandidates++;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
+ pr_debug("NumCandidates:%d\n",
+ (int)pDevice->gsPMKIDCandidate.NumCandidates);
return true;
}
@@ -4455,7 +4450,7 @@ vFlush_PMKID_Candidate(
void *hDeviceContext
)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ struct vnt_private *pDevice = hDeviceContext;
if (pDevice == NULL)
return;
@@ -4549,8 +4544,9 @@ s_bCipherMatch(
}
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%d, %d, %d, %d, EncStatus:%d\n",
- byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus);
+ pr_debug("%d, %d, %d, %d, EncStatus:%d\n",
+ byMulticastCipher, byCipherMask,
+ pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus);
// mask our cap. with BSS
if (EncStatus == Ndis802_11Encryption1Enabled) {
diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index a71daed7fa0b..ce939b30ac2a 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -175,7 +175,7 @@ typedef struct tagSTxMgmtPacket {
// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
PUWLAN_80211HDR p80211Header;
- QWORD qwLocalTSF;
+ u64 qwLocalTSF;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
unsigned int uRSSI;
diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c
index 7b1bab91a9cf..5d4eca8512af 100644
--- a/drivers/staging/vt6655/wpa.c
+++ b/drivers/staging/vt6655/wpa.c
@@ -43,8 +43,6 @@
#include "80211mgr.h"
/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
static const unsigned char abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 };
static const unsigned char abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 };
static const unsigned char abyOUI02[4] = { 0x00, 0x50, 0xf2, 0x02 };
@@ -115,13 +113,13 @@ WPA_ParseRSN(
WPA_ClearRSN(pBSSList);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA_ParseRSN: [%d]\n", pRSN->len);
+ pr_debug("WPA_ParseRSN: [%d]\n", pRSN->len);
// information element header makes sense
if ((pRSN->len >= 6) // oui1(4)+ver(2)
&& (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4)
&& (pRSN->wVersion == 1)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal RSN\n");
+ pr_debug("Legal RSN\n");
// update each variable if pRSN is long enough to contain the variable
if (pRSN->len >= 10) {
//OUI1(4)+ver(2)+GKSuite(4)
@@ -139,13 +137,14 @@ WPA_ParseRSN(
// any vendor checks here
pBSSList->byGKType = WPA_NONE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byGKType: %x\n", pBSSList->byGKType);
+ pr_debug("byGKType: %x\n", pBSSList->byGKType);
}
if (pRSN->len >= 12) {
//oui1(4)+ver(2)+GKS(4)+PKSCnt(2)
j = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
+ pr_debug("wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n",
+ pRSN->wPKCount, sizeof(pBSSList->abyPKType));
for (i = 0; (i < pRSN->wPKCount) && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) {
if (pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i)
if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4))
@@ -163,19 +162,20 @@ WPA_ParseRSN(
break;
}
pBSSList->wPKCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d\n", pBSSList->wPKCount);
+ pr_debug("wPKCount: %d\n", pBSSList->wPKCount);
}
m = pRSN->wPKCount;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "m: %d\n", m);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+m*4: %d\n", 14+m*4);
+ pr_debug("m: %d\n", m);
+ pr_debug("14+m*4: %d\n", 14+m*4);
if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)
// overlay IE_RSN_Auth structure into correct place
pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI;
j = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
- pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType));
+ pr_debug("wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
+ pIE_RSN_Auth->wAuthCount,
+ sizeof(pBSSList->abyAuthType));
for (i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) {
if (pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i)
if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4))
@@ -191,14 +191,14 @@ WPA_ParseRSN(
}
if (j > 0)
pBSSList->wAuthCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d\n", pBSSList->wAuthCount);
+ pr_debug("wAuthCount: %d\n", pBSSList->wAuthCount);
}
if (pIE_RSN_Auth != NULL) {
n = pIE_RSN_Auth->wAuthCount;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "n: %d\n", n);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+4+(m+n)*4: %d\n", 14+4+(m+n)*4);
+ pr_debug("n: %d\n", n);
+ pr_debug("14+4+(m+n)*4: %d\n", 14+4+(m+n)*4);
if (pRSN->len+2 >= 14+4+(m+n)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2)
pbyCaps = (unsigned char *)pIE_RSN_Auth->AuthKSList[n].abyOUI;
diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c
index 4e1b63be380f..bb335ef51172 100644
--- a/drivers/staging/vt6655/wpa2.c
+++ b/drivers/staging/vt6655/wpa2.c
@@ -35,8 +35,6 @@
#include "device.h"
#include "wmgr.h"
-/*--------------------- Static Definitions -------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -116,7 +114,7 @@ WPA2vParseRSN(
unsigned char *pbyOUI;
bool bUseGK = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA2_ParseRSN: [%d]\n", pRSN->len);
+ pr_debug("WPA2_ParseRSN: [%d]\n", pRSN->len);
WPA2_ClearRSN(pBSSNode);
@@ -135,7 +133,7 @@ WPA2vParseRSN(
// information element header makes sense
if ((pRSN->byElementID == WLAN_EID_RSN) &&
(pRSN->wVersion == 1)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal 802.11i RSN\n");
+ pr_debug("Legal 802.11i RSN\n");
pbyOUI = &(pRSN->abyRSN[0]);
if (!memcmp(pbyOUI, abyOUIWEP40, 4))
@@ -153,7 +151,7 @@ WPA2vParseRSN(
// any vendor checks here
pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "802.11i CSS: %X\n", pBSSNode->byCSSGK);
+ pr_debug("802.11i CSS: %X\n", pBSSNode->byCSSGK);
if (pRSN->len == 6) {
pBSSNode->bWPA2Valid = true;
@@ -186,7 +184,8 @@ WPA2vParseRSN(
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
}
pbyOUI += 4;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]);
+ pr_debug("abyCSSPK[%d]: %X\n",
+ j-1, pBSSNode->abyCSSPK[j-1]);
} else
break;
} //for
@@ -206,7 +205,7 @@ WPA2vParseRSN(
return;
}
pBSSNode->wCSSPKCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
+ pr_debug("wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
}
m = *((unsigned short *)&(pRSN->abyRSN[4]));
@@ -224,12 +223,15 @@ WPA2vParseRSN(
else
// any vendor checks here
pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]);
+ pr_debug("abyAKMSSAuthType[%d]: %X\n",
+ j-1,
+ pBSSNode->abyAKMSSAuthType[j-1]);
} else
break;
}
pBSSNode->wAKMSSAuthCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
+ pr_debug("wAKMSSAuthCount: %d\n",
+ pBSSNode->wAKMSSAuthCount);
n = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
if (pRSN->len >= 12 + 4 * m + 4 * n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2)
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index 5f454ca2a3bc..37d98f717dc3 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -50,9 +50,6 @@ static const int frequency_list[] = {
};
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
-
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -83,13 +80,13 @@ static void wpadev_setup(struct net_device *dev)
*
*/
-static int wpa_init_wpadev(PSDevice pDevice)
+static int wpa_init_wpadev(struct vnt_private *pDevice)
{
- PSDevice wpadev_priv;
+ struct vnt_private *wpadev_priv;
struct net_device *dev = pDevice->dev;
int ret = 0;
- pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa",
+ pDevice->wpadev = alloc_netdev(sizeof(*wpadev_priv), "vntwpa",
NET_NAME_UNKNOWN, wpadev_setup);
if (pDevice->wpadev == NULL)
return -ENOMEM;
@@ -103,8 +100,7 @@ static int wpa_init_wpadev(PSDevice pDevice)
pDevice->wpadev->mem_end = dev->mem_end;
ret = register_netdev(pDevice->wpadev);
if (ret) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n",
- dev->name);
+ pr_debug("%s: register_netdev(WPA) failed!\n", dev->name);
free_netdev(pDevice->wpadev);
return -1;
}
@@ -115,8 +111,8 @@ static int wpa_init_wpadev(PSDevice pDevice)
return -ENOMEM;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n",
- dev->name, pDevice->wpadev->name);
+ pr_debug("%s: Registered netdev %s for WPA management\n",
+ dev->name, pDevice->wpadev->name);
return 0;
}
@@ -134,7 +130,7 @@ static int wpa_init_wpadev(PSDevice pDevice)
*
*/
-static int wpa_release_wpadev(PSDevice pDevice)
+static int wpa_release_wpadev(struct vnt_private *pDevice)
{
if (pDevice->skb) {
dev_kfree_skb(pDevice->skb);
@@ -142,8 +138,8 @@ static int wpa_release_wpadev(PSDevice pDevice)
}
if (pDevice->wpadev) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
- pDevice->dev->name, pDevice->wpadev->name);
+ pr_debug("%s: Netdevice %s unregistered\n",
+ pDevice->dev->name, pDevice->wpadev->name);
unregister_netdev(pDevice->wpadev);
free_netdev(pDevice->wpadev);
pDevice->wpadev = NULL;
@@ -166,7 +162,7 @@ static int wpa_release_wpadev(PSDevice pDevice)
*
*/
-int wpa_set_wpadev(PSDevice pDevice, int val)
+int wpa_set_wpadev(struct vnt_private *pDevice, int val)
{
if (val)
return wpa_init_wpadev(pDevice);
@@ -188,7 +184,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
*
*/
-int wpa_set_keys(PSDevice pDevice, void *ctx,
+int wpa_set_keys(struct vnt_private *pDevice, void *ctx,
bool fcpfkernel) __must_hold(&pDevice->lock)
{
struct viawget_wpa_param *param = ctx;
@@ -196,7 +192,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
- QWORD KeyRSC;
+ u64 KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int uu, ii;
@@ -206,7 +202,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
param->u.wpa_key.seq_len > MAX_KEY_LEN)
return -EINVAL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d\n", param->u.wpa_key.alg_name);
+ pr_debug("param->u.wpa_key.alg_name = %d\n", param->u.wpa_key.alg_name);
if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
pDevice->bEncryptionEnable = false;
@@ -224,7 +220,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
} else {
spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.key &&
- copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) {
+ copy_from_user(&abyKey[0],
+ (void __user *)param->u.wpa_key.key,
+ param->u.wpa_key.key_len)) {
spin_lock_irq(&pDevice->lock);
return -EINVAL;
}
@@ -262,7 +260,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
} else {
spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.seq &&
- copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) {
+ copy_from_user(&abySeq[0],
+ (void __user *)param->u.wpa_key.seq,
+ param->u.wpa_key.seq_len)) {
spin_lock_irq(&pDevice->lock);
return -EINVAL;
}
@@ -272,15 +272,15 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
if (param->u.wpa_key.seq_len > 0) {
for (ii = 0; ii < param->u.wpa_key.seq_len; ii++) {
if (ii < 4)
- LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
+ KeyRSC |= (u64)(abySeq[ii] << (ii * 8));
else
- HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
+ KeyRSC |= (u64)(abySeq[ii] << ((ii-4) * 8));
}
dwKeyIndex |= 1 << 29;
}
if (param->u.wpa_key.key_index >= MAX_GROUP_KEY) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n");
+ pr_debug("return dwKeyIndex > 3\n");
return -EINVAL;
}
@@ -319,7 +319,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
if ((byKeyDecMode == KEY_CTL_TKIP) &&
(param->u.wpa_key.key_len != MAX_KEY_LEN)) {
// TKIP Key must be 256 bits
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return- TKIP Key must be 256 bits!\n");
+ pr_debug("return- TKIP Key must be 256 bits!\n");
return -EINVAL;
}
// Check AES key length
@@ -332,12 +332,12 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
// spin_lock_irq(&pDevice->lock);
if (is_broadcast_ether_addr(&param->addr[0]) || (param->addr == NULL)) {
// If is_broadcast_ether_addr, set the key as every key entry's group key.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n");
+ pr_debug("Groupe Key Assign\n");
if (KeybSetAllGroupKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
@@ -345,23 +345,23 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n");
+ pr_debug("GROUP Key Assign\n");
} else {
return -EINVAL;
}
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n");
+ pr_debug("Pairwise Key Assign\n");
// BSSID not 0xffffffffffff
// Pairwise Key can't be WEP
if (byKeyDecMode == KEY_CTL_WEP) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n");
+ pr_debug("Pairwise Key can't be WEP\n");
return -EINVAL;
}
@@ -373,12 +373,12 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
&param->addr[0],
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
+ (u64 *) &KeyRSC,
(unsigned char *)abyKey,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n");
+ pr_debug("Pairwise Key Set\n");
} else {
// Key Table Full
@@ -408,7 +408,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
*
*/
-static int wpa_set_wpa(PSDevice pDevice,
+static int wpa_set_wpa(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -433,7 +433,7 @@ static int wpa_set_wpa(PSDevice pDevice,
*
*/
-static int wpa_set_disassociate(PSDevice pDevice,
+static int wpa_set_disassociate(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -462,7 +462,7 @@ static int wpa_set_disassociate(PSDevice pDevice,
*
*/
-static int wpa_set_scan(PSDevice pDevice,
+static int wpa_set_scan(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
spin_lock_irq(&pDevice->lock);
@@ -487,7 +487,7 @@ static int wpa_set_scan(PSDevice pDevice,
*
*/
-static int wpa_get_bssid(PSDevice pDevice,
+static int wpa_get_bssid(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -511,7 +511,7 @@ static int wpa_get_bssid(PSDevice pDevice,
*
*/
-static int wpa_get_ssid(PSDevice pDevice,
+static int wpa_get_ssid(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -539,7 +539,7 @@ static int wpa_get_ssid(PSDevice pDevice,
*
*/
-static int wpa_get_scan(PSDevice pDevice,
+static int wpa_get_scan(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
struct viawget_scan_result *scan_buf;
@@ -636,7 +636,7 @@ static int wpa_get_scan(PSDevice pDevice,
ret = -EFAULT;
param->u.scan_results.scan_count = count;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count);
+ pr_debug(" param->u.scan_results.scan_count = %d\n", count);
kfree(pBuf);
return ret;
@@ -656,7 +656,7 @@ static int wpa_get_scan(PSDevice pDevice,
*
*/
-static int wpa_set_associate(PSDevice pDevice,
+static int wpa_set_associate(struct vnt_private *pDevice,
struct viawget_wpa_param *param)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -666,12 +666,14 @@ static int wpa_set_associate(PSDevice pDevice,
bool bWepEnabled = false;
// set key type & algorithm
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
+ pr_debug("pairwise_suite = %d\n",
+ param->u.wpa_associate.pairwise_suite);
+ pr_debug("group_suite = %d\n", param->u.wpa_associate.group_suite);
+ pr_debug("key_mgmt_suite = %d\n",
+ param->u.wpa_associate.key_mgmt_suite);
+ pr_debug("auth_alg = %d\n", param->u.wpa_associate.auth_alg);
+ pr_debug("mode = %d\n", param->u.wpa_associate.mode);
+ pr_debug("wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
if (param->u.wpa_associate.wpa_ie_len) {
if (!param->u.wpa_associate.wpa_ie)
@@ -800,7 +802,7 @@ static int wpa_set_associate(PSDevice pDevice,
*
*/
-int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
+int wpa_ioctl(struct vnt_private *pDevice, struct iw_point *p)
{
struct viawget_wpa_param *param;
int ret = 0;
@@ -822,60 +824,60 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) {
case VIAWGET_SET_WPA:
ret = wpa_set_wpa(pDevice, param);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA\n");
+ pr_debug("VIAWGET_SET_WPA\n");
break;
case VIAWGET_SET_KEY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY\n");
+ pr_debug("VIAWGET_SET_KEY\n");
spin_lock_irq(&pDevice->lock);
ret = wpa_set_keys(pDevice, param, false);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_SET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN\n");
+ pr_debug("VIAWGET_SET_SCAN\n");
ret = wpa_set_scan(pDevice, param);
break;
case VIAWGET_GET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n");
+ pr_debug("VIAWGET_GET_SCAN\n");
ret = wpa_get_scan(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_GET_SSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID\n");
+ pr_debug("VIAWGET_GET_SSID\n");
ret = wpa_get_ssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_GET_BSSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID\n");
+ pr_debug("VIAWGET_GET_BSSID\n");
ret = wpa_get_bssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_SET_ASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE\n");
+ pr_debug("VIAWGET_SET_ASSOCIATE\n");
ret = wpa_set_associate(pDevice, param);
break;
case VIAWGET_SET_DISASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE\n");
+ pr_debug("VIAWGET_SET_DISASSOCIATE\n");
ret = wpa_set_disassociate(pDevice, param);
break;
case VIAWGET_SET_DROP_UNENCRYPT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT\n");
+ pr_debug("VIAWGET_SET_DROP_UNENCRYPT\n");
break;
case VIAWGET_SET_DEAUTHENTICATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE\n");
+ pr_debug("VIAWGET_SET_DEAUTHENTICATE\n");
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n",
- param->cmd);
+ pr_debug("wpa_ioctl: unknown cmd=%d\n",
+ param->cmd);
ret = -EOPNOTSUPP;
goto out;
}
diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h
index f7638baf340d..c1b4a7292061 100644
--- a/drivers/staging/vt6655/wpactl.h
+++ b/drivers/staging/vt6655/wpactl.h
@@ -57,8 +57,8 @@ enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE,
/*--------------------- Export Functions --------------------------*/
-int wpa_set_wpadev(PSDevice pDevice, int val);
-int wpa_ioctl(PSDevice pDevice, struct iw_point *p);
-int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel);
+int wpa_set_wpadev(struct vnt_private *, int val);
+int wpa_ioctl(struct vnt_private *, struct iw_point *p);
+int wpa_set_keys(struct vnt_private *, void *ctx, bool fcpfkernel);
#endif // __WPACL_H__
diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c
index 4da3fef139dc..d1171fa3446e 100644
--- a/drivers/staging/vt6655/wroute.c
+++ b/drivers/staging/vt6655/wroute.c
@@ -42,8 +42,6 @@
/*--------------------- Static Classes ----------------------------*/
-/*--------------------- Static Variables --------------------------*/
-static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -62,7 +60,7 @@ static int msglevel = MSG_LEVEL_INFO;
* Return Value: true if packet duplicate; otherwise false
*
*/
-bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData,
+bool ROUTEbRelay(struct vnt_private *pDevice, unsigned char *pbySkbData,
unsigned int uDataLen, unsigned int uNodeIndex)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
@@ -78,8 +76,7 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData,
unsigned char *pbyBSSID;
if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) {
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO "Relay can't allocate TD1..\n");
+ pr_debug("Relay can't allocate TD1..\n");
return false;
}
@@ -102,11 +99,10 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData,
if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID,
GROUP_KEY, &pTransmitKey) == false) {
pTransmitKey = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_DEBUG "KEY is NULL. [%d]\n",
- pDevice->pMgmt->eCurrMode);
+ pr_debug("KEY is NULL. [%d]\n",
+ pDevice->pMgmt->eCurrMode);
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n");
+ pr_debug("Get GTK\n");
}
}
diff --git a/drivers/staging/vt6655/wroute.h b/drivers/staging/vt6655/wroute.h
index 3abc1d36f89d..e59eec955cac 100644
--- a/drivers/staging/vt6655/wroute.h
+++ b/drivers/staging/vt6655/wroute.h
@@ -39,6 +39,7 @@
/*--------------------- Export Functions --------------------------*/
-bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex);
+bool ROUTEbRelay(struct vnt_private *pDevice, unsigned char *pbySkbData,
+ unsigned int uDataLen, unsigned int uNodeIndex);
#endif /* __WROUTE_H__ */
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 2d1ef88808ff..852ebe86a1c1 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -573,7 +573,7 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
- }
+ }
return 0;
}
@@ -1036,6 +1036,7 @@ static int vnt_beacon_xmit(struct vnt_private *priv,
info = IEEE80211_SKB_CB(skb);
if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)mgmt_hdr;
+
hdr->duration_id = 0;
hdr->seq_ctrl = cpu_to_le16(priv->seq_counter << 4);
}
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index cba653292996..88bf518f23eb 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -131,11 +131,10 @@ static void vnt_start_interrupt_urb_complete(struct urb *urb)
}
status = usb_submit_urb(priv->interrupt_urb, GFP_ATOMIC);
- if (status) {
+ if (status)
dev_dbg(&priv->usb->dev, "Submit int URB failed %d\n", status);
- } else {
+ else
priv->int_buf.in_use = true;
- }
}
int vnt_start_interrupt_urb(struct vnt_private *priv)
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 42c14b0b6833..6c38f797d1ab 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -413,9 +413,7 @@ static int crcimage(struct imgchunk *fchunk, unsigned int nfchunks,
break;
}
if (c >= nfchunks) {
- pr_err("Failed to find chunk for "
- "crcrec[%d], addr=0x%06x len=%d , "
- "aborting crc.\n",
+ pr_err("Failed to find chunk for crcrec[%d], addr=0x%06x len=%d , aborting crc.\n",
i, s3crc[i].addr, s3crc[i].len);
return 1;
}
@@ -628,8 +626,8 @@ static int mkpdrlist(struct pda *pda)
}
if (curroff >= (HFA384x_PDA_LEN_MAX / 2)) {
- pr_err("no end record found or invalid lengths in "
- "PDR data, exiting. %x %d\n", curroff, pda->nrec);
+ pr_err("no end record found or invalid lengths in PDR data, exiting. %x %d\n",
+ curroff, pda->nrec);
return 1;
}
if (le16_to_cpu(pda16[curroff + 1]) == HFA384x_PDR_END_OF_PDA) {
@@ -685,8 +683,8 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
j = -1;
}
if (j >= pda->nrec && j != -1) { /* if no matching PDR, fail */
- pr_warn("warning: Failed to find PDR for "
- "plugrec 0x%04x.\n", s3plug[i].itemcode);
+ pr_warn("warning: Failed to find PDR for plugrec 0x%04x.\n",
+ s3plug[i].itemcode);
continue; /* and move on to the next PDR */
#if 0
/* MSM: They swear that unless it's the MAC address,
@@ -703,8 +701,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
/* Validate plug len against PDR len */
if (j != -1 && s3plug[i].len < le16_to_cpu(pda->rec[j]->len)) {
- pr_err("error: Plug vs. PDR len mismatch for "
- "plugrec 0x%04x, abort plugging.\n",
+ pr_err("error: Plug vs. PDR len mismatch for plugrec 0x%04x, abort plugging.\n",
s3plug[i].itemcode);
result = 1;
continue;
@@ -718,8 +715,8 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
break;
}
if (c >= nfchunks) {
- pr_err("error: Failed to find image chunk for "
- "plugrec 0x%04x.\n", s3plug[i].itemcode);
+ pr_err("error: Failed to find image chunk for plugrec 0x%04x.\n",
+ s3plug[i].itemcode);
result = 1;
continue;
}
@@ -727,8 +724,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
/* Plug data */
chunkoff = pstart - cstart;
dest = fchunk[c].data + chunkoff;
- pr_debug("Plugging item 0x%04x @ 0x%06x, len=%d, "
- "cnum=%d coff=0x%06x\n",
+ pr_debug("Plugging item 0x%04x @ 0x%06x, len=%d, cnum=%d coff=0x%06x\n",
s3plug[i].itemcode, pstart, s3plug[i].len,
c, chunkoff);
@@ -764,30 +760,35 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks,
static int read_cardpda(struct pda *pda, wlandevice_t *wlandev)
{
int result = 0;
- struct p80211msg_p2req_readpda msg;
+ struct p80211msg_p2req_readpda *msg;
+
+ msg = kzalloc(sizeof(*msg), GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
/* set up the msg */
- msg.msgcode = DIDmsg_p2req_readpda;
- msg.msglen = sizeof(msg);
- strcpy(msg.devname, wlandev->name);
- msg.pda.did = DIDmsg_p2req_readpda_pda;
- msg.pda.len = HFA384x_PDA_LEN_MAX;
- msg.pda.status = P80211ENUM_msgitem_status_no_value;
- msg.resultcode.did = DIDmsg_p2req_readpda_resultcode;
- msg.resultcode.len = sizeof(u32);
- msg.resultcode.status = P80211ENUM_msgitem_status_no_value;
-
- if (prism2mgmt_readpda(wlandev, &msg) != 0) {
+ msg->msgcode = DIDmsg_p2req_readpda;
+ msg->msglen = sizeof(msg);
+ strcpy(msg->devname, wlandev->name);
+ msg->pda.did = DIDmsg_p2req_readpda_pda;
+ msg->pda.len = HFA384x_PDA_LEN_MAX;
+ msg->pda.status = P80211ENUM_msgitem_status_no_value;
+ msg->resultcode.did = DIDmsg_p2req_readpda_resultcode;
+ msg->resultcode.len = sizeof(u32);
+ msg->resultcode.status = P80211ENUM_msgitem_status_no_value;
+
+ if (prism2mgmt_readpda(wlandev, msg) != 0) {
/* prism2mgmt_readpda prints an errno if appropriate */
result = -1;
- } else if (msg.resultcode.data == P80211ENUM_resultcode_success) {
- memcpy(pda->buf, msg.pda.data, HFA384x_PDA_LEN_MAX);
+ } else if (msg->resultcode.data == P80211ENUM_resultcode_success) {
+ memcpy(pda->buf, msg->pda.data, HFA384x_PDA_LEN_MAX);
result = mkpdrlist(pda);
} else {
/* resultcode must've been something other than success */
result = -1;
}
+ kfree(msg);
return result;
}
@@ -876,8 +877,7 @@ static int read_fwfile(const struct ihex_binrec *record)
switch (addr) {
case S3ADDR_START:
startaddr = *ptr32;
- pr_debug(" S7 start addr, record=%d "
- " addr=0x%08x\n",
+ pr_debug(" S7 start addr, record=%d addr=0x%08x\n",
rcnt,
startaddr);
break;
@@ -886,8 +886,7 @@ static int read_fwfile(const struct ihex_binrec *record)
s3plug[ns3plug].addr = *(ptr32 + 1);
s3plug[ns3plug].len = *(ptr32 + 2);
- pr_debug(" S3 plugrec, record=%d "
- "itemcode=0x%08x addr=0x%08x len=%d\n",
+ pr_debug(" S3 plugrec, record=%d itemcode=0x%08x addr=0x%08x len=%d\n",
rcnt,
s3plug[ns3plug].itemcode,
s3plug[ns3plug].addr,
@@ -904,8 +903,7 @@ static int read_fwfile(const struct ihex_binrec *record)
s3crc[ns3crc].len = *(ptr32 + 1);
s3crc[ns3crc].dowrite = *(ptr32 + 2);
- pr_debug(" S3 crcrec, record=%d "
- "addr=0x%08x len=%d write=0x%08x\n",
+ pr_debug(" S3 crcrec, record=%d addr=0x%08x len=%d write=0x%08x\n",
rcnt,
s3crc[ns3crc].addr,
s3crc[ns3crc].len,
@@ -920,8 +918,7 @@ static int read_fwfile(const struct ihex_binrec *record)
s3info[ns3info].len = *ptr16;
s3info[ns3info].type = *(ptr16 + 1);
- pr_debug(" S3 inforec, record=%d "
- "len=0x%04x type=0x%04x\n",
+ pr_debug(" S3 inforec, record=%d len=0x%04x type=0x%04x\n",
rcnt,
s3info[ns3info].len,
s3info[ns3info].type);
@@ -995,8 +992,7 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk,
kfree(rstmsg);
kfree(rwrmsg);
netdev_err(wlandev->netdev,
- "writeimage: no memory for firmware download, "
- "aborting download\n");
+ "writeimage: no memory for firmware download, aborting download\n");
return -ENOMEM;
}
@@ -1040,15 +1036,15 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk,
result = prism2mgmt_ramdl_state(wlandev, rstmsg);
if (result) {
netdev_err(wlandev->netdev,
- "writeimage state enable failed w/ result=%d, "
- "aborting download\n", result);
+ "writeimage state enable failed w/ result=%d, aborting download\n",
+ result);
goto free_result;
}
resultcode = rstmsg->resultcode.data;
if (resultcode != P80211ENUM_resultcode_success) {
netdev_err(wlandev->netdev,
- "writeimage()->xxxdl_state msg indicates failure, "
- "w/ resultcode=%d, aborting download.\n", resultcode);
+ "writeimage()->xxxdl_state msg indicates failure, w/ resultcode=%d, aborting download.\n",
+ resultcode);
result = 1;
goto free_result;
}
@@ -1084,14 +1080,13 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk,
/* Check the results */
if (result) {
netdev_err(wlandev->netdev,
- "writeimage chunk write failed w/ "
- "result=%d, aborting download\n", result);
+ "writeimage chunk write failed w/ result=%d, aborting download\n",
+ result);
goto free_result;
}
resultcode = rstmsg->resultcode.data;
if (resultcode != P80211ENUM_resultcode_success) {
- pr_err("writeimage()->xxxdl_write msg indicates failure, "
- "w/ resultcode=%d, aborting download.\n",
+ pr_err("writeimage()->xxxdl_write msg indicates failure, w/ resultcode=%d, aborting download.\n",
resultcode);
result = 1;
goto free_result;
@@ -1108,15 +1103,15 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk,
result = prism2mgmt_ramdl_state(wlandev, rstmsg);
if (result) {
netdev_err(wlandev->netdev,
- "writeimage state disable failed w/ result=%d, "
- "aborting download\n", result);
+ "writeimage state disable failed w/ result=%d, aborting download\n",
+ result);
goto free_result;
}
resultcode = rstmsg->resultcode.data;
if (resultcode != P80211ENUM_resultcode_success) {
netdev_err(wlandev->netdev,
- "writeimage()->xxxdl_state msg indicates failure, "
- "w/ resultcode=%d, aborting download.\n", resultcode);
+ "writeimage()->xxxdl_state msg indicates failure, w/ resultcode=%d, aborting download.\n",
+ resultcode);
result = 1;
goto free_result;
}
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
index e6a82d3303c1..013a6240f193 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -1107,8 +1107,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
if (wlandev->netdev->type == ARPHRD_ETHER) {
msg->resultcode.data =
P80211ENUM_resultcode_invalid_parameters;
- result = 0;
- goto exit;
+ return 0;
}
/* Disable monitor mode */
result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE);
@@ -1166,9 +1165,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
netdev_info(wlandev->netdev, "monitor mode disabled\n");
msg->resultcode.data = P80211ENUM_resultcode_success;
- result = 0;
- goto exit;
- break;
+ return 0;
case P80211ENUM_truth_true:
/* Disable the port (if enabled), only check Port 0 */
if (hw->port_enabled[0]) {
@@ -1313,19 +1310,13 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
}
msg->resultcode.data = P80211ENUM_resultcode_success;
- result = 0;
- goto exit;
- break;
+ return 0;
default:
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
- result = 0;
- goto exit;
- break;
+ return 0;
}
failed:
msg->resultcode.data = P80211ENUM_resultcode_refused;
- result = 0;
-exit:
- return result;
+ return 0;
}