summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-10-09 08:59:14 +0200
committerJohannes Berg <johannes.berg@intel.com>2024-10-09 08:59:22 +0200
commita0efa2f362a69e47b9d8b48f770ef3a0249a7911 (patch)
tree384d2c79a9b613213ef7591583d820d18c7be9c3 /drivers/staging
parentRevert "wifi: cfg80211: unexport wireless_nlevent_flush()" (diff)
parentnet: phy: microchip_t1: SQI support for LAN887x (diff)
downloadlinux-a0efa2f362a69e47b9d8b48f770ef3a0249a7911.tar.xz
linux-a0efa2f362a69e47b9d8b48f770ef3a0249a7911.zip
Merge net-next/main to resolve conflicts
The wireless-next tree was based on something older, and there are now conflicts between -rc2 and work here. Merge net-next, which has enough of -rc2 for the conflicts to happen, resolving them in the process. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/fbtft/fb_ili9320.c2
-rw-r--r--drivers/staging/fbtft/fb_ra8875.c7
-rw-r--r--drivers/staging/fbtft/fb_sh1106.c3
-rw-r--r--drivers/staging/fbtft/fb_ssd1289.c3
-rw-r--r--drivers/staging/fbtft/fb_ssd1306.c3
-rw-r--r--drivers/staging/fbtft/fb_ssd1325.c9
-rw-r--r--drivers/staging/fbtft/fb_ssd1331.c2
-rw-r--r--drivers/staging/fbtft/fb_ssd1351.c5
-rw-r--r--drivers/staging/fbtft/fb_uc1611.c3
-rw-r--r--drivers/staging/fbtft/fbtft-bus.c9
-rw-r--r--drivers/staging/fbtft/fbtft-core.c13
-rw-r--r--drivers/staging/fbtft/fbtft-sysfs.c4
-rw-r--r--drivers/staging/fbtft/fbtft.h2
-rw-r--r--drivers/staging/greybus/gb-camera.h4
-rw-r--r--drivers/staging/greybus/spilib.c6
-rw-r--r--drivers/staging/iio/impedance-analyzer/ad5933.c5
-rw-r--r--drivers/staging/ks7010/Kconfig14
-rw-r--r--drivers/staging/ks7010/Makefile4
-rw-r--r--drivers/staging/ks7010/TODO34
-rw-r--r--drivers/staging/ks7010/eap_packet.h70
-rw-r--r--drivers/staging/ks7010/ks7010_sdio.c1143
-rw-r--r--drivers/staging/ks7010/ks_hostif.c2312
-rw-r--r--drivers/staging/ks7010/ks_hostif.h617
-rw-r--r--drivers/staging/ks7010/ks_wlan.h567
-rw-r--r--drivers/staging/ks7010/ks_wlan_ioctl.h61
-rw-r--r--drivers/staging/ks7010/ks_wlan_net.c2676
-rw-r--r--drivers/staging/media/atomisp/include/linux/atomisp.h4
-rw-r--r--drivers/staging/media/atomisp/include/linux/atomisp_platform.h6
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c2
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_fops.c2
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_subdev.c2
-rw-r--r--drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem_local.h4
-rw-r--r--drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h6
-rw-r--r--drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h4
-rw-r--r--drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h6
-rw-r--r--drivers/staging/media/atomisp/pci/hmm/hmm.c5
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c3
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c3
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c22
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8_param.h4
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c3
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c9
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c9
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c3
-rw-r--r--drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c12
-rw-r--r--drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c259
-rw-r--r--drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c8
-rw-r--r--drivers/staging/media/atomisp/pci/sh_css.c44
-rw-r--r--drivers/staging/media/atomisp/pci/sh_css_dvs_info.h37
-rw-r--r--drivers/staging/media/atomisp/pci/sh_css_param_dvs.h1
-rw-r--r--drivers/staging/media/av7110/av7110.c2
-rw-r--r--drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c10
-rw-r--r--drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c10
-rw-r--r--drivers/staging/media/ipu3/ipu3-v4l2.c40
-rw-r--r--drivers/staging/media/meson/vdec/vdec.c2
-rw-r--r--drivers/staging/media/meson/vdec/vdec_1.c16
-rw-r--r--drivers/staging/media/meson/vdec/vdec_hevc.c43
-rw-r--r--drivers/staging/media/meson/vdec/vdec_platform.c44
-rw-r--r--drivers/staging/media/meson/vdec/vdec_platform.h2
-rw-r--r--drivers/staging/media/starfive/camss/stf-camss.c2
-rw-r--r--drivers/staging/media/starfive/camss/stf-capture.c4
-rw-r--r--drivers/staging/most/video/video.c6
-rw-r--r--drivers/staging/nvec/nvec.c17
-rw-r--r--drivers/staging/olpc_dcon/olpc_dcon.c2
-rw-r--r--drivers/staging/rtl8712/rtl8712_recv.c4
-rw-r--r--drivers/staging/rtl8712/rtl871x_cmd.c5
-rw-r--r--drivers/staging/rtl8712/rtl871x_cmd.h2
-rw-r--r--drivers/staging/rtl8712/rtl871x_io.c4
-rw-r--r--drivers/staging/rtl8712/usb_ops_linux.c2
-rw-r--r--drivers/staging/rtl8723bs/Kconfig1
-rw-r--r--drivers/staging/rtl8723bs/Makefile2
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_ap.c7
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_btcoex.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_cmd.c4
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_debug.c68
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_efuse.c60
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_ieee80211.c7
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_io.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_ioctl_set.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_mlme.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_mlme_ext.c9
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_pwrctrl.c3
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_recv.c8
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_rf.c34
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_security.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_sta_mgt.c1
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_wlan_util.c3
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_xmit.c3
-rw-r--r--drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_btcoex.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_com.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_com_phycfg.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_intf.c7
-rw-r--r--drivers/staging/rtl8723bs/hal/hal_sdio.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723b_dm.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c1
-rw-r--r--drivers/staging/rtl8723bs/hal/sdio_halinit.c5
-rw-r--r--drivers/staging/rtl8723bs/hal/sdio_ops.c1
-rw-r--r--drivers/staging/rtl8723bs/include/drv_types.h7
-rw-r--r--drivers/staging/rtl8723bs/include/hal_intf.h1
-rw-r--r--drivers/staging/rtl8723bs/include/hal_pwr_seq.h2
-rw-r--r--drivers/staging/rtl8723bs/include/osdep_service.h4
-rw-r--r--drivers/staging/rtl8723bs/include/osdep_service_linux.h72
-rw-r--r--drivers/staging/rtl8723bs/include/rtl8723b_hal.h2
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_cmd.h4
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_debug.h14
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_event.h2
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_io.h2
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_mlme.h2
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_mlme_ext.h6
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_recv.h10
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_rf.h2
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_security.h127
-rw-r--r--drivers/staging/rtl8723bs/include/rtw_xmit.h2
-rw-r--r--drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/ioctl_linux.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/mlme_linux.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/os_intfs.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/osdep_service.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/recv_linux.c3
-rw-r--r--drivers/staging/rtl8723bs/os_dep/sdio_intf.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/wifi_regd.c1
-rw-r--r--drivers/staging/rtl8723bs/os_dep/xmit_linux.c4
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c20
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c323
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h16
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c15
-rw-r--r--drivers/staging/vme_user/vme.c10
-rw-r--r--drivers/staging/vme_user/vme.h17
-rw-r--r--drivers/staging/vme_user/vme_fake.c10
-rw-r--r--drivers/staging/vme_user/vme_tsi148.c155
-rw-r--r--drivers/staging/vt6655/TODO2
-rw-r--r--drivers/staging/vt6655/card.c12
-rw-r--r--drivers/staging/vt6655/card.h4
-rw-r--r--drivers/staging/vt6655/device.h12
-rw-r--r--drivers/staging/vt6655/device_main.c34
-rw-r--r--drivers/staging/vt6655/mac.h4
-rw-r--r--drivers/staging/vt6655/rxtx.c14
146 files changed, 860 insertions, 8558 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 3f46446a84fa..fcdd559a8acf 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -52,8 +52,6 @@ source "drivers/staging/fbtft/Kconfig"
source "drivers/staging/most/Kconfig"
-source "drivers/staging/ks7010/Kconfig"
-
source "drivers/staging/greybus/Kconfig"
source "drivers/staging/vc04_services/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 5f32a5d1957b..4a84c4848664 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_MFD_NVEC) += nvec/
obj-$(CONFIG_LTE_GDM724X) += gdm724x/
obj-$(CONFIG_FB_TFT) += fbtft/
obj-$(CONFIG_MOST) += most/
-obj-$(CONFIG_KS7010) += ks7010/
obj-$(CONFIG_GREYBUS) += greybus/
obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/
obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/
diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c
index 0be7c2d51548..050fc2367c12 100644
--- a/drivers/staging/fbtft/fb_ili9320.c
+++ b/drivers/staging/fbtft/fb_ili9320.c
@@ -35,8 +35,6 @@ static int init_display(struct fbtft_par *par)
par->fbtftops.reset(par);
devcode = read_devicecode(par);
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "Device code: 0x%04X\n",
- devcode);
if ((devcode != 0x0000) && (devcode != 0x9320))
dev_warn(par->info->device,
"Unrecognized Device code: 0x%04X (expected 0x9320)\n",
diff --git a/drivers/staging/fbtft/fb_ra8875.c b/drivers/staging/fbtft/fb_ra8875.c
index 398bdbf53c9a..0ab1de6647d0 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -41,13 +41,6 @@ static int init_display(struct fbtft_par *par)
{
gpiod_set_value(par->gpio.dc, 1);
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
- "%s()\n", __func__);
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
- "display size %dx%d\n",
- par->info->var.xres,
- par->info->var.yres);
-
par->fbtftops.reset(par);
if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) {
diff --git a/drivers/staging/fbtft/fb_sh1106.c b/drivers/staging/fbtft/fb_sh1106.c
index 9685ca516a0e..e4c50c1ffed0 100644
--- a/drivers/staging/fbtft/fb_sh1106.c
+++ b/drivers/staging/fbtft/fb_sh1106.c
@@ -88,9 +88,6 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
static int blank(struct fbtft_par *par, bool on)
{
- fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
- __func__, on ? "true" : "false");
-
write_reg(par, on ? 0xAE : 0xAF);
return 0;
diff --git a/drivers/staging/fbtft/fb_ssd1289.c b/drivers/staging/fbtft/fb_ssd1289.c
index f27bab38b3ec..255a6d21ca8e 100644
--- a/drivers/staging/fbtft/fb_ssd1289.c
+++ b/drivers/staging/fbtft/fb_ssd1289.c
@@ -93,9 +93,6 @@ static int set_var(struct fbtft_par *par)
{
if (par->fbtftops.init_display != init_display) {
/* don't risk messing up register 11h */
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
- "%s: skipping since custom init_display() is used\n",
- __func__);
return 0;
}
diff --git a/drivers/staging/fbtft/fb_ssd1306.c b/drivers/staging/fbtft/fb_ssd1306.c
index 6cf9df579e88..478d710469b9 100644
--- a/drivers/staging/fbtft/fb_ssd1306.c
+++ b/drivers/staging/fbtft/fb_ssd1306.c
@@ -148,9 +148,6 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
static int blank(struct fbtft_par *par, bool on)
{
- fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
- __func__, on ? "true" : "false");
-
if (on)
write_reg(par, 0xAE);
else
diff --git a/drivers/staging/fbtft/fb_ssd1325.c b/drivers/staging/fbtft/fb_ssd1325.c
index 796a2ac3e194..256b0b87a930 100644
--- a/drivers/staging/fbtft/fb_ssd1325.c
+++ b/drivers/staging/fbtft/fb_ssd1325.c
@@ -72,10 +72,6 @@ static uint8_t rgb565_to_g16(u16 pixel)
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
- fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
- "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe,
- ye);
-
write_reg(par, 0x75);
write_reg(par, 0x00);
write_reg(par, 0x3f);
@@ -86,9 +82,6 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
static int blank(struct fbtft_par *par, bool on)
{
- fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
- __func__, on ? "true" : "false");
-
if (on)
write_reg(par, 0xAE);
else
@@ -109,8 +102,6 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
{
int i;
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);
-
for (i = 0; i < GAMMA_LEN; i++) {
if (i > 0 && curves[i] < 1) {
dev_err(par->info->device,
diff --git a/drivers/staging/fbtft/fb_ssd1331.c b/drivers/staging/fbtft/fb_ssd1331.c
index ec5eced7f8cb..06b7056d6c71 100644
--- a/drivers/staging/fbtft/fb_ssd1331.c
+++ b/drivers/staging/fbtft/fb_ssd1331.c
@@ -167,8 +167,6 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
static int blank(struct fbtft_par *par, bool on)
{
- fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
- __func__, on ? "true" : "false");
if (on)
write_reg(par, 0xAE);
else
diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c
index ca2cba2185ae..f6db2933ebba 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -72,9 +72,6 @@ static int set_var(struct fbtft_par *par)
if (par->fbtftops.init_display != init_display) {
/* don't risk messing up register A0h */
- fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
- "%s: skipping since custom init_display() is used\n",
- __func__);
return 0;
}
@@ -213,7 +210,7 @@ static void register_onboard_backlight(struct fbtft_par *par)
struct backlight_properties bl_props = { 0, };
bl_props.type = BACKLIGHT_RAW;
- bl_props.power = FB_BLANK_POWERDOWN;
+ bl_props.power = BACKLIGHT_POWER_OFF;
bd = backlight_device_register(dev_driver_string(par->info->device),
par->info->device, par, &bl_ops,
diff --git a/drivers/staging/fbtft/fb_uc1611.c b/drivers/staging/fbtft/fb_uc1611.c
index f61e373c75e9..ca35b386a12d 100644
--- a/drivers/staging/fbtft/fb_uc1611.c
+++ b/drivers/staging/fbtft/fb_uc1611.c
@@ -135,9 +135,6 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
static int blank(struct fbtft_par *par, bool on)
{
- fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
- __func__, on ? "true" : "false");
-
if (on)
write_reg(par, 0xA8 | 0x00);
else
diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 3d422bc11641..30e436ff19e4 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -129,9 +129,6 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
int ret = 0;
size_t startbyte_size = 0;
- fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n",
- __func__, offset, len);
-
remain = len / 2;
vmem16 = (u16 *)(par->info->screen_buffer + offset);
@@ -182,9 +179,6 @@ int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len)
int i;
int ret = 0;
- fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n",
- __func__, offset, len);
-
if (!par->txbuf.buf) {
dev_err(par->info->device, "%s: txbuf.buf is NULL\n", __func__);
return -1;
@@ -232,9 +226,6 @@ int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len)
{
u16 *vmem16;
- fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n",
- __func__, offset, len);
-
vmem16 = (u16 *)(par->info->screen_buffer + offset);
/* no need for buffered write with 16-bit bus */
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 8e2fd0c0fee2..4cfa494243b9 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -152,7 +152,7 @@ static int fbtft_backlight_get_brightness(struct backlight_device *bd)
void fbtft_unregister_backlight(struct fbtft_par *par)
{
if (par->info->bl_dev) {
- par->info->bl_dev->props.power = FB_BLANK_POWERDOWN;
+ par->info->bl_dev->props.power = BACKLIGHT_POWER_OFF;
backlight_update_status(par->info->bl_dev);
backlight_device_unregister(par->info->bl_dev);
par->info->bl_dev = NULL;
@@ -178,7 +178,7 @@ void fbtft_register_backlight(struct fbtft_par *par)
bl_props.type = BACKLIGHT_RAW;
/* Assume backlight is off, get polarity from current state of pin */
- bl_props.power = FB_BLANK_POWERDOWN;
+ bl_props.power = BACKLIGHT_POWER_OFF;
if (!gpiod_get_value(par->gpio.led[0]))
par->polarity = true;
@@ -215,8 +215,6 @@ static void fbtft_reset(struct fbtft_par *par)
if (!par->gpio.reset)
return;
- fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
-
gpiod_set_value_cansleep(par->gpio.reset, 1);
usleep_range(20, 40);
gpiod_set_value_cansleep(par->gpio.reset, 0);
@@ -801,7 +799,7 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
/* Turn on backlight if available */
if (fb_info->bl_dev) {
- fb_info->bl_dev->props.power = FB_BLANK_UNBLANK;
+ fb_info->bl_dev->props.power = BACKLIGHT_POWER_ON;
fb_info->bl_dev->ops->update_status(fb_info->bl_dev);
}
@@ -1052,8 +1050,6 @@ static int fbtft_verify_gpios(struct fbtft_par *par)
struct fbtft_platform_data *pdata = par->pdata;
int i;
- fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
-
if (pdata->display.buswidth != 9 && par->startbyte == 0 &&
!par->gpio.dc) {
dev_err(par->info->device,
@@ -1157,9 +1153,6 @@ int fbtft_probe_common(struct fbtft_display *display,
else
dev = &pdev->dev;
- if (unlikely(display->debug & DEBUG_DRIVER_INIT_FUNCTIONS))
- dev_info(dev, "%s()\n", __func__);
-
pdata = dev->platform_data;
if (!pdata) {
pdata = fbtft_properties_read(dev);
diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index 39e8d28066cb..e45c90a03a90 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -27,13 +27,9 @@ int fbtft_gamma_parse_str(struct fbtft_par *par, u32 *curves,
int curve_counter, value_counter;
int _count;
- fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__);
-
if (!str || !curves)
return -EINVAL;
- fbtft_par_dbg(DEBUG_SYSFS, par, "%s\n", str);
-
tmp = kmemdup(str, size + 1, GFP_KERNEL);
if (!tmp)
return -ENOMEM;
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index f86ed9d470b8..3e00a26a29d5 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -202,6 +202,7 @@ struct fbtft_par {
u8 *buf;
u8 startbyte;
struct fbtft_ops fbtftops;
+ /* Spinlock to ensure thread-safe access to dirty_lines_start and dirty_lines_end */
spinlock_t dirty_lock;
unsigned int dirty_lines_start;
unsigned int dirty_lines_end;
@@ -218,6 +219,7 @@ struct fbtft_par {
} gpio;
const s16 *init_sequence;
struct {
+ /* Mutex to synchronize access to gamma curve locking */
struct mutex lock;
u32 *curves;
int num_values;
diff --git a/drivers/staging/greybus/gb-camera.h b/drivers/staging/greybus/gb-camera.h
index 5fc469101fc1..3e09147435a5 100644
--- a/drivers/staging/greybus/gb-camera.h
+++ b/drivers/staging/greybus/gb-camera.h
@@ -92,8 +92,8 @@ struct gb_camera_ops {
unsigned int *flags, struct gb_camera_stream *streams,
struct gb_camera_csi_params *csi_params);
int (*capture)(void *priv, u32 request_id,
- unsigned int streams, unsigned int num_frames,
- size_t settings_size, const void *settings);
+ unsigned int streams, unsigned int num_frames,
+ size_t settings_size, const void *settings);
int (*flush)(void *priv, u32 *request_id);
};
diff --git a/drivers/staging/greybus/spilib.c b/drivers/staging/greybus/spilib.c
index 0e4ae01eb00f..24e9c909fa02 100644
--- a/drivers/staging/greybus/spilib.c
+++ b/drivers/staging/greybus/spilib.c
@@ -490,10 +490,10 @@ int gb_spilib_master_init(struct gb_connection *connection, struct device *dev,
int ret;
u8 i;
- /* Allocate master with space for data */
- ctlr = spi_alloc_master(dev, sizeof(*spi));
+ /* Allocate host with space for data */
+ ctlr = spi_alloc_host(dev, sizeof(*spi));
if (!ctlr) {
- dev_err(dev, "cannot alloc SPI master\n");
+ dev_err(dev, "cannot alloc SPI host\n");
return -ENOMEM;
}
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index cd00d9607565..4ae1a7039418 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -547,7 +547,8 @@ static int ad5933_ring_preenable(struct iio_dev *indio_dev)
struct ad5933_state *st = iio_priv(indio_dev);
int ret;
- if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength))
+ if (bitmap_empty(indio_dev->active_scan_mask,
+ iio_get_masklength(indio_dev)))
return -EINVAL;
ret = ad5933_reset(st);
@@ -625,7 +626,7 @@ static void ad5933_work(struct work_struct *work)
if (status & AD5933_STAT_DATA_VALID) {
int scan_count = bitmap_weight(indio_dev->active_scan_mask,
- indio_dev->masklength);
+ iio_get_masklength(indio_dev));
ret = ad5933_i2c_read(st->client,
test_bit(1, indio_dev->active_scan_mask) ?
AD5933_REG_REAL_DATA : AD5933_REG_IMAG_DATA,
diff --git a/drivers/staging/ks7010/Kconfig b/drivers/staging/ks7010/Kconfig
deleted file mode 100644
index 8ea6c0928679..000000000000
--- a/drivers/staging/ks7010/Kconfig
+++ /dev/null
@@ -1,14 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config KS7010
- tristate "KeyStream KS7010 SDIO support"
- depends on MMC && WIRELESS
- select WIRELESS_EXT
- select WEXT_PRIV
- select FW_LOADER
- select CRYPTO
- select CRYPTO_HASH
- select CRYPTO_MICHAEL_MIC
- help
- This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is
- found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
- sadly not FCC-ID "S2Y-WLAN-11B-G") and Spectec SDW-823 microSD cards.
diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile
deleted file mode 100644
index 009851a32310..000000000000
--- a/drivers/staging/ks7010/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_KS7010) += ks7010.o
-
-ks7010-y := ks_hostif.o ks_wlan_net.o ks7010_sdio.o
diff --git a/drivers/staging/ks7010/TODO b/drivers/staging/ks7010/TODO
deleted file mode 100644
index 8ad05b6e3947..000000000000
--- a/drivers/staging/ks7010/TODO
+++ /dev/null
@@ -1,34 +0,0 @@
-KS7010 Linux driver
-===================
-
-This driver is based on source code from the Ben Nanonote extra repository [1]
-which is based on the original v007 release from Renesas [2]. Some more
-background info about the chipset can be found here [3] and here [4]. Thank
-you to all which already participated in cleaning up the driver so far!
-
-[1] http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/tree/master/ks7010/src
-[2] http://downloads.qi-hardware.com/software/ks7010_sdio_v007.tar.bz2
-[3] http://en.qi-hardware.com/wiki/Ben_NanoNote_Wi-Fi
-[4] https://wikidevi.com/wiki/Renesas
-
-TODO
-----
-
-First a few words what not to do (at least not blindly):
-
-- don't be overly strict with the 80 char limit. Only if it REALLY makes the
- code more readable
-
-Now the TODOs:
-
-- fix codechecker warnings (checkpatch, sparse, smatch). But PLEASE make sure
- that you are not only silencing the warning but really fixing code. You
- should understand the change you submit.
-- fix the 'card removal' event when card is inserted when booting
-- check what other upstream wireless mechanisms can be used instead of the
- custom ones here
-- Switch to use MAC80211.
-
-Please send any patches to:
-Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Linux Driver Project Developer List <driverdev-devel@linuxdriverproject.org>
diff --git a/drivers/staging/ks7010/eap_packet.h b/drivers/staging/ks7010/eap_packet.h
deleted file mode 100644
index 1eee774319ad..000000000000
--- a/drivers/staging/ks7010/eap_packet.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef EAP_PACKET_H
-#define EAP_PACKET_H
-
-#include <linux/compiler.h>
-#include <linux/bitops.h>
-#include <uapi/linux/if_ether.h>
-
-struct ether_hdr {
- unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
- unsigned char h_source[ETH_ALEN]; /* source ether addr */
- unsigned char h_dest_snap;
- unsigned char h_source_snap;
- unsigned char h_command;
- unsigned char h_vendor_id[3];
- __be16 h_proto; /* packet type ID field */
- /* followed by length octets of data */
-} __packed;
-
-#define ETHER_HDR_SIZE sizeof(struct ether_hdr)
-
-struct ieee802_1x_hdr {
- unsigned char version;
- unsigned char type;
- unsigned short length;
- /* followed by length octets of data */
-} __packed;
-
-enum {
- IEEE802_1X_TYPE_EAP_PACKET = 0,
- IEEE802_1X_TYPE_EAPOL_START = 1,
- IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
- IEEE802_1X_TYPE_EAPOL_KEY = 3,
- IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
-};
-
-#define WPA_NONCE_LEN 32
-#define WPA_REPLAY_COUNTER_LEN 8
-
-struct wpa_eapol_key {
- unsigned char type;
- __be16 key_info;
- unsigned short key_length;
- unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN];
- unsigned char key_nonce[WPA_NONCE_LEN];
- unsigned char key_iv[16];
- unsigned char key_rsc[8];
- unsigned char key_id[8]; /* Reserved in IEEE 802.11i/RSN */
- unsigned char key_mic[16];
- unsigned short key_data_length;
- /* followed by key_data_length bytes of key_data */
-} __packed;
-
-#define WPA_KEY_INFO_TYPE_MASK GENMASK(2, 0)
-#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 BIT(0)
-#define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES BIT(1)
-#define WPA_KEY_INFO_KEY_TYPE BIT(3) /* 1 = Pairwise, 0 = Group key */
-/* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */
-#define WPA_KEY_INFO_KEY_INDEX_MASK GENMASK(5, 4)
-#define WPA_KEY_INFO_KEY_INDEX_SHIFT 4
-#define WPA_KEY_INFO_INSTALL BIT(6) /* pairwise */
-#define WPA_KEY_INFO_TXRX BIT(6) /* group */
-#define WPA_KEY_INFO_ACK BIT(7)
-#define WPA_KEY_INFO_MIC BIT(8)
-#define WPA_KEY_INFO_SECURE BIT(9)
-#define WPA_KEY_INFO_ERROR BIT(10)
-#define WPA_KEY_INFO_REQUEST BIT(11)
-#define WPA_KEY_INFO_ENCR_KEY_DATA BIT(12) /* IEEE 802.11i/RSN only */
-
-#endif /* EAP_PACKET_H */
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
deleted file mode 100644
index 8df0e77b57f6..000000000000
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ /dev/null
@@ -1,1143 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Driver for KeyStream, KS7010 based SDIO cards.
- *
- * Copyright (C) 2006-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- * Copyright (C) 2016 Sang Engineering, Wolfram Sang
- */
-
-#include <linux/atomic.h>
-#include <linux/firmware.h>
-#include <linux/jiffies.h>
-#include <linux/mmc/card.h>
-#include <linux/mmc/sdio_func.h>
-#include <linux/module.h>
-#include <linux/workqueue.h>
-#include "ks_wlan.h"
-#include "ks_hostif.h"
-
-#define ROM_FILE "ks7010sd.rom"
-
-/* SDIO KeyStream vendor and device */
-#define SDIO_VENDOR_ID_KS_CODE_A 0x005b
-#define SDIO_VENDOR_ID_KS_CODE_B 0x0023
-
-/* Older sources suggest earlier versions were named 7910 or 79xx */
-#define SDIO_DEVICE_ID_KS_7010 0x7910
-
-/* Read/Write Status Register */
-#define READ_STATUS_REG 0x000000
-#define WRITE_STATUS_REG 0x00000C
-enum reg_status_type {
- REG_STATUS_BUSY,
- REG_STATUS_IDLE
-};
-
-/* Read Index Register */
-#define READ_INDEX_REG 0x000004
-
-/* Read Data Size Register */
-#define READ_DATA_SIZE_REG 0x000008
-
-/* Write Index Register */
-#define WRITE_INDEX_REG 0x000010
-
-/*
- * Write Status/Read Data Size Register
- * for network packet (less than 2048 bytes data)
- */
-#define WSTATUS_RSIZE_REG 0x000014
-
-/* Write Status Register value */
-#define WSTATUS_MASK 0x80
-
-/* Read Data Size Register value [10:4] */
-#define RSIZE_MASK 0x7F
-
-/* ARM to SD interrupt Enable */
-#define INT_ENABLE_REG 0x000020
-/* ARM to SD interrupt Pending */
-#define INT_PENDING_REG 0x000024
-
-#define INT_GCR_B BIT(7)
-#define INT_GCR_A BIT(6)
-#define INT_WRITE_STATUS BIT(5)
-#define INT_WRITE_INDEX BIT(4)
-#define INT_WRITE_SIZE BIT(3)
-#define INT_READ_STATUS BIT(2)
-#define INT_READ_INDEX BIT(1)
-#define INT_READ_SIZE BIT(0)
-
-/* General Communication Register A */
-#define GCR_A_REG 0x000028
-enum gen_com_reg_a {
- GCR_A_INIT,
- GCR_A_REMAP,
- GCR_A_RUN
-};
-
-/* General Communication Register B */
-#define GCR_B_REG 0x00002C
-enum gen_com_reg_b {
- GCR_B_ACTIVE,
- GCR_B_DOZE
-};
-
-/* Wakeup Register */
-#define WAKEUP_REG 0x008018
-#define WAKEUP_REQ 0x5a
-
-/* AHB Data Window 0x010000-0x01FFFF */
-#define DATA_WINDOW 0x010000
-#define WINDOW_SIZE (64 * 1024)
-
-#define KS7010_IRAM_ADDRESS 0x06000000
-
-#define KS7010_IO_BLOCK_SIZE 512
-
-/**
- * struct ks_sdio_card - SDIO device data.
- *
- * Structure is used as the &struct sdio_func private data.
- *
- * @func: Pointer to the SDIO function device.
- * @priv: Pointer to the &struct net_device private data.
- */
-struct ks_sdio_card {
- struct sdio_func *func;
- struct ks_wlan_private *priv;
-};
-
-static struct sdio_func *ks7010_to_func(struct ks_wlan_private *priv)
-{
- struct ks_sdio_card *ks_sdio = priv->if_hw;
-
- return ks_sdio->func;
-}
-
-/* Read single byte from device address into byte (CMD52) */
-static int ks7010_sdio_readb(struct ks_wlan_private *priv,
- u32 address, u8 *byte)
-{
- struct sdio_func *func = ks7010_to_func(priv);
- int ret;
-
- *byte = sdio_readb(func, address, &ret);
-
- return ret;
-}
-
-/* Read length bytes from device address into buffer (CMD53) */
-static int ks7010_sdio_read(struct ks_wlan_private *priv, u32 address,
- u8 *buffer, unsigned int length)
-{
- struct sdio_func *func = ks7010_to_func(priv);
-
- return sdio_memcpy_fromio(func, buffer, address, length);
-}
-
-/* Write single byte to device address (CMD52) */
-static int ks7010_sdio_writeb(struct ks_wlan_private *priv,
- u32 address, u8 byte)
-{
- struct sdio_func *func = ks7010_to_func(priv);
- int ret;
-
- sdio_writeb(func, byte, address, &ret);
-
- return ret;
-}
-
-/* Write length bytes to device address from buffer (CMD53) */
-static int ks7010_sdio_write(struct ks_wlan_private *priv, u32 address,
- u8 *buffer, unsigned int length)
-{
- struct sdio_func *func = ks7010_to_func(priv);
-
- return sdio_memcpy_toio(func, address, buffer, length);
-}
-
-static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
-{
- int ret;
-
- /* clear request */
- atomic_set(&priv->sleepstatus.doze_request, 0);
-
- if (atomic_read(&priv->sleepstatus.status) == 0) {
- ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE);
- if (ret) {
- netdev_err(priv->net_dev, "write GCR_B_REG\n");
- goto set_sleep_mode;
- }
- atomic_set(&priv->sleepstatus.status, 1);
- priv->last_doze = jiffies;
- }
-
-set_sleep_mode:
- priv->sleep_mode = atomic_read(&priv->sleepstatus.status);
-}
-
-static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
-{
- int ret;
-
- /* clear request */
- atomic_set(&priv->sleepstatus.wakeup_request, 0);
-
- if (atomic_read(&priv->sleepstatus.status) == 1) {
- ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
- if (ret) {
- netdev_err(priv->net_dev, "write WAKEUP_REG\n");
- goto set_sleep_mode;
- }
- atomic_set(&priv->sleepstatus.status, 0);
- priv->last_wakeup = jiffies;
- ++priv->wakeup_count;
- }
-
-set_sleep_mode:
- priv->sleep_mode = atomic_read(&priv->sleepstatus.status);
-}
-
-void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
-{
- int ret;
-
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
- if (ret)
- netdev_err(priv->net_dev, "write WAKEUP_REG\n");
-
- priv->last_wakeup = jiffies;
- ++priv->wakeup_count;
- }
-}
-
-static void _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
-{
- u8 byte;
- int ret;
-
- if (priv->reg.power_mgmt == POWER_MGMT_ACTIVE)
- return;
-
- if (priv->reg.operation_mode != MODE_INFRASTRUCTURE)
- return;
-
- if (!is_connect_status(priv->connect_status))
- return;
-
- if (priv->dev_state != DEVICE_STATE_SLEEP)
- return;
-
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE)
- return;
-
- netdev_dbg(priv->net_dev,
- "STATUS:\n"
- "- psstatus.status = %d\n"
- "- psstatus.confirm_wait = %d\n"
- "- psstatus.snooze_guard = %d\n"
- "- txq_count = %d\n",
- atomic_read(&priv->psstatus.status),
- atomic_read(&priv->psstatus.confirm_wait),
- atomic_read(&priv->psstatus.snooze_guard),
- txq_count(priv));
-
- if (atomic_read(&priv->psstatus.confirm_wait) ||
- atomic_read(&priv->psstatus.snooze_guard) ||
- txq_has_space(priv)) {
- queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
- return;
- }
-
- ret = ks7010_sdio_readb(priv, INT_PENDING_REG, &byte);
- if (ret) {
- netdev_err(priv->net_dev, "read INT_PENDING_REG\n");
- goto queue_delayed_work;
- }
- if (byte)
- goto queue_delayed_work;
-
- ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE);
- if (ret) {
- netdev_err(priv->net_dev, "write GCR_B_REG\n");
- goto queue_delayed_work;
- }
- atomic_set(&priv->psstatus.status, PS_SNOOZE);
-
- return;
-
-queue_delayed_work:
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
-}
-
-int ks_wlan_hw_power_save(struct ks_wlan_private *priv)
-{
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
- return 0;
-}
-
-static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
- unsigned long size,
- void (*complete_handler)(struct ks_wlan_private *priv,
- struct sk_buff *skb),
- struct sk_buff *skb)
-{
- struct tx_device_buffer *sp;
- int ret;
-
- if (priv->dev_state < DEVICE_STATE_BOOT) {
- ret = -EPERM;
- goto err_complete;
- }
-
- if ((TX_DEVICE_BUFF_SIZE - 1) <= txq_count(priv)) {
- netdev_err(priv->net_dev, "tx buffer overflow\n");
- ret = -EOVERFLOW;
- goto err_complete;
- }
-
- sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qtail];
- sp->sendp = p;
- sp->size = size;
- sp->complete_handler = complete_handler;
- sp->skb = skb;
- inc_txqtail(priv);
-
- return 0;
-
-err_complete:
- kfree(p);
- if (complete_handler)
- (*complete_handler)(priv, skb);
-
- return ret;
-}
-
-/* write data */
-static int write_to_device(struct ks_wlan_private *priv, u8 *buffer,
- unsigned long size)
-{
- struct hostif_hdr *hdr;
- int ret;
-
- hdr = (struct hostif_hdr *)buffer;
-
- if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
- le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
- netdev_err(priv->net_dev, "unknown event=%04X\n", hdr->event);
- return 0;
- }
-
- ret = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
- if (ret) {
- netdev_err(priv->net_dev, "write DATA_WINDOW\n");
- return ret;
- }
-
- ret = ks7010_sdio_writeb(priv, WRITE_STATUS_REG, REG_STATUS_BUSY);
- if (ret) {
- netdev_err(priv->net_dev, "write WRITE_STATUS_REG\n");
- return ret;
- }
-
- return 0;
-}
-
-static void tx_device_task(struct ks_wlan_private *priv)
-{
- struct tx_device_buffer *sp;
- int ret;
-
- if (!txq_has_space(priv) ||
- atomic_read(&priv->psstatus.status) == PS_SNOOZE)
- return;
-
- sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
- if (priv->dev_state >= DEVICE_STATE_BOOT) {
- ret = write_to_device(priv, sp->sendp, sp->size);
- if (ret) {
- netdev_err(priv->net_dev,
- "write_to_device error !!(%d)\n", ret);
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
- return;
- }
- }
- kfree(sp->sendp);
- if (sp->complete_handler) /* TX Complete */
- (*sp->complete_handler)(priv, sp->skb);
- inc_txqhead(priv);
-
- if (txq_has_space(priv))
- queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
-}
-
-int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
- void (*complete_handler)(struct ks_wlan_private *priv,
- struct sk_buff *skb),
- struct sk_buff *skb)
-{
- int result;
- struct hostif_hdr *hdr;
-
- hdr = (struct hostif_hdr *)p;
-
- if (le16_to_cpu(hdr->event) < HIF_DATA_REQ ||
- le16_to_cpu(hdr->event) > HIF_REQ_MAX) {
- netdev_err(priv->net_dev, "unknown event=%04X\n", hdr->event);
- return 0;
- }
-
- /* add event to hostt buffer */
- priv->hostt.buff[priv->hostt.qtail] = le16_to_cpu(hdr->event);
- priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
-
- spin_lock_bh(&priv->tx_dev.tx_dev_lock);
- result = enqueue_txdev(priv, p, size, complete_handler, skb);
- spin_unlock_bh(&priv->tx_dev.tx_dev_lock);
-
- if (txq_has_space(priv))
- queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
-
- return result;
-}
-
-static void rx_event_task(struct tasklet_struct *t)
-{
- struct ks_wlan_private *priv = from_tasklet(priv, t, rx_bh_task);
- struct rx_device_buffer *rp;
-
- if (rxq_has_space(priv) && priv->dev_state >= DEVICE_STATE_BOOT) {
- rp = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qhead];
- hostif_receive(priv, rp->data, rp->size);
- inc_rxqhead(priv);
-
- if (rxq_has_space(priv))
- tasklet_schedule(&priv->rx_bh_task);
- }
-}
-
-static void ks_wlan_hw_rx(struct ks_wlan_private *priv, size_t size)
-{
- int ret;
- struct rx_device_buffer *rx_buffer;
- struct hostif_hdr *hdr;
- u16 event = 0;
-
- /* receive data */
- if (rxq_count(priv) >= (RX_DEVICE_BUFF_SIZE - 1)) {
- netdev_err(priv->net_dev, "rx buffer overflow\n");
- return;
- }
- rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail];
-
- ret = ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0],
- hif_align_size(size));
- if (ret)
- return;
-
- /* length check */
- if (size > 2046 || size == 0) {
-#ifdef DEBUG
- print_hex_dump_bytes("INVALID DATA dump: ",
- DUMP_PREFIX_OFFSET,
- rx_buffer->data, 32);
-#endif
- ret = ks7010_sdio_writeb(priv, READ_STATUS_REG,
- REG_STATUS_IDLE);
- if (ret)
- netdev_err(priv->net_dev, "write READ_STATUS_REG\n");
-
- /* length check fail */
- return;
- }
-
- hdr = (struct hostif_hdr *)&rx_buffer->data[0];
- rx_buffer->size = le16_to_cpu(hdr->size) + sizeof(hdr->size);
- event = le16_to_cpu(hdr->event);
- inc_rxqtail(priv);
-
- ret = ks7010_sdio_writeb(priv, READ_STATUS_REG, REG_STATUS_IDLE);
- if (ret)
- netdev_err(priv->net_dev, "write READ_STATUS_REG\n");
-
- if (atomic_read(&priv->psstatus.confirm_wait) && is_hif_conf(event)) {
- netdev_dbg(priv->net_dev, "IS_HIF_CONF true !!\n");
- atomic_dec(&priv->psstatus.confirm_wait);
- }
-
- tasklet_schedule(&priv->rx_bh_task);
-}
-
-static void ks7010_rw_function(struct work_struct *work)
-{
- struct ks_wlan_private *priv = container_of(work,
- struct ks_wlan_private,
- rw_dwork.work);
- struct sdio_func *func = ks7010_to_func(priv);
- u8 byte;
- int ret;
-
- /* wait after DOZE */
- if (time_after(priv->last_doze + msecs_to_jiffies(30), jiffies)) {
- netdev_dbg(priv->net_dev, "wait after DOZE\n");
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
- return;
- }
-
- /* wait after WAKEUP */
- while (time_after(priv->last_wakeup + msecs_to_jiffies(30), jiffies)) {
- netdev_dbg(priv->net_dev, "wait after WAKEUP\n");
- dev_info(&func->dev, "wake: %lu %lu\n",
- priv->last_wakeup + msecs_to_jiffies(30), jiffies);
- msleep(30);
- }
-
- sdio_claim_host(func);
-
- /* power save wakeup */
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- if (txq_has_space(priv)) {
- ks_wlan_hw_wakeup_request(priv);
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
- }
- goto release_host;
- }
-
- /* sleep mode doze */
- if (atomic_read(&priv->sleepstatus.doze_request) == 1) {
- ks_wlan_hw_sleep_doze_request(priv);
- goto release_host;
- }
- /* sleep mode wakeup */
- if (atomic_read(&priv->sleepstatus.wakeup_request) == 1) {
- ks_wlan_hw_sleep_wakeup_request(priv);
- goto release_host;
- }
-
- /* read (WriteStatus/ReadDataSize FN1:00_0014) */
- ret = ks7010_sdio_readb(priv, WSTATUS_RSIZE_REG, &byte);
- if (ret) {
- netdev_err(priv->net_dev, "read WSTATUS_RSIZE_REG psstatus=%d\n",
- atomic_read(&priv->psstatus.status));
- goto release_host;
- }
-
- if (byte & RSIZE_MASK) { /* Read schedule */
- ks_wlan_hw_rx(priv, (size_t)((byte & RSIZE_MASK) << 4));
- }
- if ((byte & WSTATUS_MASK))
- tx_device_task(priv);
-
- _ks_wlan_hw_power_save(priv);
-
-release_host:
- sdio_release_host(func);
-}
-
-static void ks_sdio_interrupt(struct sdio_func *func)
-{
- int ret;
- struct ks_sdio_card *card;
- struct ks_wlan_private *priv;
- u8 status, rsize, byte;
-
- card = sdio_get_drvdata(func);
- priv = card->priv;
-
- if (priv->dev_state < DEVICE_STATE_BOOT)
- goto queue_delayed_work;
-
- ret = ks7010_sdio_readb(priv, INT_PENDING_REG, &status);
- if (ret) {
- netdev_err(priv->net_dev, "read INT_PENDING_REG\n");
- goto queue_delayed_work;
- }
-
- /* schedule task for interrupt status */
- /* bit7 -> Write General Communication B register */
- /* read (General Communication B register) */
- /* bit5 -> Write Status Idle */
- /* bit2 -> Read Status Busy */
- if (status & INT_GCR_B ||
- atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- ret = ks7010_sdio_readb(priv, GCR_B_REG, &byte);
- if (ret) {
- netdev_err(priv->net_dev, "read GCR_B_REG\n");
- goto queue_delayed_work;
- }
- if (byte == GCR_B_ACTIVE) {
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- atomic_set(&priv->psstatus.status, PS_WAKEUP);
- priv->wakeup_count = 0;
- }
- complete(&priv->psstatus.wakeup_wait);
- }
- }
-
- do {
- /* read (WriteStatus/ReadDataSize FN1:00_0014) */
- ret = ks7010_sdio_readb(priv, WSTATUS_RSIZE_REG, &byte);
- if (ret) {
- netdev_err(priv->net_dev, "read WSTATUS_RSIZE_REG\n");
- goto queue_delayed_work;
- }
- rsize = byte & RSIZE_MASK;
- if (rsize != 0) /* Read schedule */
- ks_wlan_hw_rx(priv, (size_t)(rsize << 4));
-
- if (byte & WSTATUS_MASK) {
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- if (txq_has_space(priv)) {
- ks_wlan_hw_wakeup_request(priv);
- queue_delayed_work(priv->wq,
- &priv->rw_dwork, 1);
- return;
- }
- } else {
- tx_device_task(priv);
- }
- }
- } while (rsize);
-
-queue_delayed_work:
- queue_delayed_work(priv->wq, &priv->rw_dwork, 0);
-}
-
-static int trx_device_init(struct ks_wlan_private *priv)
-{
- priv->tx_dev.qhead = 0;
- priv->tx_dev.qtail = 0;
-
- priv->rx_dev.qhead = 0;
- priv->rx_dev.qtail = 0;
-
- spin_lock_init(&priv->tx_dev.tx_dev_lock);
- spin_lock_init(&priv->rx_dev.rx_dev_lock);
-
- tasklet_setup(&priv->rx_bh_task, rx_event_task);
-
- return 0;
-}
-
-static void trx_device_exit(struct ks_wlan_private *priv)
-{
- struct tx_device_buffer *sp;
-
- /* tx buffer clear */
- while (txq_has_space(priv)) {
- sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
- kfree(sp->sendp);
- if (sp->complete_handler) /* TX Complete */
- (*sp->complete_handler)(priv, sp->skb);
- inc_txqhead(priv);
- }
-
- tasklet_kill(&priv->rx_bh_task);
-}
-
-static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
-{
- int ret;
- unsigned char *data_buf;
-
- data_buf = kmemdup(&index, sizeof(u32), GFP_KERNEL);
- if (!data_buf)
- return -ENOMEM;
-
- ret = ks7010_sdio_write(priv, WRITE_INDEX_REG, data_buf, sizeof(index));
- if (ret)
- goto err_free_data_buf;
-
- ret = ks7010_sdio_write(priv, READ_INDEX_REG, data_buf, sizeof(index));
- if (ret)
- goto err_free_data_buf;
-
- return 0;
-
-err_free_data_buf:
- kfree(data_buf);
-
- return ret;
-}
-
-#define ROM_BUFF_SIZE (64 * 1024)
-static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
- u8 *data, unsigned int size)
-{
- int ret;
- u8 *read_buf;
-
- read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
- if (!read_buf)
- return -ENOMEM;
-
- ret = ks7010_sdio_read(priv, address, read_buf, size);
- if (ret)
- goto err_free_read_buf;
-
- if (memcmp(data, read_buf, size) != 0) {
- ret = -EIO;
- netdev_err(priv->net_dev, "data compare error (%d)\n", ret);
- goto err_free_read_buf;
- }
-
- return 0;
-
-err_free_read_buf:
- kfree(read_buf);
-
- return ret;
-}
-
-static int ks7010_copy_firmware(struct ks_wlan_private *priv,
- const struct firmware *fw_entry)
-{
- unsigned int length;
- unsigned int size;
- unsigned int offset;
- unsigned int n = 0;
- u8 *rom_buf;
- int ret;
-
- rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
- if (!rom_buf)
- return -ENOMEM;
-
- length = fw_entry->size;
-
- do {
- if (length >= ROM_BUFF_SIZE) {
- size = ROM_BUFF_SIZE;
- length = length - ROM_BUFF_SIZE;
- } else {
- size = length;
- length = 0;
- }
- if (size == 0)
- break;
-
- memcpy(rom_buf, fw_entry->data + n, size);
-
- offset = n;
- ret = ks7010_sdio_update_index(priv,
- KS7010_IRAM_ADDRESS + offset);
- if (ret)
- goto free_rom_buf;
-
- ret = ks7010_sdio_write(priv, DATA_WINDOW, rom_buf, size);
- if (ret)
- goto free_rom_buf;
-
- ret = ks7010_sdio_data_compare(priv,
- DATA_WINDOW, rom_buf, size);
- if (ret)
- goto free_rom_buf;
-
- n += size;
-
- } while (size);
-
- ret = ks7010_sdio_writeb(priv, GCR_A_REG, GCR_A_REMAP);
-
-free_rom_buf:
- kfree(rom_buf);
- return ret;
-}
-
-static int ks7010_upload_firmware(struct ks_sdio_card *card)
-{
- struct ks_wlan_private *priv = card->priv;
- struct sdio_func *func = ks7010_to_func(priv);
- unsigned int n;
- u8 byte = 0;
- int ret;
- const struct firmware *fw_entry = NULL;
-
- sdio_claim_host(func);
-
- /* Firmware running ? */
- ret = ks7010_sdio_readb(priv, GCR_A_REG, &byte);
- if (ret)
- goto release_host;
- if (byte == GCR_A_RUN) {
- netdev_dbg(priv->net_dev, "MAC firmware running ...\n");
- ret = -EBUSY;
- goto release_host;
- }
-
- ret = request_firmware(&fw_entry, ROM_FILE,
- &func->dev);
- if (ret)
- goto release_host;
-
- ret = ks7010_copy_firmware(priv, fw_entry);
- if (ret)
- goto release_firmware;
-
- /* Firmware running check */
- for (n = 0; n < 50; ++n) {
- usleep_range(10000, 11000); /* wait_ms(10); */
- ret = ks7010_sdio_readb(priv, GCR_A_REG, &byte);
- if (ret)
- goto release_firmware;
-
- if (byte == GCR_A_RUN)
- break;
- }
- if ((50) <= n) {
- netdev_err(priv->net_dev, "firmware can't start\n");
- ret = -EIO;
- goto release_firmware;
- }
-
- ret = 0;
-
- release_firmware:
- release_firmware(fw_entry);
- release_host:
- sdio_release_host(func);
-
- return ret;
-}
-
-static void ks7010_sme_enqueue_events(struct ks_wlan_private *priv)
-{
- static const u16 init_events[] = {
- SME_GET_EEPROM_CKSUM, SME_STOP_REQUEST,
- SME_RTS_THRESHOLD_REQUEST, SME_FRAGMENTATION_THRESHOLD_REQUEST,
- SME_WEP_INDEX_REQUEST, SME_WEP_KEY1_REQUEST,
- SME_WEP_KEY2_REQUEST, SME_WEP_KEY3_REQUEST,
- SME_WEP_KEY4_REQUEST, SME_WEP_FLAG_REQUEST,
- SME_RSN_ENABLED_REQUEST, SME_MODE_SET_REQUEST,
- SME_START_REQUEST
- };
- int ev;
-
- for (ev = 0; ev < ARRAY_SIZE(init_events); ev++)
- hostif_sme_enqueue(priv, init_events[ev]);
-}
-
-static void ks7010_card_init(struct ks_wlan_private *priv)
-{
- init_completion(&priv->confirm_wait);
-
- /* get mac address & firmware version */
- hostif_sme_enqueue(priv, SME_START);
-
- if (!wait_for_completion_interruptible_timeout
- (&priv->confirm_wait, 5 * HZ)) {
- netdev_dbg(priv->net_dev, "wait time out!! SME_START\n");
- }
-
- if (priv->mac_address_valid && priv->version_size != 0)
- priv->dev_state = DEVICE_STATE_PREINIT;
-
- ks7010_sme_enqueue_events(priv);
-
- if (!wait_for_completion_interruptible_timeout
- (&priv->confirm_wait, 5 * HZ)) {
- netdev_dbg(priv->net_dev, "wait time out!! wireless parameter set\n");
- }
-
- if (priv->dev_state >= DEVICE_STATE_PREINIT) {
- netdev_dbg(priv->net_dev, "DEVICE READY!!\n");
- priv->dev_state = DEVICE_STATE_READY;
- }
-}
-
-static void ks7010_init_defaults(struct ks_wlan_private *priv)
-{
- priv->reg.tx_rate = TX_RATE_AUTO;
- priv->reg.preamble = LONG_PREAMBLE;
- priv->reg.power_mgmt = POWER_MGMT_ACTIVE;
- priv->reg.scan_type = ACTIVE_SCAN;
- priv->reg.beacon_lost_count = 20;
- priv->reg.rts = 2347UL;
- priv->reg.fragment = 2346UL;
- priv->reg.phy_type = D_11BG_COMPATIBLE_MODE;
- priv->reg.cts_mode = CTS_MODE_FALSE;
- priv->reg.rate_set.body[11] = TX_RATE_54M;
- priv->reg.rate_set.body[10] = TX_RATE_48M;
- priv->reg.rate_set.body[9] = TX_RATE_36M;
- priv->reg.rate_set.body[8] = TX_RATE_18M;
- priv->reg.rate_set.body[7] = TX_RATE_9M;
- priv->reg.rate_set.body[6] = TX_RATE_24M | BASIC_RATE;
- priv->reg.rate_set.body[5] = TX_RATE_12M | BASIC_RATE;
- priv->reg.rate_set.body[4] = TX_RATE_6M | BASIC_RATE;
- priv->reg.rate_set.body[3] = TX_RATE_11M | BASIC_RATE;
- priv->reg.rate_set.body[2] = TX_RATE_5M | BASIC_RATE;
- priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE;
- priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE;
- priv->reg.tx_rate = TX_RATE_FULL_AUTO;
- priv->reg.rate_set.size = 12;
-}
-
-static int ks7010_sdio_setup_irqs(struct sdio_func *func)
-{
- int ret;
-
- /* interrupt disable */
- sdio_writeb(func, 0, INT_ENABLE_REG, &ret);
- if (ret)
- goto irq_error;
-
- sdio_writeb(func, 0xff, INT_PENDING_REG, &ret);
- if (ret)
- goto irq_error;
-
- /* setup interrupt handler */
- ret = sdio_claim_irq(func, ks_sdio_interrupt);
-
-irq_error:
- return ret;
-}
-
-static void ks7010_sdio_init_irqs(struct sdio_func *func,
- struct ks_wlan_private *priv)
-{
- u8 byte;
- int ret;
-
- /*
- * interrupt setting
- * clear Interrupt status write
- * (ARMtoSD_InterruptPending FN1:00_0024)
- */
- sdio_claim_host(func);
- ret = ks7010_sdio_writeb(priv, INT_PENDING_REG, 0xff);
- sdio_release_host(func);
- if (ret)
- netdev_err(priv->net_dev, "write INT_PENDING_REG\n");
-
- /* enable ks7010sdio interrupt */
- byte = (INT_GCR_B | INT_READ_STATUS | INT_WRITE_STATUS);
- sdio_claim_host(func);
- ret = ks7010_sdio_writeb(priv, INT_ENABLE_REG, byte);
- sdio_release_host(func);
- if (ret)
- netdev_err(priv->net_dev, "write INT_ENABLE_REG\n");
-}
-
-static void ks7010_private_init(struct ks_wlan_private *priv,
- struct ks_sdio_card *card,
- struct net_device *netdev)
-{
- /* private memory initialize */
- priv->if_hw = card;
-
- priv->dev_state = DEVICE_STATE_PREBOOT;
- priv->net_dev = netdev;
- priv->firmware_version[0] = '\0';
- priv->version_size = 0;
- priv->last_doze = jiffies;
- priv->last_wakeup = jiffies;
- memset(&priv->nstats, 0, sizeof(priv->nstats));
- memset(&priv->wstats, 0, sizeof(priv->wstats));
-
- /* sleep mode */
- atomic_set(&priv->sleepstatus.status, 0);
- atomic_set(&priv->sleepstatus.doze_request, 0);
- atomic_set(&priv->sleepstatus.wakeup_request, 0);
-
- trx_device_init(priv);
- hostif_init(priv);
- ks_wlan_net_start(netdev);
- ks7010_init_defaults(priv);
-}
-
-static int ks7010_sdio_probe(struct sdio_func *func,
- const struct sdio_device_id *device)
-{
- struct ks_wlan_private *priv = NULL;
- struct net_device *netdev = NULL;
- struct ks_sdio_card *card;
- int ret;
-
- card = kzalloc(sizeof(*card), GFP_KERNEL);
- if (!card)
- return -ENOMEM;
-
- card->func = func;
-
- sdio_claim_host(func);
-
- ret = sdio_set_block_size(func, KS7010_IO_BLOCK_SIZE);
- if (ret)
- goto err_free_card;
-
- dev_dbg(&card->func->dev, "multi_block=%d sdio_set_block_size()=%d %d\n",
- func->card->cccr.multi_block, func->cur_blksize, ret);
-
- ret = sdio_enable_func(func);
- if (ret)
- goto err_free_card;
-
- ret = ks7010_sdio_setup_irqs(func);
- if (ret)
- goto err_disable_func;
-
- sdio_release_host(func);
-
- sdio_set_drvdata(func, card);
-
- dev_dbg(&card->func->dev, "class = 0x%X, vendor = 0x%X, device = 0x%X\n",
- func->class, func->vendor, func->device);
-
- /* private memory allocate */
- netdev = alloc_etherdev(sizeof(*priv));
- if (!netdev) {
- dev_err(&card->func->dev, "Unable to alloc new net device\n");
- goto err_release_irq;
- }
-
- ret = dev_alloc_name(netdev, "wlan%d");
- if (ret < 0) {
- dev_err(&card->func->dev, "Couldn't get name!\n");
- goto err_free_netdev;
- }
-
- priv = netdev_priv(netdev);
-
- card->priv = priv;
- SET_NETDEV_DEV(netdev, &card->func->dev);
-
- ks7010_private_init(priv, card, netdev);
-
- ret = ks7010_upload_firmware(card);
- if (ret) {
- netdev_err(priv->net_dev,
- "firmware load failed !! ret = %d\n", ret);
- goto err_free_netdev;
- }
-
- ks7010_sdio_init_irqs(func, priv);
-
- priv->dev_state = DEVICE_STATE_BOOT;
-
- priv->wq = alloc_workqueue("wq", WQ_MEM_RECLAIM, 1);
- if (!priv->wq) {
- netdev_err(priv->net_dev, "create_workqueue failed !!\n");
- goto err_free_netdev;
- }
-
- INIT_DELAYED_WORK(&priv->rw_dwork, ks7010_rw_function);
- ks7010_card_init(priv);
-
- ret = register_netdev(priv->net_dev);
- if (ret)
- goto err_destroy_wq;
-
- return 0;
-
- err_destroy_wq:
- destroy_workqueue(priv->wq);
- err_free_netdev:
- free_netdev(netdev);
- err_release_irq:
- sdio_claim_host(func);
- sdio_release_irq(func);
- err_disable_func:
- sdio_disable_func(func);
- err_free_card:
- sdio_release_host(func);
- sdio_set_drvdata(func, NULL);
- kfree(card);
-
- return -ENODEV;
-}
-
-/* send stop request to MAC */
-static int send_stop_request(struct sdio_func *func)
-{
- struct hostif_stop_request *pp;
- struct ks_sdio_card *card;
- size_t size;
-
- card = sdio_get_drvdata(func);
-
- pp = kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL);
- if (!pp)
- return -ENOMEM;
-
- size = sizeof(*pp) - sizeof(pp->header.size);
- pp->header.size = cpu_to_le16(size);
- pp->header.event = cpu_to_le16(HIF_STOP_REQ);
-
- sdio_claim_host(func);
- write_to_device(card->priv, (u8 *)pp, hif_align_size(sizeof(*pp)));
- sdio_release_host(func);
-
- kfree(pp);
- return 0;
-}
-
-static void ks7010_sdio_remove(struct sdio_func *func)
-{
- int ret;
- struct ks_sdio_card *card;
- struct ks_wlan_private *priv;
-
- card = sdio_get_drvdata(func);
-
- if (!card)
- return;
-
- priv = card->priv;
- if (!priv)
- goto err_free_card;
-
- ks_wlan_net_stop(priv->net_dev);
-
- /* interrupt disable */
- sdio_claim_host(func);
- sdio_writeb(func, 0, INT_ENABLE_REG, &ret);
- sdio_writeb(func, 0xff, INT_PENDING_REG, &ret);
- sdio_release_host(func);
-
- ret = send_stop_request(func);
- if (ret) /* memory allocation failure */
- goto err_free_card;
-
- if (priv->wq)
- destroy_workqueue(priv->wq);
-
- hostif_exit(priv);
-
- unregister_netdev(priv->net_dev);
-
- trx_device_exit(priv);
- free_netdev(priv->net_dev);
- card->priv = NULL;
-
- sdio_claim_host(func);
- sdio_release_irq(func);
- sdio_disable_func(func);
- sdio_release_host(func);
-err_free_card:
- sdio_set_drvdata(func, NULL);
- kfree(card);
-}
-
-static const struct sdio_device_id ks7010_sdio_ids[] = {
- {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)},
- {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010)},
- { /* all zero */ }
-};
-MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
-
-static struct sdio_driver ks7010_sdio_driver = {
- .name = "ks7010_sdio",
- .id_table = ks7010_sdio_ids,
- .probe = ks7010_sdio_probe,
- .remove = ks7010_sdio_remove,
-};
-
-module_sdio_driver(ks7010_sdio_driver);
-MODULE_AUTHOR("Sang Engineering, Qi-Hardware, KeyStream");
-MODULE_DESCRIPTION("Driver for KeyStream KS7010 based SDIO cards");
-MODULE_LICENSE("GPL v2");
-MODULE_FIRMWARE(ROM_FILE);
diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
deleted file mode 100644
index af3825578d85..000000000000
--- a/drivers/staging/ks7010/ks_hostif.c
+++ /dev/null
@@ -1,2312 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Driver for KeyStream wireless LAN cards.
- *
- * Copyright (C) 2005-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- */
-
-#include <crypto/hash.h>
-#include <linux/circ_buf.h>
-#include <linux/if_arp.h>
-#include <net/iw_handler.h>
-#include <uapi/linux/llc.h>
-#include "eap_packet.h"
-#include "ks_wlan.h"
-#include "ks_hostif.h"
-
-#define MICHAEL_MIC_KEY_LEN 8
-#define MICHAEL_MIC_LEN 8
-
-static inline void inc_smeqhead(struct ks_wlan_private *priv)
-{
- priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE;
-}
-
-static inline void inc_smeqtail(struct ks_wlan_private *priv)
-{
- priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE;
-}
-
-static inline unsigned int cnt_smeqbody(struct ks_wlan_private *priv)
-{
- return CIRC_CNT_TO_END(priv->sme_i.qhead, priv->sme_i.qtail,
- SME_EVENT_BUFF_SIZE);
-}
-
-static inline u8 get_byte(struct ks_wlan_private *priv)
-{
- u8 data;
-
- data = *priv->rxp++;
- /* length check in advance ! */
- --(priv->rx_size);
- return data;
-}
-
-static inline u16 get_word(struct ks_wlan_private *priv)
-{
- u16 data;
-
- data = (get_byte(priv) & 0xff);
- data |= ((get_byte(priv) << 8) & 0xff00);
- return data;
-}
-
-static inline u32 get_dword(struct ks_wlan_private *priv)
-{
- u32 data;
-
- data = (get_byte(priv) & 0xff);
- data |= ((get_byte(priv) << 8) & 0x0000ff00);
- data |= ((get_byte(priv) << 16) & 0x00ff0000);
- data |= ((get_byte(priv) << 24) & 0xff000000);
- return data;
-}
-
-static void ks_wlan_hw_wakeup_task(struct work_struct *work)
-{
- struct ks_wlan_private *priv;
- int ps_status;
- long time_left;
-
- priv = container_of(work, struct ks_wlan_private, wakeup_work);
- ps_status = atomic_read(&priv->psstatus.status);
-
- if (ps_status == PS_SNOOZE) {
- ks_wlan_hw_wakeup_request(priv);
- time_left = wait_for_completion_interruptible_timeout(&priv->psstatus.wakeup_wait,
- msecs_to_jiffies(20));
- if (time_left <= 0) {
- netdev_dbg(priv->net_dev, "wake up timeout or interrupted !!!\n");
- schedule_work(&priv->wakeup_work);
- return;
- }
- }
-}
-
-static void ks_wlan_do_power_save(struct ks_wlan_private *priv)
-{
- if (is_connect_status(priv->connect_status))
- hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
- else
- priv->dev_state = DEVICE_STATE_READY;
-}
-
-static
-int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info *ap_info)
-{
- struct local_ap *ap;
- union iwreq_data wrqu;
- struct net_device *netdev = priv->net_dev;
- u8 size;
-
- ap = &priv->current_ap;
-
- if (is_disconnect_status(priv->connect_status)) {
- memset(ap, 0, sizeof(struct local_ap));
- return -EPERM;
- }
-
- ether_addr_copy(ap->bssid, ap_info->bssid);
- memcpy(ap->ssid.body, priv->reg.ssid.body,
- priv->reg.ssid.size);
- ap->ssid.size = priv->reg.ssid.size;
- memcpy(ap->rate_set.body, ap_info->rate_set.body,
- ap_info->rate_set.size);
- ap->rate_set.size = ap_info->rate_set.size;
- if (ap_info->ext_rate_set.size != 0) {
- memcpy(&ap->rate_set.body[ap->rate_set.size],
- ap_info->ext_rate_set.body,
- ap_info->ext_rate_set.size);
- ap->rate_set.size += ap_info->ext_rate_set.size;
- }
- ap->channel = ap_info->ds_parameter.channel;
- ap->rssi = ap_info->rssi;
- ap->sq = ap_info->sq;
- ap->noise = ap_info->noise;
- ap->capability = le16_to_cpu(ap_info->capability);
- size = (ap_info->rsn.size <= RSN_IE_BODY_MAX) ?
- ap_info->rsn.size : RSN_IE_BODY_MAX;
- if ((ap_info->rsn_mode & RSN_MODE_WPA2) &&
- (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2)) {
- ap->rsn_ie.id = RSN_INFO_ELEM_ID;
- ap->rsn_ie.size = size;
- memcpy(ap->rsn_ie.body, ap_info->rsn.body, size);
- } else if ((ap_info->rsn_mode & RSN_MODE_WPA) &&
- (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA)) {
- ap->wpa_ie.id = WPA_INFO_ELEM_ID;
- ap->wpa_ie.size = size;
- memcpy(ap->wpa_ie.body, ap_info->rsn.body, size);
- } else {
- ap->rsn_ie.id = 0;
- ap->rsn_ie.size = 0;
- ap->wpa_ie.id = 0;
- ap->wpa_ie.size = 0;
- }
-
- wrqu.data.length = 0;
- wrqu.data.flags = 0;
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- if (is_connect_status(priv->connect_status)) {
- ether_addr_copy(wrqu.ap_addr.sa_data, priv->current_ap.bssid);
- netdev_dbg(priv->net_dev,
- "IWEVENT: connect bssid=%pM\n",
- wrqu.ap_addr.sa_data);
- wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
- }
- netdev_dbg(priv->net_dev, "Link AP\n"
- "- bssid=%pM\n"
- "- essid=%s\n"
- "- rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n"
- "- channel=%d\n"
- "- rssi=%d\n"
- "- sq=%d\n"
- "- capability=%04X\n"
- "- rsn.mode=%d\n"
- "- rsn.size=%d\n"
- "- ext_rate_set_size=%d\n"
- "- rate_set_size=%d\n",
- ap->bssid,
- &ap->ssid.body[0],
- ap->rate_set.body[0], ap->rate_set.body[1],
- ap->rate_set.body[2], ap->rate_set.body[3],
- ap->rate_set.body[4], ap->rate_set.body[5],
- ap->rate_set.body[6], ap->rate_set.body[7],
- ap->channel, ap->rssi, ap->sq, ap->capability,
- ap_info->rsn_mode, ap_info->rsn.size,
- ap_info->ext_rate_set.size, ap_info->rate_set.size);
-
- return 0;
-}
-
-static u8 read_ie(unsigned char *bp, u8 max, u8 *body)
-{
- u8 size = (*(bp + 1) <= max) ? *(bp + 1) : max;
-
- memcpy(body, bp + 2, size);
- return size;
-}
-
-static int
-michael_mic(u8 *key, u8 *data, unsigned int len, u8 priority, u8 *result)
-{
- u8 pad_data[4] = { priority, 0, 0, 0 };
- struct crypto_shash *tfm = NULL;
- struct shash_desc *desc = NULL;
- int ret;
-
- tfm = crypto_alloc_shash("michael_mic", 0, 0);
- if (IS_ERR(tfm)) {
- ret = PTR_ERR(tfm);
- goto err;
- }
-
- ret = crypto_shash_setkey(tfm, key, MICHAEL_MIC_KEY_LEN);
- if (ret < 0)
- goto err_free_tfm;
-
- desc = kmalloc(sizeof(*desc) + crypto_shash_descsize(tfm), GFP_KERNEL);
- if (!desc) {
- ret = -ENOMEM;
- goto err_free_tfm;
- }
-
- desc->tfm = tfm;
-
- ret = crypto_shash_init(desc);
- if (ret < 0)
- goto err_free_desc;
-
- // Compute the MIC value
- /*
- * IEEE802.11i page 47
- * Figure 43g TKIP MIC processing format
- * +--+--+--------+--+----+--+--+--+--+--+--+--+--+
- * |6 |6 |1 |3 |M |1 |1 |1 |1 |1 |1 |1 |1 | Octet
- * +--+--+--------+--+----+--+--+--+--+--+--+--+--+
- * |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7|
- * +--+--+--------+--+----+--+--+--+--+--+--+--+--+
- */
-
- ret = crypto_shash_update(desc, data, 12);
- if (ret < 0)
- goto err_free_desc;
-
- ret = crypto_shash_update(desc, pad_data, 4);
- if (ret < 0)
- goto err_free_desc;
-
- ret = crypto_shash_finup(desc, data + 12, len - 12, result);
-
-err_free_desc:
- kfree_sensitive(desc);
-
-err_free_tfm:
- crypto_free_shash(tfm);
-
-err:
- return ret;
-}
-
-static
-int get_ap_information(struct ks_wlan_private *priv, struct ap_info *ap_info,
- struct local_ap *ap)
-{
- unsigned char *bp;
- int bsize, offset;
-
- memset(ap, 0, sizeof(struct local_ap));
-
- ether_addr_copy(ap->bssid, ap_info->bssid);
- ap->rssi = ap_info->rssi;
- ap->sq = ap_info->sq;
- ap->noise = ap_info->noise;
- ap->capability = le16_to_cpu(ap_info->capability);
- ap->channel = ap_info->ch_info;
-
- bp = ap_info->body;
- bsize = le16_to_cpu(ap_info->body_size);
- offset = 0;
-
- while (bsize > offset) {
- switch (*bp) { /* Information Element ID */
- case WLAN_EID_SSID:
- ap->ssid.size = read_ie(bp, IEEE80211_MAX_SSID_LEN,
- ap->ssid.body);
- break;
- case WLAN_EID_SUPP_RATES:
- case WLAN_EID_EXT_SUPP_RATES:
- if ((*(bp + 1) + ap->rate_set.size) <=
- RATE_SET_MAX_SIZE) {
- memcpy(&ap->rate_set.body[ap->rate_set.size],
- bp + 2, *(bp + 1));
- ap->rate_set.size += *(bp + 1);
- } else {
- memcpy(&ap->rate_set.body[ap->rate_set.size],
- bp + 2,
- RATE_SET_MAX_SIZE - ap->rate_set.size);
- ap->rate_set.size +=
- (RATE_SET_MAX_SIZE - ap->rate_set.size);
- }
- break;
- case WLAN_EID_RSN:
- ap->rsn_ie.id = *bp;
- ap->rsn_ie.size = read_ie(bp, RSN_IE_BODY_MAX,
- ap->rsn_ie.body);
- break;
- case WLAN_EID_VENDOR_SPECIFIC: /* WPA */
- /* WPA OUI check */
- if (memcmp(bp + 2, CIPHER_ID_WPA_WEP40, 4) == 0) {
- ap->wpa_ie.id = *bp;
- ap->wpa_ie.size = read_ie(bp, RSN_IE_BODY_MAX,
- ap->wpa_ie.body);
- }
- break;
- case WLAN_EID_DS_PARAMS:
- case WLAN_EID_FH_PARAMS:
- case WLAN_EID_CF_PARAMS:
- case WLAN_EID_TIM:
- case WLAN_EID_IBSS_PARAMS:
- case WLAN_EID_COUNTRY:
- case WLAN_EID_ERP_INFO:
- break;
- default:
- netdev_err(priv->net_dev,
- "unknown Element ID=%d\n", *bp);
- break;
- }
-
- offset += 2; /* id & size field */
- offset += *(bp + 1); /* +size offset */
- bp += (*(bp + 1) + 2); /* pointer update */
- }
-
- return 0;
-}
-
-static
-int hostif_data_indication_wpa(struct ks_wlan_private *priv,
- unsigned short auth_type)
-{
- struct ether_hdr *eth_hdr;
- unsigned short eth_proto;
- unsigned char recv_mic[MICHAEL_MIC_LEN];
- char buf[128];
- unsigned long now;
- struct mic_failure *mic_failure;
- u8 mic[MICHAEL_MIC_LEN];
- union iwreq_data wrqu;
- unsigned int key_index = auth_type - 1;
- struct wpa_key *key = &priv->wpa.key[key_index];
-
- eth_hdr = (struct ether_hdr *)(priv->rxp);
- eth_proto = ntohs(eth_hdr->h_proto);
-
- if (eth_hdr->h_dest_snap != eth_hdr->h_source_snap) {
- netdev_err(priv->net_dev, "invalid data format\n");
- priv->nstats.rx_errors++;
- return -EINVAL;
- }
- if (((auth_type == TYPE_PMK1 &&
- priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) ||
- (auth_type == TYPE_GMK1 &&
- priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP) ||
- (auth_type == TYPE_GMK2 &&
- priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)) &&
- key->key_len) {
- int ret;
-
- netdev_dbg(priv->net_dev, "TKIP: protocol=%04X: size=%u\n",
- eth_proto, priv->rx_size);
- /* MIC save */
- memcpy(&recv_mic[0],
- (priv->rxp) + ((priv->rx_size) - sizeof(recv_mic)),
- sizeof(recv_mic));
- priv->rx_size = priv->rx_size - sizeof(recv_mic);
-
- ret = michael_mic(key->rx_mic_key, priv->rxp, priv->rx_size,
- 0, mic);
- if (ret < 0)
- return ret;
- if (memcmp(mic, recv_mic, sizeof(mic)) != 0) {
- now = jiffies;
- mic_failure = &priv->wpa.mic_failure;
- /* MIC FAILURE */
- if (mic_failure->last_failure_time &&
- (now - mic_failure->last_failure_time) / HZ >= 60) {
- mic_failure->failure = 0;
- }
- netdev_err(priv->net_dev, "MIC FAILURE\n");
- if (mic_failure->failure == 0) {
- mic_failure->failure = 1;
- mic_failure->counter = 0;
- } else if (mic_failure->failure == 1) {
- mic_failure->failure = 2;
- mic_failure->counter =
- (u16)((now - mic_failure->last_failure_time) / HZ);
- /* range 1-60 */
- if (!mic_failure->counter)
- mic_failure->counter = 1;
- }
- priv->wpa.mic_failure.last_failure_time = now;
-
- /* needed parameters: count, keyid, key type, TSC */
- sprintf(buf,
- "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)",
- key_index,
- eth_hdr->h_dest[0] & 0x01 ? "broad" : "uni",
- eth_hdr->h_source);
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.length = strlen(buf);
- wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu,
- buf);
- return -EINVAL;
- }
- }
- return 0;
-}
-
-static
-void hostif_data_indication(struct ks_wlan_private *priv)
-{
- unsigned int rx_ind_size; /* indicate data size */
- struct sk_buff *skb;
- u16 auth_type;
- unsigned char temp[256];
- struct ether_hdr *eth_hdr;
- struct ieee802_1x_hdr *aa1x_hdr;
- size_t size;
- int ret;
-
- /* min length check */
- if (priv->rx_size <= ETH_HLEN) {
- priv->nstats.rx_errors++;
- return;
- }
-
- auth_type = get_word(priv); /* AuthType */
- get_word(priv); /* Reserve Area */
-
- eth_hdr = (struct ether_hdr *)(priv->rxp);
-
- /* source address check */
- if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) {
- netdev_err(priv->net_dev, "invalid : source is own mac address !!\n");
- netdev_err(priv->net_dev, "eth_hdrernet->h_dest=%pM\n", eth_hdr->h_source);
- priv->nstats.rx_errors++;
- return;
- }
-
- /* for WPA */
- if (auth_type != TYPE_DATA && priv->wpa.rsn_enabled) {
- ret = hostif_data_indication_wpa(priv, auth_type);
- if (ret)
- return;
- }
-
- if ((priv->connect_status & FORCE_DISCONNECT) ||
- priv->wpa.mic_failure.failure == 2) {
- return;
- }
-
- /* check 13th byte at rx data */
- switch (*(priv->rxp + 12)) {
- case LLC_SAP_SNAP:
- rx_ind_size = priv->rx_size - 6;
- skb = dev_alloc_skb(rx_ind_size);
- if (!skb) {
- priv->nstats.rx_dropped++;
- return;
- }
- netdev_dbg(priv->net_dev, "SNAP, rx_ind_size = %d\n",
- rx_ind_size);
-
- size = ETH_ALEN * 2;
- skb_put_data(skb, priv->rxp, size);
-
- /* (SNAP+UI..) skip */
-
- size = rx_ind_size - (ETH_ALEN * 2);
- skb_put_data(skb, &eth_hdr->h_proto, size);
-
- aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + ETHER_HDR_SIZE);
- break;
- case LLC_SAP_NETBEUI:
- rx_ind_size = (priv->rx_size + 2);
- skb = dev_alloc_skb(rx_ind_size);
- if (!skb) {
- priv->nstats.rx_dropped++;
- return;
- }
- netdev_dbg(priv->net_dev, "NETBEUI/NetBIOS rx_ind_size=%d\n",
- rx_ind_size);
-
- /* 8802/FDDI MAC copy */
- skb_put_data(skb, priv->rxp, 12);
-
- /* NETBEUI size add */
- temp[0] = (((rx_ind_size - 12) >> 8) & 0xff);
- temp[1] = ((rx_ind_size - 12) & 0xff);
- skb_put_data(skb, temp, 2);
-
- /* copy after Type */
- skb_put_data(skb, priv->rxp + 12, rx_ind_size - 14);
-
- aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14);
- break;
- default: /* other rx data */
- netdev_err(priv->net_dev, "invalid data format\n");
- priv->nstats.rx_errors++;
- return;
- }
-
- if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY &&
- priv->wpa.rsn_enabled)
- atomic_set(&priv->psstatus.snooze_guard, 1);
-
- /* rx indication */
- skb->dev = priv->net_dev;
- skb->protocol = eth_type_trans(skb, skb->dev);
- priv->nstats.rx_packets++;
- priv->nstats.rx_bytes += rx_ind_size;
- netif_rx(skb);
-}
-
-static
-void hostif_mib_get_confirm(struct ks_wlan_private *priv)
-{
- struct net_device *dev = priv->net_dev;
- u32 mib_status;
- u32 mib_attribute;
-
- mib_status = get_dword(priv);
- mib_attribute = get_dword(priv);
- get_word(priv); /* mib_val_size */
- get_word(priv); /* mib_val_type */
-
- if (mib_status) {
- netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
- mib_attribute, mib_status);
- return;
- }
-
- switch (mib_attribute) {
- case DOT11_MAC_ADDRESS:
- hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS);
- ether_addr_copy(priv->eth_addr, priv->rxp);
- priv->mac_address_valid = true;
- eth_hw_addr_set(dev, priv->eth_addr);
- netdev_info(dev, "MAC ADDRESS = %pM\n", priv->eth_addr);
- break;
- case DOT11_PRODUCT_VERSION:
- priv->version_size = priv->rx_size;
- memcpy(priv->firmware_version, priv->rxp, priv->rx_size);
- priv->firmware_version[priv->rx_size] = '\0';
- netdev_info(dev, "firmware ver. = %s\n",
- priv->firmware_version);
- hostif_sme_enqueue(priv, SME_GET_PRODUCT_VERSION);
- /* wake_up_interruptible_all(&priv->confirm_wait); */
- complete(&priv->confirm_wait);
- break;
- case LOCAL_GAIN:
- memcpy(&priv->gain, priv->rxp, sizeof(priv->gain));
- netdev_dbg(priv->net_dev, "tx_mode=%d, rx_mode=%d, tx_gain=%d, rx_gain=%d\n",
- priv->gain.tx_mode, priv->gain.rx_mode,
- priv->gain.tx_gain, priv->gain.rx_gain);
- break;
- case LOCAL_EEPROM_SUM:
- memcpy(&priv->eeprom_sum, priv->rxp, sizeof(priv->eeprom_sum));
- if (priv->eeprom_sum.type != 0 &&
- priv->eeprom_sum.type != 1) {
- netdev_err(dev, "LOCAL_EEPROM_SUM error!\n");
- return;
- }
- priv->eeprom_checksum = (priv->eeprom_sum.type == 0) ?
- EEPROM_CHECKSUM_NONE :
- (priv->eeprom_sum.result == 0) ?
- EEPROM_NG : EEPROM_OK;
- break;
- default:
- netdev_err(priv->net_dev, "mib_attribute=%08x\n",
- (unsigned int)mib_attribute);
- break;
- }
-}
-
-static
-void hostif_mib_set_confirm(struct ks_wlan_private *priv)
-{
- u32 mib_status;
- u32 mib_attribute;
-
- mib_status = get_dword(priv);
- mib_attribute = get_dword(priv);
-
- if (mib_status) {
- /* in case of error */
- netdev_err(priv->net_dev, "error :: attribute=%08X, status=%08X\n",
- mib_attribute, mib_status);
- }
-
- switch (mib_attribute) {
- case DOT11_RTS_THRESHOLD:
- hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_CONFIRM);
- break;
- case DOT11_FRAGMENTATION_THRESHOLD:
- hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_CONFIRM);
- break;
- case DOT11_WEP_DEFAULT_KEY_ID:
- if (!priv->wpa.wpa_enabled)
- hostif_sme_enqueue(priv, SME_WEP_INDEX_CONFIRM);
- break;
- case DOT11_WEP_DEFAULT_KEY_VALUE1:
- if (priv->wpa.rsn_enabled)
- hostif_sme_enqueue(priv, SME_SET_PMK_TSC);
- else
- hostif_sme_enqueue(priv, SME_WEP_KEY1_CONFIRM);
- break;
- case DOT11_WEP_DEFAULT_KEY_VALUE2:
- if (priv->wpa.rsn_enabled)
- hostif_sme_enqueue(priv, SME_SET_GMK1_TSC);
- else
- hostif_sme_enqueue(priv, SME_WEP_KEY2_CONFIRM);
- break;
- case DOT11_WEP_DEFAULT_KEY_VALUE3:
- if (priv->wpa.rsn_enabled)
- hostif_sme_enqueue(priv, SME_SET_GMK2_TSC);
- else
- hostif_sme_enqueue(priv, SME_WEP_KEY3_CONFIRM);
- break;
- case DOT11_WEP_DEFAULT_KEY_VALUE4:
- if (!priv->wpa.rsn_enabled)
- hostif_sme_enqueue(priv, SME_WEP_KEY4_CONFIRM);
- break;
- case DOT11_PRIVACY_INVOKED:
- if (!priv->wpa.rsn_enabled)
- hostif_sme_enqueue(priv, SME_WEP_FLAG_CONFIRM);
- break;
- case DOT11_RSN_ENABLED:
- hostif_sme_enqueue(priv, SME_RSN_ENABLED_CONFIRM);
- break;
- case LOCAL_RSN_MODE:
- hostif_sme_enqueue(priv, SME_RSN_MODE_CONFIRM);
- break;
- case LOCAL_MULTICAST_ADDRESS:
- hostif_sme_enqueue(priv, SME_MULTICAST_REQUEST);
- break;
- case LOCAL_MULTICAST_FILTER:
- hostif_sme_enqueue(priv, SME_MULTICAST_CONFIRM);
- break;
- case LOCAL_CURRENTADDRESS:
- priv->mac_address_valid = true;
- break;
- case DOT11_RSN_CONFIG_MULTICAST_CIPHER:
- hostif_sme_enqueue(priv, SME_RSN_MCAST_CONFIRM);
- break;
- case DOT11_RSN_CONFIG_UNICAST_CIPHER:
- hostif_sme_enqueue(priv, SME_RSN_UCAST_CONFIRM);
- break;
- case DOT11_RSN_CONFIG_AUTH_SUITE:
- hostif_sme_enqueue(priv, SME_RSN_AUTH_CONFIRM);
- break;
- case DOT11_GMK1_TSC:
- if (atomic_read(&priv->psstatus.snooze_guard))
- atomic_set(&priv->psstatus.snooze_guard, 0);
- break;
- case DOT11_GMK2_TSC:
- if (atomic_read(&priv->psstatus.snooze_guard))
- atomic_set(&priv->psstatus.snooze_guard, 0);
- break;
- case DOT11_PMK_TSC:
- case LOCAL_PMK:
- case LOCAL_GAIN:
- case LOCAL_WPS_ENABLE:
- case LOCAL_WPS_PROBE_REQ:
- case LOCAL_REGION:
- default:
- break;
- }
-}
-
-static
-void hostif_power_mgmt_confirm(struct ks_wlan_private *priv)
-{
- if (priv->reg.power_mgmt > POWER_MGMT_ACTIVE &&
- priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
- atomic_set(&priv->psstatus.confirm_wait, 0);
- priv->dev_state = DEVICE_STATE_SLEEP;
- ks_wlan_hw_power_save(priv);
- } else {
- priv->dev_state = DEVICE_STATE_READY;
- }
-}
-
-static
-void hostif_sleep_confirm(struct ks_wlan_private *priv)
-{
- atomic_set(&priv->sleepstatus.doze_request, 1);
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
-}
-
-static
-void hostif_start_confirm(struct ks_wlan_private *priv)
-{
- union iwreq_data wrqu;
-
- wrqu.data.length = 0;
- wrqu.data.flags = 0;
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- if (is_connect_status(priv->connect_status)) {
- eth_zero_addr(wrqu.ap_addr.sa_data);
- wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL);
- }
- netdev_dbg(priv->net_dev, " scan_ind_count=%d\n", priv->scan_ind_count);
- hostif_sme_enqueue(priv, SME_START_CONFIRM);
-}
-
-static
-void hostif_connect_indication(struct ks_wlan_private *priv)
-{
- u16 connect_code;
- unsigned int tmp = 0;
- unsigned int old_status = priv->connect_status;
- struct net_device *netdev = priv->net_dev;
- union iwreq_data wrqu0;
-
- connect_code = get_word(priv);
-
- switch (connect_code) {
- case RESULT_CONNECT:
- if (!(priv->connect_status & FORCE_DISCONNECT))
- netif_carrier_on(netdev);
- tmp = FORCE_DISCONNECT & priv->connect_status;
- priv->connect_status = tmp + CONNECT_STATUS;
- break;
- case RESULT_DISCONNECT:
- netif_carrier_off(netdev);
- tmp = FORCE_DISCONNECT & priv->connect_status;
- priv->connect_status = tmp + DISCONNECT_STATUS;
- break;
- default:
- netdev_dbg(priv->net_dev, "unknown connect_code=%d :: scan_ind_count=%d\n",
- connect_code, priv->scan_ind_count);
- netif_carrier_off(netdev);
- tmp = FORCE_DISCONNECT & priv->connect_status;
- priv->connect_status = tmp + DISCONNECT_STATUS;
- break;
- }
-
- get_current_ap(priv, (struct link_ap_info *)priv->rxp);
- if (is_connect_status(priv->connect_status) &&
- is_disconnect_status(old_status)) {
- /* for power save */
- atomic_set(&priv->psstatus.snooze_guard, 0);
- atomic_set(&priv->psstatus.confirm_wait, 0);
- }
- ks_wlan_do_power_save(priv);
-
- wrqu0.data.length = 0;
- wrqu0.data.flags = 0;
- wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
- if (is_disconnect_status(priv->connect_status) &&
- is_connect_status(old_status)) {
- eth_zero_addr(wrqu0.ap_addr.sa_data);
- netdev_dbg(priv->net_dev, "disconnect :: scan_ind_count=%d\n",
- priv->scan_ind_count);
- wireless_send_event(netdev, SIOCGIWAP, &wrqu0, NULL);
- }
- priv->scan_ind_count = 0;
-}
-
-static
-void hostif_scan_indication(struct ks_wlan_private *priv)
-{
- int i;
- struct ap_info *ap_info;
-
- netdev_dbg(priv->net_dev,
- "scan_ind_count = %d\n", priv->scan_ind_count);
- ap_info = (struct ap_info *)(priv->rxp);
-
- if (priv->scan_ind_count) {
- /* bssid check */
- for (i = 0; i < priv->aplist.size; i++) {
- u8 *bssid = priv->aplist.ap[i].bssid;
-
- if (ether_addr_equal(ap_info->bssid, bssid))
- continue;
-
- if (ap_info->frame_type == IEEE80211_STYPE_PROBE_RESP)
- get_ap_information(priv, ap_info,
- &priv->aplist.ap[i]);
- return;
- }
- }
- priv->scan_ind_count++;
- if (priv->scan_ind_count < LOCAL_APLIST_MAX + 1) {
- netdev_dbg(priv->net_dev, " scan_ind_count=%d :: aplist.size=%d\n",
- priv->scan_ind_count, priv->aplist.size);
- get_ap_information(priv, (struct ap_info *)(priv->rxp),
- &priv->aplist.ap[priv->scan_ind_count - 1]);
- priv->aplist.size = priv->scan_ind_count;
- } else {
- netdev_dbg(priv->net_dev, " count over :: scan_ind_count=%d\n",
- priv->scan_ind_count);
- }
-}
-
-static
-void hostif_stop_confirm(struct ks_wlan_private *priv)
-{
- unsigned int tmp = 0;
- unsigned int old_status = priv->connect_status;
- struct net_device *netdev = priv->net_dev;
- union iwreq_data wrqu0;
-
- if (priv->dev_state == DEVICE_STATE_SLEEP)
- priv->dev_state = DEVICE_STATE_READY;
-
- /* disconnect indication */
- if (is_connect_status(priv->connect_status)) {
- netif_carrier_off(netdev);
- tmp = FORCE_DISCONNECT & priv->connect_status;
- priv->connect_status = tmp | DISCONNECT_STATUS;
- netdev_info(netdev, "IWEVENT: disconnect\n");
-
- wrqu0.data.length = 0;
- wrqu0.data.flags = 0;
- wrqu0.ap_addr.sa_family = ARPHRD_ETHER;
- if (is_disconnect_status(priv->connect_status) &&
- is_connect_status(old_status)) {
- eth_zero_addr(wrqu0.ap_addr.sa_data);
- netdev_info(netdev, "IWEVENT: disconnect\n");
- wireless_send_event(netdev, SIOCGIWAP, &wrqu0, NULL);
- }
- priv->scan_ind_count = 0;
- }
-
- hostif_sme_enqueue(priv, SME_STOP_CONFIRM);
-}
-
-static
-void hostif_ps_adhoc_set_confirm(struct ks_wlan_private *priv)
-{
- priv->infra_status = 0; /* infrastructure mode cancel */
- hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
-}
-
-static
-void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
-{
- get_word(priv); /* result_code */
- priv->infra_status = 1; /* infrastructure mode set */
- hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
-}
-
-static
-void hostif_adhoc_set_confirm(struct ks_wlan_private *priv)
-{
- priv->infra_status = 1; /* infrastructure mode set */
- hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
-}
-
-static
-void hostif_associate_indication(struct ks_wlan_private *priv)
-{
- struct association_request *assoc_req;
- struct association_response *assoc_resp;
- unsigned char *pb;
- union iwreq_data wrqu;
- char buf[IW_CUSTOM_MAX];
- char *pbuf = &buf[0];
- int i;
-
- static const char associnfo_leader0[] = "ASSOCINFO(ReqIEs=";
- static const char associnfo_leader1[] = " RespIEs=";
-
- assoc_req = (struct association_request *)(priv->rxp);
- assoc_resp = (struct association_response *)(assoc_req + 1);
- pb = (unsigned char *)(assoc_resp + 1);
-
- memset(&wrqu, 0, sizeof(wrqu));
- memcpy(pbuf, associnfo_leader0, sizeof(associnfo_leader0) - 1);
- wrqu.data.length += sizeof(associnfo_leader0) - 1;
- pbuf += sizeof(associnfo_leader0) - 1;
-
- for (i = 0; i < le16_to_cpu(assoc_req->req_ies_size); i++)
- pbuf += sprintf(pbuf, "%02x", *(pb + i));
- wrqu.data.length += (le16_to_cpu(assoc_req->req_ies_size)) * 2;
-
- memcpy(pbuf, associnfo_leader1, sizeof(associnfo_leader1) - 1);
- wrqu.data.length += sizeof(associnfo_leader1) - 1;
- pbuf += sizeof(associnfo_leader1) - 1;
-
- pb += le16_to_cpu(assoc_req->req_ies_size);
- for (i = 0; i < le16_to_cpu(assoc_resp->resp_ies_size); i++)
- pbuf += sprintf(pbuf, "%02x", *(pb + i));
- wrqu.data.length += (le16_to_cpu(assoc_resp->resp_ies_size)) * 2;
-
- pbuf += sprintf(pbuf, ")");
- wrqu.data.length += 1;
-
- wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu, buf);
-}
-
-static
-void hostif_bss_scan_confirm(struct ks_wlan_private *priv)
-{
- u32 result_code;
- struct net_device *dev = priv->net_dev;
- union iwreq_data wrqu;
-
- result_code = get_dword(priv);
- netdev_dbg(priv->net_dev, "result=%d :: scan_ind_count=%d\n",
- result_code, priv->scan_ind_count);
-
- priv->sme_i.sme_flag &= ~SME_AP_SCAN;
- hostif_sme_enqueue(priv, SME_BSS_SCAN_CONFIRM);
-
- wrqu.data.length = 0;
- wrqu.data.flags = 0;
- wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
- priv->scan_ind_count = 0;
-}
-
-static
-void hostif_phy_information_confirm(struct ks_wlan_private *priv)
-{
- struct iw_statistics *wstats = &priv->wstats;
- u8 rssi, signal;
- u8 link_speed;
- u32 transmitted_frame_count, received_fragment_count;
- u32 failed_count, fcs_error_count;
-
- rssi = get_byte(priv);
- signal = get_byte(priv);
- get_byte(priv); /* noise */
- link_speed = get_byte(priv);
- transmitted_frame_count = get_dword(priv);
- received_fragment_count = get_dword(priv);
- failed_count = get_dword(priv);
- fcs_error_count = get_dword(priv);
-
- netdev_dbg(priv->net_dev, "phyinfo confirm rssi=%d signal=%d\n",
- rssi, signal);
- priv->current_rate = (link_speed & RATE_MASK);
- wstats->qual.qual = signal;
- wstats->qual.level = 256 - rssi;
- wstats->qual.noise = 0; /* invalid noise value */
- wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
-
- netdev_dbg(priv->net_dev, "\n rssi=%u\n"
- " signal=%u\n"
- " link_speed=%ux500Kbps\n"
- " transmitted_frame_count=%u\n"
- " received_fragment_count=%u\n"
- " failed_count=%u\n"
- " fcs_error_count=%u\n",
- rssi, signal, link_speed, transmitted_frame_count,
- received_fragment_count, failed_count, fcs_error_count);
- /* wake_up_interruptible_all(&priv->confirm_wait); */
- complete(&priv->confirm_wait);
-}
-
-static
-void hostif_mic_failure_confirm(struct ks_wlan_private *priv)
-{
- netdev_dbg(priv->net_dev, "mic_failure=%u\n",
- priv->wpa.mic_failure.failure);
- hostif_sme_enqueue(priv, SME_MIC_FAILURE_CONFIRM);
-}
-
-static
-void hostif_event_check(struct ks_wlan_private *priv)
-{
- u16 event;
-
- event = get_word(priv);
- switch (event) {
- case HIF_DATA_IND:
- hostif_data_indication(priv);
- break;
- case HIF_MIB_GET_CONF:
- hostif_mib_get_confirm(priv);
- break;
- case HIF_MIB_SET_CONF:
- hostif_mib_set_confirm(priv);
- break;
- case HIF_POWER_MGMT_CONF:
- hostif_power_mgmt_confirm(priv);
- break;
- case HIF_SLEEP_CONF:
- hostif_sleep_confirm(priv);
- break;
- case HIF_START_CONF:
- hostif_start_confirm(priv);
- break;
- case HIF_CONNECT_IND:
- hostif_connect_indication(priv);
- break;
- case HIF_STOP_CONF:
- hostif_stop_confirm(priv);
- break;
- case HIF_PS_ADH_SET_CONF:
- hostif_ps_adhoc_set_confirm(priv);
- break;
- case HIF_INFRA_SET_CONF:
- case HIF_INFRA_SET2_CONF:
- hostif_infrastructure_set_confirm(priv);
- break;
- case HIF_ADH_SET_CONF:
- case HIF_ADH_SET2_CONF:
- hostif_adhoc_set_confirm(priv);
- break;
- case HIF_ASSOC_INFO_IND:
- hostif_associate_indication(priv);
- break;
- case HIF_MIC_FAILURE_CONF:
- hostif_mic_failure_confirm(priv);
- break;
- case HIF_SCAN_CONF:
- hostif_bss_scan_confirm(priv);
- break;
- case HIF_PHY_INFO_CONF:
- case HIF_PHY_INFO_IND:
- hostif_phy_information_confirm(priv);
- break;
- case HIF_SCAN_IND:
- hostif_scan_indication(priv);
- break;
- case HIF_AP_SET_CONF:
- default:
- netdev_err(priv->net_dev, "undefined event[%04X]\n", event);
- /* wake_up_all(&priv->confirm_wait); */
- complete(&priv->confirm_wait);
- break;
- }
-
- /* add event to hostt buffer */
- priv->hostt.buff[priv->hostt.qtail] = event;
- priv->hostt.qtail = (priv->hostt.qtail + 1) % SME_EVENT_BUFF_SIZE;
-}
-
-/* allocate size bytes, set header size and event */
-static void *hostif_generic_request(size_t size, int event)
-{
- struct hostif_hdr *p;
-
- p = kzalloc(hif_align_size(size), GFP_ATOMIC);
- if (!p)
- return NULL;
-
- p->size = cpu_to_le16(size - sizeof(p->size));
- p->event = cpu_to_le16(event);
-
- return p;
-}
-
-int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
-{
- unsigned int skb_len = 0;
- unsigned char *buffer = NULL;
- unsigned int length = 0;
- struct hostif_data_request *pp;
- unsigned char *p;
- unsigned short eth_proto;
- struct ether_hdr *eth_hdr;
- unsigned short keyinfo = 0;
- struct ieee802_1x_hdr *aa1x_hdr;
- struct wpa_eapol_key *eap_key;
- struct ethhdr *eth;
- size_t size;
- int ret;
-
- skb_len = skb->len;
- if (skb_len > ETH_FRAME_LEN) {
- netdev_err(priv->net_dev, "bad length skb_len=%d\n", skb_len);
- ret = -EOVERFLOW;
- goto err_kfree_skb;
- }
-
- if (is_disconnect_status(priv->connect_status) ||
- (priv->connect_status & FORCE_DISCONNECT) ||
- priv->wpa.mic_failure.stop) {
- if (netif_queue_stopped(priv->net_dev))
- netif_wake_queue(priv->net_dev);
-
- dev_kfree_skb(skb);
-
- return 0;
- }
-
- /* power save wakeup */
- if (atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
- if (!netif_queue_stopped(priv->net_dev))
- netif_stop_queue(priv->net_dev);
- }
-
- size = sizeof(*pp) + 6 + skb_len + 8;
- pp = kmalloc(hif_align_size(size), GFP_ATOMIC);
- if (!pp) {
- ret = -ENOMEM;
- goto err_kfree_skb;
- }
-
- p = (unsigned char *)pp->data;
-
- buffer = skb->data;
- length = skb->len;
-
- /* skb check */
- eth = (struct ethhdr *)skb->data;
- if (!ether_addr_equal(&priv->eth_addr[0], eth->h_source)) {
- netdev_err(priv->net_dev,
- "Invalid mac address: ethernet->h_source=%pM\n",
- eth->h_source);
- ret = -ENXIO;
- goto err_kfree;
- }
-
- /* dest and src MAC address copy */
- size = ETH_ALEN * 2;
- memcpy(p, buffer, size);
- p += size;
- buffer += size;
- length -= size;
-
- /* EtherType/Length check */
- if (*(buffer + 1) + (*buffer << 8) > 1500) {
- /* ProtocolEAP = *(buffer+1) + (*buffer << 8); */
- /* SAP/CTL/OUI(6 byte) add */
- *p++ = 0xAA; /* DSAP */
- *p++ = 0xAA; /* SSAP */
- *p++ = 0x03; /* CTL */
- *p++ = 0x00; /* OUI ("000000") */
- *p++ = 0x00; /* OUI ("000000") */
- *p++ = 0x00; /* OUI ("000000") */
- skb_len += 6;
- } else {
- /* Length(2 byte) delete */
- buffer += 2;
- length -= 2;
- skb_len -= 2;
- }
-
- /* pp->data copy */
- memcpy(p, buffer, length);
-
- p += length;
-
- /* for WPA */
- eth_hdr = (struct ether_hdr *)&pp->data[0];
- eth_proto = ntohs(eth_hdr->h_proto);
-
- /* for MIC FAILURE REPORT check */
- if (eth_proto == ETH_P_PAE &&
- priv->wpa.mic_failure.failure > 0) {
- aa1x_hdr = (struct ieee802_1x_hdr *)(eth_hdr + 1);
- if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY) {
- eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1);
- keyinfo = ntohs(eap_key->key_info);
- }
- }
-
- if (priv->wpa.rsn_enabled && priv->wpa.key[0].key_len) {
- /* no encryption */
- if (eth_proto == ETH_P_PAE &&
- priv->wpa.key[1].key_len == 0 &&
- priv->wpa.key[2].key_len == 0 &&
- priv->wpa.key[3].key_len == 0) {
- pp->auth_type = cpu_to_le16(TYPE_AUTH);
- } else {
- if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) {
- u8 mic[MICHAEL_MIC_LEN];
-
- ret = michael_mic(priv->wpa.key[0].tx_mic_key,
- &pp->data[0], skb_len,
- 0, mic);
- if (ret < 0)
- goto err_kfree;
-
- memcpy(p, mic, sizeof(mic));
- length += sizeof(mic);
- skb_len += sizeof(mic);
- p += sizeof(mic);
- pp->auth_type =
- cpu_to_le16(TYPE_DATA);
- } else if (priv->wpa.pairwise_suite ==
- IW_AUTH_CIPHER_CCMP) {
- pp->auth_type =
- cpu_to_le16(TYPE_DATA);
- }
- }
- } else {
- if (eth_proto == ETH_P_PAE)
- pp->auth_type = cpu_to_le16(TYPE_AUTH);
- else
- pp->auth_type = cpu_to_le16(TYPE_DATA);
- }
-
- /* header value set */
- pp->header.size =
- cpu_to_le16((sizeof(*pp) - sizeof(pp->header.size) + skb_len));
- pp->header.event = cpu_to_le16(HIF_DATA_REQ);
-
- /* tx request */
- ret = ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len),
- send_packet_complete, skb);
-
- /* MIC FAILURE REPORT check */
- if (eth_proto == ETH_P_PAE &&
- priv->wpa.mic_failure.failure > 0) {
- if (keyinfo & WPA_KEY_INFO_ERROR &&
- keyinfo & WPA_KEY_INFO_REQUEST) {
- netdev_err(priv->net_dev,
- "MIC ERROR Report SET : %04X\n", keyinfo);
- hostif_sme_enqueue(priv, SME_MIC_FAILURE_REQUEST);
- }
- if (priv->wpa.mic_failure.failure == 2)
- priv->wpa.mic_failure.stop = 1;
- }
-
- return ret;
-
-err_kfree:
- kfree(pp);
-err_kfree_skb:
- dev_kfree_skb(skb);
-
- return ret;
-}
-
-static inline void ps_confirm_wait_inc(struct ks_wlan_private *priv)
-{
- if (atomic_read(&priv->psstatus.status) > PS_ACTIVE_SET)
- atomic_inc(&priv->psstatus.confirm_wait);
-}
-
-static inline void send_request_to_device(struct ks_wlan_private *priv,
- void *data, size_t size)
-{
- ps_confirm_wait_inc(priv);
- ks_wlan_hw_tx(priv, data, size, NULL, NULL);
-}
-
-static void hostif_mib_get_request(struct ks_wlan_private *priv,
- u32 mib_attribute)
-{
- struct hostif_mib_get_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_MIB_GET_REQ);
- if (!pp)
- return;
-
- pp->mib_attribute = cpu_to_le32(mib_attribute);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static void hostif_mib_set_request(struct ks_wlan_private *priv,
- enum mib_attribute attr,
- enum mib_data_type type,
- void *data, size_t size)
-{
- struct hostif_mib_set_request_t *pp;
-
- if (priv->dev_state < DEVICE_STATE_BOOT)
- return;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_MIB_SET_REQ);
- if (!pp)
- return;
-
- pp->mib_attribute = cpu_to_le32(attr);
- pp->mib_value.size = cpu_to_le16(size);
- pp->mib_value.type = cpu_to_le16(type);
- memcpy(&pp->mib_value.body, data, size);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp) + size));
-}
-
-static inline void hostif_mib_set_request_int(struct ks_wlan_private *priv,
- enum mib_attribute attr, int val)
-{
- __le32 v = cpu_to_le32(val);
- size_t size = sizeof(v);
-
- hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_INT, &v, size);
-}
-
-static inline void hostif_mib_set_request_bool(struct ks_wlan_private *priv,
- enum mib_attribute attr,
- bool val)
-{
- __le32 v = cpu_to_le32(val);
- size_t size = sizeof(v);
-
- hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_BOOL, &v, size);
-}
-
-static inline void hostif_mib_set_request_ostring(struct ks_wlan_private *priv,
- enum mib_attribute attr,
- void *data, size_t size)
-{
- hostif_mib_set_request(priv, attr, MIB_VALUE_TYPE_OSTRING, data, size);
-}
-
-static
-void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode)
-{
- struct hostif_start_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_START_REQ);
- if (!pp)
- return;
-
- pp->mode = cpu_to_le16(mode);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-
- priv->aplist.size = 0;
- priv->scan_ind_count = 0;
-}
-
-static __le16 ks_wlan_cap(struct ks_wlan_private *priv)
-{
- u16 capability = 0x0000;
-
- if (priv->reg.preamble == SHORT_PREAMBLE)
- capability |= WLAN_CAPABILITY_SHORT_PREAMBLE;
-
- capability &= ~(WLAN_CAPABILITY_PBCC); /* pbcc not support */
-
- if (priv->reg.phy_type != D_11B_ONLY_MODE) {
- capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
- capability &= ~(WLAN_CAPABILITY_DSSS_OFDM);
- }
-
- return cpu_to_le16(capability);
-}
-
-static void init_request(struct ks_wlan_private *priv,
- struct hostif_request *req)
-{
- req->phy_type = cpu_to_le16(priv->reg.phy_type);
- req->cts_mode = cpu_to_le16(priv->reg.cts_mode);
- req->scan_type = cpu_to_le16(priv->reg.scan_type);
- req->rate_set.size = priv->reg.rate_set.size;
- req->capability = ks_wlan_cap(priv);
- memcpy(&req->rate_set.body[0], &priv->reg.rate_set.body[0],
- priv->reg.rate_set.size);
-}
-
-static
-void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv)
-{
- struct hostif_ps_adhoc_set_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_PS_ADH_SET_REQ);
- if (!pp)
- return;
-
- init_request(priv, &pp->request);
- pp->channel = cpu_to_le16(priv->reg.channel);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_infrastructure_set_request(struct ks_wlan_private *priv, int event)
-{
- struct hostif_infrastructure_set_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), event);
- if (!pp)
- return;
-
- init_request(priv, &pp->request);
- pp->ssid.size = priv->reg.ssid.size;
- memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size);
- pp->beacon_lost_count =
- cpu_to_le16(priv->reg.beacon_lost_count);
- pp->auth_type = cpu_to_le16(priv->reg.authenticate_type);
-
- pp->channel_list.body[0] = 1;
- pp->channel_list.body[1] = 8;
- pp->channel_list.body[2] = 2;
- pp->channel_list.body[3] = 9;
- pp->channel_list.body[4] = 3;
- pp->channel_list.body[5] = 10;
- pp->channel_list.body[6] = 4;
- pp->channel_list.body[7] = 11;
- pp->channel_list.body[8] = 5;
- pp->channel_list.body[9] = 12;
- pp->channel_list.body[10] = 6;
- pp->channel_list.body[11] = 13;
- pp->channel_list.body[12] = 7;
- if (priv->reg.phy_type == D_11G_ONLY_MODE) {
- pp->channel_list.size = 13;
- } else {
- pp->channel_list.body[13] = 14;
- pp->channel_list.size = 14;
- }
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_adhoc_set_request(struct ks_wlan_private *priv)
-{
- struct hostif_adhoc_set_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_ADH_SET_REQ);
- if (!pp)
- return;
-
- init_request(priv, &pp->request);
- pp->channel = cpu_to_le16(priv->reg.channel);
- pp->ssid.size = priv->reg.ssid.size;
- memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_adhoc_set2_request(struct ks_wlan_private *priv)
-{
- struct hostif_adhoc_set2_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_ADH_SET_REQ);
- if (!pp)
- return;
-
- init_request(priv, &pp->request);
- pp->ssid.size = priv->reg.ssid.size;
- memcpy(&pp->ssid.body[0], &priv->reg.ssid.body[0], priv->reg.ssid.size);
-
- pp->channel_list.body[0] = priv->reg.channel;
- pp->channel_list.size = 1;
- memcpy(pp->bssid, priv->reg.bssid, ETH_ALEN);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_stop_request(struct ks_wlan_private *priv)
-{
- struct hostif_stop_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_STOP_REQ);
- if (!pp)
- return;
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_phy_information_request(struct ks_wlan_private *priv)
-{
- struct hostif_phy_information_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_PHY_INFO_REQ);
- if (!pp)
- return;
-
- if (priv->reg.phy_info_timer) {
- pp->type = cpu_to_le16(TIME_TYPE);
- pp->time = cpu_to_le16(priv->reg.phy_info_timer);
- } else {
- pp->type = cpu_to_le16(NORMAL_TYPE);
- pp->time = cpu_to_le16(0);
- }
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_power_mgmt_request(struct ks_wlan_private *priv,
- u32 mode, u32 wake_up, u32 receive_dtims)
-{
- struct hostif_power_mgmt_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_POWER_MGMT_REQ);
- if (!pp)
- return;
-
- pp->mode = cpu_to_le32(mode);
- pp->wake_up = cpu_to_le32(wake_up);
- pp->receive_dtims = cpu_to_le32(receive_dtims);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-static
-void hostif_sleep_request(struct ks_wlan_private *priv,
- enum sleep_mode_type mode)
-{
- struct hostif_sleep_request *pp;
-
- if (mode == SLP_SLEEP) {
- pp = hostif_generic_request(sizeof(*pp), HIF_SLEEP_REQ);
- if (!pp)
- return;
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
- } else if (mode == SLP_ACTIVE) {
- atomic_set(&priv->sleepstatus.wakeup_request, 1);
- queue_delayed_work(priv->wq, &priv->rw_dwork, 1);
- } else {
- netdev_err(priv->net_dev, "invalid mode %ld\n", (long)mode);
- return;
- }
-}
-
-static
-void hostif_bss_scan_request(struct ks_wlan_private *priv,
- unsigned long scan_type, u8 *scan_ssid,
- u8 scan_ssid_len)
-{
- struct hostif_bss_scan_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_SCAN_REQ);
- if (!pp)
- return;
-
- pp->scan_type = scan_type;
-
- pp->ch_time_min = cpu_to_le32(110); /* default value */
- pp->ch_time_max = cpu_to_le32(130); /* default value */
- pp->channel_list.body[0] = 1;
- pp->channel_list.body[1] = 8;
- pp->channel_list.body[2] = 2;
- pp->channel_list.body[3] = 9;
- pp->channel_list.body[4] = 3;
- pp->channel_list.body[5] = 10;
- pp->channel_list.body[6] = 4;
- pp->channel_list.body[7] = 11;
- pp->channel_list.body[8] = 5;
- pp->channel_list.body[9] = 12;
- pp->channel_list.body[10] = 6;
- pp->channel_list.body[11] = 13;
- pp->channel_list.body[12] = 7;
- if (priv->reg.phy_type == D_11G_ONLY_MODE) {
- pp->channel_list.size = 13;
- } else {
- pp->channel_list.body[13] = 14;
- pp->channel_list.size = 14;
- }
- pp->ssid.size = 0;
-
- /* specified SSID SCAN */
- if (scan_ssid_len > 0 && scan_ssid_len <= 32) {
- pp->ssid.size = scan_ssid_len;
- memcpy(&pp->ssid.body[0], scan_ssid, scan_ssid_len);
- }
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-
- priv->aplist.size = 0;
- priv->scan_ind_count = 0;
-}
-
-static
-void hostif_mic_failure_request(struct ks_wlan_private *priv,
- u16 failure_count, u16 timer)
-{
- struct hostif_mic_failure_request *pp;
-
- pp = hostif_generic_request(sizeof(*pp), HIF_MIC_FAILURE_REQ);
- if (!pp)
- return;
-
- pp->failure_count = cpu_to_le16(failure_count);
- pp->timer = cpu_to_le16(timer);
-
- send_request_to_device(priv, pp, hif_align_size(sizeof(*pp)));
-}
-
-/* Device I/O Receive indicate */
-static void devio_rec_ind(struct ks_wlan_private *priv, unsigned char *p,
- unsigned int size)
-{
- if (!priv->is_device_open)
- return;
-
- spin_lock(&priv->dev_read_lock);
- priv->dev_data[atomic_read(&priv->rec_count)] = p;
- priv->dev_size[atomic_read(&priv->rec_count)] = size;
-
- if (atomic_read(&priv->event_count) != DEVICE_STOCK_COUNT) {
- /* rx event count inc */
- atomic_inc(&priv->event_count);
- }
- atomic_inc(&priv->rec_count);
- if (atomic_read(&priv->rec_count) == DEVICE_STOCK_COUNT)
- atomic_set(&priv->rec_count, 0);
-
- wake_up_interruptible_all(&priv->devread_wait);
-
- spin_unlock(&priv->dev_read_lock);
-}
-
-void hostif_receive(struct ks_wlan_private *priv, unsigned char *p,
- unsigned int size)
-{
- devio_rec_ind(priv, p, size);
-
- priv->rxp = p;
- priv->rx_size = size;
-
- if (get_word(priv) == priv->rx_size)
- hostif_event_check(priv);
-}
-
-static void hostif_sme_set_wep(struct ks_wlan_private *priv, int type)
-{
- switch (type) {
- case SME_WEP_INDEX_REQUEST:
- hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID,
- priv->reg.wep_index);
- break;
- case SME_WEP_KEY1_REQUEST:
- if (priv->wpa.wpa_enabled)
- return;
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE1,
- &priv->reg.wep_key[0].val[0],
- priv->reg.wep_key[0].size);
- break;
- case SME_WEP_KEY2_REQUEST:
- if (priv->wpa.wpa_enabled)
- return;
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE2,
- &priv->reg.wep_key[1].val[0],
- priv->reg.wep_key[1].size);
- break;
- case SME_WEP_KEY3_REQUEST:
- if (priv->wpa.wpa_enabled)
- return;
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE3,
- &priv->reg.wep_key[2].val[0],
- priv->reg.wep_key[2].size);
- break;
- case SME_WEP_KEY4_REQUEST:
- if (priv->wpa.wpa_enabled)
- return;
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE4,
- &priv->reg.wep_key[3].val[0],
- priv->reg.wep_key[3].size);
- break;
- case SME_WEP_FLAG_REQUEST:
- hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED,
- priv->reg.privacy_invoked);
- break;
- }
-}
-
-struct wpa_suite {
- __le16 size;
- unsigned char suite[4][CIPHER_ID_LEN];
-} __packed;
-
-struct rsn_mode {
- __le32 rsn_mode;
- __le16 rsn_capability;
-} __packed;
-
-static void hostif_sme_set_rsn(struct ks_wlan_private *priv, int type)
-{
- struct wpa_suite wpa_suite;
- struct rsn_mode rsn_mode;
- size_t size;
- u32 mode;
- const u8 *buf = NULL;
-
- memset(&wpa_suite, 0, sizeof(wpa_suite));
-
- switch (type) {
- case SME_RSN_UCAST_REQUEST:
- wpa_suite.size = cpu_to_le16(1);
- switch (priv->wpa.pairwise_suite) {
- case IW_AUTH_CIPHER_NONE:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_NONE : CIPHER_ID_WPA_NONE;
- break;
- case IW_AUTH_CIPHER_WEP40:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_WEP40 : CIPHER_ID_WPA_WEP40;
- break;
- case IW_AUTH_CIPHER_TKIP:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_TKIP : CIPHER_ID_WPA_TKIP;
- break;
- case IW_AUTH_CIPHER_CCMP:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_CCMP : CIPHER_ID_WPA_CCMP;
- break;
- case IW_AUTH_CIPHER_WEP104:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_WEP104 : CIPHER_ID_WPA_WEP104;
- break;
- }
-
- if (buf)
- memcpy(&wpa_suite.suite[0][0], buf, CIPHER_ID_LEN);
- size = sizeof(wpa_suite.size) +
- (CIPHER_ID_LEN * le16_to_cpu(wpa_suite.size));
- hostif_mib_set_request_ostring(priv,
- DOT11_RSN_CONFIG_UNICAST_CIPHER,
- &wpa_suite, size);
- break;
- case SME_RSN_MCAST_REQUEST:
- switch (priv->wpa.group_suite) {
- case IW_AUTH_CIPHER_NONE:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_NONE : CIPHER_ID_WPA_NONE;
- break;
- case IW_AUTH_CIPHER_WEP40:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_WEP40 : CIPHER_ID_WPA_WEP40;
- break;
- case IW_AUTH_CIPHER_TKIP:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_TKIP : CIPHER_ID_WPA_TKIP;
- break;
- case IW_AUTH_CIPHER_CCMP:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_CCMP : CIPHER_ID_WPA_CCMP;
- break;
- case IW_AUTH_CIPHER_WEP104:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- CIPHER_ID_WPA2_WEP104 : CIPHER_ID_WPA_WEP104;
- break;
- }
- if (buf)
- memcpy(&wpa_suite.suite[0][0], buf, CIPHER_ID_LEN);
- hostif_mib_set_request_ostring(priv,
- DOT11_RSN_CONFIG_MULTICAST_CIPHER,
- &wpa_suite.suite[0][0],
- CIPHER_ID_LEN);
- break;
- case SME_RSN_AUTH_REQUEST:
- wpa_suite.size = cpu_to_le16(1);
- switch (priv->wpa.key_mgmt_suite) {
- case IW_AUTH_KEY_MGMT_802_1X:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- KEY_MGMT_ID_WPA2_1X : KEY_MGMT_ID_WPA_1X;
- break;
- case IW_AUTH_KEY_MGMT_PSK:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- KEY_MGMT_ID_WPA2_PSK : KEY_MGMT_ID_WPA_PSK;
- break;
- case 0:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- KEY_MGMT_ID_WPA2_NONE : KEY_MGMT_ID_WPA_NONE;
- break;
- case 4:
- buf = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- KEY_MGMT_ID_WPA2_WPANONE :
- KEY_MGMT_ID_WPA_WPANONE;
- break;
- }
-
- if (buf)
- memcpy(&wpa_suite.suite[0][0], buf, KEY_MGMT_ID_LEN);
- size = sizeof(wpa_suite.size) +
- (KEY_MGMT_ID_LEN * le16_to_cpu(wpa_suite.size));
- hostif_mib_set_request_ostring(priv,
- DOT11_RSN_CONFIG_AUTH_SUITE,
- &wpa_suite, size);
- break;
- case SME_RSN_ENABLED_REQUEST:
- hostif_mib_set_request_bool(priv, DOT11_RSN_ENABLED,
- priv->wpa.rsn_enabled);
- break;
- case SME_RSN_MODE_REQUEST:
- mode = (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA2) ?
- RSN_MODE_WPA2 :
- (priv->wpa.version == IW_AUTH_WPA_VERSION_WPA) ?
- RSN_MODE_WPA : RSN_MODE_NONE;
- rsn_mode.rsn_mode = cpu_to_le32(mode);
- rsn_mode.rsn_capability = cpu_to_le16(0);
- hostif_mib_set_request_ostring(priv, LOCAL_RSN_MODE,
- &rsn_mode, sizeof(rsn_mode));
- break;
- }
-}
-
-static
-void hostif_sme_mode_setup(struct ks_wlan_private *priv)
-{
- unsigned char rate_size;
- unsigned char rate_octet[RATE_SET_MAX_SIZE];
- int i = 0;
-
- /* rate setting if rate segging is auto for changing phy_type (#94) */
- if (priv->reg.tx_rate == TX_RATE_FULL_AUTO) {
- if (priv->reg.phy_type == D_11B_ONLY_MODE) {
- priv->reg.rate_set.body[3] = TX_RATE_11M;
- priv->reg.rate_set.body[2] = TX_RATE_5M;
- priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE;
- priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE;
- priv->reg.rate_set.size = 4;
- } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
- priv->reg.rate_set.body[11] = TX_RATE_54M;
- priv->reg.rate_set.body[10] = TX_RATE_48M;
- priv->reg.rate_set.body[9] = TX_RATE_36M;
- priv->reg.rate_set.body[8] = TX_RATE_18M;
- priv->reg.rate_set.body[7] = TX_RATE_9M;
- priv->reg.rate_set.body[6] = TX_RATE_24M | BASIC_RATE;
- priv->reg.rate_set.body[5] = TX_RATE_12M | BASIC_RATE;
- priv->reg.rate_set.body[4] = TX_RATE_6M | BASIC_RATE;
- priv->reg.rate_set.body[3] = TX_RATE_11M | BASIC_RATE;
- priv->reg.rate_set.body[2] = TX_RATE_5M | BASIC_RATE;
- priv->reg.rate_set.body[1] = TX_RATE_2M | BASIC_RATE;
- priv->reg.rate_set.body[0] = TX_RATE_1M | BASIC_RATE;
- priv->reg.rate_set.size = 12;
- }
- }
-
- /* rate mask by phy setting */
- if (priv->reg.phy_type == D_11B_ONLY_MODE) {
- for (i = 0; i < priv->reg.rate_set.size; i++) {
- if (!is_11b_rate(priv->reg.rate_set.body[i]))
- break;
-
- if ((priv->reg.rate_set.body[i] & RATE_MASK) >= TX_RATE_5M) {
- rate_octet[i] = priv->reg.rate_set.body[i] &
- RATE_MASK;
- } else {
- rate_octet[i] = priv->reg.rate_set.body[i];
- }
- }
-
- } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
- for (i = 0; i < priv->reg.rate_set.size; i++) {
- if (!is_11bg_rate(priv->reg.rate_set.body[i]))
- break;
-
- if (is_ofdm_ext_rate(priv->reg.rate_set.body[i])) {
- rate_octet[i] = priv->reg.rate_set.body[i] &
- RATE_MASK;
- } else {
- rate_octet[i] = priv->reg.rate_set.body[i];
- }
- }
- }
- rate_size = i;
- if (rate_size == 0) {
- if (priv->reg.phy_type == D_11G_ONLY_MODE)
- rate_octet[0] = TX_RATE_6M | BASIC_RATE;
- else
- rate_octet[0] = TX_RATE_2M | BASIC_RATE;
- rate_size = 1;
- }
-
- /* rate set update */
- priv->reg.rate_set.size = rate_size;
- memcpy(&priv->reg.rate_set.body[0], &rate_octet[0], rate_size);
-
- switch (priv->reg.operation_mode) {
- case MODE_PSEUDO_ADHOC:
- hostif_ps_adhoc_set_request(priv);
- break;
- case MODE_INFRASTRUCTURE:
- if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) {
- hostif_infrastructure_set_request(priv,
- HIF_INFRA_SET_REQ);
- } else {
- hostif_infrastructure_set_request(priv,
- HIF_INFRA_SET2_REQ);
- netdev_dbg(priv->net_dev,
- "Infra bssid = %pM\n", priv->reg.bssid);
- }
- break;
- case MODE_ADHOC:
- if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) {
- hostif_adhoc_set_request(priv);
- } else {
- hostif_adhoc_set2_request(priv);
- netdev_dbg(priv->net_dev,
- "Adhoc bssid = %pM\n", priv->reg.bssid);
- }
- break;
- default:
- break;
- }
-}
-
-static
-void hostif_sme_multicast_set(struct ks_wlan_private *priv)
-{
- struct net_device *dev = priv->net_dev;
- int mc_count;
- struct netdev_hw_addr *ha;
- char set_address[NIC_MAX_MCAST_LIST * ETH_ALEN];
- int i = 0;
-
- spin_lock(&priv->multicast_spin);
-
- memset(set_address, 0, NIC_MAX_MCAST_LIST * ETH_ALEN);
-
- if (dev->flags & IFF_PROMISC) {
- hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER,
- MCAST_FILTER_PROMISC);
- goto spin_unlock;
- }
-
- if ((netdev_mc_count(dev) > NIC_MAX_MCAST_LIST) ||
- (dev->flags & IFF_ALLMULTI)) {
- hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER,
- MCAST_FILTER_MCASTALL);
- goto spin_unlock;
- }
-
- if (priv->sme_i.sme_flag & SME_MULTICAST) {
- mc_count = netdev_mc_count(dev);
- netdev_for_each_mc_addr(ha, dev) {
- ether_addr_copy(&set_address[i * ETH_ALEN], ha->addr);
- i++;
- }
- priv->sme_i.sme_flag &= ~SME_MULTICAST;
- hostif_mib_set_request_ostring(priv, LOCAL_MULTICAST_ADDRESS,
- &set_address[0],
- ETH_ALEN * mc_count);
- } else {
- priv->sme_i.sme_flag |= SME_MULTICAST;
- hostif_mib_set_request_int(priv, LOCAL_MULTICAST_FILTER,
- MCAST_FILTER_MCAST);
- }
-
-spin_unlock:
- spin_unlock(&priv->multicast_spin);
-}
-
-static void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv)
-{
- u32 mode, wake_up, receive_dtims;
-
- if (priv->reg.power_mgmt != POWER_MGMT_SAVE1 &&
- priv->reg.power_mgmt != POWER_MGMT_SAVE2) {
- mode = POWER_ACTIVE;
- wake_up = 0;
- receive_dtims = 0;
- } else {
- mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ?
- POWER_SAVE : POWER_ACTIVE;
- wake_up = 0;
- receive_dtims = (priv->reg.operation_mode == MODE_INFRASTRUCTURE &&
- priv->reg.power_mgmt == POWER_MGMT_SAVE2);
- }
-
- hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims);
-}
-
-static void hostif_sme_sleep_set(struct ks_wlan_private *priv)
-{
- if (priv->sleep_mode != SLP_SLEEP &&
- priv->sleep_mode != SLP_ACTIVE)
- return;
-
- hostif_sleep_request(priv, priv->sleep_mode);
-}
-
-static
-void hostif_sme_set_key(struct ks_wlan_private *priv, int type)
-{
- switch (type) {
- case SME_SET_FLAG:
- hostif_mib_set_request_bool(priv, DOT11_PRIVACY_INVOKED,
- priv->reg.privacy_invoked);
- break;
- case SME_SET_TXKEY:
- hostif_mib_set_request_int(priv, DOT11_WEP_DEFAULT_KEY_ID,
- priv->wpa.txkey);
- break;
- case SME_SET_KEY1:
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE1,
- &priv->wpa.key[0].key_val[0],
- priv->wpa.key[0].key_len);
- break;
- case SME_SET_KEY2:
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE2,
- &priv->wpa.key[1].key_val[0],
- priv->wpa.key[1].key_len);
- break;
- case SME_SET_KEY3:
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE3,
- &priv->wpa.key[2].key_val[0],
- priv->wpa.key[2].key_len);
- break;
- case SME_SET_KEY4:
- hostif_mib_set_request_ostring(priv,
- DOT11_WEP_DEFAULT_KEY_VALUE4,
- &priv->wpa.key[3].key_val[0],
- priv->wpa.key[3].key_len);
- break;
- case SME_SET_PMK_TSC:
- hostif_mib_set_request_ostring(priv, DOT11_PMK_TSC,
- &priv->wpa.key[0].rx_seq[0],
- WPA_RX_SEQ_LEN);
- break;
- case SME_SET_GMK1_TSC:
- hostif_mib_set_request_ostring(priv, DOT11_GMK1_TSC,
- &priv->wpa.key[1].rx_seq[0],
- WPA_RX_SEQ_LEN);
- break;
- case SME_SET_GMK2_TSC:
- hostif_mib_set_request_ostring(priv, DOT11_GMK2_TSC,
- &priv->wpa.key[2].rx_seq[0],
- WPA_RX_SEQ_LEN);
- break;
- }
-}
-
-static
-void hostif_sme_set_pmksa(struct ks_wlan_private *priv)
-{
- struct pmk_cache {
- __le16 size;
- struct {
- u8 bssid[ETH_ALEN];
- u8 pmkid[IW_PMKID_LEN];
- } __packed list[PMK_LIST_MAX];
- } __packed pmkcache;
- struct pmk *pmk;
- size_t size;
- int i = 0;
-
- list_for_each_entry(pmk, &priv->pmklist.head, list) {
- if (i >= PMK_LIST_MAX)
- break;
- ether_addr_copy(pmkcache.list[i].bssid, pmk->bssid);
- memcpy(pmkcache.list[i].pmkid, pmk->pmkid, IW_PMKID_LEN);
- i++;
- }
- pmkcache.size = cpu_to_le16(priv->pmklist.size);
- size = sizeof(priv->pmklist.size) +
- ((ETH_ALEN + IW_PMKID_LEN) * priv->pmklist.size);
- hostif_mib_set_request_ostring(priv, LOCAL_PMK, &pmkcache, size);
-}
-
-/* execute sme */
-static void hostif_sme_execute(struct ks_wlan_private *priv, int event)
-{
- u16 failure;
-
- switch (event) {
- case SME_START:
- if (priv->dev_state == DEVICE_STATE_BOOT)
- hostif_mib_get_request(priv, DOT11_MAC_ADDRESS);
- break;
- case SME_MULTICAST_REQUEST:
- hostif_sme_multicast_set(priv);
- break;
- case SME_MACADDRESS_SET_REQUEST:
- hostif_mib_set_request_ostring(priv, LOCAL_CURRENTADDRESS,
- &priv->eth_addr[0], ETH_ALEN);
- break;
- case SME_BSS_SCAN_REQUEST:
- hostif_bss_scan_request(priv, priv->reg.scan_type,
- priv->scan_ssid, priv->scan_ssid_len);
- break;
- case SME_POW_MNGMT_REQUEST:
- hostif_sme_power_mgmt_set(priv);
- break;
- case SME_PHY_INFO_REQUEST:
- hostif_phy_information_request(priv);
- break;
- case SME_MIC_FAILURE_REQUEST:
- failure = priv->wpa.mic_failure.failure;
- if (failure != 1 && failure != 2) {
- netdev_err(priv->net_dev,
- "SME_MIC_FAILURE_REQUEST: failure count=%u error?\n",
- failure);
- return;
- }
- hostif_mic_failure_request(priv, failure - 1, (failure == 1) ?
- 0 : priv->wpa.mic_failure.counter);
- break;
- case SME_MIC_FAILURE_CONFIRM:
- if (priv->wpa.mic_failure.failure == 2) {
- if (priv->wpa.mic_failure.stop)
- priv->wpa.mic_failure.stop = 0;
- priv->wpa.mic_failure.failure = 0;
- hostif_start_request(priv, priv->reg.operation_mode);
- }
- break;
- case SME_GET_MAC_ADDRESS:
- if (priv->dev_state == DEVICE_STATE_BOOT)
- hostif_mib_get_request(priv, DOT11_PRODUCT_VERSION);
- break;
- case SME_GET_PRODUCT_VERSION:
- if (priv->dev_state == DEVICE_STATE_BOOT)
- priv->dev_state = DEVICE_STATE_PREINIT;
- break;
- case SME_STOP_REQUEST:
- hostif_stop_request(priv);
- break;
- case SME_RTS_THRESHOLD_REQUEST:
- hostif_mib_set_request_int(priv, DOT11_RTS_THRESHOLD,
- priv->reg.rts);
- break;
- case SME_FRAGMENTATION_THRESHOLD_REQUEST:
- hostif_mib_set_request_int(priv, DOT11_FRAGMENTATION_THRESHOLD,
- priv->reg.fragment);
- break;
- case SME_WEP_INDEX_REQUEST:
- case SME_WEP_KEY1_REQUEST:
- case SME_WEP_KEY2_REQUEST:
- case SME_WEP_KEY3_REQUEST:
- case SME_WEP_KEY4_REQUEST:
- case SME_WEP_FLAG_REQUEST:
- hostif_sme_set_wep(priv, event);
- break;
- case SME_RSN_UCAST_REQUEST:
- case SME_RSN_MCAST_REQUEST:
- case SME_RSN_AUTH_REQUEST:
- case SME_RSN_ENABLED_REQUEST:
- case SME_RSN_MODE_REQUEST:
- hostif_sme_set_rsn(priv, event);
- break;
- case SME_SET_FLAG:
- case SME_SET_TXKEY:
- case SME_SET_KEY1:
- case SME_SET_KEY2:
- case SME_SET_KEY3:
- case SME_SET_KEY4:
- case SME_SET_PMK_TSC:
- case SME_SET_GMK1_TSC:
- case SME_SET_GMK2_TSC:
- hostif_sme_set_key(priv, event);
- break;
- case SME_SET_PMKSA:
- hostif_sme_set_pmksa(priv);
- break;
- case SME_WPS_ENABLE_REQUEST:
- hostif_mib_set_request_int(priv, LOCAL_WPS_ENABLE,
- priv->wps.wps_enabled);
- break;
- case SME_WPS_PROBE_REQUEST:
- hostif_mib_set_request_ostring(priv, LOCAL_WPS_PROBE_REQ,
- priv->wps.ie, priv->wps.ielen);
- break;
- case SME_MODE_SET_REQUEST:
- hostif_sme_mode_setup(priv);
- break;
- case SME_SET_GAIN:
- hostif_mib_set_request_ostring(priv, LOCAL_GAIN,
- &priv->gain, sizeof(priv->gain));
- break;
- case SME_GET_GAIN:
- hostif_mib_get_request(priv, LOCAL_GAIN);
- break;
- case SME_GET_EEPROM_CKSUM:
- priv->eeprom_checksum = EEPROM_FW_NOT_SUPPORT; /* initialize */
- hostif_mib_get_request(priv, LOCAL_EEPROM_SUM);
- break;
- case SME_START_REQUEST:
- hostif_start_request(priv, priv->reg.operation_mode);
- break;
- case SME_START_CONFIRM:
- /* for power save */
- atomic_set(&priv->psstatus.snooze_guard, 0);
- atomic_set(&priv->psstatus.confirm_wait, 0);
- if (priv->dev_state == DEVICE_STATE_PREINIT)
- priv->dev_state = DEVICE_STATE_INIT;
- /* wake_up_interruptible_all(&priv->confirm_wait); */
- complete(&priv->confirm_wait);
- break;
- case SME_SLEEP_REQUEST:
- hostif_sme_sleep_set(priv);
- break;
- case SME_SET_REGION:
- hostif_mib_set_request_int(priv, LOCAL_REGION, priv->region);
- break;
- case SME_MULTICAST_CONFIRM:
- case SME_BSS_SCAN_CONFIRM:
- case SME_POW_MNGMT_CONFIRM:
- case SME_PHY_INFO_CONFIRM:
- case SME_STOP_CONFIRM:
- case SME_RTS_THRESHOLD_CONFIRM:
- case SME_FRAGMENTATION_THRESHOLD_CONFIRM:
- case SME_WEP_INDEX_CONFIRM:
- case SME_WEP_KEY1_CONFIRM:
- case SME_WEP_KEY2_CONFIRM:
- case SME_WEP_KEY3_CONFIRM:
- case SME_WEP_KEY4_CONFIRM:
- case SME_WEP_FLAG_CONFIRM:
- case SME_RSN_UCAST_CONFIRM:
- case SME_RSN_MCAST_CONFIRM:
- case SME_RSN_AUTH_CONFIRM:
- case SME_RSN_ENABLED_CONFIRM:
- case SME_RSN_MODE_CONFIRM:
- case SME_MODE_SET_CONFIRM:
- case SME_TERMINATE:
- default:
- break;
- }
-}
-
-static void hostif_sme_work(struct work_struct *work)
-{
- struct ks_wlan_private *priv;
-
- priv = container_of(work, struct ks_wlan_private, sme_work);
-
- if (priv->dev_state < DEVICE_STATE_BOOT)
- return;
-
- if (cnt_smeqbody(priv) <= 0)
- return;
-
- hostif_sme_execute(priv, priv->sme_i.event_buff[priv->sme_i.qhead]);
- inc_smeqhead(priv);
- if (cnt_smeqbody(priv) > 0)
- schedule_work(&priv->sme_work);
-}
-
-/* send to Station Management Entity module */
-void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event)
-{
- /* enqueue sme event */
- if (cnt_smeqbody(priv) < (SME_EVENT_BUFF_SIZE - 1)) {
- priv->sme_i.event_buff[priv->sme_i.qtail] = event;
- inc_smeqtail(priv);
- } else {
- /* in case of buffer overflow */
- netdev_err(priv->net_dev, "sme queue buffer overflow\n");
- }
-
- schedule_work(&priv->sme_work);
-}
-
-static inline void hostif_aplist_init(struct ks_wlan_private *priv)
-{
- size_t size = LOCAL_APLIST_MAX * sizeof(struct local_ap);
-
- priv->aplist.size = 0;
- memset(&priv->aplist.ap[0], 0, size);
-}
-
-static inline void hostif_status_init(struct ks_wlan_private *priv)
-{
- priv->infra_status = 0;
- priv->current_rate = 4;
- priv->connect_status = DISCONNECT_STATUS;
-}
-
-static inline void hostif_sme_init(struct ks_wlan_private *priv)
-{
- priv->sme_i.sme_status = SME_IDLE;
- priv->sme_i.qhead = 0;
- priv->sme_i.qtail = 0;
- spin_lock_init(&priv->sme_i.sme_spin);
- priv->sme_i.sme_flag = 0;
- INIT_WORK(&priv->sme_work, hostif_sme_work);
-}
-
-static inline void hostif_wpa_init(struct ks_wlan_private *priv)
-{
- memset(&priv->wpa, 0, sizeof(priv->wpa));
- priv->wpa.rsn_enabled = false;
- priv->wpa.mic_failure.failure = 0;
- priv->wpa.mic_failure.last_failure_time = 0;
- priv->wpa.mic_failure.stop = 0;
-}
-
-static inline void hostif_power_save_init(struct ks_wlan_private *priv)
-{
- atomic_set(&priv->psstatus.status, PS_NONE);
- atomic_set(&priv->psstatus.confirm_wait, 0);
- atomic_set(&priv->psstatus.snooze_guard, 0);
- init_completion(&priv->psstatus.wakeup_wait);
- INIT_WORK(&priv->wakeup_work, ks_wlan_hw_wakeup_task);
-}
-
-static inline void hostif_pmklist_init(struct ks_wlan_private *priv)
-{
- int i;
-
- memset(&priv->pmklist, 0, sizeof(priv->pmklist));
- INIT_LIST_HEAD(&priv->pmklist.head);
- for (i = 0; i < PMK_LIST_MAX; i++)
- INIT_LIST_HEAD(&priv->pmklist.pmk[i].list);
-}
-
-static inline void hostif_counters_init(struct ks_wlan_private *priv)
-{
- priv->dev_count = 0;
- atomic_set(&priv->event_count, 0);
- atomic_set(&priv->rec_count, 0);
-}
-
-int hostif_init(struct ks_wlan_private *priv)
-{
- hostif_aplist_init(priv);
- hostif_status_init(priv);
-
- spin_lock_init(&priv->multicast_spin);
- spin_lock_init(&priv->dev_read_lock);
- init_waitqueue_head(&priv->devread_wait);
-
- hostif_counters_init(priv);
- hostif_power_save_init(priv);
- hostif_wpa_init(priv);
- hostif_pmklist_init(priv);
- hostif_sme_init(priv);
-
- return 0;
-}
-
-void hostif_exit(struct ks_wlan_private *priv)
-{
- cancel_work_sync(&priv->sme_work);
-}
diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
deleted file mode 100644
index c62a494ed6bb..000000000000
--- a/drivers/staging/ks7010/ks_hostif.h
+++ /dev/null
@@ -1,617 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Driver for KeyStream wireless LAN
- *
- * Copyright (c) 2005-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- */
-
-#ifndef _KS_HOSTIF_H_
-#define _KS_HOSTIF_H_
-
-#include <linux/compiler.h>
-#include <linux/ieee80211.h>
-
-/*
- * HOST-MAC I/F events
- */
-#define HIF_DATA_REQ 0xE001
-#define HIF_DATA_IND 0xE801
-#define HIF_MIB_GET_REQ 0xE002
-#define HIF_MIB_GET_CONF 0xE802
-#define HIF_MIB_SET_REQ 0xE003
-#define HIF_MIB_SET_CONF 0xE803
-#define HIF_POWER_MGMT_REQ 0xE004
-#define HIF_POWER_MGMT_CONF 0xE804
-#define HIF_START_REQ 0xE005
-#define HIF_START_CONF 0xE805
-#define HIF_CONNECT_IND 0xE806
-#define HIF_STOP_REQ 0xE006
-#define HIF_STOP_CONF 0xE807
-#define HIF_PS_ADH_SET_REQ 0xE007
-#define HIF_PS_ADH_SET_CONF 0xE808
-#define HIF_INFRA_SET_REQ 0xE008
-#define HIF_INFRA_SET_CONF 0xE809
-#define HIF_ADH_SET_REQ 0xE009
-#define HIF_ADH_SET_CONF 0xE80A
-#define HIF_AP_SET_REQ 0xE00A
-#define HIF_AP_SET_CONF 0xE80B
-#define HIF_ASSOC_INFO_IND 0xE80C
-#define HIF_MIC_FAILURE_REQ 0xE00B
-#define HIF_MIC_FAILURE_CONF 0xE80D
-#define HIF_SCAN_REQ 0xE00C
-#define HIF_SCAN_CONF 0xE80E
-#define HIF_PHY_INFO_REQ 0xE00D
-#define HIF_PHY_INFO_CONF 0xE80F
-#define HIF_SLEEP_REQ 0xE00E
-#define HIF_SLEEP_CONF 0xE810
-#define HIF_PHY_INFO_IND 0xE811
-#define HIF_SCAN_IND 0xE812
-#define HIF_INFRA_SET2_REQ 0xE00F
-#define HIF_INFRA_SET2_CONF 0xE813
-#define HIF_ADH_SET2_REQ 0xE010
-#define HIF_ADH_SET2_CONF 0xE814
-
-#define HIF_REQ_MAX 0xE010
-
-/*
- * HOST-MAC I/F data structure
- * Byte alignment Little Endian
- */
-
-struct hostif_hdr {
- __le16 size;
- __le16 event;
-} __packed;
-
-struct hostif_data_request {
- struct hostif_hdr header;
- __le16 auth_type;
-#define TYPE_DATA 0x0000
-#define TYPE_AUTH 0x0001
- __le16 reserved;
- u8 data[];
-} __packed;
-
-#define TYPE_PMK1 0x0001
-#define TYPE_GMK1 0x0002
-#define TYPE_GMK2 0x0003
-
-#define CHANNEL_LIST_MAX_SIZE 14
-struct channel_list {
- u8 size;
- u8 body[CHANNEL_LIST_MAX_SIZE];
- u8 pad;
-} __packed;
-
-/**
- * enum mib_attribute - Management Information Base attribute
- * Attribute value used for accessing and updating MIB
- *
- * @DOT11_MAC_ADDRESS: MAC Address (R)
- * @DOT11_PRODUCT_VERSION: FirmWare Version (R)
- * @DOT11_RTS_THRESHOLD: RTS Threshold (R/W)
- * @DOT11_FRAGMENTATION_THRESHOLD: Fragment Threshold (R/W)
- * @DOT11_PRIVACY_INVOKED: WEP ON/OFF (W)
- * @DOT11_WEP_DEFAULT_KEY_ID: WEP Index (W)
- * @DOT11_WEP_DEFAULT_KEY_VALUE1: WEP Key#1(TKIP AES: PairwiseTemporalKey) (W)
- * @DOT11_WEP_DEFAULT_KEY_VALUE2: WEP Key#2(TKIP AES: GroupKey1) (W)
- * @DOT11_WEP_DEFAULT_KEY_VALUE3: WEP Key#3(TKIP AES: GroupKey2) (W)
- * @DOT11_WEP_DEFAULT_KEY_VALUE4: WEP Key#4 (W)
- * @DOT11_WEP_LIST: WEP LIST
- * @DOT11_DESIRED_SSID: SSID
- * @DOT11_CURRENT_CHANNEL: channel set
- * @DOT11_OPERATION_RATE_SET: rate set
- * @LOCAL_AP_SEARCH_INTERVAL: AP search interval (R/W)
- * @LOCAL_CURRENTADDRESS: MAC Address change (W)
- * @LOCAL_MULTICAST_ADDRESS: Multicast Address (W)
- * @LOCAL_MULTICAST_FILTER: Multicast Address Filter enable/disable (W)
- * @LOCAL_SEARCHED_AP_LIST: AP list (R)
- * @LOCAL_LINK_AP_STATUS: Link AP status (R)
- * @LOCAL_PACKET_STATISTICS: tx,rx packets statistics
- * @LOCAL_AP_SCAN_LIST_TYPE_SET: AP_SCAN_LIST_TYPE
- * @DOT11_RSN_ENABLED: WPA enable/disable (W)
- * @LOCAL_RSN_MODE: RSN mode WPA/WPA2 (W)
- * @DOT11_RSN_CONFIG_MULTICAST_CIPHER: GroupKeyCipherSuite (W)
- * @DOT11_RSN_CONFIG_UNICAST_CIPHER: PairwiseKeyCipherSuite (W)
- * @DOT11_RSN_CONFIG_AUTH_SUITE: AuthenticationKeyManagementSuite (W)
- * @DOT11_RSN_CONFIG_VERSION: RSN version (W)
- * @LOCAL_RSN_CONFIG_ALL: RSN CONFIG ALL (W)
- * @DOT11_PMK_TSC: PMK_TSC (W)
- * @DOT11_GMK1_TSC: GMK1_TSC (W)
- * @DOT11_GMK2_TSC: GMK2_TSC (W)
- * @DOT11_GMK3_TSC: GMK3_TSC
- * @LOCAL_PMK: Pairwise Master Key cache (W)
- * @LOCAL_REGION: Region setting
- * @LOCAL_WPS_ENABLE: WiFi Protected Setup
- * @LOCAL_WPS_PROBE_REQ: WPS Probe Request
- * @LOCAL_GAIN: Carrer sense threshold for demo ato show
- * @LOCAL_EEPROM_SUM: EEPROM checksum information
- */
-enum mib_attribute {
- DOT11_MAC_ADDRESS = 0x21010100,
- DOT11_PRODUCT_VERSION = 0x31024100,
- DOT11_RTS_THRESHOLD = 0x21020100,
- DOT11_FRAGMENTATION_THRESHOLD = 0x21050100,
- DOT11_PRIVACY_INVOKED = 0x15010100,
- DOT11_WEP_DEFAULT_KEY_ID = 0x15020100,
- DOT11_WEP_DEFAULT_KEY_VALUE1 = 0x13020101,
- DOT11_WEP_DEFAULT_KEY_VALUE2 = 0x13020102,
- DOT11_WEP_DEFAULT_KEY_VALUE3 = 0x13020103,
- DOT11_WEP_DEFAULT_KEY_VALUE4 = 0x13020104,
- DOT11_WEP_LIST = 0x13020100,
- DOT11_DESIRED_SSID = 0x11090100,
- DOT11_CURRENT_CHANNEL = 0x45010100,
- DOT11_OPERATION_RATE_SET = 0x11110100,
- LOCAL_AP_SEARCH_INTERVAL = 0xF1010100,
- LOCAL_CURRENTADDRESS = 0xF1050100,
- LOCAL_MULTICAST_ADDRESS = 0xF1060100,
- LOCAL_MULTICAST_FILTER = 0xF1060200,
- LOCAL_SEARCHED_AP_LIST = 0xF1030100,
- LOCAL_LINK_AP_STATUS = 0xF1040100,
- LOCAL_PACKET_STATISTICS = 0xF1020100,
- LOCAL_AP_SCAN_LIST_TYPE_SET = 0xF1030200,
- DOT11_RSN_ENABLED = 0x15070100,
- LOCAL_RSN_MODE = 0x56010100,
- DOT11_RSN_CONFIG_MULTICAST_CIPHER = 0x51040100,
- DOT11_RSN_CONFIG_UNICAST_CIPHER = 0x52020100,
- DOT11_RSN_CONFIG_AUTH_SUITE = 0x53020100,
- DOT11_RSN_CONFIG_VERSION = 0x51020100,
- LOCAL_RSN_CONFIG_ALL = 0x5F010100,
- DOT11_PMK_TSC = 0x55010100,
- DOT11_GMK1_TSC = 0x55010101,
- DOT11_GMK2_TSC = 0x55010102,
- DOT11_GMK3_TSC = 0x55010103,
- LOCAL_PMK = 0x58010100,
- LOCAL_REGION = 0xF10A0100,
- LOCAL_WPS_ENABLE = 0xF10B0100,
- LOCAL_WPS_PROBE_REQ = 0xF10C0100,
- LOCAL_GAIN = 0xF10D0100,
- LOCAL_EEPROM_SUM = 0xF10E0100
-};
-
-struct hostif_mib_get_request {
- struct hostif_hdr header;
- __le32 mib_attribute;
-} __packed;
-
-/**
- * enum mib_data_type - Message Information Base data type.
- * @MIB_VALUE_TYPE_NULL: NULL type
- * @MIB_VALUE_TYPE_INT: INTEGER type
- * @MIB_VALUE_TYPE_BOOL: BOOL type
- * @MIB_VALUE_TYPE_COUNT32: unused
- * @MIB_VALUE_TYPE_OSTRING: Chunk of memory
- */
-enum mib_data_type {
- MIB_VALUE_TYPE_NULL = 0,
- MIB_VALUE_TYPE_INT,
- MIB_VALUE_TYPE_BOOL,
- MIB_VALUE_TYPE_COUNT32,
- MIB_VALUE_TYPE_OSTRING
-};
-
-struct hostif_mib_value {
- __le16 size;
- __le16 type;
- u8 body[];
-} __packed;
-
-struct hostif_mib_get_confirm_t {
- struct hostif_hdr header;
- __le32 mib_status;
-#define MIB_SUCCESS 0
-#define MIB_INVALID 1
-#define MIB_READ_ONLY 2
-#define MIB_WRITE_ONLY 3
- __le32 mib_attribute;
- struct hostif_mib_value mib_value;
-} __packed;
-
-struct hostif_mib_set_request_t {
- struct hostif_hdr header;
- __le32 mib_attribute;
- struct hostif_mib_value mib_value;
-} __packed;
-
-struct hostif_power_mgmt_request {
- struct hostif_hdr header;
- __le32 mode;
-#define POWER_ACTIVE 1
-#define POWER_SAVE 2
- __le32 wake_up;
-#define SLEEP_FALSE 0
-#define SLEEP_TRUE 1 /* not used */
- __le32 receive_dtims;
-#define DTIM_FALSE 0
-#define DTIM_TRUE 1
-} __packed;
-
-enum power_mgmt_mode_type {
- POWER_MGMT_ACTIVE,
- POWER_MGMT_SAVE1,
- POWER_MGMT_SAVE2
-};
-
-#define RESULT_SUCCESS 0
-#define RESULT_INVALID_PARAMETERS 1
-#define RESULT_NOT_SUPPORTED 2
-/* #define RESULT_ALREADY_RUNNING 3 */
-#define RESULT_ALREADY_RUNNING 7
-
-struct hostif_start_request {
- struct hostif_hdr header;
- __le16 mode;
-#define MODE_PSEUDO_ADHOC 0
-#define MODE_INFRASTRUCTURE 1
-#define MODE_AP 2 /* not used */
-#define MODE_ADHOC 3
-} __packed;
-
-struct ssid {
- u8 size;
- u8 body[IEEE80211_MAX_SSID_LEN];
- u8 ssid_pad;
-} __packed;
-
-#define RATE_SET_MAX_SIZE 16
-struct rate_set8 {
- u8 size;
- u8 body[8];
- u8 rate_pad;
-} __packed;
-
-struct fh_parms {
- __le16 dwell_time;
- u8 hop_set;
- u8 hop_pattern;
- u8 hop_index;
-} __packed;
-
-struct ds_parms {
- u8 channel;
-} __packed;
-
-struct cf_parms {
- u8 count;
- u8 period;
- __le16 max_duration;
- __le16 dur_remaining;
-} __packed;
-
-struct ibss_parms {
- __le16 atim_window;
-} __packed;
-
-struct rsn_t {
- u8 size;
-#define RSN_BODY_SIZE 64
- u8 body[RSN_BODY_SIZE];
-} __packed;
-
-struct erp_params_t {
- u8 erp_info;
-} __packed;
-
-struct rate_set16 {
- u8 size;
- u8 body[16];
- u8 rate_pad;
-} __packed;
-
-struct ap_info {
- u8 bssid[6]; /* +00 */
- u8 rssi; /* +06 */
- u8 sq; /* +07 */
- u8 noise; /* +08 */
- u8 pad0; /* +09 */
- __le16 beacon_period; /* +10 */
- __le16 capability; /* +12 */
- u8 frame_type; /* +14 */
- u8 ch_info; /* +15 */
- __le16 body_size; /* +16 */
- u8 body[1024]; /* +18 */
- /* +1032 */
-} __packed;
-
-struct link_ap_info {
- u8 bssid[6]; /* +00 */
- u8 rssi; /* +06 */
- u8 sq; /* +07 */
- u8 noise; /* +08 */
- u8 pad0; /* +09 */
- __le16 beacon_period; /* +10 */
- __le16 capability; /* +12 */
- struct rate_set8 rate_set; /* +14 */
- struct fh_parms fh_parameter; /* +24 */
- struct ds_parms ds_parameter; /* +29 */
- struct cf_parms cf_parameter; /* +30 */
- struct ibss_parms ibss_parameter; /* +36 */
- struct erp_params_t erp_parameter; /* +38 */
- u8 pad1; /* +39 */
- struct rate_set8 ext_rate_set; /* +40 */
- u8 DTIM_period; /* +50 */
- u8 rsn_mode; /* +51 */
-#define RSN_MODE_NONE 0
-#define RSN_MODE_WPA 1
-#define RSN_MODE_WPA2 2
- struct {
- u8 size; /* +52 */
- u8 body[128]; /* +53 */
- } __packed rsn;
-} __packed;
-
-#define RESULT_CONNECT 0
-#define RESULT_DISCONNECT 1
-
-struct hostif_stop_request {
- struct hostif_hdr header;
-} __packed;
-
-#define D_11B_ONLY_MODE 0
-#define D_11G_ONLY_MODE 1
-#define D_11BG_COMPATIBLE_MODE 2
-#define D_11A_ONLY_MODE 3
-
-#define CTS_MODE_FALSE 0
-#define CTS_MODE_TRUE 1
-
-struct hostif_request {
- __le16 phy_type;
- __le16 cts_mode;
- __le16 scan_type;
- __le16 capability;
- struct rate_set16 rate_set;
-} __packed;
-
-/**
- * struct hostif_ps_adhoc_set_request - pseudo adhoc mode
- * @capability: bit5 : preamble
- * bit6 : pbcc - Not supported always 0
- * bit10 : ShortSlotTime
- * bit13 : DSSS-OFDM - Not supported always 0
- */
-struct hostif_ps_adhoc_set_request {
- struct hostif_hdr header;
- struct hostif_request request;
- __le16 channel;
-} __packed;
-
-#define AUTH_TYPE_OPEN_SYSTEM 0
-#define AUTH_TYPE_SHARED_KEY 1
-
-/**
- * struct hostif_infrastructure_set_request
- * @capability: bit5 : preamble
- * bit6 : pbcc - Not supported always 0
- * bit10 : ShortSlotTime
- * bit13 : DSSS-OFDM - Not supported always 0
- */
-struct hostif_infrastructure_set_request {
- struct hostif_hdr header;
- struct hostif_request request;
- struct ssid ssid;
- __le16 beacon_lost_count;
- __le16 auth_type;
- struct channel_list channel_list;
- u8 bssid[ETH_ALEN];
-} __packed;
-
-/**
- * struct hostif_adhoc_set_request
- * @capability: bit5 : preamble
- * bit6 : pbcc - Not supported always 0
- * bit10 : ShortSlotTime
- * bit13 : DSSS-OFDM - Not supported always 0
- */
-struct hostif_adhoc_set_request {
- struct hostif_hdr header;
- struct hostif_request request;
- struct ssid ssid;
- __le16 channel;
-} __packed;
-
-/**
- * struct hostif_adhoc_set2_request
- * @capability: bit5 : preamble
- * bit6 : pbcc - Not supported always 0
- * bit10 : ShortSlotTime
- * bit13 : DSSS-OFDM - Not supported always 0
- */
-struct hostif_adhoc_set2_request {
- struct hostif_hdr header;
- struct hostif_request request;
- __le16 reserved;
- struct ssid ssid;
- struct channel_list channel_list;
- u8 bssid[ETH_ALEN];
-} __packed;
-
-struct association_request {
- u8 type;
- u8 pad;
- __le16 capability;
- __le16 listen_interval;
- u8 ap_address[6];
- __le16 req_ies_size;
-} __packed;
-
-struct association_response {
- u8 type;
- u8 pad;
- __le16 capability;
- __le16 status;
- __le16 association_id;
- __le16 resp_ies_size;
-} __packed;
-
-struct hostif_bss_scan_request {
- struct hostif_hdr header;
- u8 scan_type;
-#define ACTIVE_SCAN 0
-#define PASSIVE_SCAN 1
- u8 pad[3];
- __le32 ch_time_min;
- __le32 ch_time_max;
- struct channel_list channel_list;
- struct ssid ssid;
-} __packed;
-
-struct hostif_phy_information_request {
- struct hostif_hdr header;
- __le16 type;
-#define NORMAL_TYPE 0
-#define TIME_TYPE 1
- __le16 time; /* unit 100ms */
-} __packed;
-
-enum sleep_mode_type {
- SLP_ACTIVE,
- SLP_SLEEP
-};
-
-struct hostif_sleep_request {
- struct hostif_hdr header;
-} __packed;
-
-struct hostif_mic_failure_request {
- struct hostif_hdr header;
- __le16 failure_count;
- __le16 timer;
-} __packed;
-
-#define BASIC_RATE 0x80
-#define RATE_MASK 0x7F
-
-#define TX_RATE_AUTO 0xff
-#define TX_RATE_1M_FIXED 0
-#define TX_RATE_2M_FIXED 1
-#define TX_RATE_1_2M_AUTO 2
-#define TX_RATE_5M_FIXED 3
-#define TX_RATE_11M_FIXED 4
-
-#define TX_RATE_FULL_AUTO 0
-#define TX_RATE_11_AUTO 1
-#define TX_RATE_11B_AUTO 2
-#define TX_RATE_11BG_AUTO 3
-#define TX_RATE_MANUAL_AUTO 4
-#define TX_RATE_FIXED 5
-
-/* 11b rate */
-#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */
-#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */
-#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */
-#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */
-
-/* 11g rate */
-#define TX_RATE_6M ((u8)(60 / 5)) /* 11g basic rate */
-#define TX_RATE_12M ((u8)(120 / 5)) /* 11g basic rate */
-#define TX_RATE_24M ((u8)(240 / 5)) /* 11g basic rate */
-#define TX_RATE_9M ((u8)(90 / 5))
-#define TX_RATE_18M ((u8)(180 / 5))
-#define TX_RATE_36M ((u8)(360 / 5))
-#define TX_RATE_48M ((u8)(480 / 5))
-#define TX_RATE_54M ((u8)(540 / 5))
-
-static inline bool is_11b_rate(u8 rate)
-{
- return (((rate & RATE_MASK) == TX_RATE_1M) ||
- ((rate & RATE_MASK) == TX_RATE_2M) ||
- ((rate & RATE_MASK) == TX_RATE_5M) ||
- ((rate & RATE_MASK) == TX_RATE_11M));
-}
-
-static inline bool is_ofdm_rate(u8 rate)
-{
- return (((rate & RATE_MASK) == TX_RATE_6M) ||
- ((rate & RATE_MASK) == TX_RATE_12M) ||
- ((rate & RATE_MASK) == TX_RATE_24M) ||
- ((rate & RATE_MASK) == TX_RATE_9M) ||
- ((rate & RATE_MASK) == TX_RATE_18M) ||
- ((rate & RATE_MASK) == TX_RATE_36M) ||
- ((rate & RATE_MASK) == TX_RATE_48M) ||
- ((rate & RATE_MASK) == TX_RATE_54M));
-}
-
-static inline bool is_11bg_rate(u8 rate)
-{
- return (is_11b_rate(rate) || is_ofdm_rate(rate));
-}
-
-static inline bool is_ofdm_ext_rate(u8 rate)
-{
- return (((rate & RATE_MASK) == TX_RATE_9M) ||
- ((rate & RATE_MASK) == TX_RATE_18M) ||
- ((rate & RATE_MASK) == TX_RATE_36M) ||
- ((rate & RATE_MASK) == TX_RATE_48M) ||
- ((rate & RATE_MASK) == TX_RATE_54M));
-}
-
-enum connect_status_type {
- CONNECT_STATUS,
- DISCONNECT_STATUS
-};
-
-enum preamble_type {
- LONG_PREAMBLE,
- SHORT_PREAMBLE
-};
-
-enum multicast_filter_type {
- MCAST_FILTER_MCAST,
- MCAST_FILTER_MCASTALL,
- MCAST_FILTER_PROMISC,
-};
-
-#define NIC_MAX_MCAST_LIST 32
-
-#define HIF_EVENT_MASK 0xE800
-
-static inline bool is_hif_ind(unsigned short event)
-{
- return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) &&
- (((event & ~HIF_EVENT_MASK) == 0x0001) ||
- ((event & ~HIF_EVENT_MASK) == 0x0006) ||
- ((event & ~HIF_EVENT_MASK) == 0x000C) ||
- ((event & ~HIF_EVENT_MASK) == 0x0011) ||
- ((event & ~HIF_EVENT_MASK) == 0x0012)));
-}
-
-static inline bool is_hif_conf(unsigned short event)
-{
- return (((event & HIF_EVENT_MASK) == HIF_EVENT_MASK) &&
- ((event & ~HIF_EVENT_MASK) > 0x0000) &&
- ((event & ~HIF_EVENT_MASK) < 0x0012) &&
- !is_hif_ind(event));
-}
-
-#ifdef __KERNEL__
-
-#include "ks_wlan.h"
-
-/* function prototype */
-int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb);
-void hostif_receive(struct ks_wlan_private *priv, unsigned char *p,
- unsigned int size);
-void hostif_sme_enqueue(struct ks_wlan_private *priv, u16 event);
-int hostif_init(struct ks_wlan_private *priv);
-void hostif_exit(struct ks_wlan_private *priv);
-int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
- void (*complete_handler)(struct ks_wlan_private *priv,
- struct sk_buff *skb),
- struct sk_buff *skb);
-void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb);
-
-void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv);
-int ks_wlan_hw_power_save(struct ks_wlan_private *priv);
-
-#define KS7010_SIZE_ALIGNMENT 32
-
-static inline size_t hif_align_size(size_t size)
-{
- return ALIGN(size, KS7010_SIZE_ALIGNMENT);
-}
-
-#endif /* __KERNEL__ */
-
-#endif /* _KS_HOSTIF_H_ */
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
deleted file mode 100644
index 3e9a91b5131c..000000000000
--- a/drivers/staging/ks7010/ks_wlan.h
+++ /dev/null
@@ -1,567 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Driver for KeyStream IEEE802.11 b/g wireless LAN cards.
- *
- * Copyright (C) 2006-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- */
-
-#ifndef _KS_WLAN_H
-#define _KS_WLAN_H
-
-#include <linux/atomic.h>
-#include <linux/circ_buf.h>
-#include <linux/completion.h>
-#include <linux/netdevice.h>
-#include <linux/sched.h>
-#include <linux/spinlock.h>
-#include <linux/wireless.h>
-
-struct ks_wlan_parameter {
- u8 operation_mode;
- u8 channel;
- u8 tx_rate;
- struct {
- u8 size;
- u8 body[16];
- } rate_set;
- u8 bssid[ETH_ALEN];
- struct {
- u8 size;
- u8 body[32 + 1];
- } ssid;
- u8 preamble;
- u8 power_mgmt;
- u32 scan_type;
-#define BEACON_LOST_COUNT_MAX 65535
- u32 beacon_lost_count;
- u32 rts;
- u32 fragment;
- u32 privacy_invoked;
- u32 wep_index;
- struct {
- u8 size;
- u8 val[13 * 2 + 1];
- } wep_key[4];
- u16 authenticate_type;
- u16 phy_type;
- u16 cts_mode;
- u16 phy_info_timer;
-};
-
-enum {
- DEVICE_STATE_OFF = 0, /* this means hw_unavailable is != 0 */
- DEVICE_STATE_PREBOOT, /* we are in a pre-boot state (empty RAM) */
- DEVICE_STATE_BOOT, /* boot state (fw upload, run fw) */
- DEVICE_STATE_PREINIT, /* pre-init state */
- DEVICE_STATE_INIT, /* init state (restore MIB backup to device) */
- DEVICE_STATE_READY, /* driver&device are in operational state */
- DEVICE_STATE_SLEEP /* device in sleep mode */
-};
-
-/* SME flag */
-#define SME_MODE_SET BIT(0)
-#define SME_RTS BIT(1)
-#define SME_FRAG BIT(2)
-#define SME_WEP_FLAG BIT(3)
-#define SME_WEP_INDEX BIT(4)
-#define SME_WEP_VAL1 BIT(5)
-#define SME_WEP_VAL2 BIT(6)
-#define SME_WEP_VAL3 BIT(7)
-#define SME_WEP_VAL4 BIT(8)
-#define SME_WEP_VAL_MASK GENMASK(8, 5)
-#define SME_RSN BIT(9)
-#define SME_RSN_MULTICAST BIT(10)
-#define SME_RSN_UNICAST BIT(11)
-#define SME_RSN_AUTH BIT(12)
-
-#define SME_AP_SCAN BIT(13)
-#define SME_MULTICAST BIT(14)
-
-/* SME Event */
-enum {
- SME_START,
-
- SME_MULTICAST_REQUEST,
- SME_MACADDRESS_SET_REQUEST,
- SME_BSS_SCAN_REQUEST,
- SME_SET_FLAG,
- SME_SET_TXKEY,
- SME_SET_KEY1,
- SME_SET_KEY2,
- SME_SET_KEY3,
- SME_SET_KEY4,
- SME_SET_PMK_TSC,
- SME_SET_GMK1_TSC,
- SME_SET_GMK2_TSC,
- SME_SET_GMK3_TSC,
- SME_SET_PMKSA,
- SME_POW_MNGMT_REQUEST,
- SME_PHY_INFO_REQUEST,
- SME_MIC_FAILURE_REQUEST,
- SME_GET_MAC_ADDRESS,
- SME_GET_PRODUCT_VERSION,
- SME_STOP_REQUEST,
- SME_RTS_THRESHOLD_REQUEST,
- SME_FRAGMENTATION_THRESHOLD_REQUEST,
- SME_WEP_INDEX_REQUEST,
- SME_WEP_KEY1_REQUEST,
- SME_WEP_KEY2_REQUEST,
- SME_WEP_KEY3_REQUEST,
- SME_WEP_KEY4_REQUEST,
- SME_WEP_FLAG_REQUEST,
- SME_RSN_UCAST_REQUEST,
- SME_RSN_MCAST_REQUEST,
- SME_RSN_AUTH_REQUEST,
- SME_RSN_ENABLED_REQUEST,
- SME_RSN_MODE_REQUEST,
- SME_WPS_ENABLE_REQUEST,
- SME_WPS_PROBE_REQUEST,
- SME_SET_GAIN,
- SME_GET_GAIN,
- SME_SLEEP_REQUEST,
- SME_SET_REGION,
- SME_MODE_SET_REQUEST,
- SME_START_REQUEST,
- SME_GET_EEPROM_CKSUM,
-
- SME_MIC_FAILURE_CONFIRM,
- SME_START_CONFIRM,
-
- SME_MULTICAST_CONFIRM,
- SME_BSS_SCAN_CONFIRM,
- SME_GET_CURRENT_AP,
- SME_POW_MNGMT_CONFIRM,
- SME_PHY_INFO_CONFIRM,
- SME_STOP_CONFIRM,
- SME_RTS_THRESHOLD_CONFIRM,
- SME_FRAGMENTATION_THRESHOLD_CONFIRM,
- SME_WEP_INDEX_CONFIRM,
- SME_WEP_KEY1_CONFIRM,
- SME_WEP_KEY2_CONFIRM,
- SME_WEP_KEY3_CONFIRM,
- SME_WEP_KEY4_CONFIRM,
- SME_WEP_FLAG_CONFIRM,
- SME_RSN_UCAST_CONFIRM,
- SME_RSN_MCAST_CONFIRM,
- SME_RSN_AUTH_CONFIRM,
- SME_RSN_ENABLED_CONFIRM,
- SME_RSN_MODE_CONFIRM,
- SME_MODE_SET_CONFIRM,
- SME_SLEEP_CONFIRM,
-
- SME_RSN_SET_CONFIRM,
- SME_WEP_SET_CONFIRM,
- SME_TERMINATE,
-
- SME_EVENT_SIZE
-};
-
-/* SME Status */
-enum {
- SME_IDLE,
- SME_SETUP,
- SME_DISCONNECT,
- SME_CONNECT
-};
-
-#define SME_EVENT_BUFF_SIZE 128
-
-struct sme_info {
- int sme_status;
- int event_buff[SME_EVENT_BUFF_SIZE];
- unsigned int qhead;
- unsigned int qtail;
- spinlock_t sme_spin;
- unsigned long sme_flag;
-};
-
-struct hostt {
- int buff[SME_EVENT_BUFF_SIZE];
- unsigned int qhead;
- unsigned int qtail;
-};
-
-#define RSN_IE_BODY_MAX 64
-struct rsn_ie {
- u8 id; /* 0xdd = WPA or 0x30 = RSN */
- u8 size; /* max ? 255 ? */
- u8 body[RSN_IE_BODY_MAX];
-} __packed;
-
-#define WPA_INFO_ELEM_ID 0xdd
-#define RSN_INFO_ELEM_ID 0x30
-
-#define WPS_IE_BODY_MAX 255
-struct wps_ie {
- u8 id; /* 221 'dd <len> 00 50 F2 04' */
- u8 size; /* max ? 255 ? */
- u8 body[WPS_IE_BODY_MAX];
-} __packed;
-
-struct local_ap {
- u8 bssid[6];
- u8 rssi;
- u8 sq;
- struct {
- u8 size;
- u8 body[32];
- u8 ssid_pad;
- } ssid;
- struct {
- u8 size;
- u8 body[16];
- u8 rate_pad;
- } rate_set;
- u16 capability;
- u8 channel;
- u8 noise;
- struct rsn_ie wpa_ie;
- struct rsn_ie rsn_ie;
- struct wps_ie wps_ie;
-};
-
-#define LOCAL_APLIST_MAX 31
-#define LOCAL_CURRENT_AP LOCAL_APLIST_MAX
-struct local_aplist {
- int size;
- struct local_ap ap[LOCAL_APLIST_MAX + 1];
-};
-
-struct local_gain {
- u8 tx_mode;
- u8 rx_mode;
- u8 tx_gain;
- u8 rx_gain;
-};
-
-struct local_eeprom_sum {
- u8 type;
- u8 result;
-};
-
-enum {
- EEPROM_OK,
- EEPROM_CHECKSUM_NONE,
- EEPROM_FW_NOT_SUPPORT,
- EEPROM_NG,
-};
-
-/* Power Save Status */
-enum {
- PS_NONE,
- PS_ACTIVE_SET,
- PS_SAVE_SET,
- PS_CONF_WAIT,
- PS_SNOOZE,
- PS_WAKEUP
-};
-
-struct power_save_status {
- atomic_t status; /* initialvalue 0 */
- struct completion wakeup_wait;
- atomic_t confirm_wait;
- atomic_t snooze_guard;
-};
-
-struct sleep_status {
- atomic_t status; /* initialvalue 0 */
- atomic_t doze_request;
- atomic_t wakeup_request;
-};
-
-/* WPA */
-struct scan_ext {
- unsigned int flag;
- char ssid[IW_ESSID_MAX_SIZE + 1];
-};
-
-#define CIPHER_ID_WPA_NONE "\x00\x50\xf2\x00"
-#define CIPHER_ID_WPA_WEP40 "\x00\x50\xf2\x01"
-#define CIPHER_ID_WPA_TKIP "\x00\x50\xf2\x02"
-#define CIPHER_ID_WPA_CCMP "\x00\x50\xf2\x04"
-#define CIPHER_ID_WPA_WEP104 "\x00\x50\xf2\x05"
-
-#define CIPHER_ID_WPA2_NONE "\x00\x0f\xac\x00"
-#define CIPHER_ID_WPA2_WEP40 "\x00\x0f\xac\x01"
-#define CIPHER_ID_WPA2_TKIP "\x00\x0f\xac\x02"
-#define CIPHER_ID_WPA2_CCMP "\x00\x0f\xac\x04"
-#define CIPHER_ID_WPA2_WEP104 "\x00\x0f\xac\x05"
-
-#define CIPHER_ID_LEN 4
-
-enum {
- KEY_MGMT_802_1X,
- KEY_MGMT_PSK,
- KEY_MGMT_WPANONE,
-};
-
-#define KEY_MGMT_ID_WPA_NONE "\x00\x50\xf2\x00"
-#define KEY_MGMT_ID_WPA_1X "\x00\x50\xf2\x01"
-#define KEY_MGMT_ID_WPA_PSK "\x00\x50\xf2\x02"
-#define KEY_MGMT_ID_WPA_WPANONE "\x00\x50\xf2\xff"
-
-#define KEY_MGMT_ID_WPA2_NONE "\x00\x0f\xac\x00"
-#define KEY_MGMT_ID_WPA2_1X "\x00\x0f\xac\x01"
-#define KEY_MGMT_ID_WPA2_PSK "\x00\x0f\xac\x02"
-#define KEY_MGMT_ID_WPA2_WPANONE "\x00\x0f\xac\xff"
-
-#define KEY_MGMT_ID_LEN 4
-
-#define MIC_KEY_SIZE 8
-
-struct wpa_key {
- u32 ext_flags; /* IW_ENCODE_EXT_xxx */
- u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
- u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
- struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
- * (group) keys or unicast address for
- * individual keys
- */
- u16 alg;
- u16 key_len; /* WEP: 5 or 13, TKIP: 32, CCMP: 16 */
- u8 key_val[IW_ENCODING_TOKEN_MAX];
- u8 tx_mic_key[MIC_KEY_SIZE];
- u8 rx_mic_key[MIC_KEY_SIZE];
-};
-
-#define WPA_KEY_INDEX_MAX 4
-#define WPA_RX_SEQ_LEN 6
-
-struct mic_failure {
- u16 failure; /* MIC Failure counter 0 or 1 or 2 */
- u16 counter; /* 1sec counter 0-60 */
- u32 last_failure_time;
- int stop;
-};
-
-struct wpa_status {
- int wpa_enabled;
- bool rsn_enabled;
- int version;
- int pairwise_suite; /* unicast cipher */
- int group_suite; /* multicast cipher */
- int key_mgmt_suite;
- int auth_alg;
- int txkey;
- struct wpa_key key[WPA_KEY_INDEX_MAX];
- struct scan_ext scan_ext;
- struct mic_failure mic_failure;
-};
-
-#include <linux/list.h>
-#define PMK_LIST_MAX 8
-struct pmk_list {
- u16 size;
- struct list_head head;
- struct pmk {
- struct list_head list;
- u8 bssid[ETH_ALEN];
- u8 pmkid[IW_PMKID_LEN];
- } pmk[PMK_LIST_MAX];
-};
-
-struct wps_status {
- int wps_enabled;
- int ielen;
- u8 ie[255];
-};
-
-/* Tx Device struct */
-#define TX_DEVICE_BUFF_SIZE 1024
-
-struct ks_wlan_private;
-
-/**
- * struct tx_device_buffer - Queue item for the tx queue.
- * @sendp: Pointer to the send request data.
- * @size: Size of @sendp data.
- * @complete_handler: Function called once data write to device is complete.
- * @arg1: First argument to @complete_handler.
- * @arg2: Second argument to @complete_handler.
- */
-struct tx_device_buffer {
- unsigned char *sendp;
- unsigned int size;
- void (*complete_handler)(struct ks_wlan_private *priv,
- struct sk_buff *skb);
- struct sk_buff *skb;
-};
-
-/**
- * struct tx_device - Tx buffer queue.
- * @tx_device_buffer: Queue buffer.
- * @qhead: Head of tx queue.
- * @qtail: Tail of tx queue.
- * @tx_dev_lock: Queue lock.
- */
-struct tx_device {
- struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
- unsigned int qhead;
- unsigned int qtail;
- spinlock_t tx_dev_lock; /* protect access to the queue */
-};
-
-/* Rx Device struct */
-#define RX_DATA_SIZE (2 + 2 + 2347 + 1)
-#define RX_DEVICE_BUFF_SIZE 32
-
-/**
- * struct rx_device_buffer - Queue item for the rx queue.
- * @data: rx data.
- * @size: Size of @data.
- */
-struct rx_device_buffer {
- unsigned char data[RX_DATA_SIZE];
- unsigned int size;
-};
-
-/**
- * struct rx_device - Rx buffer queue.
- * @rx_device_buffer: Queue buffer.
- * @qhead: Head of rx queue.
- * @qtail: Tail of rx queue.
- * @rx_dev_lock: Queue lock.
- */
-struct rx_device {
- struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
- unsigned int qhead;
- unsigned int qtail;
- spinlock_t rx_dev_lock; /* protect access to the queue */
-};
-
-struct ks_wlan_private {
- /* hardware information */
- void *if_hw;
- struct workqueue_struct *wq;
- struct delayed_work rw_dwork;
- struct tasklet_struct rx_bh_task;
-
- struct net_device *net_dev;
- struct net_device_stats nstats;
- struct iw_statistics wstats;
-
- struct completion confirm_wait;
-
- /* trx device & sme */
- struct tx_device tx_dev;
- struct rx_device rx_dev;
- struct sme_info sme_i;
- u8 *rxp;
- unsigned int rx_size;
- struct work_struct sme_work;
- struct work_struct wakeup_work;
- int scan_ind_count;
-
- unsigned char eth_addr[ETH_ALEN];
-
- struct local_aplist aplist;
- struct local_ap current_ap;
- struct power_save_status psstatus;
- struct sleep_status sleepstatus;
- struct wpa_status wpa;
- struct pmk_list pmklist;
- /* wireless parameter */
- struct ks_wlan_parameter reg;
- u8 current_rate;
-
- char nick[IW_ESSID_MAX_SIZE + 1];
-
- spinlock_t multicast_spin;
-
- spinlock_t dev_read_lock;
- wait_queue_head_t devread_wait;
-
- unsigned int need_commit; /* for ioctl */
-
- /* DeviceIoControl */
- bool is_device_open;
- atomic_t event_count;
- atomic_t rec_count;
- int dev_count;
-#define DEVICE_STOCK_COUNT 20
- unsigned char *dev_data[DEVICE_STOCK_COUNT];
- int dev_size[DEVICE_STOCK_COUNT];
-
- /* ioctl : IOCTL_FIRMWARE_VERSION */
- unsigned char firmware_version[128 + 1];
- int version_size;
-
- bool mac_address_valid;
-
- int dev_state;
-
- struct sk_buff *skb;
- unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */
-#define FORCE_DISCONNECT 0x80000000
-#define CONNECT_STATUS_MASK 0x7FFFFFFF
- u32 connect_status;
- int infra_status;
- u8 scan_ssid_len;
- u8 scan_ssid[IW_ESSID_MAX_SIZE + 1];
- struct local_gain gain;
- struct wps_status wps;
- u8 sleep_mode;
-
- u8 region;
- struct local_eeprom_sum eeprom_sum;
- u8 eeprom_checksum;
-
- struct hostt hostt;
-
- unsigned long last_doze;
- unsigned long last_wakeup;
-
- unsigned int wakeup_count; /* for detect wakeup loop */
-};
-
-static inline void inc_txqhead(struct ks_wlan_private *priv)
-{
- priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
-}
-
-static inline void inc_txqtail(struct ks_wlan_private *priv)
-{
- priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
-}
-
-static inline bool txq_has_space(struct ks_wlan_private *priv)
-{
- return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail,
- TX_DEVICE_BUFF_SIZE) > 0);
-}
-
-static inline void inc_rxqhead(struct ks_wlan_private *priv)
-{
- priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
-}
-
-static inline void inc_rxqtail(struct ks_wlan_private *priv)
-{
- priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
-}
-
-static inline bool rxq_has_space(struct ks_wlan_private *priv)
-{
- return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail,
- RX_DEVICE_BUFF_SIZE) > 0);
-}
-
-static inline unsigned int txq_count(struct ks_wlan_private *priv)
-{
- return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail,
- TX_DEVICE_BUFF_SIZE);
-}
-
-static inline unsigned int rxq_count(struct ks_wlan_private *priv)
-{
- return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail,
- RX_DEVICE_BUFF_SIZE);
-}
-
-int ks_wlan_net_start(struct net_device *dev);
-int ks_wlan_net_stop(struct net_device *dev);
-bool is_connect_status(u32 status);
-bool is_disconnect_status(u32 status);
-
-#endif /* _KS_WLAN_H */
diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h b/drivers/staging/ks7010/ks_wlan_ioctl.h
deleted file mode 100644
index 97c7d95de411..000000000000
--- a/drivers/staging/ks7010/ks_wlan_ioctl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Driver for KeyStream 11b/g wireless LAN
- *
- * Copyright (c) 2005-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- */
-
-#ifndef _KS_WLAN_IOCTL_H
-#define _KS_WLAN_IOCTL_H
-
-#include <linux/wireless.h>
-/* The low order bit identify a SET (0) or a GET (1) ioctl. */
-
-/* (SIOCIWFIRSTPRIV + 0) */
-/* former KS_WLAN_GET_DRIVER_VERSION (SIOCIWFIRSTPRIV + 1) */
-/* (SIOCIWFIRSTPRIV + 2) */
-#define KS_WLAN_GET_FIRM_VERSION (SIOCIWFIRSTPRIV + 3)
-#define KS_WLAN_SET_WPS_ENABLE (SIOCIWFIRSTPRIV + 4)
-#define KS_WLAN_GET_WPS_ENABLE (SIOCIWFIRSTPRIV + 5)
-#define KS_WLAN_SET_WPS_PROBE_REQ (SIOCIWFIRSTPRIV + 6)
-#define KS_WLAN_GET_EEPROM_CKSUM (SIOCIWFIRSTPRIV + 7)
-#define KS_WLAN_SET_PREAMBLE (SIOCIWFIRSTPRIV + 8)
-#define KS_WLAN_GET_PREAMBLE (SIOCIWFIRSTPRIV + 9)
-#define KS_WLAN_SET_POWER_SAVE (SIOCIWFIRSTPRIV + 10)
-#define KS_WLAN_GET_POWER_SAVE (SIOCIWFIRSTPRIV + 11)
-#define KS_WLAN_SET_SCAN_TYPE (SIOCIWFIRSTPRIV + 12)
-#define KS_WLAN_GET_SCAN_TYPE (SIOCIWFIRSTPRIV + 13)
-#define KS_WLAN_SET_RX_GAIN (SIOCIWFIRSTPRIV + 14)
-#define KS_WLAN_GET_RX_GAIN (SIOCIWFIRSTPRIV + 15)
-#define KS_WLAN_HOSTT (SIOCIWFIRSTPRIV + 16) /* unused */
-//#define KS_WLAN_SET_REGION (SIOCIWFIRSTPRIV + 17)
-#define KS_WLAN_SET_BEACON_LOST (SIOCIWFIRSTPRIV + 18)
-#define KS_WLAN_GET_BEACON_LOST (SIOCIWFIRSTPRIV + 19)
-
-#define KS_WLAN_SET_TX_GAIN (SIOCIWFIRSTPRIV + 20)
-#define KS_WLAN_GET_TX_GAIN (SIOCIWFIRSTPRIV + 21)
-
-/* for KS7010 */
-#define KS_WLAN_SET_PHY_TYPE (SIOCIWFIRSTPRIV + 22)
-#define KS_WLAN_GET_PHY_TYPE (SIOCIWFIRSTPRIV + 23)
-#define KS_WLAN_SET_CTS_MODE (SIOCIWFIRSTPRIV + 24)
-#define KS_WLAN_GET_CTS_MODE (SIOCIWFIRSTPRIV + 25)
-/* (SIOCIWFIRSTPRIV + 26) */
-/* (SIOCIWFIRSTPRIV + 27) */
-#define KS_WLAN_SET_SLEEP_MODE (SIOCIWFIRSTPRIV + 28) /* sleep mode */
-#define KS_WLAN_GET_SLEEP_MODE (SIOCIWFIRSTPRIV + 29) /* sleep mode */
-/* (SIOCIWFIRSTPRIV + 30) */
-/* (SIOCIWFIRSTPRIV + 31) */
-
-#ifdef __KERNEL__
-
-#include "ks_wlan.h"
-#include <linux/netdevice.h>
-
-int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
- unsigned int commit_flag);
-
-#endif /* __KERNEL__ */
-
-#endif /* _KS_WLAN_IOCTL_H */
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
deleted file mode 100644
index 0fb97a79ad0b..000000000000
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ /dev/null
@@ -1,2676 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Driver for KeyStream 11b/g wireless LAN
- *
- * Copyright (C) 2005-2008 KeyStream Corp.
- * Copyright (C) 2009 Renesas Technology Corp.
- */
-
-#include <linux/atomic.h>
-#include <linux/completion.h>
-#include <linux/if_arp.h>
-#include <linux/netdevice.h>
-#include <linux/timer.h>
-#include <linux/uaccess.h>
-
-static int wep_on_off;
-#define WEP_OFF 0
-#define WEP_ON_64BIT 1
-#define WEP_ON_128BIT 2
-
-#include "ks_wlan.h"
-#include "ks_hostif.h"
-#include "ks_wlan_ioctl.h"
-
-/* Include Wireless Extension definition and check version */
-#include <linux/wireless.h>
-#define WIRELESS_SPY /* enable iwspy support */
-#include <net/iw_handler.h> /* New driver API */
-
-/* Frequency list (map channels to frequencies) */
-static const long frequency_list[] = {
- 2412, 2417, 2422, 2427, 2432, 2437, 2442,
- 2447, 2452, 2457, 2462, 2467, 2472, 2484
-};
-
-/* A few details needed for WEP (Wireless Equivalent Privacy) */
-#define MAX_KEY_SIZE 13 /* 128 (?) bits */
-#define MIN_KEY_SIZE 5 /* 40 bits RC4 - WEP */
-struct wep_key {
- u16 len;
- u8 key[16]; /* 40-bit and 104-bit keys */
-};
-
-/*
- * function prototypes
- */
-static int ks_wlan_open(struct net_device *dev);
-static void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue);
-static netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static int ks_wlan_close(struct net_device *dev);
-static void ks_wlan_set_rx_mode(struct net_device *dev);
-static struct net_device_stats *ks_wlan_get_stats(struct net_device *dev);
-static int ks_wlan_set_mac_address(struct net_device *dev, void *addr);
-static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq,
- int cmd);
-
-static atomic_t update_phyinfo;
-static struct timer_list update_phyinfo_timer;
-static
-int ks_wlan_update_phy_information(struct ks_wlan_private *priv)
-{
- struct iw_statistics *wstats = &priv->wstats;
-
- netdev_dbg(priv->net_dev, "in_interrupt = %ld\n", in_interrupt());
-
- if (priv->dev_state < DEVICE_STATE_READY)
- return -EBUSY; /* not finished initialize */
-
- if (atomic_read(&update_phyinfo))
- return -EPERM;
-
- /* The status */
- wstats->status = priv->reg.operation_mode; /* Operation mode */
-
- /* Signal quality and co. But where is the noise level ??? */
- hostif_sme_enqueue(priv, SME_PHY_INFO_REQUEST);
-
- /* interruptible_sleep_on_timeout(&priv->confirm_wait, HZ/2); */
- if (!wait_for_completion_interruptible_timeout
- (&priv->confirm_wait, HZ / 2)) {
- netdev_dbg(priv->net_dev, "wait time out!!\n");
- }
-
- atomic_inc(&update_phyinfo);
- update_phyinfo_timer.expires = jiffies + HZ; /* 1sec */
- add_timer(&update_phyinfo_timer);
-
- return 0;
-}
-
-static
-void ks_wlan_update_phyinfo_timeout(struct timer_list *unused)
-{
- pr_debug("in_interrupt = %ld\n", in_interrupt());
- atomic_set(&update_phyinfo, 0);
-}
-
-int ks_wlan_setup_parameter(struct ks_wlan_private *priv,
- unsigned int commit_flag)
-{
- hostif_sme_enqueue(priv, SME_STOP_REQUEST);
-
- if (commit_flag & SME_RTS)
- hostif_sme_enqueue(priv, SME_RTS_THRESHOLD_REQUEST);
- if (commit_flag & SME_FRAG)
- hostif_sme_enqueue(priv, SME_FRAGMENTATION_THRESHOLD_REQUEST);
-
- if (commit_flag & SME_WEP_INDEX)
- hostif_sme_enqueue(priv, SME_WEP_INDEX_REQUEST);
- if (commit_flag & SME_WEP_VAL1)
- hostif_sme_enqueue(priv, SME_WEP_KEY1_REQUEST);
- if (commit_flag & SME_WEP_VAL2)
- hostif_sme_enqueue(priv, SME_WEP_KEY2_REQUEST);
- if (commit_flag & SME_WEP_VAL3)
- hostif_sme_enqueue(priv, SME_WEP_KEY3_REQUEST);
- if (commit_flag & SME_WEP_VAL4)
- hostif_sme_enqueue(priv, SME_WEP_KEY4_REQUEST);
- if (commit_flag & SME_WEP_FLAG)
- hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST);
-
- if (commit_flag & SME_RSN) {
- hostif_sme_enqueue(priv, SME_RSN_ENABLED_REQUEST);
- hostif_sme_enqueue(priv, SME_RSN_MODE_REQUEST);
- }
- if (commit_flag & SME_RSN_MULTICAST)
- hostif_sme_enqueue(priv, SME_RSN_MCAST_REQUEST);
- if (commit_flag & SME_RSN_UNICAST)
- hostif_sme_enqueue(priv, SME_RSN_UCAST_REQUEST);
- if (commit_flag & SME_RSN_AUTH)
- hostif_sme_enqueue(priv, SME_RSN_AUTH_REQUEST);
-
- hostif_sme_enqueue(priv, SME_MODE_SET_REQUEST);
-
- hostif_sme_enqueue(priv, SME_START_REQUEST);
-
- return 0;
-}
-
-/*
- * Initial Wireless Extension code for Ks_Wlannet driver by :
- * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 17 November 00
- * Conversion to new driver API by :
- * Jean Tourrilhes <jt@hpl.hp.com> - HPL - 26 March 02
- * Javier also did a good amount of work here, adding some new extensions
- * and fixing my code. Let's just say that without him this code just
- * would not work at all... - Jean II
- */
-
-static int ks_wlan_get_name(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *cwrq,
- char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (priv->dev_state < DEVICE_STATE_READY)
- strscpy(cwrq->name, "NOT READY!", sizeof(cwrq->name));
- else if (priv->reg.phy_type == D_11B_ONLY_MODE)
- strscpy(cwrq->name, "IEEE 802.11b", sizeof(cwrq->name));
- else if (priv->reg.phy_type == D_11G_ONLY_MODE)
- strscpy(cwrq->name, "IEEE 802.11g", sizeof(cwrq->name));
- else
- strscpy(cwrq->name, "IEEE 802.11b/g", sizeof(cwrq->name));
-
- return 0;
-}
-
-static int ks_wlan_set_freq(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *fwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int channel;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* If setting by frequency, convert to a channel */
- if ((fwrq->freq.e == 1) &&
- (fwrq->freq.m >= 241200000) && (fwrq->freq.m <= 248700000)) {
- int f = fwrq->freq.m / 100000;
- int c = 0;
-
- while ((c < 14) && (f != frequency_list[c]))
- c++;
- /* Hack to fall through... */
- fwrq->freq.e = 0;
- fwrq->freq.m = c + 1;
- }
- /* Setting by channel number */
- if ((fwrq->freq.m > 1000) || (fwrq->freq.e > 0))
- return -EOPNOTSUPP;
-
- channel = fwrq->freq.m;
- /* We should do a better check than that,
- * based on the card capability !!!
- */
- if ((channel < 1) || (channel > 14)) {
- netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
- dev->name, fwrq->freq.m);
- return -EINVAL;
- }
-
- /* Yes ! We can set it !!! */
- priv->reg.channel = (u8)(channel);
- priv->need_commit |= SME_MODE_SET;
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_freq(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *fwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int f;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (is_connect_status(priv->connect_status))
- f = (int)priv->current_ap.channel;
- else
- f = (int)priv->reg.channel;
-
- fwrq->freq.m = frequency_list[f - 1] * 100000;
- fwrq->freq.e = 1;
-
- return 0;
-}
-
-static int ks_wlan_set_essid(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- size_t len;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* Check if we asked for `any' */
- if (!dwrq->essid.flags) {
- /* Just send an empty SSID list */
- memset(priv->reg.ssid.body, 0, sizeof(priv->reg.ssid.body));
- priv->reg.ssid.size = 0;
- } else {
- len = dwrq->essid.length;
- /* iwconfig uses nul termination in SSID.. */
- if (len > 0 && extra[len - 1] == '\0')
- len--;
-
- /* Check the size of the string */
- if (len > IW_ESSID_MAX_SIZE)
- return -EINVAL;
-
- /* Set the SSID */
- memset(priv->reg.ssid.body, 0, sizeof(priv->reg.ssid.body));
- memcpy(priv->reg.ssid.body, extra, len);
- priv->reg.ssid.size = len;
- }
- /* Write it to the card */
- priv->need_commit |= SME_MODE_SET;
-
- ks_wlan_setup_parameter(priv, priv->need_commit);
- priv->need_commit = 0;
- return 0;
-}
-
-static int ks_wlan_get_essid(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* Note : if dwrq->flags != 0, we should
- * get the relevant SSID from the SSID list...
- */
- if (priv->reg.ssid.size != 0) {
- /* Get the current SSID */
- memcpy(extra, priv->reg.ssid.body, priv->reg.ssid.size);
-
- /* If none, we may want to get the one that was set */
-
- /* Push it out ! */
- dwrq->essid.length = priv->reg.ssid.size;
- dwrq->essid.flags = 1; /* active */
- } else {
- dwrq->essid.length = 0;
- dwrq->essid.flags = 0; /* ANY */
- }
-
- return 0;
-}
-
-static int ks_wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *awrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (priv->reg.operation_mode != MODE_ADHOC &&
- priv->reg.operation_mode != MODE_INFRASTRUCTURE) {
- eth_zero_addr(priv->reg.bssid);
- return -EOPNOTSUPP;
- }
-
- ether_addr_copy(priv->reg.bssid, awrq->ap_addr.sa_data);
- if (is_valid_ether_addr((u8 *)priv->reg.bssid))
- priv->need_commit |= SME_MODE_SET;
-
- netdev_dbg(dev, "bssid = %pM\n", priv->reg.bssid);
-
- /* Write it to the card */
- if (priv->need_commit) {
- priv->need_commit |= SME_MODE_SET;
- return -EINPROGRESS; /* Call commit handler */
- }
- return 0;
-}
-
-static int ks_wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *awrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (is_connect_status(priv->connect_status))
- ether_addr_copy(awrq->ap_addr.sa_data, priv->current_ap.bssid);
- else
- eth_zero_addr(awrq->ap_addr.sa_data);
-
- awrq->ap_addr.sa_family = ARPHRD_ETHER;
-
- return 0;
-}
-
-static int ks_wlan_set_nick(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* Check the size of the string */
- if (dwrq->data.length > 16 + 1)
- return -E2BIG;
-
- memset(priv->nick, 0, sizeof(priv->nick));
- memcpy(priv->nick, extra, dwrq->data.length);
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_nick(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- strscpy(extra, priv->nick, 17);
- dwrq->data.length = strlen(extra) + 1;
-
- return 0;
-}
-
-static int ks_wlan_set_rate(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int i = 0;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (priv->reg.phy_type == D_11B_ONLY_MODE) {
- if (vwrq->bitrate.fixed == 1) {
- switch (vwrq->bitrate.value) {
- case 11000000:
- case 5500000:
- priv->reg.rate_set.body[0] =
- (u8)(vwrq->bitrate.value / 500000);
- break;
- case 2000000:
- case 1000000:
- priv->reg.rate_set.body[0] =
- ((u8)(vwrq->bitrate.value / 500000)) |
- BASIC_RATE;
- break;
- default:
- return -EINVAL;
- }
- priv->reg.tx_rate = TX_RATE_FIXED;
- priv->reg.rate_set.size = 1;
- } else { /* vwrq->fixed == 0 */
- if (vwrq->bitrate.value > 0) {
- switch (vwrq->bitrate.value) {
- case 11000000:
- priv->reg.rate_set.body[3] =
- TX_RATE_11M;
- i++;
- fallthrough;
- case 5500000:
- priv->reg.rate_set.body[2] = TX_RATE_5M;
- i++;
- fallthrough;
- case 2000000:
- priv->reg.rate_set.body[1] =
- TX_RATE_2M | BASIC_RATE;
- i++;
- fallthrough;
- case 1000000:
- priv->reg.rate_set.body[0] =
- TX_RATE_1M | BASIC_RATE;
- i++;
- break;
- default:
- return -EINVAL;
- }
- priv->reg.tx_rate = TX_RATE_MANUAL_AUTO;
- priv->reg.rate_set.size = i;
- } else {
- priv->reg.rate_set.body[3] = TX_RATE_11M;
- priv->reg.rate_set.body[2] = TX_RATE_5M;
- priv->reg.rate_set.body[1] =
- TX_RATE_2M | BASIC_RATE;
- priv->reg.rate_set.body[0] =
- TX_RATE_1M | BASIC_RATE;
- priv->reg.tx_rate = TX_RATE_FULL_AUTO;
- priv->reg.rate_set.size = 4;
- }
- }
- } else { /* D_11B_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
- if (vwrq->bitrate.fixed == 1) {
- switch (vwrq->bitrate.value) {
- case 54000000:
- case 48000000:
- case 36000000:
- case 18000000:
- case 9000000:
- priv->reg.rate_set.body[0] =
- (u8)(vwrq->bitrate.value / 500000);
- break;
- case 24000000:
- case 12000000:
- case 11000000:
- case 6000000:
- case 5500000:
- case 2000000:
- case 1000000:
- priv->reg.rate_set.body[0] =
- ((u8)(vwrq->bitrate.value / 500000)) |
- BASIC_RATE;
- break;
- default:
- return -EINVAL;
- }
- priv->reg.tx_rate = TX_RATE_FIXED;
- priv->reg.rate_set.size = 1;
- } else { /* vwrq->fixed == 0 */
- if (vwrq->bitrate.value > 0) {
- switch (vwrq->bitrate.value) {
- case 54000000:
- priv->reg.rate_set.body[11] =
- TX_RATE_54M;
- i++;
- fallthrough;
- case 48000000:
- priv->reg.rate_set.body[10] =
- TX_RATE_48M;
- i++;
- fallthrough;
- case 36000000:
- priv->reg.rate_set.body[9] =
- TX_RATE_36M;
- i++;
- fallthrough;
- case 24000000:
- case 18000000:
- case 12000000:
- case 11000000:
- case 9000000:
- case 6000000:
- if (vwrq->bitrate.value == 24000000) {
- priv->reg.rate_set.body[8] =
- TX_RATE_18M;
- i++;
- priv->reg.rate_set.body[7] =
- TX_RATE_9M;
- i++;
- priv->reg.rate_set.body[6] =
- TX_RATE_24M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[5] =
- TX_RATE_12M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[4] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[3] =
- TX_RATE_11M | BASIC_RATE;
- i++;
- } else if (vwrq->bitrate.value == 18000000) {
- priv->reg.rate_set.body[7] =
- TX_RATE_18M;
- i++;
- priv->reg.rate_set.body[6] =
- TX_RATE_9M;
- i++;
- priv->reg.rate_set.body[5] =
- TX_RATE_12M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[4] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[3] =
- TX_RATE_11M | BASIC_RATE;
- i++;
- } else if (vwrq->bitrate.value == 12000000) {
- priv->reg.rate_set.body[6] =
- TX_RATE_9M;
- i++;
- priv->reg.rate_set.body[5] =
- TX_RATE_12M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[4] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[3] =
- TX_RATE_11M | BASIC_RATE;
- i++;
- } else if (vwrq->bitrate.value == 11000000) {
- priv->reg.rate_set.body[5] =
- TX_RATE_9M;
- i++;
- priv->reg.rate_set.body[4] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- priv->reg.rate_set.body[3] =
- TX_RATE_11M | BASIC_RATE;
- i++;
- } else if (vwrq->bitrate.value == 9000000) {
- priv->reg.rate_set.body[4] =
- TX_RATE_9M;
- i++;
- priv->reg.rate_set.body[3] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- } else { /* vwrq->value == 6000000 */
- priv->reg.rate_set.body[3] =
- TX_RATE_6M | BASIC_RATE;
- i++;
- }
- fallthrough;
- case 5500000:
- priv->reg.rate_set.body[2] =
- TX_RATE_5M | BASIC_RATE;
- i++;
- fallthrough;
- case 2000000:
- priv->reg.rate_set.body[1] =
- TX_RATE_2M | BASIC_RATE;
- i++;
- fallthrough;
- case 1000000:
- priv->reg.rate_set.body[0] =
- TX_RATE_1M | BASIC_RATE;
- i++;
- break;
- default:
- return -EINVAL;
- }
- priv->reg.tx_rate = TX_RATE_MANUAL_AUTO;
- priv->reg.rate_set.size = i;
- } else {
- priv->reg.rate_set.body[11] = TX_RATE_54M;
- priv->reg.rate_set.body[10] = TX_RATE_48M;
- priv->reg.rate_set.body[9] = TX_RATE_36M;
- priv->reg.rate_set.body[8] = TX_RATE_18M;
- priv->reg.rate_set.body[7] = TX_RATE_9M;
- priv->reg.rate_set.body[6] =
- TX_RATE_24M | BASIC_RATE;
- priv->reg.rate_set.body[5] =
- TX_RATE_12M | BASIC_RATE;
- priv->reg.rate_set.body[4] =
- TX_RATE_6M | BASIC_RATE;
- priv->reg.rate_set.body[3] =
- TX_RATE_11M | BASIC_RATE;
- priv->reg.rate_set.body[2] =
- TX_RATE_5M | BASIC_RATE;
- priv->reg.rate_set.body[1] =
- TX_RATE_2M | BASIC_RATE;
- priv->reg.rate_set.body[0] =
- TX_RATE_1M | BASIC_RATE;
- priv->reg.tx_rate = TX_RATE_FULL_AUTO;
- priv->reg.rate_set.size = 12;
- }
- }
- }
-
- priv->need_commit |= SME_MODE_SET;
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_rate(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- netdev_dbg(dev, "in_interrupt = %ld update_phyinfo = %d\n",
- in_interrupt(), atomic_read(&update_phyinfo));
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (!atomic_read(&update_phyinfo))
- ks_wlan_update_phy_information(priv);
-
- vwrq->bitrate.value = ((priv->current_rate) & RATE_MASK) * 500000;
- vwrq->bitrate.fixed = (priv->reg.tx_rate == TX_RATE_FIXED) ? 1 : 0;
-
- return 0;
-}
-
-static int ks_wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int rthr = vwrq->rts.value;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (vwrq->rts.disabled)
- rthr = 2347;
- if ((rthr < 0) || (rthr > 2347))
- return -EINVAL;
-
- priv->reg.rts = rthr;
- priv->need_commit |= SME_RTS;
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- vwrq->rts.value = priv->reg.rts;
- vwrq->rts.disabled = (vwrq->rts.value >= 2347);
- vwrq->rts.fixed = 1;
-
- return 0;
-}
-
-static int ks_wlan_set_frag(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int fthr = vwrq->frag.value;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (vwrq->frag.disabled)
- fthr = 2346;
- if ((fthr < 256) || (fthr > 2346))
- return -EINVAL;
-
- fthr &= ~0x1; /* Get an even value - is it really needed ??? */
- priv->reg.fragment = fthr;
- priv->need_commit |= SME_FRAG;
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_frag(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- vwrq->frag.value = priv->reg.fragment;
- vwrq->frag.disabled = (vwrq->frag.value >= 2346);
- vwrq->frag.fixed = 1;
-
- return 0;
-}
-
-static int ks_wlan_set_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (uwrq->mode != IW_MODE_ADHOC &&
- uwrq->mode != IW_MODE_INFRA)
- return -EINVAL;
-
- priv->reg.operation_mode = (uwrq->mode == IW_MODE_ADHOC) ?
- MODE_ADHOC : MODE_INFRASTRUCTURE;
- priv->need_commit |= SME_MODE_SET;
-
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* If not managed, assume it's ad-hoc */
- uwrq->mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ?
- IW_MODE_INFRA : IW_MODE_ADHOC;
-
- return 0;
-}
-
-static int ks_wlan_set_encode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_point *enc = &dwrq->encoding;
- struct wep_key key;
- int index = (enc->flags & IW_ENCODE_INDEX);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (enc->length > MAX_KEY_SIZE)
- return -EINVAL;
-
- /* for SLEEP MODE */
- if ((index < 0) || (index > 4))
- return -EINVAL;
-
- index = (index == 0) ? priv->reg.wep_index : (index - 1);
-
- /* Is WEP supported ? */
- /* Basic checking: do we have a key to set ? */
- if (enc->length > 0) {
- key.len = (enc->length > MIN_KEY_SIZE) ?
- MAX_KEY_SIZE : MIN_KEY_SIZE;
- priv->reg.privacy_invoked = 0x01;
- priv->need_commit |= SME_WEP_FLAG;
- wep_on_off = (enc->length > MIN_KEY_SIZE) ?
- WEP_ON_128BIT : WEP_ON_64BIT;
- /* Check if the key is not marked as invalid */
- if (enc->flags & IW_ENCODE_NOKEY)
- return 0;
-
- /* Cleanup */
- memset(key.key, 0, MAX_KEY_SIZE);
- /* Copy the key in the driver */
- if (copy_from_user(key.key, enc->pointer, enc->length)) {
- key.len = 0;
- return -EFAULT;
- }
- /* Send the key to the card */
- priv->reg.wep_key[index].size = key.len;
- memcpy(&priv->reg.wep_key[index].val[0], &key.key[0],
- priv->reg.wep_key[index].size);
- priv->need_commit |= (SME_WEP_VAL1 << index);
- priv->reg.wep_index = index;
- priv->need_commit |= SME_WEP_INDEX;
- } else {
- if (enc->flags & IW_ENCODE_DISABLED) {
- priv->reg.wep_key[0].size = 0;
- priv->reg.wep_key[1].size = 0;
- priv->reg.wep_key[2].size = 0;
- priv->reg.wep_key[3].size = 0;
- priv->reg.privacy_invoked = 0x00;
- if (priv->reg.authenticate_type == AUTH_TYPE_SHARED_KEY)
- priv->need_commit |= SME_MODE_SET;
-
- priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM;
- wep_on_off = WEP_OFF;
- priv->need_commit |= SME_WEP_FLAG;
- } else {
- /* set_wep_key(priv, index, 0, 0, 1); xxx */
- if (priv->reg.wep_key[index].size == 0)
- return -EINVAL;
- priv->reg.wep_index = index;
- priv->need_commit |= SME_WEP_INDEX;
- }
- }
-
- /* Commit the changes if needed */
- if (enc->flags & IW_ENCODE_MODE)
- priv->need_commit |= SME_WEP_FLAG;
-
- if (enc->flags & IW_ENCODE_OPEN) {
- if (priv->reg.authenticate_type == AUTH_TYPE_SHARED_KEY)
- priv->need_commit |= SME_MODE_SET;
-
- priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM;
- } else if (enc->flags & IW_ENCODE_RESTRICTED) {
- if (priv->reg.authenticate_type == AUTH_TYPE_OPEN_SYSTEM)
- priv->need_commit |= SME_MODE_SET;
-
- priv->reg.authenticate_type = AUTH_TYPE_SHARED_KEY;
- }
- if (priv->need_commit) {
- ks_wlan_setup_parameter(priv, priv->need_commit);
- priv->need_commit = 0;
- }
- return 0;
-}
-
-static int ks_wlan_get_encode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_point *enc = &dwrq->encoding;
- int index = (enc->flags & IW_ENCODE_INDEX) - 1;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- enc->flags = IW_ENCODE_DISABLED;
-
- /* Check encryption mode */
- switch (priv->reg.authenticate_type) {
- case AUTH_TYPE_OPEN_SYSTEM:
- enc->flags = IW_ENCODE_OPEN;
- break;
- case AUTH_TYPE_SHARED_KEY:
- enc->flags = IW_ENCODE_RESTRICTED;
- break;
- }
-
- /* Which key do we want ? -1 -> tx index */
- if ((index < 0) || (index >= 4))
- index = priv->reg.wep_index;
- if (priv->reg.privacy_invoked) {
- enc->flags &= ~IW_ENCODE_DISABLED;
- /* dwrq->flags |= IW_ENCODE_NOKEY; */
- }
- enc->flags |= index + 1;
- /* Copy the key to the user buffer */
- if (index >= 0 && index < 4) {
- enc->length = (priv->reg.wep_key[index].size <= 16) ?
- priv->reg.wep_key[index].size : 0;
- memcpy(extra, priv->reg.wep_key[index].val, enc->length);
- }
-
- return 0;
-}
-
-static int ks_wlan_get_range(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_range *range = (struct iw_range *)extra;
- int i, k;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- dwrq->data.length = sizeof(struct iw_range);
- memset(range, 0, sizeof(*range));
- range->min_nwid = 0x0000;
- range->max_nwid = 0x0000;
- range->num_channels = 14;
- /* Should be based on cap_rid.country to give only
- * what the current card support
- */
- k = 0;
- for (i = 0; i < 13; i++) { /* channel 1 -- 13 */
- range->freq[k].i = i + 1; /* List index */
- range->freq[k].m = frequency_list[i] * 100000;
- range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
- }
- range->num_frequency = k;
- if (priv->reg.phy_type == D_11B_ONLY_MODE ||
- priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) { /* channel 14 */
- range->freq[13].i = 14; /* List index */
- range->freq[13].m = frequency_list[13] * 100000;
- range->freq[13].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
- range->num_frequency = 14;
- }
-
- /* Hum... Should put the right values there */
- range->max_qual.qual = 100;
- range->max_qual.level = 256 - 128; /* 0 dBm? */
- range->max_qual.noise = 256 - 128;
- range->sensitivity = 1;
-
- if (priv->reg.phy_type == D_11B_ONLY_MODE) {
- range->bitrate[0] = 1e6;
- range->bitrate[1] = 2e6;
- range->bitrate[2] = 5.5e6;
- range->bitrate[3] = 11e6;
- range->num_bitrates = 4;
- } else { /* D_11G_ONLY_MODE or D_11BG_COMPATIBLE_MODE */
- range->bitrate[0] = 1e6;
- range->bitrate[1] = 2e6;
- range->bitrate[2] = 5.5e6;
- range->bitrate[3] = 11e6;
-
- range->bitrate[4] = 6e6;
- range->bitrate[5] = 9e6;
- range->bitrate[6] = 12e6;
- if (IW_MAX_BITRATES < 9) {
- range->bitrate[7] = 54e6;
- range->num_bitrates = 8;
- } else {
- range->bitrate[7] = 18e6;
- range->bitrate[8] = 24e6;
- range->bitrate[9] = 36e6;
- range->bitrate[10] = 48e6;
- range->bitrate[11] = 54e6;
-
- range->num_bitrates = 12;
- }
- }
-
- /* Set an indication of the max TCP throughput
- * in bit/s that we can expect using this interface.
- * May be use for QoS stuff... Jean II
- */
- if (i > 2)
- range->throughput = 5000 * 1000;
- else
- range->throughput = 1500 * 1000;
-
- range->min_rts = 0;
- range->max_rts = 2347;
- range->min_frag = 256;
- range->max_frag = 2346;
-
- range->encoding_size[0] = 5; /* WEP: RC4 40 bits */
- range->encoding_size[1] = 13; /* WEP: RC4 ~128 bits */
- range->num_encoding_sizes = 2;
- range->max_encoding_tokens = 4;
-
- /* power management not support */
- range->pmp_flags = IW_POWER_ON;
- range->pmt_flags = IW_POWER_ON;
- range->pm_capa = 0;
-
- /* Transmit Power - values are in dBm( or mW) */
- range->txpower[0] = -256;
- range->num_txpower = 1;
- range->txpower_capa = IW_TXPOW_DBM;
- /* range->txpower_capa = IW_TXPOW_MWATT; */
-
- range->we_version_source = 21;
- range->we_version_compiled = WIRELESS_EXT;
-
- range->retry_capa = IW_RETRY_ON;
- range->retry_flags = IW_RETRY_ON;
- range->r_time_flags = IW_RETRY_ON;
-
- /* Experimental measurements - boundary 11/5.5 Mb/s
- *
- * Note : with or without the (local->rssi), results
- * are somewhat different. - Jean II
- */
- range->avg_qual.qual = 50;
- range->avg_qual.level = 186; /* -70 dBm */
- range->avg_qual.noise = 0;
-
- /* Event capability (kernel + driver) */
- range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
- IW_EVENT_CAPA_MASK(SIOCGIWAP) |
- IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
- range->event_capa[1] = IW_EVENT_CAPA_K_1;
- range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVCUSTOM) |
- IW_EVENT_CAPA_MASK(IWEVMICHAELMICFAILURE));
-
- /* encode extension (WPA) capability */
- range->enc_capa = (IW_ENC_CAPA_WPA |
- IW_ENC_CAPA_WPA2 |
- IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP);
- return 0;
-}
-
-static int ks_wlan_set_power(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (vwrq->power.disabled) {
- priv->reg.power_mgmt = POWER_MGMT_ACTIVE;
- } else {
- if (priv->reg.operation_mode != MODE_INFRASTRUCTURE)
- return -EINVAL;
- priv->reg.power_mgmt = POWER_MGMT_SAVE1;
- }
-
- hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-
- return 0;
-}
-
-static int ks_wlan_get_power(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- vwrq->power.disabled = (priv->reg.power_mgmt <= 0);
-
- return 0;
-}
-
-static int ks_wlan_get_iwstats(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- vwrq->qual.qual = 0; /* not supported */
- vwrq->qual.level = priv->wstats.qual.level;
- vwrq->qual.noise = 0; /* not supported */
- vwrq->qual.updated = 0;
-
- return 0;
-}
-
-/* Note : this is deprecated in favor of IWSCAN */
-static int ks_wlan_get_aplist(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct sockaddr *address = (struct sockaddr *)extra;
- struct iw_quality qual[LOCAL_APLIST_MAX];
- int i;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- for (i = 0; i < priv->aplist.size; i++) {
- ether_addr_copy(address[i].sa_data, priv->aplist.ap[i].bssid);
- address[i].sa_family = ARPHRD_ETHER;
- qual[i].level = 256 - priv->aplist.ap[i].rssi;
- qual[i].qual = priv->aplist.ap[i].sq;
- qual[i].noise = 0; /* invalid noise value */
- qual[i].updated = 7;
- }
- if (i) {
- dwrq->data.flags = 1; /* Should be define'd */
- memcpy(extra + sizeof(struct sockaddr) * i,
- &qual, sizeof(struct iw_quality) * i);
- }
- dwrq->data.length = i;
-
- return 0;
-}
-
-static int ks_wlan_set_scan(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *wrqu, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_scan_req *req = NULL;
- int len;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* specified SSID SCAN */
- if (wrqu->data.length == sizeof(struct iw_scan_req) &&
- wrqu->data.flags & IW_SCAN_THIS_ESSID) {
- req = (struct iw_scan_req *)extra;
- len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
- priv->scan_ssid_len = len;
- memcpy(priv->scan_ssid, req->essid, len);
- } else {
- priv->scan_ssid_len = 0;
- }
-
- priv->sme_i.sme_flag |= SME_AP_SCAN;
- hostif_sme_enqueue(priv, SME_BSS_SCAN_REQUEST);
-
- /* At this point, just return to the user. */
-
- return 0;
-}
-
-static char *ks_wlan_add_leader_event(const char *rsn_leader, char *end_buf,
- char *current_ev, struct rsn_ie *rsn,
- struct iw_event *iwe,
- struct iw_request_info *info)
-{
- char buffer[RSN_IE_BODY_MAX * 2 + 30];
- char *pbuf;
- int i;
-
- pbuf = &buffer[0];
- memset(iwe, 0, sizeof(*iwe));
- iwe->cmd = IWEVCUSTOM;
- memcpy(buffer, rsn_leader, sizeof(rsn_leader) - 1);
- iwe->u.data.length += sizeof(rsn_leader) - 1;
- pbuf += sizeof(rsn_leader) - 1;
- pbuf += sprintf(pbuf, "%02x", rsn->id);
- pbuf += sprintf(pbuf, "%02x", rsn->size);
- iwe->u.data.length += 4;
-
- for (i = 0; i < rsn->size; i++)
- pbuf += sprintf(pbuf, "%02x", rsn->body[i]);
-
- iwe->u.data.length += rsn->size * 2;
-
- return iwe_stream_add_point(info, current_ev, end_buf, iwe, &buffer[0]);
-}
-
-/*
- * Translate scan data returned from the card to a card independent
- * format that the Wireless Tools will understand - Jean II
- */
-static inline char *ks_wlan_translate_scan(struct net_device *dev,
- struct iw_request_info *info,
- char *current_ev, char *end_buf,
- struct local_ap *ap)
-{
- /* struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv; */
- static const char rsn_leader[] = "rsn_ie=";
- static const char wpa_leader[] = "wpa_ie=";
- struct iw_event iwe; /* Temporary buffer */
- u16 capabilities;
- char *current_val; /* For rates */
- int i;
-
- /* First entry *MUST* be the AP MAC address */
- iwe.cmd = SIOCGIWAP;
- iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
- ether_addr_copy(iwe.u.ap_addr.sa_data, ap->bssid);
- current_ev = iwe_stream_add_event(info, current_ev,
- end_buf, &iwe, IW_EV_ADDR_LEN);
-
- /* Other entries will be displayed in the order we give them */
-
- /* Add the ESSID */
- iwe.u.data.length = ap->ssid.size;
- if (iwe.u.data.length > 32)
- iwe.u.data.length = 32;
- iwe.cmd = SIOCGIWESSID;
- iwe.u.data.flags = 1;
- current_ev = iwe_stream_add_point(info, current_ev,
- end_buf, &iwe, ap->ssid.body);
-
- /* Add mode */
- iwe.cmd = SIOCGIWMODE;
- capabilities = ap->capability;
- if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
- iwe.u.mode = (capabilities & WLAN_CAPABILITY_ESS) ?
- IW_MODE_INFRA : IW_MODE_ADHOC;
- current_ev = iwe_stream_add_event(info, current_ev,
- end_buf, &iwe, IW_EV_UINT_LEN);
- }
-
- /* Add frequency */
- iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = ap->channel;
- iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000;
- iwe.u.freq.e = 1;
- current_ev = iwe_stream_add_event(info, current_ev,
- end_buf, &iwe, IW_EV_FREQ_LEN);
-
- /* Add quality statistics */
- iwe.cmd = IWEVQUAL;
- iwe.u.qual.level = 256 - ap->rssi;
- iwe.u.qual.qual = ap->sq;
- iwe.u.qual.noise = 0; /* invalid noise value */
- current_ev = iwe_stream_add_event(info, current_ev, end_buf,
- &iwe, IW_EV_QUAL_LEN);
-
- /* Add encryption capability */
- iwe.cmd = SIOCGIWENCODE;
- iwe.u.data.flags = (capabilities & WLAN_CAPABILITY_PRIVACY) ?
- (IW_ENCODE_ENABLED | IW_ENCODE_NOKEY) :
- IW_ENCODE_DISABLED;
- iwe.u.data.length = 0;
- current_ev = iwe_stream_add_point(info, current_ev, end_buf,
- &iwe, ap->ssid.body);
-
- /*
- * Rate : stuffing multiple values in a single event
- * require a bit more of magic - Jean II
- */
- current_val = current_ev + IW_EV_LCP_LEN;
-
- iwe.cmd = SIOCGIWRATE;
-
- /* These two flags are ignored... */
- iwe.u.bitrate.fixed = 0;
- iwe.u.bitrate.disabled = 0;
-
- /* Max 16 values */
- for (i = 0; i < 16; i++) {
- /* NULL terminated */
- if (i >= ap->rate_set.size)
- break;
- /* Bit rate given in 500 kb/s units (+ 0x80) */
- iwe.u.bitrate.value = ((ap->rate_set.body[i] & 0x7f) * 500000);
- /* Add new value to event */
- current_val = iwe_stream_add_value(info, current_ev,
- current_val, end_buf, &iwe,
- IW_EV_PARAM_LEN);
- }
- /* Check if we added any event */
- if ((current_val - current_ev) > IW_EV_LCP_LEN)
- current_ev = current_val;
-
- if (ap->rsn_ie.id == RSN_INFO_ELEM_ID && ap->rsn_ie.size != 0)
- current_ev = ks_wlan_add_leader_event(rsn_leader, end_buf,
- current_ev, &ap->rsn_ie,
- &iwe, info);
-
- if (ap->wpa_ie.id == WPA_INFO_ELEM_ID && ap->wpa_ie.size != 0)
- current_ev = ks_wlan_add_leader_event(wpa_leader, end_buf,
- current_ev, &ap->wpa_ie,
- &iwe, info);
-
- /*
- * The other data in the scan result are not really
- * interesting, so for now drop it - Jean II
- */
- return current_ev;
-}
-
-static int ks_wlan_get_scan(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int i;
- char *current_ev = extra;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (priv->sme_i.sme_flag & SME_AP_SCAN)
- return -EAGAIN;
-
- if (priv->aplist.size == 0) {
- /* Client error, no scan results...
- * The caller need to restart the scan.
- */
- return -ENODATA;
- }
-
- /* Read and parse all entries */
- for (i = 0; i < priv->aplist.size; i++) {
- if ((extra + dwrq->data.length) - current_ev <= IW_EV_ADDR_LEN) {
- dwrq->data.length = 0;
- return -E2BIG;
- }
- /* Translate to WE format this entry */
- current_ev = ks_wlan_translate_scan(dev, info, current_ev,
- extra + dwrq->data.length,
- &priv->aplist.ap[i]);
- }
- /* Length of data */
- dwrq->data.length = (current_ev - extra);
- dwrq->data.flags = 0;
-
- return 0;
-}
-
-/* called after a bunch of SET operations */
-static int ks_wlan_config_commit(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *zwrq,
- char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (!priv->need_commit)
- return 0;
-
- ks_wlan_setup_parameter(priv, priv->need_commit);
- priv->need_commit = 0;
- return 0;
-}
-
-/* set association ie params */
-static int ks_wlan_set_genie(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- return 0;
-// return -EOPNOTSUPP;
-}
-
-static int ks_wlan_set_auth_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_param *param = &vwrq->param;
- int index = (param->flags & IW_AUTH_INDEX);
- int value = param->value;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- switch (index) {
- case IW_AUTH_WPA_VERSION: /* 0 */
- switch (value) {
- case IW_AUTH_WPA_VERSION_DISABLED:
- priv->wpa.version = value;
- if (priv->wpa.rsn_enabled)
- priv->wpa.rsn_enabled = false;
- priv->need_commit |= SME_RSN;
- break;
- case IW_AUTH_WPA_VERSION_WPA:
- case IW_AUTH_WPA_VERSION_WPA2:
- priv->wpa.version = value;
- if (!(priv->wpa.rsn_enabled))
- priv->wpa.rsn_enabled = true;
- priv->need_commit |= SME_RSN;
- break;
- default:
- return -EOPNOTSUPP;
- }
- break;
- case IW_AUTH_CIPHER_PAIRWISE: /* 1 */
- switch (value) {
- case IW_AUTH_CIPHER_NONE:
- if (priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x00;
- priv->need_commit |= SME_WEP_FLAG;
- }
- break;
- case IW_AUTH_CIPHER_WEP40:
- case IW_AUTH_CIPHER_TKIP:
- case IW_AUTH_CIPHER_CCMP:
- case IW_AUTH_CIPHER_WEP104:
- if (!priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x01;
- priv->need_commit |= SME_WEP_FLAG;
- }
- priv->wpa.pairwise_suite = value;
- priv->need_commit |= SME_RSN_UNICAST;
- break;
- default:
- return -EOPNOTSUPP;
- }
- break;
- case IW_AUTH_CIPHER_GROUP: /* 2 */
- switch (value) {
- case IW_AUTH_CIPHER_NONE:
- if (priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x00;
- priv->need_commit |= SME_WEP_FLAG;
- }
- break;
- case IW_AUTH_CIPHER_WEP40:
- case IW_AUTH_CIPHER_TKIP:
- case IW_AUTH_CIPHER_CCMP:
- case IW_AUTH_CIPHER_WEP104:
- if (!priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x01;
- priv->need_commit |= SME_WEP_FLAG;
- }
- priv->wpa.group_suite = value;
- priv->need_commit |= SME_RSN_MULTICAST;
- break;
- default:
- return -EOPNOTSUPP;
- }
- break;
- case IW_AUTH_KEY_MGMT: /* 3 */
- switch (value) {
- case IW_AUTH_KEY_MGMT_802_1X:
- case IW_AUTH_KEY_MGMT_PSK:
- case 0: /* NONE or 802_1X_NO_WPA */
- case 4: /* WPA_NONE */
- priv->wpa.key_mgmt_suite = value;
- priv->need_commit |= SME_RSN_AUTH;
- break;
- default:
- return -EOPNOTSUPP;
- }
- break;
- case IW_AUTH_80211_AUTH_ALG: /* 6 */
- switch (value) {
- case IW_AUTH_ALG_OPEN_SYSTEM:
- priv->wpa.auth_alg = value;
- priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM;
- break;
- case IW_AUTH_ALG_SHARED_KEY:
- priv->wpa.auth_alg = value;
- priv->reg.authenticate_type = AUTH_TYPE_SHARED_KEY;
- break;
- case IW_AUTH_ALG_LEAP:
- default:
- return -EOPNOTSUPP;
- }
- priv->need_commit |= SME_MODE_SET;
- break;
- case IW_AUTH_WPA_ENABLED: /* 7 */
- priv->wpa.wpa_enabled = value;
- break;
- case IW_AUTH_PRIVACY_INVOKED: /* 10 */
- if ((value && !priv->reg.privacy_invoked) ||
- (!value && priv->reg.privacy_invoked)) {
- priv->reg.privacy_invoked = value ? 0x01 : 0x00;
- priv->need_commit |= SME_WEP_FLAG;
- }
- break;
- case IW_AUTH_RX_UNENCRYPTED_EAPOL: /* 4 */
- case IW_AUTH_TKIP_COUNTERMEASURES: /* 5 */
- case IW_AUTH_DROP_UNENCRYPTED: /* 8 */
- case IW_AUTH_ROAMING_CONTROL: /* 9 */
- default:
- break;
- }
-
- /* return -EINPROGRESS; */
- if (priv->need_commit) {
- ks_wlan_setup_parameter(priv, priv->need_commit);
- priv->need_commit = 0;
- }
- return 0;
-}
-
-static int ks_wlan_get_auth_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *vwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_param *param = &vwrq->param;
- int index = (param->flags & IW_AUTH_INDEX);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* WPA (not used ?? wpa_supplicant) */
- switch (index) {
- case IW_AUTH_WPA_VERSION:
- param->value = priv->wpa.version;
- break;
- case IW_AUTH_CIPHER_PAIRWISE:
- param->value = priv->wpa.pairwise_suite;
- break;
- case IW_AUTH_CIPHER_GROUP:
- param->value = priv->wpa.group_suite;
- break;
- case IW_AUTH_KEY_MGMT:
- param->value = priv->wpa.key_mgmt_suite;
- break;
- case IW_AUTH_80211_AUTH_ALG:
- param->value = priv->wpa.auth_alg;
- break;
- case IW_AUTH_WPA_ENABLED:
- param->value = priv->wpa.rsn_enabled;
- break;
- case IW_AUTH_RX_UNENCRYPTED_EAPOL: /* OK??? */
- case IW_AUTH_TKIP_COUNTERMEASURES:
- case IW_AUTH_DROP_UNENCRYPTED:
- default:
- /* return -EOPNOTSUPP; */
- break;
- }
- return 0;
-}
-
-/* set encoding token & mode (WPA)*/
-static int ks_wlan_set_encode_ext(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_encode_ext *enc;
- int index = dwrq->encoding.flags & IW_ENCODE_INDEX;
- unsigned int commit = 0;
- struct wpa_key *key;
-
- enc = (struct iw_encode_ext *)extra;
- if (!enc)
- return -EINVAL;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (index < 1 || index > 4)
- return -EINVAL;
- index--;
- key = &priv->wpa.key[index];
-
- if (dwrq->encoding.flags & IW_ENCODE_DISABLED)
- key->key_len = 0;
-
- key->ext_flags = enc->ext_flags;
- if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
- priv->wpa.txkey = index;
- commit |= SME_WEP_INDEX;
- } else if (enc->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
- memcpy(&key->rx_seq[0], &enc->rx_seq[0], IW_ENCODE_SEQ_MAX_SIZE);
- }
-
- ether_addr_copy(&key->addr.sa_data[0], &enc->addr.sa_data[0]);
-
- switch (enc->alg) {
- case IW_ENCODE_ALG_NONE:
- if (priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x00;
- commit |= SME_WEP_FLAG;
- }
- key->key_len = 0;
-
- break;
- case IW_ENCODE_ALG_WEP:
- case IW_ENCODE_ALG_CCMP:
- if (!priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x01;
- commit |= SME_WEP_FLAG;
- }
- if (enc->key_len) {
- int key_len = clamp_val(enc->key_len, 0, IW_ENCODING_TOKEN_MAX);
-
- memcpy(&key->key_val[0], &enc->key[0], key_len);
- key->key_len = key_len;
- commit |= (SME_WEP_VAL1 << index);
- }
- break;
- case IW_ENCODE_ALG_TKIP:
- if (!priv->reg.privacy_invoked) {
- priv->reg.privacy_invoked = 0x01;
- commit |= SME_WEP_FLAG;
- }
- if (enc->key_len == 32) {
- memcpy(&key->key_val[0], &enc->key[0], enc->key_len - 16);
- key->key_len = enc->key_len - 16;
- if (priv->wpa.key_mgmt_suite == 4) { /* WPA_NONE */
- memcpy(&key->tx_mic_key[0], &enc->key[16], 8);
- memcpy(&key->rx_mic_key[0], &enc->key[16], 8);
- } else {
- memcpy(&key->tx_mic_key[0], &enc->key[16], 8);
- memcpy(&key->rx_mic_key[0], &enc->key[24], 8);
- }
- commit |= (SME_WEP_VAL1 << index);
- }
- break;
- default:
- return -EINVAL;
- }
- key->alg = enc->alg;
-
- if (commit) {
- if (commit & SME_WEP_INDEX)
- hostif_sme_enqueue(priv, SME_SET_TXKEY);
- if (commit & SME_WEP_VAL_MASK)
- hostif_sme_enqueue(priv, SME_SET_KEY1 + index);
- if (commit & SME_WEP_FLAG)
- hostif_sme_enqueue(priv, SME_WEP_FLAG_REQUEST);
- }
-
- return 0;
-}
-
-/* get encoding token & mode (WPA)*/
-static int ks_wlan_get_encode_ext(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- /* WPA (not used ?? wpa_supplicant)
- * struct ks_wlan_private *priv = (struct ks_wlan_private *)dev->priv;
- * struct iw_encode_ext *enc;
- * enc = (struct iw_encode_ext *)extra;
- * int index = dwrq->flags & IW_ENCODE_INDEX;
- * WPA (not used ?? wpa_supplicant)
- */
- return 0;
-}
-
-static int ks_wlan_set_pmksa(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_pmksa *pmksa;
- int i;
- struct pmk *pmk;
- struct list_head *ptr;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (!extra)
- return -EINVAL;
-
- pmksa = (struct iw_pmksa *)extra;
-
- switch (pmksa->cmd) {
- case IW_PMKSA_ADD:
- if (list_empty(&priv->pmklist.head)) {
- for (i = 0; i < PMK_LIST_MAX; i++) {
- pmk = &priv->pmklist.pmk[i];
- if (is_zero_ether_addr(pmk->bssid))
- break;
- }
- ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data);
- memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN);
- list_add(&pmk->list, &priv->pmklist.head);
- priv->pmklist.size++;
- break;
- }
- /* search cache data */
- list_for_each(ptr, &priv->pmklist.head) {
- pmk = list_entry(ptr, struct pmk, list);
- if (ether_addr_equal(pmksa->bssid.sa_data, pmk->bssid)) {
- memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN);
- list_move(&pmk->list, &priv->pmklist.head);
- break;
- }
- }
- /* not find address. */
- if (ptr != &priv->pmklist.head)
- break;
- /* new cache data */
- if (priv->pmklist.size < PMK_LIST_MAX) {
- for (i = 0; i < PMK_LIST_MAX; i++) {
- pmk = &priv->pmklist.pmk[i];
- if (is_zero_ether_addr(pmk->bssid))
- break;
- }
- ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data);
- memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN);
- list_add(&pmk->list, &priv->pmklist.head);
- priv->pmklist.size++;
- } else { /* overwrite old cache data */
- pmk = list_entry(priv->pmklist.head.prev, struct pmk,
- list);
- ether_addr_copy(pmk->bssid, pmksa->bssid.sa_data);
- memcpy(pmk->pmkid, pmksa->pmkid, IW_PMKID_LEN);
- list_move(&pmk->list, &priv->pmklist.head);
- }
- break;
- case IW_PMKSA_REMOVE:
- if (list_empty(&priv->pmklist.head))
- return -EINVAL;
- /* search cache data */
- list_for_each(ptr, &priv->pmklist.head) {
- pmk = list_entry(ptr, struct pmk, list);
- if (ether_addr_equal(pmksa->bssid.sa_data, pmk->bssid)) {
- eth_zero_addr(pmk->bssid);
- memset(pmk->pmkid, 0, IW_PMKID_LEN);
- list_del_init(&pmk->list);
- break;
- }
- }
- /* not find address. */
- if (ptr == &priv->pmklist.head)
- return 0;
- break;
- case IW_PMKSA_FLUSH:
- memset(&priv->pmklist, 0, sizeof(priv->pmklist));
- INIT_LIST_HEAD(&priv->pmklist.head);
- for (i = 0; i < PMK_LIST_MAX; i++)
- INIT_LIST_HEAD(&priv->pmklist.pmk[i].list);
- break;
- default:
- return -EINVAL;
- }
-
- hostif_sme_enqueue(priv, SME_SET_PMKSA);
- return 0;
-}
-
-static struct iw_statistics *ks_get_wireless_stats(struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_statistics *wstats = &priv->wstats;
-
- if (!atomic_read(&update_phyinfo))
- return (priv->dev_state < DEVICE_STATE_READY) ? NULL : wstats;
-
- /*
- * Packets discarded in the wireless adapter due to wireless
- * specific problems
- */
- wstats->discard.nwid = 0; /* Rx invalid nwid */
- wstats->discard.code = 0; /* Rx invalid crypt */
- wstats->discard.fragment = 0; /* Rx invalid frag */
- wstats->discard.retries = 0; /* Tx excessive retries */
- wstats->discard.misc = 0; /* Invalid misc */
- wstats->miss.beacon = 0; /* Missed beacon */
-
- return wstats;
-}
-
-static int ks_wlan_set_stop_request(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (!(uwrq->mode))
- return -EINVAL;
-
- hostif_sme_enqueue(priv, SME_STOP_REQUEST);
- return 0;
-}
-
-#include <linux/ieee80211.h>
-static int ks_wlan_set_mlme(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *dwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct iw_mlme *mlme = (struct iw_mlme *)extra;
- union iwreq_data uwrq;
-
- uwrq.mode = 1;
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (mlme->cmd != IW_MLME_DEAUTH &&
- mlme->cmd != IW_MLME_DISASSOC)
- return -EOPNOTSUPP;
-
- if (mlme->cmd == IW_MLME_DEAUTH &&
- mlme->reason_code == WLAN_REASON_MIC_FAILURE)
- return 0;
-
- return ks_wlan_set_stop_request(dev, NULL, &uwrq, NULL);
-}
-
-static int ks_wlan_get_firmware_version(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct iw_point *dwrq = &uwrq->data;
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- dwrq->length = priv->version_size + 1;
- strscpy(extra, priv->firmware_version, dwrq->length);
- return 0;
-}
-
-static int ks_wlan_set_preamble(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- if (uwrq->mode != LONG_PREAMBLE && uwrq->mode != SHORT_PREAMBLE)
- return -EINVAL;
-
- priv->reg.preamble = uwrq->mode;
- priv->need_commit |= SME_MODE_SET;
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_preamble(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.preamble;
- return 0;
-}
-
-static int ks_wlan_set_power_mgmt(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (uwrq->mode != POWER_MGMT_ACTIVE &&
- uwrq->mode != POWER_MGMT_SAVE1 &&
- uwrq->mode != POWER_MGMT_SAVE2)
- return -EINVAL;
-
- if ((uwrq->mode == POWER_MGMT_SAVE1 || uwrq->mode == POWER_MGMT_SAVE2) &&
- (priv->reg.operation_mode != MODE_INFRASTRUCTURE))
- return -EINVAL;
-
- priv->reg.power_mgmt = uwrq->mode;
- hostif_sme_enqueue(priv, SME_POW_MNGMT_REQUEST);
-
- return 0;
-}
-
-static int ks_wlan_get_power_mgmt(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.power_mgmt;
- return 0;
-}
-
-static int ks_wlan_set_scan_type(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
-
- if (uwrq->mode != ACTIVE_SCAN && uwrq->mode != PASSIVE_SCAN)
- return -EINVAL;
-
- priv->reg.scan_type = uwrq->mode;
- return 0;
-}
-
-static int ks_wlan_get_scan_type(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.scan_type;
- return 0;
-}
-
-static int ks_wlan_set_beacon_lost(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (uwrq->mode > BEACON_LOST_COUNT_MAX)
- return -EINVAL;
-
- priv->reg.beacon_lost_count = uwrq->mode;
-
- if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
- priv->need_commit |= SME_MODE_SET;
- return -EINPROGRESS; /* Call commit handler */
- }
-
- return 0;
-}
-
-static int ks_wlan_get_beacon_lost(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.beacon_lost_count;
- return 0;
-}
-
-static int ks_wlan_set_phy_type(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- if (uwrq->mode != D_11B_ONLY_MODE &&
- uwrq->mode != D_11G_ONLY_MODE &&
- uwrq->mode != D_11BG_COMPATIBLE_MODE)
- return -EINVAL;
-
- /* for SLEEP MODE */
- priv->reg.phy_type = uwrq->mode;
- priv->need_commit |= SME_MODE_SET;
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_phy_type(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.phy_type;
- return 0;
-}
-
-static int ks_wlan_set_cts_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (uwrq->mode != CTS_MODE_FALSE && uwrq->mode != CTS_MODE_TRUE)
- return -EINVAL;
-
- priv->reg.cts_mode = (uwrq->mode == CTS_MODE_FALSE) ? uwrq->mode :
- (priv->reg.phy_type == D_11G_ONLY_MODE ||
- priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) ?
- uwrq->mode : !uwrq->mode;
-
- priv->need_commit |= SME_MODE_SET;
- return -EINPROGRESS; /* Call commit handler */
-}
-
-static int ks_wlan_get_cts_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->reg.cts_mode;
- return 0;
-}
-
-static int ks_wlan_set_sleep_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (uwrq->mode != SLP_SLEEP &&
- uwrq->mode != SLP_ACTIVE) {
- netdev_err(dev, "SET_SLEEP_MODE %d error\n", uwrq->mode);
- return -EINVAL;
- }
-
- priv->sleep_mode = uwrq->mode;
- netdev_info(dev, "SET_SLEEP_MODE %d\n", priv->sleep_mode);
-
- if (uwrq->mode == SLP_SLEEP)
- hostif_sme_enqueue(priv, SME_STOP_REQUEST);
-
- hostif_sme_enqueue(priv, SME_SLEEP_REQUEST);
-
- return 0;
-}
-
-static int ks_wlan_get_sleep_mode(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- uwrq->mode = priv->sleep_mode;
-
- return 0;
-}
-
-static int ks_wlan_set_wps_enable(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (uwrq->mode != 0 && uwrq->mode != 1)
- return -EINVAL;
-
- priv->wps.wps_enabled = uwrq->mode;
- hostif_sme_enqueue(priv, SME_WPS_ENABLE_REQUEST);
-
- return 0;
-}
-
-static int ks_wlan_get_wps_enable(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->wps.wps_enabled;
- netdev_info(dev, "return=%d\n", uwrq->mode);
-
- return 0;
-}
-
-static int ks_wlan_set_wps_probe_req(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct iw_point *dwrq = &uwrq->data;
- u8 *p = extra;
- unsigned char len;
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
-
- /* length check */
- if (p[1] + 2 != dwrq->length || dwrq->length > 256)
- return -EINVAL;
-
- priv->wps.ielen = p[1] + 2 + 1; /* IE header + IE + sizeof(len) */
- len = p[1] + 2; /* IE header + IE */
-
- memcpy(priv->wps.ie, &len, sizeof(len));
- p = memcpy(priv->wps.ie + 1, p, len);
-
- netdev_dbg(dev, "%d(%#x): %02X %02X %02X %02X ... %02X %02X %02X\n",
- priv->wps.ielen, priv->wps.ielen, p[0], p[1], p[2], p[3],
- p[priv->wps.ielen - 3], p[priv->wps.ielen - 2],
- p[priv->wps.ielen - 1]);
-
- hostif_sme_enqueue(priv, SME_WPS_PROBE_REQUEST);
-
- return 0;
-}
-
-static int ks_wlan_set_tx_gain(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (uwrq->mode > 0xFF)
- return -EINVAL;
-
- priv->gain.tx_gain = (u8)uwrq->mode;
- priv->gain.tx_mode = (priv->gain.tx_gain < 0xFF) ? 1 : 0;
- hostif_sme_enqueue(priv, SME_SET_GAIN);
- return 0;
-}
-
-static int ks_wlan_get_tx_gain(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->gain.tx_gain;
- hostif_sme_enqueue(priv, SME_GET_GAIN);
- return 0;
-}
-
-static int ks_wlan_set_rx_gain(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- if (uwrq->mode > 0xFF)
- return -EINVAL;
-
- priv->gain.rx_gain = (u8)uwrq->mode;
- priv->gain.rx_mode = (priv->gain.rx_gain < 0xFF) ? 1 : 0;
- hostif_sme_enqueue(priv, SME_SET_GAIN);
- return 0;
-}
-
-static int ks_wlan_get_rx_gain(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->sleep_mode == SLP_SLEEP)
- return -EPERM;
- /* for SLEEP MODE */
- uwrq->mode = priv->gain.rx_gain;
- hostif_sme_enqueue(priv, SME_GET_GAIN);
- return 0;
-}
-
-static int ks_wlan_get_eeprom_cksum(struct net_device *dev,
- struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- uwrq->mode = priv->eeprom_checksum;
- return 0;
-}
-
-static void print_hif_event(struct net_device *dev, int event)
-{
- switch (event) {
- case HIF_DATA_REQ:
- netdev_info(dev, "HIF_DATA_REQ\n");
- break;
- case HIF_DATA_IND:
- netdev_info(dev, "HIF_DATA_IND\n");
- break;
- case HIF_MIB_GET_REQ:
- netdev_info(dev, "HIF_MIB_GET_REQ\n");
- break;
- case HIF_MIB_GET_CONF:
- netdev_info(dev, "HIF_MIB_GET_CONF\n");
- break;
- case HIF_MIB_SET_REQ:
- netdev_info(dev, "HIF_MIB_SET_REQ\n");
- break;
- case HIF_MIB_SET_CONF:
- netdev_info(dev, "HIF_MIB_SET_CONF\n");
- break;
- case HIF_POWER_MGMT_REQ:
- netdev_info(dev, "HIF_POWER_MGMT_REQ\n");
- break;
- case HIF_POWER_MGMT_CONF:
- netdev_info(dev, "HIF_POWER_MGMT_CONF\n");
- break;
- case HIF_START_REQ:
- netdev_info(dev, "HIF_START_REQ\n");
- break;
- case HIF_START_CONF:
- netdev_info(dev, "HIF_START_CONF\n");
- break;
- case HIF_CONNECT_IND:
- netdev_info(dev, "HIF_CONNECT_IND\n");
- break;
- case HIF_STOP_REQ:
- netdev_info(dev, "HIF_STOP_REQ\n");
- break;
- case HIF_STOP_CONF:
- netdev_info(dev, "HIF_STOP_CONF\n");
- break;
- case HIF_PS_ADH_SET_REQ:
- netdev_info(dev, "HIF_PS_ADH_SET_REQ\n");
- break;
- case HIF_PS_ADH_SET_CONF:
- netdev_info(dev, "HIF_PS_ADH_SET_CONF\n");
- break;
- case HIF_INFRA_SET_REQ:
- netdev_info(dev, "HIF_INFRA_SET_REQ\n");
- break;
- case HIF_INFRA_SET_CONF:
- netdev_info(dev, "HIF_INFRA_SET_CONF\n");
- break;
- case HIF_ADH_SET_REQ:
- netdev_info(dev, "HIF_ADH_SET_REQ\n");
- break;
- case HIF_ADH_SET_CONF:
- netdev_info(dev, "HIF_ADH_SET_CONF\n");
- break;
- case HIF_AP_SET_REQ:
- netdev_info(dev, "HIF_AP_SET_REQ\n");
- break;
- case HIF_AP_SET_CONF:
- netdev_info(dev, "HIF_AP_SET_CONF\n");
- break;
- case HIF_ASSOC_INFO_IND:
- netdev_info(dev, "HIF_ASSOC_INFO_IND\n");
- break;
- case HIF_MIC_FAILURE_REQ:
- netdev_info(dev, "HIF_MIC_FAILURE_REQ\n");
- break;
- case HIF_MIC_FAILURE_CONF:
- netdev_info(dev, "HIF_MIC_FAILURE_CONF\n");
- break;
- case HIF_SCAN_REQ:
- netdev_info(dev, "HIF_SCAN_REQ\n");
- break;
- case HIF_SCAN_CONF:
- netdev_info(dev, "HIF_SCAN_CONF\n");
- break;
- case HIF_PHY_INFO_REQ:
- netdev_info(dev, "HIF_PHY_INFO_REQ\n");
- break;
- case HIF_PHY_INFO_CONF:
- netdev_info(dev, "HIF_PHY_INFO_CONF\n");
- break;
- case HIF_SLEEP_REQ:
- netdev_info(dev, "HIF_SLEEP_REQ\n");
- break;
- case HIF_SLEEP_CONF:
- netdev_info(dev, "HIF_SLEEP_CONF\n");
- break;
- case HIF_PHY_INFO_IND:
- netdev_info(dev, "HIF_PHY_INFO_IND\n");
- break;
- case HIF_SCAN_IND:
- netdev_info(dev, "HIF_SCAN_IND\n");
- break;
- case HIF_INFRA_SET2_REQ:
- netdev_info(dev, "HIF_INFRA_SET2_REQ\n");
- break;
- case HIF_INFRA_SET2_CONF:
- netdev_info(dev, "HIF_INFRA_SET2_CONF\n");
- break;
- case HIF_ADH_SET2_REQ:
- netdev_info(dev, "HIF_ADH_SET2_REQ\n");
- break;
- case HIF_ADH_SET2_CONF:
- netdev_info(dev, "HIF_ADH_SET2_CONF\n");
- }
-}
-
-/* get host command history */
-static int ks_wlan_hostt(struct net_device *dev, struct iw_request_info *info,
- union iwreq_data *uwrq, char *extra)
-{
- int i, event;
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- for (i = 63; i >= 0; i--) {
- event =
- priv->hostt.buff[(priv->hostt.qtail - 1 - i) %
- SME_EVENT_BUFF_SIZE];
- print_hif_event(dev, event);
- }
- return 0;
-}
-
-/* Structures to export the Wireless Handlers */
-
-static const struct iw_priv_args ks_wlan_private_args[] = {
-/*{ cmd, set_args, get_args, name[16] } */
- {KS_WLAN_GET_FIRM_VERSION, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_CHAR | (128 + 1), "GetFirmwareVer"},
- {KS_WLAN_SET_WPS_ENABLE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetWPSEnable"},
- {KS_WLAN_GET_WPS_ENABLE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetW"},
- {KS_WLAN_SET_WPS_PROBE_REQ, IW_PRIV_TYPE_BYTE | 2047, IW_PRIV_TYPE_NONE,
- "SetWPSProbeReq"},
- {KS_WLAN_SET_PREAMBLE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetPreamble"},
- {KS_WLAN_GET_PREAMBLE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPreamble"},
- {KS_WLAN_SET_POWER_SAVE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetPowerSave"},
- {KS_WLAN_GET_POWER_SAVE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPowerSave"},
- {KS_WLAN_SET_SCAN_TYPE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetScanType"},
- {KS_WLAN_GET_SCAN_TYPE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetScanType"},
- {KS_WLAN_SET_RX_GAIN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetRxGain"},
- {KS_WLAN_GET_RX_GAIN, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetRxGain"},
- {KS_WLAN_HOSTT, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR | (128 + 1),
- "hostt"},
- {KS_WLAN_SET_BEACON_LOST, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetBeaconLost"},
- {KS_WLAN_GET_BEACON_LOST, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetBeaconLost"},
- {KS_WLAN_SET_SLEEP_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetSleepMode"},
- {KS_WLAN_GET_SLEEP_MODE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetSleepMode"},
- {KS_WLAN_SET_TX_GAIN, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetTxGain"},
- {KS_WLAN_GET_TX_GAIN, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetTxGain"},
- {KS_WLAN_SET_PHY_TYPE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetPhyType"},
- {KS_WLAN_GET_PHY_TYPE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetPhyType"},
- {KS_WLAN_SET_CTS_MODE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
- IW_PRIV_TYPE_NONE, "SetCtsMode"},
- {KS_WLAN_GET_CTS_MODE, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetCtsMode"},
- {KS_WLAN_GET_EEPROM_CKSUM, IW_PRIV_TYPE_NONE,
- IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "GetChecksum"},
-};
-
-static const iw_handler ks_wlan_handler[] = {
- IW_HANDLER(SIOCSIWCOMMIT, ks_wlan_config_commit),
- IW_HANDLER(SIOCGIWNAME, ks_wlan_get_name),
- IW_HANDLER(SIOCSIWFREQ, ks_wlan_set_freq),
- IW_HANDLER(SIOCGIWFREQ, ks_wlan_get_freq),
- IW_HANDLER(SIOCSIWMODE, ks_wlan_set_mode),
- IW_HANDLER(SIOCGIWMODE, ks_wlan_get_mode),
- IW_HANDLER(SIOCGIWRANGE, ks_wlan_get_range),
- IW_HANDLER(SIOCGIWSTATS, ks_wlan_get_iwstats),
- IW_HANDLER(SIOCSIWAP, ks_wlan_set_wap),
- IW_HANDLER(SIOCGIWAP, ks_wlan_get_wap),
- IW_HANDLER(SIOCSIWMLME, ks_wlan_set_mlme),
- IW_HANDLER(SIOCGIWAPLIST, ks_wlan_get_aplist),
- IW_HANDLER(SIOCSIWSCAN, ks_wlan_set_scan),
- IW_HANDLER(SIOCGIWSCAN, ks_wlan_get_scan),
- IW_HANDLER(SIOCSIWESSID, ks_wlan_set_essid),
- IW_HANDLER(SIOCGIWESSID, ks_wlan_get_essid),
- IW_HANDLER(SIOCSIWNICKN, ks_wlan_set_nick),
- IW_HANDLER(SIOCGIWNICKN, ks_wlan_get_nick),
- IW_HANDLER(SIOCSIWRATE, ks_wlan_set_rate),
- IW_HANDLER(SIOCGIWRATE, ks_wlan_get_rate),
- IW_HANDLER(SIOCSIWRTS, ks_wlan_set_rts),
- IW_HANDLER(SIOCGIWRTS, ks_wlan_get_rts),
- IW_HANDLER(SIOCSIWFRAG, ks_wlan_set_frag),
- IW_HANDLER(SIOCGIWFRAG, ks_wlan_get_frag),
- IW_HANDLER(SIOCSIWENCODE, ks_wlan_set_encode),
- IW_HANDLER(SIOCGIWENCODE, ks_wlan_get_encode),
- IW_HANDLER(SIOCSIWPOWER, ks_wlan_set_power),
- IW_HANDLER(SIOCGIWPOWER, ks_wlan_get_power),
- IW_HANDLER(SIOCSIWGENIE, ks_wlan_set_genie),
- IW_HANDLER(SIOCSIWAUTH, ks_wlan_set_auth_mode),
- IW_HANDLER(SIOCGIWAUTH, ks_wlan_get_auth_mode),
- IW_HANDLER(SIOCSIWENCODEEXT, ks_wlan_set_encode_ext),
- IW_HANDLER(SIOCGIWENCODEEXT, ks_wlan_get_encode_ext),
- IW_HANDLER(SIOCSIWPMKSA, ks_wlan_set_pmksa),
-};
-
-/* private_handler */
-static const iw_handler ks_wlan_private_handler[] = {
- NULL, /* 0 */
- NULL, /* 1, KS_WLAN_GET_DRIVER_VERSION */
- NULL, /* 2 */
- ks_wlan_get_firmware_version, /* 3 KS_WLAN_GET_FIRM_VERSION */
- ks_wlan_set_wps_enable, /* 4 KS_WLAN_SET_WPS_ENABLE */
- ks_wlan_get_wps_enable, /* 5 KS_WLAN_GET_WPS_ENABLE */
- ks_wlan_set_wps_probe_req, /* 6 KS_WLAN_SET_WPS_PROBE_REQ */
- ks_wlan_get_eeprom_cksum, /* 7 KS_WLAN_GET_CONNECT */
- ks_wlan_set_preamble, /* 8 KS_WLAN_SET_PREAMBLE */
- ks_wlan_get_preamble, /* 9 KS_WLAN_GET_PREAMBLE */
- ks_wlan_set_power_mgmt, /* 10 KS_WLAN_SET_POWER_SAVE */
- ks_wlan_get_power_mgmt, /* 11 KS_WLAN_GET_POWER_SAVE */
- ks_wlan_set_scan_type, /* 12 KS_WLAN_SET_SCAN_TYPE */
- ks_wlan_get_scan_type, /* 13 KS_WLAN_GET_SCAN_TYPE */
- ks_wlan_set_rx_gain, /* 14 KS_WLAN_SET_RX_GAIN */
- ks_wlan_get_rx_gain, /* 15 KS_WLAN_GET_RX_GAIN */
- ks_wlan_hostt, /* 16 KS_WLAN_HOSTT */
- NULL, /* 17 */
- ks_wlan_set_beacon_lost, /* 18 KS_WLAN_SET_BECAN_LOST */
- ks_wlan_get_beacon_lost, /* 19 KS_WLAN_GET_BECAN_LOST */
- ks_wlan_set_tx_gain, /* 20 KS_WLAN_SET_TX_GAIN */
- ks_wlan_get_tx_gain, /* 21 KS_WLAN_GET_TX_GAIN */
- ks_wlan_set_phy_type, /* 22 KS_WLAN_SET_PHY_TYPE */
- ks_wlan_get_phy_type, /* 23 KS_WLAN_GET_PHY_TYPE */
- ks_wlan_set_cts_mode, /* 24 KS_WLAN_SET_CTS_MODE */
- ks_wlan_get_cts_mode, /* 25 KS_WLAN_GET_CTS_MODE */
- NULL, /* 26 */
- NULL, /* 27 */
- ks_wlan_set_sleep_mode, /* 28 KS_WLAN_SET_SLEEP_MODE */
- ks_wlan_get_sleep_mode, /* 29 KS_WLAN_GET_SLEEP_MODE */
- NULL, /* 30 */
- NULL, /* 31 */
-};
-
-static const struct iw_handler_def ks_wlan_handler_def = {
- .num_standard = ARRAY_SIZE(ks_wlan_handler),
- .num_private = ARRAY_SIZE(ks_wlan_private_handler),
- .num_private_args = ARRAY_SIZE(ks_wlan_private_args),
- .standard = ks_wlan_handler,
- .private = ks_wlan_private_handler,
- .private_args = ks_wlan_private_args,
- .get_wireless_stats = ks_get_wireless_stats,
-};
-
-static int ks_wlan_netdev_ioctl(struct net_device *dev, struct ifreq *rq,
- int cmd)
-{
- int ret;
- struct iwreq *wrq = (struct iwreq *)rq;
-
- switch (cmd) {
- case SIOCIWFIRSTPRIV + 20: /* KS_WLAN_SET_STOP_REQ */
- ret = ks_wlan_set_stop_request(dev, NULL, &wrq->u, NULL);
- break;
- // All other calls are currently unsupported
- default:
- ret = -EOPNOTSUPP;
- }
-
- return ret;
-}
-
-static
-struct net_device_stats *ks_wlan_get_stats(struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->dev_state < DEVICE_STATE_READY)
- return NULL; /* not finished initialize */
-
- return &priv->nstats;
-}
-
-static
-int ks_wlan_set_mac_address(struct net_device *dev, void *addr)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- struct sockaddr *mac_addr = (struct sockaddr *)addr;
-
- if (netif_running(dev))
- return -EBUSY;
- eth_hw_addr_set(dev, mac_addr->sa_data);
- ether_addr_copy(priv->eth_addr, mac_addr->sa_data);
-
- priv->mac_address_valid = false;
- hostif_sme_enqueue(priv, SME_MACADDRESS_SET_REQUEST);
- netdev_info(dev, "ks_wlan: MAC ADDRESS = %pM\n", priv->eth_addr);
- return 0;
-}
-
-static
-void ks_wlan_tx_timeout(struct net_device *dev, unsigned int txqueue)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- netdev_dbg(dev, "head(%d) tail(%d)!!\n", priv->tx_dev.qhead,
- priv->tx_dev.qtail);
- if (!netif_queue_stopped(dev))
- netif_stop_queue(dev);
- priv->nstats.tx_errors++;
- netif_wake_queue(dev);
-}
-
-static
-netdev_tx_t ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
- int ret;
-
- netdev_dbg(dev, "in_interrupt()=%ld\n", in_interrupt());
-
- if (!skb) {
- netdev_err(dev, "ks_wlan: skb == NULL!!!\n");
- return 0;
- }
- if (priv->dev_state < DEVICE_STATE_READY) {
- dev_kfree_skb(skb);
- return 0; /* not finished initialize */
- }
-
- if (netif_running(dev))
- netif_stop_queue(dev);
-
- ret = hostif_data_request(priv, skb);
- netif_trans_update(dev);
-
- if (ret)
- netdev_err(dev, "hostif_data_request error: =%d\n", ret);
-
- return 0;
-}
-
-void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb)
-{
- priv->nstats.tx_packets++;
-
- if (netif_queue_stopped(priv->net_dev))
- netif_wake_queue(priv->net_dev);
-
- if (skb) {
- priv->nstats.tx_bytes += skb->len;
- dev_kfree_skb(skb);
- }
-}
-
-/*
- * Set or clear the multicast filter for this adaptor.
- * This routine is not state sensitive and need not be SMP locked.
- */
-static
-void ks_wlan_set_rx_mode(struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- if (priv->dev_state < DEVICE_STATE_READY)
- return; /* not finished initialize */
- hostif_sme_enqueue(priv, SME_MULTICAST_REQUEST);
-}
-
-static
-int ks_wlan_open(struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- priv->cur_rx = 0;
-
- if (!priv->mac_address_valid) {
- netdev_err(dev, "ks_wlan : %s Not READY !!\n", dev->name);
- return -EBUSY;
- }
- netif_start_queue(dev);
-
- return 0;
-}
-
-static
-int ks_wlan_close(struct net_device *dev)
-{
- netif_stop_queue(dev);
-
- return 0;
-}
-
-/* Operational parameters that usually are not changed. */
-/* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT (3 * HZ)
-static const unsigned char dummy_addr[] = {
- 0x00, 0x0b, 0xe3, 0x00, 0x00, 0x00
-};
-
-static const struct net_device_ops ks_wlan_netdev_ops = {
- .ndo_start_xmit = ks_wlan_start_xmit,
- .ndo_open = ks_wlan_open,
- .ndo_stop = ks_wlan_close,
- .ndo_do_ioctl = ks_wlan_netdev_ioctl,
- .ndo_set_mac_address = ks_wlan_set_mac_address,
- .ndo_get_stats = ks_wlan_get_stats,
- .ndo_tx_timeout = ks_wlan_tx_timeout,
- .ndo_set_rx_mode = ks_wlan_set_rx_mode,
-};
-
-int ks_wlan_net_start(struct net_device *dev)
-{
- struct ks_wlan_private *priv;
- /* int rc; */
-
- priv = netdev_priv(dev);
- priv->mac_address_valid = false;
- priv->is_device_open = true;
- priv->need_commit = 0;
- /* phy information update timer */
- atomic_set(&update_phyinfo, 0);
- timer_setup(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout, 0);
-
- /* dummy address set */
- ether_addr_copy(priv->eth_addr, dummy_addr);
- eth_hw_addr_set(dev, priv->eth_addr);
-
- /* The ks_wlan-specific entries in the device structure. */
- dev->netdev_ops = &ks_wlan_netdev_ops;
- dev->wireless_handlers = &ks_wlan_handler_def;
- dev->watchdog_timeo = TX_TIMEOUT;
-
- netif_carrier_off(dev);
-
- return 0;
-}
-
-int ks_wlan_net_stop(struct net_device *dev)
-{
- struct ks_wlan_private *priv = netdev_priv(dev);
-
- priv->is_device_open = false;
- del_timer_sync(&update_phyinfo_timer);
-
- if (netif_running(dev))
- netif_stop_queue(dev);
-
- return 0;
-}
-
-/**
- * is_connect_status() - return true if status is 'connected'
- * @status: high bit is used as FORCE_DISCONNECT, low bits used for
- * connect status.
- */
-bool is_connect_status(u32 status)
-{
- return (status & CONNECT_STATUS_MASK) == CONNECT_STATUS;
-}
-
-/**
- * is_disconnect_status() - return true if status is 'disconnected'
- * @status: high bit is used as FORCE_DISCONNECT, low bits used for
- * disconnect status.
- */
-bool is_disconnect_status(u32 status)
-{
- return (status & CONNECT_STATUS_MASK) == DISCONNECT_STATUS;
-}
diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h
index fefbe3cd08f3..4cfe9a0e0d56 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp.h
@@ -200,7 +200,7 @@ struct atomisp_dis_vector {
};
/* DVS 2.0 Coefficient types. This structure contains 4 pointers to
- * arrays that contain the coeffients for each type.
+ * arrays that contain the coefficients for each type.
*/
struct atomisp_dvs2_coef_types {
short __user *odd_real; /** real part of the odd coefficients*/
@@ -698,7 +698,7 @@ enum atomisp_burst_capture_options {
/* Digital Image Stabilization:
* 1. get dis statistics: reads DIS statistics from ISP (every frame)
* 2. set dis coefficients: set DIS filter coefficients (one time)
- * 3. set dis motion vecotr: set motion vector (result of DIS, every frame)
+ * 3. set dis motion vector: set motion vector (result of DIS, every frame)
*/
#define ATOMISP_IOC_G_DIS_STAT \
_IOWR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_statistics)
diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
index fdeb247036b0..064449fd51af 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
@@ -116,7 +116,7 @@ struct intel_v4l2_subdev_table {
};
/*
- * Sensor of external ISP can send multiple steams with different mipi data
+ * Sensor of external ISP can send multiple streams with different mipi data
* type in the same virtual channel. This information needs to come from the
* sensor or external ISP
*/
@@ -138,7 +138,7 @@ struct atomisp_input_stream_info {
/*
* if more isys_configs is more than 0, sensor needs to configure the
* input format differently. width and height can be 0. If width and
- * height is not zero, then the corresponsing data needs to be set
+ * height is not zero, then the corresponding data needs to be set
*/
struct atomisp_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL];
};
@@ -175,8 +175,6 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,
enum atomisp_bayer_order bayer_order);
void atomisp_unregister_subdev(struct v4l2_subdev *subdev);
-int v4l2_get_acpi_sensor_info(struct device *dev, char **module_id_str);
-
/* API from old platform_camera.h, new CPUID implementation */
#define __IS_SOC(x) (boot_cpu_data.x86_vfm == x)
#define __IS_SOCS(x, y) (boot_cpu_data.x86_vfm == x || boot_cpu_data.x86_vfm == y)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
index d789d38ef689..6abda358a72f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c
@@ -109,6 +109,8 @@ static struct gmin_cfg_var lenovo_ideapad_miix_310_vars[] = {
static struct gmin_cfg_var xiaomi_mipad2_vars[] = {
/* _DSM contains the wrong CsiPort for the front facing OV5693 sensor */
{ "INT33BE:00", "CsiPort", "0" },
+ /* _DSM contains the wrong CsiLanes for the back facing T4KA3 sensor */
+ { "XMCC0003:00", "CsiLanes", "4" },
{}
};
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 50c4123ba006..b180fcbea9b1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -441,6 +441,8 @@ const struct vb2_ops atomisp_vb2_ops = {
.buf_queue = atomisp_buf_queue,
.start_streaming = atomisp_start_streaming,
.stop_streaming = atomisp_stop_streaming,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};
static void atomisp_dev_init_struct(struct atomisp_device *isp)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index 3a3e84a035e2..202497695e46 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -797,12 +797,12 @@ static int atomisp_init_subdev_pipe(struct atomisp_sub_device *asd,
pipe->vb_queue.ops = &atomisp_vb2_ops;
pipe->vb_queue.mem_ops = &vb2_vmalloc_memops;
pipe->vb_queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ pipe->vb_queue.lock = &pipe->vb_queue_mutex;
ret = vb2_queue_init(&pipe->vb_queue);
if (ret)
return ret;
pipe->vdev.queue = &pipe->vb_queue;
- pipe->vdev.queue->lock = &pipe->vb_queue_mutex;
INIT_LIST_HEAD(&pipe->buffers_in_css);
INIT_LIST_HEAD(&pipe->activeq);
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem_local.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem_local.h
index d0ba59cedc92..6f0a8fe868bd 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem_local.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/vmem_local.h
@@ -20,8 +20,10 @@
#include "vmem_global.h"
typedef u16 t_vmem_elem;
+typedef s16 t_svmem_elem;
-#define VMEM_ARRAY(x, s) t_vmem_elem x[s / ISP_NWAY][ISP_NWAY]
+#define VMEM_ARRAY(x, s) t_vmem_elem x[(s) / ISP_NWAY][ISP_NWAY]
+#define SVMEM_ARRAY(x, s) t_svmem_elem x[(s) / ISP_NWAY][ISP_NWAY]
void isp_vmem_load(
const isp_ID_t ID,
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
index d294ac402de8..c5ab13511db8 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
@@ -27,7 +27,8 @@
* #define assert(cnd) BUG_ON(cnd)
* but that causes many compiler warnings (==errors) under Android
* because it seems that the BUG_ON() macro is not seen as a check by
- * gcc like the BUG() macro is. */
+ * gcc like the BUG() macro is.
+ */
#define assert(cnd) \
do { \
if (!(cnd)) \
@@ -37,7 +38,8 @@
#ifndef PIPE_GENERATION
/* Deprecated OP___assert, this is still used in ~1000 places
* in the code. This will be removed over time.
- * The implementation for the pipe generation tool is in see support.isp.h */
+ * The implementation for the pipe generation tool is in see support.isp.h
+ */
#define OP___assert(cnd) assert(cnd)
static inline void compile_time_assert(unsigned int cond)
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h
index 693154e8ec2f..7e37f0809034 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h
@@ -94,7 +94,7 @@ hrt_data csi_rx_fe_ctrl_reg_load(
const hrt_address reg);
/**
* @brief Store a value to the register.
- * Store a value to the registe of the csi rx fe.
+ * Store a value to the register of the csi rx fe.
*
* @param[in] ID The global unique ID for the ibuf-controller instance.
* @param[in] reg The offset address of the register.
@@ -119,7 +119,7 @@ hrt_data csi_rx_be_ctrl_reg_load(
const hrt_address reg);
/**
* @brief Store a value to the register.
- * Store a value to the registe of the csi rx be.
+ * Store a value to the register of the csi rx be.
*
* @param[in] ID The global unique ID for the ibuf-controller instance.
* @param[in] reg The offset address of the register.
diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
index 160c496784b7..907f9ebcc60d 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
@@ -28,12 +28,6 @@
#define CEIL_SHIFT(a, b) (((a) + (1 << (b)) - 1) >> (b))
#define CEIL_SHIFT_MUL(a, b) (CEIL_SHIFT(a, b) << (b))
-#if !defined(PIPE_GENERATION)
-
-#define ceil_div(a, b) (CEIL_DIV(a, b))
-
-#endif /* !defined(PIPE_GENERATION) */
-
/*
* For SP and ISP, SDK provides the definition of OP_std_modadd.
* We need it only for host
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 3e2899ad8517..e8c5d728fd55 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -204,9 +204,6 @@ static ia_css_ptr __hmm_alloc(size_t bytes, enum hmm_bo_type type,
goto bind_err;
}
- dev_dbg(atomisp_dev, "pages: 0x%08x (%zu bytes), type: %d, vmalloc %p\n",
- bo->start, bytes, type, vmalloc_noprof);
-
return bo->start;
bind_err:
@@ -231,8 +228,6 @@ void hmm_free(ia_css_ptr virt)
{
struct hmm_buffer_object *bo;
- dev_dbg(atomisp_dev, "%s: free 0x%08x\n", __func__, virt);
-
if (WARN_ON(virt == mmgr_EXCEPTION))
return;
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c
index 457a004e194d..b75cfd3096d8 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c
@@ -45,7 +45,8 @@ ia_css_bnr_dump(
const struct sh_css_isp_bnr_params *bnr,
unsigned int level)
{
- if (!bnr) return;
+ if (!bnr)
+ return;
ia_css_debug_dtrace(level, "Bayer Noise Reduction:\n");
ia_css_debug_dtrace(level, "\t%-32s = %d\n",
"bnr_gain_all", bnr->gain_all);
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c
index 25e3f0822fb8..e66faeda3613 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/de/de_1.0/ia_css_de.host.c
@@ -47,7 +47,8 @@ ia_css_de_dump(
const struct sh_css_isp_de_params *de,
unsigned int level)
{
- if (!de) return;
+ if (!de)
+ return;
ia_css_debug_dtrace(level, "Demosaic:\n");
ia_css_debug_dtrace(level, "\t%-32s = %d\n",
"de_pixelnoise", de->pixelnoise);
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
index e4fc90f88e24..b79d78e5b77f 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8.host.c
@@ -172,25 +172,21 @@ ia_css_eed1_8_vmem_encode(
base = shuffle_block * i;
for (j = 0; j < IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS; j++) {
- to->e_dew_enh_x[0][base + j] = min_t(int, max_t(int,
- from->dew_enhance_seg_x[j], 0),
- 8191);
- to->e_dew_enh_y[0][base + j] = min_t(int, max_t(int,
- from->dew_enhance_seg_y[j], -8192),
- 8191);
+ to->e_dew_enh_x[0][base + j] = clamp(from->dew_enhance_seg_x[j],
+ 0, 8191);
+ to->e_dew_enh_y[0][base + j] = clamp(from->dew_enhance_seg_y[j],
+ -8192, 8191);
}
for (j = 0; j < (IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS - 1); j++) {
- to->e_dew_enh_a[0][base + j] = min_t(int, max_t(int,
- from->dew_enhance_seg_slope[j],
- -8192), 8191);
+ to->e_dew_enh_a[0][base + j] = clamp(from->dew_enhance_seg_slope[j],
+ -8192, 8191);
/* Convert dew_enhance_seg_exp to flag:
* 0 -> 0
* 1...13 -> 1
*/
- to->e_dew_enh_f[0][base + j] = (min_t(int, max_t(int,
- from->dew_enhance_seg_exp[j],
- 0), 13) > 0);
+ to->e_dew_enh_f[0][base + j] = clamp(from->dew_enhance_seg_exp[j],
+ 0, 13) > 0;
}
/* Hard-coded to 0, in order to be able to handle out of
@@ -276,7 +272,7 @@ ia_css_eed1_8_encode(
for (i = 0; i < (IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS - 1); i++) {
min_exp = max(min_exp, from->dew_enhance_seg_exp[i]);
}
- to->e_dew_enh_asr = 13 - min(max(min_exp, 0), 13);
+ to->e_dew_enh_asr = 13 - clamp(min_exp, 0, 13);
to->dedgew_max = from->dedgew_max;
}
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8_param.h
index 6fb3b38f49e7..b9eeeb592ec8 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8_param.h
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/eed1_8/ia_css_eed1_8_param.h
@@ -94,8 +94,8 @@
struct eed1_8_vmem_params {
VMEM_ARRAY(e_dew_enh_x, ISP_VEC_NELEMS);
- VMEM_ARRAY(e_dew_enh_y, ISP_VEC_NELEMS);
- VMEM_ARRAY(e_dew_enh_a, ISP_VEC_NELEMS);
+ SVMEM_ARRAY(e_dew_enh_y, ISP_VEC_NELEMS);
+ SVMEM_ARRAY(e_dew_enh_a, ISP_VEC_NELEMS);
VMEM_ARRAY(e_dew_enh_f, ISP_VEC_NELEMS);
VMEM_ARRAY(chgrinv_x, ISP_VEC_NELEMS);
VMEM_ARRAY(chgrinv_a, ISP_VEC_NELEMS);
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c
index 57b5e11e1cfe..8ccfa99c61ef 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c
@@ -43,7 +43,8 @@ ia_css_fpn_dump(
const struct sh_css_isp_fpn_params *fpn,
unsigned int level)
{
- if (!fpn) return;
+ if (!fpn)
+ return;
ia_css_debug_dtrace(level, "Fixed Pattern Noise Reduction:\n");
ia_css_debug_dtrace(level, "\t%-32s = %d\n",
"fpn_shift", fpn->shift);
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c
index 0091e2a3da52..c32659894c29 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c
@@ -13,9 +13,11 @@
* more details.
*/
+#include <linux/bitops.h>
+#include <linux/math.h>
+
#include "ia_css_bayer_io.host.h"
#include "dma.h"
-#include "math_support.h"
#ifndef IA_CSS_NO_DEBUG
#include "ia_css_debug.h"
#endif
@@ -29,9 +31,8 @@ int ia_css_bayer_io_config(const struct ia_css_binary *binary,
const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
&args->out_frame;
const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
- const unsigned int ddr_bits_per_element = sizeof(short) * 8;
- const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
- ddr_bits_per_element);
+ const unsigned int ddr_elems_per_word =
+ DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
unsigned int size_get = 0, size_put = 0;
unsigned int offset = 0;
int ret;
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
index 32c504a950ce..5b2d5023b5ee 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
@@ -13,9 +13,11 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
*/
+#include <linux/bitops.h>
+#include <linux/math.h>
+
#include "ia_css_yuv444_io.host.h"
#include "dma.h"
-#include "math_support.h"
#ifndef IA_CSS_NO_DEBUG
#include "ia_css_debug.h"
#endif
@@ -29,9 +31,8 @@ int ia_css_yuv444_io_config(const struct ia_css_binary *binary,
const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
&args->out_frame;
const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
- const unsigned int ddr_bits_per_element = sizeof(short) * 8;
- const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
- ddr_bits_per_element);
+ const unsigned int ddr_elems_per_word =
+ DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
unsigned int size_get = 0, size_put = 0;
unsigned int offset = 0;
int ret;
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c
index 5f186fb03642..15386a773dc5 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c
@@ -65,8 +65,7 @@ int ia_css_iterator_configure(const struct ia_css_binary *binary,
* the original out res. for video pipe, it has two output pins --- out and
* vf_out, so it can keep these two resolutions already. */
if (binary->info->sp.pipeline.mode == IA_CSS_BINARY_MODE_PREVIEW &&
- binary->vf_downscale_log2 > 0)
- {
+ binary->vf_downscale_log2 > 0) {
/* TODO: Remove this after preview output decimation is fixed
* by configuring out&vf info files properly */
my_info.padded_width <<= binary->vf_downscale_log2;
diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
index 70132d955e9b..def2c8fb4b38 100644
--- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
+++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c
@@ -108,7 +108,7 @@ compute_coring(int coring)
* factor. Clip to [0, isp_scale-1).
*/
isp_coring = ((coring * isp_scale) + offset) / host_scale;
- return min(max(isp_coring, 0), isp_scale - 1);
+ return clamp(isp_coring, 0, isp_scale - 1);
}
/*
@@ -168,15 +168,15 @@ ia_css_xnr3_encode(
to->alpha.y0 = alpha_y0;
to->alpha.u0 = alpha_u0;
to->alpha.v0 = alpha_v0;
- to->alpha.ydiff = min(max(alpha_ydiff, min_diff), max_diff);
- to->alpha.udiff = min(max(alpha_udiff, min_diff), max_diff);
- to->alpha.vdiff = min(max(alpha_vdiff, min_diff), max_diff);
+ to->alpha.ydiff = clamp(alpha_ydiff, min_diff, max_diff);
+ to->alpha.udiff = clamp(alpha_udiff, min_diff, max_diff);
+ to->alpha.vdiff = clamp(alpha_vdiff, min_diff, max_diff);
/* coring parameters are expressed in q1.NN format */
to->coring.u0 = coring_u0;
to->coring.v0 = coring_v0;
- to->coring.udiff = min(max(coring_udiff, min_diff), max_diff);
- to->coring.vdiff = min(max(coring_vdiff, min_diff), max_diff);
+ to->coring.udiff = clamp(coring_udiff, min_diff, max_diff);
+ to->coring.vdiff = clamp(coring_vdiff, min_diff, max_diff);
/* blending strength is expressed in q1.NN format */
to->blending.strength = blending;
diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
index b0f904a5e442..7ce2b2d6da11 100644
--- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
+++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
@@ -328,7 +328,8 @@ ia_css_binary_dvs_grid_info(const struct ia_css_binary *binary,
dvs_info = &info->dvs_grid.dvs_grid_info;
- /* for DIS, we use a division instead of a ceil_div. If this is smaller
+ /*
+ * For DIS, we use a division instead of a DIV_ROUND_UP(). If this is smaller
* than the 3a grid size, it indicates that the outer values are not
* valid for DIS.
*/
@@ -923,8 +924,8 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
return 0;
}
-static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
- struct ia_css_binary *binary) {
+int ia_css_binary_find(struct ia_css_binary_descr *descr, struct ia_css_binary *binary)
+{
int mode;
bool online;
bool two_ppc;
@@ -953,10 +954,8 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
/* MW: used after an error check, may accept NULL, but doubtfull */
assert(binary);
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() enter: descr=%p, (mode=%d), binary=%p\n",
- descr, descr->mode,
- binary);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() enter: descr=%p, (mode=%d), binary=%p\n",
+ descr, descr->mode, binary);
mode = descr->mode;
online = descr->online;
@@ -1001,15 +1000,15 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
}
/* print a map of the binary file */
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "BINARY INFO:\n");
+ dev_dbg(atomisp_dev, "BINARY INFO:\n");
for (i = 0; i < IA_CSS_BINARY_NUM_MODES; i++) {
xcandidate = binary_infos[i];
if (xcandidate) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "%d:\n", i);
+ dev_dbg(atomisp_dev, "%d:\n", i);
while (xcandidate) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, " Name:%s Type:%d Cont:%d\n",
- xcandidate->blob->name, xcandidate->type,
- xcandidate->sp.enable.continuous);
+ dev_dbg(atomisp_dev, " Name:%s Type:%d Cont:%d\n",
+ xcandidate->blob->name, xcandidate->type,
+ xcandidate->sp.enable.continuous);
xcandidate = xcandidate->next;
}
}
@@ -1021,9 +1020,9 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
struct ia_css_binary_info *candidate = &xcandidate->sp;
/* printf("sh_css_binary_find: evaluating candidate:
* %d\n",candidate->id); */
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() candidate = %p, mode = %d ID = %d\n",
- candidate, candidate->pipeline.mode, candidate->id);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() candidate = %p, mode = %d ID = %d\n",
+ candidate, candidate->pipeline.mode, candidate->id);
/*
* MW: Only a limited set of jointly configured binaries can
@@ -1032,17 +1031,16 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
*/
if (!candidate->enable.continuous &&
continuous && (mode != IA_CSS_BINARY_MODE_COPY)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d && (%d != %d)\n",
- __LINE__, candidate->enable.continuous,
- continuous, mode,
- IA_CSS_BINARY_MODE_COPY);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: !%d && %d && (%d != %d)\n",
+ __LINE__, candidate->enable.continuous,
+ continuous, mode, IA_CSS_BINARY_MODE_COPY);
continue;
}
if (striped && candidate->iterator.num_stripes == 1) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: binary is not striped\n",
- __LINE__);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: binary is not striped\n",
+ __LINE__);
continue;
}
@@ -1050,58 +1048,38 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
(mode != IA_CSS_BINARY_MODE_COPY) &&
(mode != IA_CSS_BINARY_MODE_CAPTURE_PP) &&
(mode != IA_CSS_BINARY_MODE_VF_PP)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d != %d)\n",
- __LINE__,
- candidate->pipeline.isp_pipe_version, isp_pipe_version);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: (%d != %d)\n",
+ __LINE__, candidate->pipeline.isp_pipe_version, isp_pipe_version);
continue;
}
if (!candidate->enable.reduced_pipe && enable_reduced_pipe) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d\n",
- __LINE__,
- candidate->enable.reduced_pipe,
- enable_reduced_pipe);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d && %d\n",
+ __LINE__, candidate->enable.reduced_pipe, enable_reduced_pipe);
continue;
}
if (!candidate->enable.dvs_6axis && enable_dvs_6axis) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d\n",
- __LINE__,
- candidate->enable.dvs_6axis,
- enable_dvs_6axis);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d && %d\n",
+ __LINE__, candidate->enable.dvs_6axis, enable_dvs_6axis);
continue;
}
if (candidate->enable.high_speed && !enable_high_speed) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: %d && !%d\n",
- __LINE__,
- candidate->enable.high_speed,
- enable_high_speed);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: %d && !%d\n",
+ __LINE__, candidate->enable.high_speed, enable_high_speed);
continue;
}
if (!candidate->enable.xnr && need_xnr) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: %d && !%d\n",
- __LINE__,
- candidate->enable.xnr,
- need_xnr);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: %d && !%d\n",
+ __LINE__, candidate->enable.xnr, need_xnr);
continue;
}
if (!(candidate->enable.ds & 2) && enable_yuv_ds) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d\n",
- __LINE__,
- ((candidate->enable.ds & 2) != 0),
- enable_yuv_ds);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d && %d\n",
+ __LINE__, ((candidate->enable.ds & 2) != 0), enable_yuv_ds);
continue;
}
if ((candidate->enable.ds & 2) && !enable_yuv_ds) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: %d && !%d\n",
- __LINE__,
- ((candidate->enable.ds & 2) != 0),
- enable_yuv_ds);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: %d && !%d\n",
+ __LINE__, ((candidate->enable.ds & 2) != 0), enable_yuv_ds);
continue;
}
@@ -1115,100 +1093,85 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
candidate->vf_dec.is_variable ||
/* or more than one output pin. */
xcandidate->num_output_pins > 1)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%p != NULL) && !(%d || %d || (%d >%d))\n",
- __LINE__, req_vf_info,
- candidate->enable.vf_veceven,
- candidate->vf_dec.is_variable,
- xcandidate->num_output_pins, 1);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%p != NULL) && !(%d || %d || (%d >%d))\n",
+ __LINE__, req_vf_info, candidate->enable.vf_veceven,
+ candidate->vf_dec.is_variable, xcandidate->num_output_pins, 1);
continue;
}
if (!candidate->enable.dvs_envelope && need_dvs) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d\n",
- __LINE__,
- candidate->enable.dvs_envelope, (int)need_dvs);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d && %d\n",
+ __LINE__, candidate->enable.dvs_envelope, (int)need_dvs);
continue;
}
/* internal_res check considers input, output, and dvs envelope sizes */
ia_css_binary_internal_res(req_in_info, req_bds_out_info,
req_bin_out_info, &dvs_env, candidate, &internal_res);
if (internal_res.width > candidate->internal.max_width) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d > %d)\n",
- __LINE__, internal_res.width,
- candidate->internal.max_width);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: (%d > %d)\n",
+ __LINE__, internal_res.width, candidate->internal.max_width);
continue;
}
if (internal_res.height > candidate->internal.max_height) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d > %d)\n",
- __LINE__, internal_res.height,
- candidate->internal.max_height);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: (%d > %d)\n",
+ __LINE__, internal_res.height, candidate->internal.max_height);
continue;
}
if (!candidate->enable.ds && need_ds && !(xcandidate->num_output_pins > 1)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && %d\n",
- __LINE__, candidate->enable.ds, (int)need_ds);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d && %d\n",
+ __LINE__, candidate->enable.ds, (int)need_ds);
continue;
}
if (!candidate->enable.uds && !candidate->enable.dvs_6axis && need_dz) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && !%d && %d\n",
- __LINE__, candidate->enable.uds,
- candidate->enable.dvs_6axis, (int)need_dz);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: !%d && !%d && %d\n",
+ __LINE__, candidate->enable.uds, candidate->enable.dvs_6axis,
+ (int)need_dz);
continue;
}
if (online && candidate->input.source == IA_CSS_BINARY_INPUT_MEMORY) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: %d && (%d == %d)\n",
- __LINE__, online, candidate->input.source,
- IA_CSS_BINARY_INPUT_MEMORY);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: %d && (%d == %d)\n",
+ __LINE__, online, candidate->input.source,
+ IA_CSS_BINARY_INPUT_MEMORY);
continue;
}
if (!online && candidate->input.source == IA_CSS_BINARY_INPUT_SENSOR) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d && (%d == %d)\n",
- __LINE__, online, candidate->input.source,
- IA_CSS_BINARY_INPUT_SENSOR);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: !%d && (%d == %d)\n",
+ __LINE__, online, candidate->input.source,
+ IA_CSS_BINARY_INPUT_SENSOR);
continue;
}
if (req_bin_out_info->res.width < candidate->output.min_width ||
req_bin_out_info->res.width > candidate->output.max_width) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d > %d) || (%d < %d)\n",
- __LINE__,
- req_bin_out_info->padded_width,
- candidate->output.min_width,
- req_bin_out_info->padded_width,
- candidate->output.max_width);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%d > %d) || (%d < %d)\n",
+ __LINE__, req_bin_out_info->padded_width,
+ candidate->output.min_width, req_bin_out_info->padded_width,
+ candidate->output.max_width);
continue;
}
if (xcandidate->num_output_pins > 1 &&
/* in case we have a second output pin, */
req_vf_info) { /* and we need vf output. */
if (req_vf_info->res.width > candidate->output.max_width) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d < %d)\n",
- __LINE__,
- req_vf_info->res.width,
- candidate->output.max_width);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%d < %d)\n",
+ __LINE__, req_vf_info->res.width,
+ candidate->output.max_width);
continue;
}
}
if (req_in_info->padded_width > candidate->input.max_width) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d > %d)\n",
- __LINE__, req_in_info->padded_width,
- candidate->input.max_width);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: (%d > %d)\n",
+ __LINE__, req_in_info->padded_width, candidate->input.max_width);
continue;
}
if (!binary_supports_output_format(xcandidate, req_bin_out_info->format)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: !%d\n",
- __LINE__,
- binary_supports_output_format(xcandidate, req_bin_out_info->format));
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: !%d\n",
+ __LINE__, binary_supports_output_format(xcandidate,
+ req_bin_out_info->format));
continue;
}
if (xcandidate->num_output_pins > 1 &&
@@ -1217,11 +1180,10 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
/* check if the required vf format
is supported. */
!binary_supports_output_format(xcandidate, req_vf_info->format)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d > %d) && (%p != NULL) && !%d\n",
- __LINE__, xcandidate->num_output_pins, 1,
- req_vf_info,
- binary_supports_output_format(xcandidate, req_vf_info->format));
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%d > %d) && (%p != NULL) && !%d\n",
+ __LINE__, xcandidate->num_output_pins, 1, req_vf_info,
+ binary_supports_output_format(xcandidate, req_vf_info->format));
continue;
}
@@ -1229,11 +1191,11 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
if (xcandidate->num_output_pins == 1 &&
req_vf_info && candidate->enable.vf_veceven &&
!binary_supports_vf_format(xcandidate, req_vf_info->format)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d == %d) && (%p != NULL) && %d && !%d\n",
- __LINE__, xcandidate->num_output_pins, 1,
- req_vf_info, candidate->enable.vf_veceven,
- binary_supports_vf_format(xcandidate, req_vf_info->format));
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%d == %d) && (%p != NULL) && %d && !%d\n",
+ __LINE__, xcandidate->num_output_pins, 1,
+ req_vf_info, candidate->enable.vf_veceven,
+ binary_supports_vf_format(xcandidate, req_vf_info->format));
continue;
}
@@ -1241,37 +1203,31 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
if (xcandidate->num_output_pins == 1 &&
req_vf_info && candidate->enable.vf_veceven) { /* and we need vf output. */
if (req_vf_info->res.width > candidate->output.max_width) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: (%d < %d)\n",
- __LINE__,
- req_vf_info->res.width,
- candidate->output.max_width);
+ dev_dbg(atomisp_dev,
+ "ia_css_binary_find() [%d] continue: (%d < %d)\n",
+ __LINE__, req_vf_info->res.width,
+ candidate->output.max_width);
continue;
}
}
if (!supports_bds_factor(candidate->bds.supported_bds_factors,
descr->required_bds_factor)) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
- __LINE__, candidate->bds.supported_bds_factors,
- descr->required_bds_factor);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
+ __LINE__, candidate->bds.supported_bds_factors,
+ descr->required_bds_factor);
continue;
}
if (!candidate->enable.dpc && need_dpc) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
- __LINE__, candidate->enable.dpc,
- descr->enable_dpc);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
+ __LINE__, candidate->enable.dpc, descr->enable_dpc);
continue;
}
if (candidate->uds.use_bci && enable_capture_pp_bli) {
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
- __LINE__, candidate->uds.use_bci,
- descr->enable_capture_pp_bli);
+ dev_dbg(atomisp_dev, "ia_css_binary_find() [%d] continue: 0x%x & 0x%x)\n",
+ __LINE__, candidate->uds.use_bci, descr->enable_capture_pp_bli);
continue;
}
@@ -1290,39 +1246,18 @@ static int __ia_css_binary_find(struct ia_css_binary_descr *descr,
break;
}
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() selected = %p, mode = %d ID = %d\n",
- xcandidate, xcandidate ? xcandidate->sp.pipeline.mode : 0, xcandidate ? xcandidate->sp.id : 0);
-
- ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
- "ia_css_binary_find() leave: return_err=%d\n", err);
-
if (!err && xcandidate)
- dev_dbg(atomisp_dev,
- "Using binary %s (id %d), type %d, mode %d, continuous %s\n",
- xcandidate->blob->name,
- xcandidate->sp.id,
- xcandidate->type,
+ dev_dbg(atomisp_dev, "Using binary %s (id %d), type %d, mode %d, continuous %s\n",
+ xcandidate->blob->name, xcandidate->sp.id, xcandidate->type,
xcandidate->sp.pipeline.mode,
xcandidate->sp.enable.continuous ? "true" : "false");
+ if (err)
+ dev_err(atomisp_dev, "Failed to find a firmware binary matching the pipeline parameters\n");
return err;
}
-int ia_css_binary_find(struct ia_css_binary_descr *descr,
- struct ia_css_binary *binary)
-{
- int ret = __ia_css_binary_find(descr, binary);
-
- if (unlikely(ret)) {
- dev_dbg(atomisp_dev, "Seeking for binary failed at:");
- dump_stack();
- }
-
- return ret;
-}
-
unsigned
ia_css_binary_max_vf_width(void)
{
diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c
index 52483498239d..2e0193671f4b 100644
--- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c
+++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c
@@ -13,6 +13,8 @@
* more details.
*/
+#include <linux/bitops.h>
+#include <linux/math.h>
#include <linux/string.h> /* for memcpy() */
#include "system_global.h"
@@ -20,7 +22,6 @@
#include "ia_css_isys.h"
#include "ia_css_debug.h"
-#include "math_support.h"
#include "virtual_isys.h"
#include "isp.h"
#include "sh_css_defs.h"
@@ -558,7 +559,7 @@ static int32_t calculate_stride(
bits_per_pixel = CEIL_MUL(bits_per_pixel, 8);
pixels_per_word = HIVE_ISP_DDR_WORD_BITS / bits_per_pixel;
- words_per_line = ceil_div(pixels_per_line_padded, pixels_per_word);
+ words_per_line = DIV_ROUND_UP(pixels_per_line_padded, pixels_per_word);
bytes_per_line = HIVE_ISP_DDR_WORD_BYTES * words_per_line;
return bytes_per_line;
@@ -690,7 +691,6 @@ static bool calculate_ibuf_ctrl_cfg(
const isp2401_input_system_cfg_t *isys_cfg,
ibuf_ctrl_cfg_t *cfg)
{
- const s32 bits_per_byte = 8;
s32 bits_per_pixel;
s32 bytes_per_pixel;
s32 left_padding;
@@ -698,7 +698,7 @@ static bool calculate_ibuf_ctrl_cfg(
(void)input_port;
bits_per_pixel = isys_cfg->input_port_resolution.bits_per_pixel;
- bytes_per_pixel = ceil_div(bits_per_pixel, bits_per_byte);
+ bytes_per_pixel = BITS_TO_BYTES(bits_per_pixel);
left_padding = CEIL_MUL(isys_cfg->output_port_attr.left_padding, ISP_VEC_NELEMS)
* bytes_per_pixel;
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index 01f0b8a33c99..ca97ea082cf4 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -5826,20 +5826,19 @@ need_yuv_scaler_stage(const struct ia_css_pipe *pipe)
* Later, merge this with ia_css_pipe_create_cas_scaler_desc
*/
static int ia_css_pipe_create_cas_scaler_desc_single_output(
- struct ia_css_frame_info *cas_scaler_in_info,
- struct ia_css_frame_info *cas_scaler_out_info,
- struct ia_css_frame_info *cas_scaler_vf_info,
+ struct ia_css_frame_info *in_info,
+ struct ia_css_frame_info *out_info,
+ struct ia_css_frame_info *vf_info,
struct ia_css_cas_binary_descr *descr)
{
unsigned int i;
unsigned int hor_ds_factor = 0, ver_ds_factor = 0;
int err = 0;
struct ia_css_frame_info tmp_in_info;
-
unsigned int max_scale_factor_per_stage = MAX_PREFERRED_YUV_DS_PER_STEP;
- assert(cas_scaler_in_info);
- assert(cas_scaler_out_info);
+ assert(in_info);
+ assert(out_info);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE,
"ia_css_pipe_create_cas_scaler_desc() enter:\n");
@@ -5847,10 +5846,8 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output(
/* We assume that this function is used only for single output port case. */
descr->num_output_stage = 1;
- hor_ds_factor = CEIL_DIV(cas_scaler_in_info->res.width,
- cas_scaler_out_info->res.width);
- ver_ds_factor = CEIL_DIV(cas_scaler_in_info->res.height,
- cas_scaler_out_info->res.height);
+ hor_ds_factor = CEIL_DIV(in_info->res.width, out_info->res.width);
+ ver_ds_factor = CEIL_DIV(in_info->res.height, out_info->res.height);
/* use the same horizontal and vertical downscaling factor for simplicity */
assert(hor_ds_factor == ver_ds_factor);
@@ -5895,30 +5892,29 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output(
goto ERR;
}
- tmp_in_info = *cas_scaler_in_info;
+ tmp_in_info = *in_info;
for (i = 0; i < descr->num_stage; i++) {
descr->in_info[i] = tmp_in_info;
- if ((tmp_in_info.res.width / max_scale_factor_per_stage) <=
- cas_scaler_out_info->res.width) {
+ if ((tmp_in_info.res.width / max_scale_factor_per_stage) <= out_info->res.width) {
descr->is_output_stage[i] = true;
if ((descr->num_output_stage > 1) && (i != (descr->num_stage - 1))) {
- descr->internal_out_info[i].res.width = cas_scaler_out_info->res.width;
- descr->internal_out_info[i].res.height = cas_scaler_out_info->res.height;
- descr->internal_out_info[i].padded_width = cas_scaler_out_info->padded_width;
+ descr->internal_out_info[i].res.width = out_info->res.width;
+ descr->internal_out_info[i].res.height = out_info->res.height;
+ descr->internal_out_info[i].padded_width = out_info->padded_width;
descr->internal_out_info[i].format = IA_CSS_FRAME_FORMAT_YUV420;
} else {
assert(i == (descr->num_stage - 1));
descr->internal_out_info[i].res.width = 0;
descr->internal_out_info[i].res.height = 0;
}
- descr->out_info[i].res.width = cas_scaler_out_info->res.width;
- descr->out_info[i].res.height = cas_scaler_out_info->res.height;
- descr->out_info[i].padded_width = cas_scaler_out_info->padded_width;
- descr->out_info[i].format = cas_scaler_out_info->format;
- if (cas_scaler_vf_info) {
- descr->vf_info[i].res.width = cas_scaler_vf_info->res.width;
- descr->vf_info[i].res.height = cas_scaler_vf_info->res.height;
- descr->vf_info[i].padded_width = cas_scaler_vf_info->padded_width;
+ descr->out_info[i].res.width = out_info->res.width;
+ descr->out_info[i].res.height = out_info->res.height;
+ descr->out_info[i].padded_width = out_info->padded_width;
+ descr->out_info[i].format = out_info->format;
+ if (vf_info) {
+ descr->vf_info[i].res.width = vf_info->res.width;
+ descr->vf_info[i].res.height = vf_info->res.height;
+ descr->vf_info[i].padded_width = vf_info->padded_width;
ia_css_frame_info_set_format(&descr->vf_info[i], IA_CSS_FRAME_FORMAT_YUV_LINE);
} else {
descr->vf_info[i].res.width = 0;
diff --git a/drivers/staging/media/atomisp/pci/sh_css_dvs_info.h b/drivers/staging/media/atomisp/pci/sh_css_dvs_info.h
deleted file mode 100644
index 6f058f132300..000000000000
--- a/drivers/staging/media/atomisp/pci/sh_css_dvs_info.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/**
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope 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.
-*/
-
-#ifndef __SH_CSS_DVS_INFO_H__
-#define __SH_CSS_DVS_INFO_H__
-
-#include <math_support.h>
-
-/* horizontal 64x64 blocks round up to DVS_BLOCKDIM_X, make even */
-#define DVS_NUM_BLOCKS_X(X) (CEIL_MUL(CEIL_DIV((X), DVS_BLOCKDIM_X), 2))
-
-/* vertical 64x64 blocks round up to DVS_BLOCKDIM_Y */
-#define DVS_NUM_BLOCKS_Y(X) (CEIL_DIV((X), DVS_BLOCKDIM_Y_LUMA))
-
-/* Bilinear interpolation (HRT_GDC_BLI_MODE) is the supported method currently.
- * Bicubic interpolation (HRT_GDC_BCI_MODE) is not supported yet */
-#define DVS_GDC_INTERP_METHOD HRT_GDC_BLI_MODE
-
-#define DVS_INPUT_BYTES_PER_PIXEL (1)
-
-#define DVS_NUM_BLOCKS_X_CHROMA(X) (CEIL_DIV((X), DVS_BLOCKDIM_X))
-
-#define DVS_NUM_BLOCKS_Y_CHROMA(X) (CEIL_DIV((X), DVS_BLOCKDIM_Y_CHROMA))
-
-#endif /* __SH_CSS_DVS_INFO_H__ */
diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.h b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.h
index 7782f76b9f97..25e5b4570f7d 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.h
+++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.h
@@ -18,7 +18,6 @@
#include <math_support.h>
#include <ia_css_types.h>
-#include <sh_css_dvs_info.h>
#include "gdc_global.h" /* gdc_warp_param_mem_t */
#define DVS_ENV_MIN_X (12)
diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index 728b3892a20c..bc9a2a40afcb 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -32,7 +32,7 @@
#include <linux/i2c.h>
#include <linux/kthread.h>
#include <linux/slab.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
#include <asm/byteorder.h>
#include <linux/dvb/frontend.h>
diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
index 31b2b48085c5..712f916f0935 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
@@ -333,20 +333,16 @@ static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
static int isc_parse_dt(struct device *dev, struct isc_device *isc)
{
struct device_node *np = dev->of_node;
- struct device_node *epn = NULL;
+ struct device_node *epn;
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
- int ret;
+ int ret = -EINVAL;
INIT_LIST_HEAD(&isc->subdev_entities);
- while (1) {
+ for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
- epn = of_graph_get_next_endpoint(np, epn);
- if (!epn)
- return 0;
-
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
&v4l2_epn);
if (ret) {
diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
index 020034f631f5..9485167d5b7d 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
@@ -316,23 +316,19 @@ static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = {
static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
{
struct device_node *np = dev->of_node;
- struct device_node *epn = NULL;
+ struct device_node *epn;
struct isc_subdev_entity *subdev_entity;
unsigned int flags;
- int ret;
+ int ret = -EINVAL;
bool mipi_mode;
INIT_LIST_HEAD(&isc->subdev_entities);
mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
- while (1) {
+ for_each_endpoint_of_node(np, epn) {
struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
- epn = of_graph_get_next_endpoint(np, epn);
- if (!epn)
- return 0;
-
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
&v4l2_epn);
if (ret) {
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index 3df58eb3e882..e7aee7e3db5b 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -535,31 +535,53 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq)
container_of(vq, struct imgu_video_device, vbq);
int r;
unsigned int pipe;
+ bool stop_streaming = false;
+ /* Verify that the node had been setup with imgu_v4l2_node_setup() */
WARN_ON(!node->enabled);
pipe = node->pipe;
dev_dbg(dev, "Try to stream off node [%u][%u]", pipe, node->id);
- imgu_pipe = &imgu->imgu_pipe[pipe];
- r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev, video, s_stream, 0);
- if (r)
- dev_err(&imgu->pci_dev->dev,
- "failed to stop subdev streaming\n");
+ /*
+ * When the first node of a streaming setup is stopped, the entire
+ * pipeline needs to stop before individual nodes are disabled.
+ * Perform the inverse of the initial setup.
+ *
+ * Part 1 - s_stream on the entire pipeline
+ */
mutex_lock(&imgu->streaming_lock);
- /* Was this the first node with streaming disabled? */
- if (imgu->streaming && imgu_all_nodes_streaming(imgu, node)) {
+ if (imgu->streaming) {
/* Yes, really stop streaming now */
dev_dbg(dev, "IMGU streaming is ready to stop");
r = imgu_s_stream(imgu, false);
if (!r)
imgu->streaming = false;
+ stop_streaming = true;
}
-
- imgu_return_all_buffers(imgu, node, VB2_BUF_STATE_ERROR);
mutex_unlock(&imgu->streaming_lock);
+ /* Part 2 - s_stream on subdevs
+ *
+ * If we call s_stream multiple times, Linux v6.7's call_s_stream()
+ * WARNs and aborts. Thus, disable all pipes at once, and only once.
+ */
+ if (stop_streaming) {
+ for_each_set_bit(pipe, imgu->css.enabled_pipes,
+ IMGU_MAX_PIPE_NUM) {
+ imgu_pipe = &imgu->imgu_pipe[pipe];
+
+ r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev,
+ video, s_stream, 0);
+ if (r)
+ dev_err(&imgu->pci_dev->dev,
+ "failed to stop subdev streaming\n");
+ }
+ }
+
+ /* Part 3 - individual node teardown */
video_device_pipeline_stop(&node->vdev);
+ imgu_return_all_buffers(imgu, node, VB2_BUF_STATE_ERROR);
}
/******************** v4l2_ioctl_ops ********************/
diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c
index de3e0345ab7c..5e5b296f93ba 100644
--- a/drivers/staging/media/meson/vdec/vdec.c
+++ b/drivers/staging/media/meson/vdec/vdec.c
@@ -982,6 +982,8 @@ static const struct of_device_id vdec_dt_match[] = {
.data = &vdec_platform_gxm },
{ .compatible = "amlogic,gxl-vdec",
.data = &vdec_platform_gxl },
+ { .compatible = "amlogic,gxlx-vdec",
+ .data = &vdec_platform_gxlx },
{ .compatible = "amlogic,g12a-vdec",
.data = &vdec_platform_g12a },
{ .compatible = "amlogic,sm1-vdec",
diff --git a/drivers/staging/media/meson/vdec/vdec_1.c b/drivers/staging/media/meson/vdec/vdec_1.c
index 3fe2de0c9331..a65cb4959446 100644
--- a/drivers/staging/media/meson/vdec/vdec_1.c
+++ b/drivers/staging/media/meson/vdec/vdec_1.c
@@ -129,7 +129,7 @@ static u32 vdec_1_vififo_level(struct amvdec_session *sess)
return amvdec_read_dos(core, VLD_MEM_VIFIFO_LEVEL);
}
-static int vdec_1_stop(struct amvdec_session *sess)
+static void __vdec_1_stop(struct amvdec_session *sess)
{
struct amvdec_core *core = sess->core;
struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops;
@@ -158,10 +158,17 @@ static int vdec_1_stop(struct amvdec_session *sess)
regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
GEN_PWR_VDEC_1, GEN_PWR_VDEC_1);
- clk_disable_unprepare(core->vdec_1_clk);
-
if (sess->priv)
codec_ops->stop(sess);
+}
+
+static int vdec_1_stop(struct amvdec_session *sess)
+{
+ struct amvdec_core *core = sess->core;
+
+ __vdec_1_stop(sess);
+
+ clk_disable_unprepare(core->vdec_1_clk);
return 0;
}
@@ -235,7 +242,8 @@ static int vdec_1_start(struct amvdec_session *sess)
return 0;
stop:
- vdec_1_stop(sess);
+ __vdec_1_stop(sess);
+ clk_disable_unprepare(core->vdec_1_clk);
return ret;
}
diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c
index afced435c907..1939c47def58 100644
--- a/drivers/staging/media/meson/vdec/vdec_hevc.c
+++ b/drivers/staging/media/meson/vdec/vdec_hevc.c
@@ -110,7 +110,7 @@ static u32 vdec_hevc_vififo_level(struct amvdec_session *sess)
return readl_relaxed(sess->core->dos_base + HEVC_STREAM_LEVEL);
}
-static int vdec_hevc_stop(struct amvdec_session *sess)
+static void __vdec_hevc_stop(struct amvdec_session *sess)
{
struct amvdec_core *core = sess->core;
struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops;
@@ -142,6 +142,13 @@ static int vdec_hevc_stop(struct amvdec_session *sess)
else
regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0,
GEN_PWR_VDEC_HEVC, GEN_PWR_VDEC_HEVC);
+}
+
+static int vdec_hevc_stop(struct amvdec_session *sess)
+{
+ struct amvdec_core *core = sess->core;
+
+ __vdec_hevc_stop(sess);
clk_disable_unprepare(core->vdec_hevc_clk);
if (core->platform->revision == VDEC_REVISION_G12A ||
@@ -151,20 +158,12 @@ static int vdec_hevc_stop(struct amvdec_session *sess)
return 0;
}
-static int vdec_hevc_start(struct amvdec_session *sess)
+static int __vdec_hevc_start(struct amvdec_session *sess)
{
int ret;
struct amvdec_core *core = sess->core;
struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops;
- if (core->platform->revision == VDEC_REVISION_G12A ||
- core->platform->revision == VDEC_REVISION_SM1) {
- clk_set_rate(core->vdec_hevcf_clk, 666666666);
- ret = clk_prepare_enable(core->vdec_hevcf_clk);
- if (ret)
- return ret;
- }
-
clk_set_rate(core->vdec_hevc_clk, 666666666);
ret = clk_prepare_enable(core->vdec_hevc_clk);
if (ret) {
@@ -223,10 +222,32 @@ static int vdec_hevc_start(struct amvdec_session *sess)
return 0;
stop:
- vdec_hevc_stop(sess);
+ __vdec_hevc_stop(sess);
+ clk_disable_unprepare(core->vdec_hevc_clk);
return ret;
}
+static int vdec_hevc_start(struct amvdec_session *sess)
+{
+ struct amvdec_core *core = sess->core;
+ int ret;
+
+ if (core->platform->revision == VDEC_REVISION_G12A ||
+ core->platform->revision == VDEC_REVISION_SM1) {
+ clk_set_rate(core->vdec_hevcf_clk, 666666666);
+ ret = clk_prepare_enable(core->vdec_hevcf_clk);
+ if (ret)
+ return ret;
+
+ ret = __vdec_hevc_start(sess);
+ if (ret)
+ clk_disable_unprepare(core->vdec_hevcf_clk);
+ return ret;
+ }
+
+ return __vdec_hevc_start(sess);
+}
+
struct amvdec_ops vdec_hevc_ops = {
.start = vdec_hevc_start,
.stop = vdec_hevc_stop,
diff --git a/drivers/staging/media/meson/vdec/vdec_platform.c b/drivers/staging/media/meson/vdec/vdec_platform.c
index 70c9fd7c8bc5..66bb307db85a 100644
--- a/drivers/staging/media/meson/vdec/vdec_platform.c
+++ b/drivers/staging/media/meson/vdec/vdec_platform.c
@@ -101,6 +101,44 @@ static const struct amvdec_format vdec_formats_gxl[] = {
},
};
+static const struct amvdec_format vdec_formats_gxlx[] = {
+ {
+ .pixfmt = V4L2_PIX_FMT_H264,
+ .min_buffers = 2,
+ .max_buffers = 24,
+ .max_width = 3840,
+ .max_height = 2160,
+ .vdec_ops = &vdec_1_ops,
+ .codec_ops = &codec_h264_ops,
+ .firmware_path = "meson/vdec/gxl_h264.bin",
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
+ .flags = V4L2_FMT_FLAG_COMPRESSED |
+ V4L2_FMT_FLAG_DYN_RESOLUTION,
+ }, {
+ .pixfmt = V4L2_PIX_FMT_MPEG1,
+ .min_buffers = 8,
+ .max_buffers = 8,
+ .max_width = 1920,
+ .max_height = 1080,
+ .vdec_ops = &vdec_1_ops,
+ .codec_ops = &codec_mpeg12_ops,
+ .firmware_path = "meson/vdec/gxl_mpeg12.bin",
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
+ .flags = V4L2_FMT_FLAG_COMPRESSED,
+ }, {
+ .pixfmt = V4L2_PIX_FMT_MPEG2,
+ .min_buffers = 8,
+ .max_buffers = 8,
+ .max_width = 1920,
+ .max_height = 1080,
+ .vdec_ops = &vdec_1_ops,
+ .codec_ops = &codec_mpeg12_ops,
+ .firmware_path = "meson/vdec/gxl_mpeg12.bin",
+ .pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
+ .flags = V4L2_FMT_FLAG_COMPRESSED,
+ },
+};
+
static const struct amvdec_format vdec_formats_gxm[] = {
{
.pixfmt = V4L2_PIX_FMT_VP9,
@@ -263,6 +301,12 @@ const struct vdec_platform vdec_platform_gxl = {
.revision = VDEC_REVISION_GXL,
};
+const struct vdec_platform vdec_platform_gxlx = {
+ .formats = vdec_formats_gxlx,
+ .num_formats = ARRAY_SIZE(vdec_formats_gxlx),
+ .revision = VDEC_REVISION_GXLX,
+};
+
const struct vdec_platform vdec_platform_gxm = {
.formats = vdec_formats_gxm,
.num_formats = ARRAY_SIZE(vdec_formats_gxm),
diff --git a/drivers/staging/media/meson/vdec/vdec_platform.h b/drivers/staging/media/meson/vdec/vdec_platform.h
index 731877a771f4..88ca4a9db8a8 100644
--- a/drivers/staging/media/meson/vdec/vdec_platform.h
+++ b/drivers/staging/media/meson/vdec/vdec_platform.h
@@ -14,6 +14,7 @@ struct amvdec_format;
enum vdec_revision {
VDEC_REVISION_GXBB,
VDEC_REVISION_GXL,
+ VDEC_REVISION_GXLX,
VDEC_REVISION_GXM,
VDEC_REVISION_G12A,
VDEC_REVISION_SM1,
@@ -28,6 +29,7 @@ struct vdec_platform {
extern const struct vdec_platform vdec_platform_gxbb;
extern const struct vdec_platform vdec_platform_gxm;
extern const struct vdec_platform vdec_platform_gxl;
+extern const struct vdec_platform vdec_platform_gxlx;
extern const struct vdec_platform vdec_platform_g12a;
extern const struct vdec_platform vdec_platform_sm1;
diff --git a/drivers/staging/media/starfive/camss/stf-camss.c b/drivers/staging/media/starfive/camss/stf-camss.c
index fecd3e67c7a1..b6d34145bc19 100644
--- a/drivers/staging/media/starfive/camss/stf-camss.c
+++ b/drivers/staging/media/starfive/camss/stf-camss.c
@@ -358,8 +358,6 @@ err_cleanup_notifier:
/*
* stfcamss_remove - Remove STFCAMSS platform device
* @pdev: Pointer to STFCAMSS platform device
- *
- * Always returns 0.
*/
static void stfcamss_remove(struct platform_device *pdev)
{
diff --git a/drivers/staging/media/starfive/camss/stf-capture.c b/drivers/staging/media/starfive/camss/stf-capture.c
index ec5169e7b391..e15d2e97eb0b 100644
--- a/drivers/staging/media/starfive/camss/stf-capture.c
+++ b/drivers/staging/media/starfive/camss/stf-capture.c
@@ -180,6 +180,8 @@ static void stf_channel_set(struct stfcamss_video *video)
u32 val;
if (cap->type == STF_CAPTURE_RAW) {
+ const struct v4l2_pix_format *pix = &video->active_fmt.fmt.pix;
+
val = stf_syscon_reg_read(stfcamss, VIN_CHANNEL_SEL_EN);
val &= ~U0_VIN_CHANNEL_SEL_MASK;
val |= CHANNEL(0);
@@ -193,7 +195,7 @@ static void stf_channel_set(struct stfcamss_video *video)
val |= PIXEL_HEIGH_BIT_SEL(0);
val &= ~U0_VIN_PIX_CNT_END_MASK;
- val |= PIX_CNT_END(IMAGE_MAX_WIDTH / 4 - 1);
+ val |= PIX_CNT_END(pix->width / 4 - 1);
stf_syscon_reg_write(stfcamss, VIN_INRT_PIX_CFG, val);
} else if (cap->type == STF_CAPTURE_YUV) {
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 6254a5df2502..2b3cdb1ce140 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -454,18 +454,18 @@ static int comp_probe_channel(struct most_interface *iface, int channel_idx,
struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
if (mdev) {
- pr_err("channel already linked\n");
+ pr_err("Channel already linked\n");
return -EEXIST;
}
if (ccfg->direction != MOST_CH_RX) {
- pr_err("wrong direction, expect rx\n");
+ pr_err("Wrong direction, expected rx\n");
return -EINVAL;
}
if (ccfg->data_type != MOST_CH_SYNC &&
ccfg->data_type != MOST_CH_ISOC) {
- pr_err("wrong channel type, expect sync or isoc\n");
+ pr_err("Wrong channel type, expected sync or isoc\n");
return -EINVAL;
}
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index d09211589d1c..977f8fc29e63 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -175,7 +175,7 @@ static struct nvec_msg *nvec_msg_alloc(struct nvec_chip *nvec,
}
}
- dev_err(nvec->dev, "could not allocate %s buffer\n",
+ dev_err(nvec->dev, "Could not allocate %s buffer\n",
(category == NVEC_MSG_TX) ? "TX" : "RX");
return NULL;
@@ -315,7 +315,7 @@ int nvec_write_sync(struct nvec_chip *nvec,
if (!(wait_for_completion_timeout(&nvec->sync_write,
msecs_to_jiffies(2000)))) {
dev_warn(nvec->dev,
- "timeout waiting for sync write to complete\n");
+ "Timeout waiting for sync write to complete\n");
mutex_unlock(&nvec->sync_write_mutex);
return -ETIMEDOUT;
}
@@ -392,7 +392,7 @@ static void nvec_request_master(struct work_struct *work)
msecs_to_jiffies(5000));
if (err == 0) {
- dev_warn(nvec->dev, "timeout waiting for ec transfer\n");
+ dev_warn(nvec->dev, "Timeout waiting for ec transfer\n");
nvec_gpio_set_value(nvec, 1);
msg->pos = 0;
}
@@ -454,7 +454,7 @@ static void nvec_dispatch(struct work_struct *work)
if (nvec->sync_write_pending ==
(msg->data[2] << 8) + msg->data[0]) {
- dev_dbg(nvec->dev, "sync write completed!\n");
+ dev_dbg(nvec->dev, "Sync write completed!\n");
nvec->sync_write_pending = 0;
nvec->last_sync_msg = msg;
complete(&nvec->sync_write);
@@ -477,7 +477,7 @@ static void nvec_tx_completed(struct nvec_chip *nvec)
{
/* We got an END_TRANS, let's skip this, maybe there's an event */
if (nvec->tx->pos != nvec->tx->size) {
- dev_err(nvec->dev, "premature END_TRANS, resending\n");
+ dev_err(nvec->dev, "Premature END_TRANS, resending\n");
nvec->tx->pos = 0;
nvec_gpio_set_value(nvec, 0);
} else {
@@ -608,7 +608,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
/* Filter out some errors */
if ((status & irq_mask) == 0 && (status & ~irq_mask) != 0) {
- dev_err(nvec->dev, "unexpected irq mask %lx\n", status);
+ dev_err(nvec->dev, "Unexpected irq mask %lx\n", status);
return IRQ_HANDLED;
}
if ((status & I2C_SL_IRQ) == 0) {
@@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
if (status != (I2C_SL_IRQ | RCVD))
nvec_invalid_flags(nvec, status, false);
break;
- case 1: /* command byte */
+ case 1: /* Command byte */
if (status != I2C_SL_IRQ) {
nvec_invalid_flags(nvec, status, true);
} else {
@@ -845,13 +845,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
return PTR_ERR(nvec->gpiod);
}
- err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0,
+ err = devm_request_irq(dev, nvec->irq, nvec_interrupt, IRQF_NO_AUTOEN,
"nvec", nvec);
if (err) {
dev_err(dev, "couldn't request irq\n");
return -ENODEV;
}
- disable_irq(nvec->irq);
tegra_init_i2c_slave(nvec);
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 08ec3aae90ea..4cb904a5f8f4 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -544,7 +544,7 @@ static const struct backlight_ops dcon_bl_ops = {
static struct backlight_properties dcon_bl_props = {
.max_brightness = 15,
.type = BACKLIGHT_RAW,
- .power = FB_BLANK_UNBLANK,
+ .power = BACKLIGHT_POWER_ON,
};
static int dcon_reboot_notify(struct notifier_block *nb,
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 1fabc5137a4c..ab344d676bb9 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -136,10 +136,6 @@ void r8712_free_recvframe(union recv_frame *precvframe,
static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
struct recv_stat *prxstat)
{
- u16 drvinfo_sz;
-
- drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
- drvinfo_sz <<= 3;
/*TODO:
* Offset 0
*/
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index bbd4a13c7bb9..ffeb91dd28c4 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -528,8 +528,9 @@ void r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key)
if (unicast_key)
memcpy(&psetstakey_para->key, &sta->x_UncstKey, 16);
else
- memcpy(&psetstakey_para->key, &psecuritypriv->XGrpKey[psecuritypriv->XGrpKeyid - 1].
- skey, 16);
+ memcpy(&psetstakey_para->key,
+ &psecuritypriv->XGrpKey[psecuritypriv->XGrpKeyid - 1].skey,
+ 16);
r8712_enqueue_cmd(pcmdpriv, ph2c);
}
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.h b/drivers/staging/rtl8712/rtl871x_cmd.h
index 2613b3c2acfc..268844af57f0 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.h
+++ b/drivers/staging/rtl8712/rtl871x_cmd.h
@@ -736,7 +736,7 @@ void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj
void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
void r8712_setstaKey_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
void r8712_setassocsta_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
-void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt,
+void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt,
u32 tryPktInterval, u32 firstStageTO);
struct _cmd_callback {
diff --git a/drivers/staging/rtl8712/rtl871x_io.c b/drivers/staging/rtl8712/rtl871x_io.c
index 6789a4c98564..20e080e284dd 100644
--- a/drivers/staging/rtl8712/rtl871x_io.c
+++ b/drivers/staging/rtl8712/rtl871x_io.c
@@ -48,8 +48,8 @@ static uint _init_intf_hdl(struct _adapter *padapter,
set_intf_funs = &(r8712_usb_set_intf_funs);
set_intf_ops = &r8712_usb_set_intf_ops;
init_intf_priv = &r8712_usb_init_intf_priv;
- pintf_priv = pintf_hdl->pintfpriv = kmalloc(sizeof(struct intf_priv),
- GFP_ATOMIC);
+ pintf_priv = kmalloc(sizeof(*pintf_priv), GFP_ATOMIC);
+ pintf_hdl->pintfpriv = pintf_priv;
if (!pintf_priv)
goto _init_intf_hdl_fail;
pintf_hdl->adapter = (u8 *)padapter;
diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
index 0a3451cdc8a1..4a34824830e3 100644
--- a/drivers/staging/rtl8712/usb_ops_linux.c
+++ b/drivers/staging/rtl8712/usb_ops_linux.c
@@ -221,7 +221,7 @@ static void r8712_usb_read_port_complete(struct urb *purb)
fallthrough;
case -EPROTO:
r8712_read_port(padapter, precvpriv->ff_hwaddr, 0,
- (unsigned char *)precvbuf);
+ (unsigned char *)precvbuf);
break;
case -EINPROGRESS:
netdev_err(padapter->pnetdev, "ERROR: URB IS IN PROGRESS!\n");
diff --git a/drivers/staging/rtl8723bs/Kconfig b/drivers/staging/rtl8723bs/Kconfig
index f23e29b679fb..8d48c61961a6 100644
--- a/drivers/staging/rtl8723bs/Kconfig
+++ b/drivers/staging/rtl8723bs/Kconfig
@@ -3,7 +3,6 @@ config RTL8723BS
tristate "Realtek RTL8723BS SDIO Wireless LAN NIC driver"
depends on WLAN && MMC && CFG80211
depends on m
- select CFG80211_WEXT
select CRYPTO
select CRYPTO_LIB_ARC4
help
diff --git a/drivers/staging/rtl8723bs/Makefile b/drivers/staging/rtl8723bs/Makefile
index 7f5067e89295..ba200ee669f3 100644
--- a/drivers/staging/rtl8723bs/Makefile
+++ b/drivers/staging/rtl8723bs/Makefile
@@ -3,7 +3,6 @@ r8723bs-y = \
core/rtw_ap.o \
core/rtw_btcoex.o \
core/rtw_cmd.o \
- core/rtw_debug.o \
core/rtw_efuse.o \
core/rtw_io.o \
core/rtw_ioctl_set.o \
@@ -12,7 +11,6 @@ r8723bs-y = \
core/rtw_mlme_ext.o \
core/rtw_pwrctrl.o \
core/rtw_recv.o \
- core/rtw_rf.o \
core/rtw_security.o \
core/rtw_sta_mgt.o \
core/rtw_wlan_util.o \
diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index e4063713fecc..a6dc88dd4ba1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -6,8 +6,7 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
void init_mlme_ap_info(struct adapter *padapter)
{
@@ -277,7 +276,7 @@ void expire_timeout_chk(struct adapter *padapter)
/* switch to correct channel of current network before issue keep-alive frames */
if (rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
backup_oper_channel = rtw_get_oper_ch(padapter);
- SelectChannel(padapter, pmlmeext->cur_channel);
+ r8723bs_select_channel(padapter, pmlmeext->cur_channel);
}
/* issue null data to check sta alive*/
@@ -315,7 +314,7 @@ void expire_timeout_chk(struct adapter *padapter)
}
if (backup_oper_channel > 0) /* back to the original operation channel */
- SelectChannel(padapter, backup_oper_channel);
+ r8723bs_select_channel(padapter, backup_oper_channel);
}
associated_clients_update(padapter, updated);
diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index 62cbf84b079a..d54095f50113 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtw_btcoex.h>
#include <hal_btcoex.h>
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index d3f10a3cf972..84ce7307d8f3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_btcoex.h>
#include <linux/jiffies.h>
@@ -1884,9 +1883,6 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
/* copy pdev_network information to pmlmepriv->cur_network */
memcpy(&tgt_network->network, pnetwork, (get_wlan_bssid_ex_sz(pnetwork)));
- /* reset ds_config */
- /* tgt_network->network.configuration.ds_config = (u32)rtw_ch2freq(pnetwork->configuration.ds_config); */
-
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c
deleted file mode 100644
index 5354fdd11c9b..000000000000
--- a/drivers/staging/rtl8723bs/core/rtw_debug.c
+++ /dev/null
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-
-#include <drv_types.h>
-#include <rtw_debug.h>
-#include <hal_btcoex.h>
-
-#include <rtw_version.h>
-
-static void dump_4_regs(struct adapter *adapter, int offset)
-{
- u32 reg[4];
- int i;
-
- for (i = 0; i < 4; i++)
- reg[i] = rtw_read32(adapter, offset + i);
-
- netdev_dbg(adapter->pnetdev, "0x%03x 0x%08x 0x%08x 0x%08x 0x%08x\n",
- i, reg[0], reg[1], reg[2], reg[3]);
-}
-
-void mac_reg_dump(struct adapter *adapter)
-{
- int i;
-
- netdev_dbg(adapter->pnetdev, "======= MAC REG =======\n");
-
- for (i = 0x0; i < 0x800; i += 4)
- dump_4_regs(adapter, i);
-}
-
-void bb_reg_dump(struct adapter *adapter)
-{
- int i;
-
- netdev_dbg(adapter->pnetdev, "======= BB REG =======\n");
-
- for (i = 0x800; i < 0x1000 ; i += 4)
- dump_4_regs(adapter, i);
-}
-
-static void dump_4_rf_regs(struct adapter *adapter, int path, int offset)
-{
- u8 reg[4];
- int i;
-
- for (i = 0; i < 4; i++)
- reg[i] = rtw_hal_read_rfreg(adapter, path, offset + i,
- 0xffffffff);
-
- netdev_dbg(adapter->pnetdev, "0x%02x 0x%08x 0x%08x 0x%08x 0x%08x\n",
- i, reg[0], reg[1], reg[2], reg[3]);
-}
-
-void rf_reg_dump(struct adapter *adapter)
-{
- int i, path = 0;
-
- netdev_dbg(adapter->pnetdev, "======= RF REG =======\n");
-
- netdev_dbg(adapter->pnetdev, "RF_Path(%x)\n", path);
- for (i = 0; i < 0x100; i++)
- dump_4_rf_regs(adapter, path, i);
-}
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index eb848f9bbf2c..8b671f8a7965 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
#include <linux/jiffies.h>
@@ -38,7 +37,7 @@ Efuse_Read1ByteFromFakeContent(u16 Offset, u8 *Value)
if (fakeEfuseBank == 0)
*Value = fakeEfuseContent[Offset];
else
- *Value = fakeBTEfuseContent[fakeEfuseBank-1][Offset];
+ *Value = fakeBTEfuseContent[fakeEfuseBank - 1][Offset];
return true;
}
@@ -50,7 +49,7 @@ Efuse_Write1ByteToFakeContent(u16 Offset, u8 Value)
if (fakeEfuseBank == 0)
fakeEfuseContent[Offset] = Value;
else
- fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value;
+ fakeBTEfuseContent[fakeEfuseBank - 1][Offset] = Value;
return true;
}
@@ -206,21 +205,21 @@ u16 Address)
if (Address < contentLen) {/* E-fuse 512Byte */
/* Write E-fuse Register address bit0~7 */
temp = Address & 0xFF;
- rtw_write8(Adapter, EFUSE_CTRL+1, temp);
- Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
+ rtw_write8(Adapter, EFUSE_CTRL + 1, temp);
+ Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 2);
/* Write E-fuse Register address bit8~9 */
temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
- rtw_write8(Adapter, EFUSE_CTRL+2, temp);
+ rtw_write8(Adapter, EFUSE_CTRL + 2, temp);
/* Write 0x30[31]= 0 */
- Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
+ Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3);
temp = Bytetemp & 0x7F;
- rtw_write8(Adapter, EFUSE_CTRL+3, temp);
+ rtw_write8(Adapter, EFUSE_CTRL + 3, temp);
/* Wait Write-ready (0x30[31]= 1) */
- Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
+ Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3);
while (!(Bytetemp & 0x80)) {
- Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
+ Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3);
k++;
if (k == 1000)
break;
@@ -253,16 +252,16 @@ bool bPseudoTest)
/* -----------------e-fuse reg ctrl --------------------------------- */
/* address */
- rtw_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xff));
- rtw_write8(padapter, EFUSE_CTRL+2, ((u8)((addr>>8) & 0x03)) |
- (rtw_read8(padapter, EFUSE_CTRL+2)&0xFC));
+ rtw_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+ rtw_write8(padapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) |
+ (rtw_read8(padapter, EFUSE_CTRL + 2) & 0xFC));
/* rtw_write8(padapter, EFUSE_CTRL+3, 0x72); read cmd */
/* Write bit 32 0 */
- readbyte = rtw_read8(padapter, EFUSE_CTRL+3);
- rtw_write8(padapter, EFUSE_CTRL+3, (readbyte & 0x7f));
+ readbyte = rtw_read8(padapter, EFUSE_CTRL + 3);
+ rtw_write8(padapter, EFUSE_CTRL + 3, (readbyte & 0x7f));
- while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 1000)) {
+ while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 1000)) {
mdelay(1);
tmpidx++;
}
@@ -282,31 +281,22 @@ u8 efuse_OneByteWrite(struct adapter *padapter, u16 addr, u8 data, bool bPseudoT
{
u8 tmpidx = 0;
u8 bResult = false;
- u32 efuseValue;
if (bPseudoTest)
return Efuse_Write1ByteToFakeContent(addr, data);
-
/* -----------------e-fuse reg ctrl --------------------------------- */
/* address */
-
- efuseValue = rtw_read32(padapter, EFUSE_CTRL);
- efuseValue |= (BIT21|BIT31);
- efuseValue &= ~(0x3FFFF);
- efuseValue |= ((addr<<8 | data) & 0x3FFFF);
-
-
/* <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. */
/* <20130121, Kordan> For SMIC EFUSE specificatoin. */
/* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) */
/* PHY_SetMacReg(padapter, 0x34, BIT11, 1); */
rtw_write16(padapter, 0x34, rtw_read16(padapter, 0x34) | (BIT11));
- rtw_write32(padapter, EFUSE_CTRL, 0x90600000|((addr<<8 | data)));
+ rtw_write32(padapter, EFUSE_CTRL, 0x90600000 | ((addr << 8 | data)));
- while ((0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) {
+ while ((0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) {
mdelay(1);
tmpidx++;
}
@@ -365,19 +355,19 @@ efuse_WordEnableDataRead(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];
}
@@ -463,7 +453,7 @@ static void efuse_ShadowRead2Byte(struct adapter *padapter, u16 Offset, u16 *Val
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
*Value = pEEPROM->efuse_eeprom_data[Offset];
- *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
+ *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8;
} /* EFUSE_ShadowRead2Byte */
@@ -473,9 +463,9 @@ static void efuse_ShadowRead4Byte(struct adapter *padapter, u16 Offset, u32 *Val
struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
*Value = pEEPROM->efuse_eeprom_data[Offset];
- *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
- *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16;
- *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24;
+ *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8;
+ *Value |= pEEPROM->efuse_eeprom_data[Offset + 2] << 16;
+ *Value |= pEEPROM->efuse_eeprom_data[Offset + 3] << 24;
} /* efuse_ShadowRead4Byte */
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index b89e88d6a82d..0ed420f3d096 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -6,9 +6,8 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <linux/of.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 };
u16 RTW_WPA_VERSION = 1;
@@ -55,7 +54,9 @@ static u8 WIFI_OFDMRATES[] = {
int rtw_get_bit_value_from_ieee_value(u8 val)
{
- unsigned char dot11_rate_table[] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0}; /* last element must be zero!! */
+ static const unsigned char dot11_rate_table[] = {
+ 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0
+ }; /* last element must be zero!! */
int i = 0;
while (dot11_rate_table[i] != 0) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index 4d3c30ec93b5..fcda9db6ebb5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -26,7 +26,6 @@ jackson@realtek.com.tw
*/
#include <drv_types.h>
-#include <rtw_debug.h>
u8 rtw_read8(struct adapter *adapter, u32 addr)
{
diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index 3b44f0dd5b0a..587a87fbffeb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
u8 rtw_validate_bssid(u8 *bssid)
{
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 8c487b7b7a40..cbdb134278d3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <linux/etherdevice.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_btcoex.h>
#include <linux/jiffies.h>
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 9ebf25a0ef9b..4d4bec47d187 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5,11 +5,10 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtw_wifi_regd.h>
#include <hal_btcoex.h>
#include <linux/kernel.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
static struct mlme_handler mlme_sta_tbl[] = {
{WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq},
@@ -628,7 +627,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)
ret = rtw_check_bcn_info(padapter, pframe, len);
if (!ret) {
netdev_dbg(padapter->pnetdev,
- "ap has changed, disconnect now\n ");
+ "ap has changed, disconnect now\n");
receive_disconnect(padapter,
pmlmeinfo->network.mac_address, 0);
return _SUCCESS;
@@ -3831,10 +3830,10 @@ void site_survey(struct adapter *padapter)
} else {
#ifdef DBG_FIXED_CHAN
if (pmlmeext->fixed_chan != 0xff)
- SelectChannel(padapter, pmlmeext->fixed_chan);
+ r8723bs_select_channel(padapter, pmlmeext->fixed_chan);
else
#endif
- SelectChannel(padapter, survey_channel);
+ r8723bs_select_channel(padapter, survey_channel);
}
if (ScanType == SCAN_ACTIVE) { /* obey the channel plan setting... */
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index e9763eab16f6..dbfcbac3d855 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
#include <linux/jiffies.h>
@@ -285,14 +284,12 @@ void rtw_set_rpwm(struct adapter *padapter, u8 pslv)
if (rpwm & PS_ACK) {
unsigned long start_time;
u8 cpwm_now;
- u8 poll_cnt = 0;
start_time = jiffies;
/* polling cpwm */
do {
mdelay(1);
- poll_cnt++;
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now);
if ((cpwm_orig ^ cpwm_now) & 0x80) {
pwrpriv->cpwm = PS_STATE_S4;
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 0eadc23a7d54..a389ba5ecc6f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -5,11 +5,10 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <linux/jiffies.h>
#include <rtw_recv.h>
#include <net/cfg80211.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
@@ -2027,12 +2026,9 @@ static int recv_func(struct adapter *padapter, union recv_frame *rframe)
/* check if need to handle uc_swdec_pending_queue*/
if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && psecuritypriv->busetkipkey) {
union recv_frame *pending_frame;
- int cnt = 0;
- while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue))) {
- cnt++;
+ while ((pending_frame = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue)))
recv_func_posthandle(padapter, pending_frame);
- }
}
ret = recv_func_prehandle(padapter, rframe);
diff --git a/drivers/staging/rtl8723bs/core/rtw_rf.c b/drivers/staging/rtl8723bs/core/rtw_rf.c
deleted file mode 100644
index 4f120c894998..000000000000
--- a/drivers/staging/rtl8723bs/core/rtw_rf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-
-#include <drv_types.h>
-#include <linux/kernel.h>
-
-static const u32 ch_freq_map[] = {
- 2412,
- 2417,
- 2422,
- 2427,
- 2432,
- 2437,
- 2442,
- 2447,
- 2452,
- 2457,
- 2462,
- 2467,
- 2472,
- 2484
-};
-
-u32 rtw_ch2freq(u32 channel)
-{
- if (channel == 0 || channel > ARRAY_SIZE(ch_freq_map))
- return 2412;
-
- return ch_freq_map[channel - 1];
-}
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 7ecdaa2eeaf3..1e9eff01b1aa 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <linux/crc32.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include <crypto/aes.h>
static const char * const _security_type_str[] = {
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index 0145c4da5ac0..1b72f2196a1c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
void _rtw_init_stainfo(struct sta_info *psta);
void _rtw_init_stainfo(struct sta_info *psta)
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 7fac9ca3e9a0..f37fec1efaf9 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_com_h2c.h>
static unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f};
@@ -333,7 +332,7 @@ inline unsigned long rtw_get_on_cur_ch_time(struct adapter *adapter)
return 0;
}
-void SelectChannel(struct adapter *padapter, unsigned char channel)
+void r8723bs_select_channel(struct adapter *padapter, unsigned char channel)
{
if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->setch_mutex)))
return;
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index b1965ec0181f..3e88f14e3bf7 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
@@ -45,7 +44,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
init_completion(&pxmitpriv->terminate_xmitthread_comp);
/*
- * Please insert all the queue initializaiton using _rtw_init_queue below
+ * Please insert all the queue initialization using _rtw_init_queue below
*/
pxmitpriv->adapter = padapter;
diff --git a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
index 22e33b97800d..81149ab81904 100644
--- a/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
+++ b/drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include "odm_precomp.h"
/* MACRO definition for pRFCalibrateInfo->TxIQC_8723B[0] */
diff --git a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c
index 5f9e94a7e6ad..86404b5e6c52 100644
--- a/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c
+++ b/drivers/staging/rtl8723bs/hal/HalPwrSeqCmd.c
@@ -21,7 +21,6 @@ Major Change History:
--*/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <HalPwrSeqCmd.h>
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index e26b789b9cdd..b72cf520d576 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <hal_data.h>
-#include <rtw_debug.h>
#include <hal_btcoex.h>
#include <Mp_Precomp.h>
diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 852232102433..719dd116d807 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -7,7 +7,6 @@
#include <linux/kernel.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include "hal_com_h2c.h"
#include "odm_precomp.h"
diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 3e814a15e893..d5649e7d8f99 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
#include <linux/kernel.h>
diff --git a/drivers/staging/rtl8723bs/hal/hal_intf.c b/drivers/staging/rtl8723bs/hal/hal_intf.c
index 7e3db8d3c910..0a3900548fd2 100644
--- a/drivers/staging/rtl8723bs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723bs/hal/hal_intf.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
void rtw_hal_chip_configure(struct adapter *padapter)
@@ -160,12 +159,6 @@ void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariab
padapter->HalFunc.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet);
}
-void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2)
-{
- if (padapter->HalFunc.GetHalODMVarHandler)
- padapter->HalFunc.GetHalODMVarHandler(padapter, eVariable, pValue1, pValue2);
-}
-
void rtw_hal_enable_interrupt(struct adapter *padapter)
{
if (padapter->HalFunc.enable_interrupt)
diff --git a/drivers/staging/rtl8723bs/hal/hal_sdio.c b/drivers/staging/rtl8723bs/hal/hal_sdio.c
index 9de62a0f5d35..665c85eccbdf 100644
--- a/drivers/staging/rtl8723bs/hal/hal_sdio.c
+++ b/drivers/staging/rtl8723bs/hal/hal_sdio.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
u8 rtw_hal_sdio_max_txoqt_free_space(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index d1ac2f44939c..56526056dd1d 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
index 2028791988e7..d1c875cf8e6d 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
@@ -8,7 +8,6 @@
/* This file is for 92CE/92CU dynamic mechanism only */
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
/* Global var */
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 7a5c3a98183b..37ebbbf408ec 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -8,7 +8,6 @@
#include <linux/firmware.h>
#include <linux/slab.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
index 7764896a04ea..4ff092b7c9c9 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
/**
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
index 74e75dc970f7..28c914ec2604 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
static void initrecvbuf(struct recv_buf *precvbuf, struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index 15810438a472..78298e63edce 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -6,7 +6,6 @@
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
static u8 rtw_sdio_wait_enough_TxOQT_space(struct adapter *padapter, u8 agg_num)
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index c9cd6578f7f8..d3aae413fc0f 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
@@ -380,8 +379,8 @@ static void _InitWMACSetting(struct adapter *padapter)
rtw_write32(padapter, REG_RCR, pHalData->ReceiveConfig);
/* Accept all multicast address */
- rtw_write32(padapter, REG_MAR, 0xFFFFFFFF);
- rtw_write32(padapter, REG_MAR + 4, 0xFFFFFFFF);
+ rtw_write32(padapter, REG_MAR, 0xFFFFFFFF); /* Offset 0x0620-0x0623 */
+ rtw_write32(padapter, REG_MAR + 4, 0xFFFFFFFF); /* Offset 0x0624-0x0627 */
/* Accept all data frames */
value16 = 0xFFFF;
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 107f427ee4aa..21e9f1858745 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -5,7 +5,6 @@
*
*******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtl8723b_hal.h>
/* */
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index 9e6ca1dec525..0b35c97843cc 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -452,14 +452,7 @@ struct adapter {
#define DF_RX_BIT BIT1
#define DF_IO_BIT BIT2
-/* define RTW_DISABLE_FUNC(padapter, func) (atomic_add(&adapter_to_dvobj(padapter)->disable_func, (func))) */
/* define RTW_ENABLE_FUNC(padapter, func) (atomic_sub(&adapter_to_dvobj(padapter)->disable_func, (func))) */
-static inline void RTW_DISABLE_FUNC(struct adapter *padapter, int func_bit)
-{
- int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func);
- df |= func_bit;
- atomic_set(&adapter_to_dvobj(padapter)->disable_func, df);
-}
static inline void RTW_ENABLE_FUNC(struct adapter *padapter, int func_bit)
{
diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h
index 5cffab2d06ff..efdd1f912b5d 100644
--- a/drivers/staging/rtl8723bs/include/hal_intf.h
+++ b/drivers/staging/rtl8723bs/include/hal_intf.h
@@ -301,7 +301,6 @@ u8 rtw_hal_set_def_var(struct adapter *padapter, enum hal_def_variable eVariable
u8 rtw_hal_get_def_var(struct adapter *padapter, enum hal_def_variable eVariable, void *pValue);
void rtw_hal_set_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, bool bSet);
-void rtw_hal_get_odm_var(struct adapter *padapter, enum hal_odm_variable eVariable, void *pValue1, void *pValue2);
void rtw_hal_enable_interrupt(struct adapter *padapter);
void rtw_hal_disable_interrupt(struct adapter *padapter);
diff --git a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h
index 5e43cc89f535..b93d74a5b9a5 100644
--- a/drivers/staging/rtl8723bs/include/hal_pwr_seq.h
+++ b/drivers/staging/rtl8723bs/include/hal_pwr_seq.h
@@ -101,7 +101,7 @@
{0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x20}, /*0x07 = 0x20 , SOP option to disable BG/MB*/ \
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK|PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3|BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \
{0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, BIT2}, /*0x04[10] = 1, enable SW LPS*/ \
- {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
+ {0x004A, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 1}, /*0x48[16] = 1 to enable GPIO9 as EXT WAKEUP*/ \
{0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4}, /*0x23[4] = 1b'1 12H LDO enter sleep mode*/ \
{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \
{0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/
diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h b/drivers/staging/rtl8723bs/include/osdep_service.h
index cf96b5f7a776..b21267d7ef72 100644
--- a/drivers/staging/rtl8723bs/include/osdep_service.h
+++ b/drivers/staging/rtl8723bs/include/osdep_service.h
@@ -81,9 +81,7 @@ static inline void thread_enter(char *name)
static inline void flush_signals_thread(void)
{
if (signal_pending(current))
- {
flush_signals(current);
- }
}
#define rtw_warn_on(condition) WARN_ON(condition)
@@ -102,7 +100,7 @@ static inline int rtw_bug_check(void *parg1, void *parg2, void *parg3, void *par
#define MAC_ARG(x) (x)
#endif
-extern void rtw_free_netdev(struct net_device * netdev);
+extern void rtw_free_netdev(struct net_device *netdev);
/* Macros for handling unaligned memory accesses */
diff --git a/drivers/staging/rtl8723bs/include/osdep_service_linux.h b/drivers/staging/rtl8723bs/include/osdep_service_linux.h
index 188ed7e26550..2ec54f9e180c 100644
--- a/drivers/staging/rtl8723bs/include/osdep_service_linux.h
+++ b/drivers/staging/rtl8723bs/include/osdep_service_linux.h
@@ -7,43 +7,41 @@
#ifndef __OSDEP_LINUX_SERVICE_H_
#define __OSDEP_LINUX_SERVICE_H_
- #include <linux/spinlock.h>
- #include <linux/compiler.h>
- #include <linux/kernel.h>
- #include <linux/errno.h>
- #include <linux/init.h>
- #include <linux/slab.h>
- #include <linux/module.h>
- #include <linux/kref.h>
- /* include <linux/smp_lock.h> */
- #include <linux/netdevice.h>
- #include <linux/skbuff.h>
- #include <linux/uaccess.h>
- #include <asm/byteorder.h>
- #include <linux/atomic.h>
- #include <linux/io.h>
- #include <linux/sem.h>
- #include <linux/sched.h>
- #include <linux/etherdevice.h>
- #include <linux/wireless.h>
- #include <net/iw_handler.h>
- #include <linux/if_arp.h>
- #include <linux/rtnetlink.h>
- #include <linux/delay.h>
- #include <linux/interrupt.h> /* for struct tasklet_struct */
- #include <linux/ip.h>
- #include <linux/kthread.h>
- #include <linux/list.h>
- #include <linux/vmalloc.h>
-
-/* #include <linux/ieee80211.h> */
- #include <net/ieee80211_radiotap.h>
- #include <net/cfg80211.h>
-
- struct __queue {
- struct list_head queue;
- spinlock_t lock;
- };
+#include <linux/spinlock.h>
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/kref.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/uaccess.h>
+#include <asm/byteorder.h>
+#include <linux/atomic.h>
+#include <linux/io.h>
+#include <linux/sem.h>
+#include <linux/sched.h>
+#include <linux/etherdevice.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
+#include <linux/if_arp.h>
+#include <linux/rtnetlink.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h> /* for struct tasklet_struct */
+#include <linux/ip.h>
+#include <linux/kthread.h>
+#include <linux/list.h>
+#include <linux/vmalloc.h>
+
+#include <net/ieee80211_radiotap.h>
+#include <net/cfg80211.h>
+
+struct __queue {
+ struct list_head queue;
+ spinlock_t lock;
+};
static inline struct list_head *get_next(struct list_head *list)
{
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index f9ecd9047d52..e6d6e9de5474 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -38,7 +38,7 @@ struct rt_firmware {
/* This structure must be carefully byte-ordered. */
struct rt_firmware_hdr {
- /* 8-byte alinment required */
+ /* 8-byte alignment required */
/* LONG WORD 0 ---- */
__le16 signature; /* 92C0: test chip; 92C, 88C0: test chip;
diff --git a/drivers/staging/rtl8723bs/include/rtw_cmd.h b/drivers/staging/rtl8723bs/include/rtw_cmd.h
index fe1b03101203..cb44119ce9a9 100644
--- a/drivers/staging/rtl8723bs/include/rtw_cmd.h
+++ b/drivers/staging/rtl8723bs/include/rtw_cmd.h
@@ -516,10 +516,6 @@ struct drvextra_cmd_parm {
/*------------------- Below are used for RF/BB tuning ---------------------*/
-struct getcountjudge_rsp {
- u8 count_judge[MAX_RATES_LENGTH];
-};
-
struct addBaReq_parm {
unsigned int tid;
u8 addr[ETH_ALEN];
diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h
deleted file mode 100644
index 7f96ff66915f..000000000000
--- a/drivers/staging/rtl8723bs/include/rtw_debug.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- ******************************************************************************/
-#ifndef __RTW_DEBUG_H__
-#define __RTW_DEBUG_H__
-
-void mac_reg_dump(struct adapter *adapter);
-void bb_reg_dump(struct adapter *adapter);
-void rf_reg_dump(struct adapter *adapter);
-
-#endif /* __RTW_DEBUG_H__ */
diff --git a/drivers/staging/rtl8723bs/include/rtw_event.h b/drivers/staging/rtl8723bs/include/rtw_event.h
index d48bae5416fe..62e0dec249ad 100644
--- a/drivers/staging/rtl8723bs/include/rtw_event.h
+++ b/drivers/staging/rtl8723bs/include/rtw_event.h
@@ -28,7 +28,7 @@ struct surveydone_event {
};
/*
-Used to report the link result of joinning the given bss
+Used to report the link result of joining the given bss
join_res:
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index be9741a056e5..0ee87be6dc4f 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -13,7 +13,7 @@
Otherwise, io_handler will free io_req
*/
-/* below is for the intf_option bit defition... */
+/* below is for the intf_option bit definition... */
struct intf_priv;
struct intf_hdl;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index e103c4a15d1a..e665479babc2 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -131,7 +131,7 @@ struct mlme_priv {
u8 roam_rssi_diff_th; /* rssi difference threshold for active scan candidate selection */
u32 roam_scan_int_ms; /* scan interval for active roam */
u32 roam_scanr_exp_ms; /* scan result expire time in ms for roam */
- u8 roam_tgt_addr[ETH_ALEN]; /* request to roam to speicific target without other consideration */
+ u8 roam_tgt_addr[ETH_ALEN]; /* request to roam to specific target without other consideration */
u8 *nic_hdl;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
index 5b8574f5a251..8315399b64fd 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
@@ -384,8 +384,8 @@ struct mlme_ext_priv {
unsigned char default_supported_mcs_set[16];
struct ss_res sitesurvey_res;
- struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including current scanning/connecting/connected related info. */
- /* for ap mode, network includes ap's cap_info */
+ struct mlme_ext_info mlmext_info; /* for sta/adhoc mode, including current scanning/connecting/connected related info. */
+ /* for ap mode, network includes ap's cap_info */
struct timer_list survey_timer;
struct timer_list link_timer;
struct timer_list sa_query_timer;
@@ -455,7 +455,7 @@ u8 rtw_get_center_ch(u8 channel, u8 chnl_bw, u8 chnl_offset);
unsigned long rtw_get_on_cur_ch_time(struct adapter *adapter);
void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigned char channel_offset, unsigned short bwmode);
-void SelectChannel(struct adapter *padapter, unsigned char channel);
+void r8723bs_select_channel(struct adapter *padapter, unsigned char channel);
unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval);
diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h
index c93594f75436..18dd1464e0c2 100644
--- a/drivers/staging/rtl8723bs/include/rtw_recv.h
+++ b/drivers/staging/rtl8723bs/include/rtw_recv.h
@@ -444,16 +444,6 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, signed int s
}
-static inline union recv_frame *rxmem_to_recvframe(u8 *rxmem)
-{
- /* due to the design of 2048 bytes alignment of recv_frame, we can reference the union recv_frame */
- /* from any given member of recv_frame. */
- /* rxmem indicates the any member/address in recv_frame */
-
- return (union recv_frame *)(((SIZE_PTR)rxmem >> RXFRAME_ALIGN) << RXFRAME_ALIGN);
-
-}
-
static inline signed int get_recvframe_len(union recv_frame *precvframe)
{
return precvframe->u.hdr.len;
diff --git a/drivers/staging/rtl8723bs/include/rtw_rf.h b/drivers/staging/rtl8723bs/include/rtw_rf.h
index 718275ee4500..9f98b3f5a2e3 100644
--- a/drivers/staging/rtl8723bs/include/rtw_rf.h
+++ b/drivers/staging/rtl8723bs/include/rtw_rf.h
@@ -97,6 +97,4 @@ enum {
HT_DATA_SC_20_LOWER_OF_40MHZ = 2,
};
-u32 rtw_ch2freq(u32 ch);
-
#endif /* _RTL8711_RF_H_ */
diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h
index 98afbd3054a4..32f6d3a5e309 100644
--- a/drivers/staging/rtl8723bs/include/rtw_security.h
+++ b/drivers/staging/rtl8723bs/include/rtw_security.h
@@ -50,43 +50,43 @@ union pn48 {
#ifdef __LITTLE_ENDIAN
struct {
- u8 TSC0;
- u8 TSC1;
- u8 TSC2;
- u8 TSC3;
- u8 TSC4;
- u8 TSC5;
- u8 TSC6;
- u8 TSC7;
+ u8 TSC0;
+ u8 TSC1;
+ u8 TSC2;
+ u8 TSC3;
+ u8 TSC4;
+ u8 TSC5;
+ u8 TSC6;
+ u8 TSC7;
} _byte_;
#else
struct {
- u8 TSC7;
- u8 TSC6;
- u8 TSC5;
- u8 TSC4;
- u8 TSC3;
- u8 TSC2;
- u8 TSC1;
- u8 TSC0;
+ u8 TSC7;
+ u8 TSC6;
+ u8 TSC5;
+ u8 TSC4;
+ u8 TSC3;
+ u8 TSC2;
+ u8 TSC1;
+ u8 TSC0;
} _byte_;
#endif
};
union Keytype {
- u8 skey[16];
- u32 lkey[4];
+ u8 skey[16];
+ u32 lkey[4];
};
struct rt_pmkid_list {
- u8 bUsed;
- u8 Bssid[6];
- u8 PMKID[16];
- u8 SsidBuf[33];
+ u8 bUsed;
+ u8 Bssid[6];
+ u8 PMKID[16];
+ u8 SsidBuf[33];
u8 *ssid_octet;
- u16 ssid_length;
+ u16 ssid_length;
};
@@ -162,7 +162,7 @@ struct security_priv {
/* For WPA2 Pre-Authentication. */
struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; /* Renamed from PreAuthKey[NUM_PRE_AUTH_KEY]. Annie, 2006-10-13. */
- u8 PMKIDIndex;
+ u8 PMKIDIndex;
u8 bWepDefaultKeyIdxSet;
@@ -170,50 +170,48 @@ struct security_priv {
#define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
do {\
- switch (psecuritypriv->dot11AuthAlgrthm)\
- {\
- case dot11AuthAlgrthm_Open:\
- case dot11AuthAlgrthm_Shared:\
- case dot11AuthAlgrthm_Auto:\
- encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
- break;\
- case dot11AuthAlgrthm_8021X:\
- if (bmcst)\
- encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\
- else\
- encry_algo = (u8)psta->dot118021XPrivacy;\
- break;\
- case dot11AuthAlgrthm_WAPI:\
- encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
- break;\
+ switch (psecuritypriv->dot11AuthAlgrthm) {\
+ case dot11AuthAlgrthm_Open:\
+ case dot11AuthAlgrthm_Shared:\
+ case dot11AuthAlgrthm_Auto:\
+ encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
+ break;\
+ case dot11AuthAlgrthm_8021X:\
+ if (bmcst)\
+ encry_algo = (u8)psecuritypriv->dot118021XGrpPrivacy;\
+ else\
+ encry_algo = (u8)psta->dot118021XPrivacy;\
+ break;\
+ case dot11AuthAlgrthm_WAPI:\
+ encry_algo = (u8)psecuritypriv->dot11PrivacyAlgrthm;\
+ break;\
} \
} while (0)
#define SET_ICE_IV_LEN(iv_len, icv_len, encrypt)\
do {\
- switch (encrypt)\
- {\
- case _WEP40_:\
- case _WEP104_:\
- iv_len = 4;\
- icv_len = 4;\
- break;\
- case _TKIP_:\
- iv_len = 8;\
- icv_len = 4;\
- break;\
- case _AES_:\
- iv_len = 8;\
- icv_len = 8;\
- break;\
- case _SMS4_:\
- iv_len = 18;\
- icv_len = 16;\
- break;\
- default:\
- iv_len = 0;\
- icv_len = 0;\
- break;\
+ switch (encrypt) {\
+ case _WEP40_:\
+ case _WEP104_:\
+ iv_len = 4;\
+ icv_len = 4;\
+ break;\
+ case _TKIP_:\
+ iv_len = 8;\
+ icv_len = 4;\
+ break;\
+ case _AES_:\
+ iv_len = 8;\
+ icv_len = 8;\
+ break;\
+ case _SMS4_:\
+ iv_len = 18;\
+ icv_len = 16;\
+ break;\
+ default:\
+ iv_len = 0;\
+ icv_len = 0;\
+ break;\
} \
} while (0)
@@ -242,7 +240,8 @@ struct mic_data {
/* ===== start - public domain SHA256 implementation ===== */
/* This is based on SHA256 implementation in LibTomCrypt that was released into
- * public domain by Tom St Denis. */
+ * public domain by Tom St Denis.
+ */
int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac);
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key);
diff --git a/drivers/staging/rtl8723bs/include/rtw_xmit.h b/drivers/staging/rtl8723bs/include/rtw_xmit.h
index a3b4310caddf..544468f57692 100644
--- a/drivers/staging/rtl8723bs/include/rtw_xmit.h
+++ b/drivers/staging/rtl8723bs/include/rtw_xmit.h
@@ -15,7 +15,7 @@
#define XMITBUF_ALIGN_SZ 512
-/* xmit extension buff defination */
+/* xmit extension buff definition */
#define MAX_XMIT_EXTBUF_SZ (1536)
#define NR_XMIT_EXTBUFF (32)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index eb3c73cc2662..b63a74e669bc 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -7,7 +7,6 @@
#include <linux/etherdevice.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include <linux/jiffies.h>
#include <rtw_wifi_regd.h>
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index c81b30f1f1b0..a9e481e182ad 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -7,7 +7,6 @@
#include <linux/etherdevice.h>
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtw_mp.h>
#include <hal_btcoex.h>
#include <linux/jiffies.h>
diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
index 1341801e5c21..1904e82a24b5 100644
--- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
static void _dynamic_check_timer_handler(struct timer_list *t)
{
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 55d0140cd543..fc9b9c5efb50 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_data.h>
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index f09c1324c39c..a00f9f0c85c5 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
/*
* Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE
diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
index 4d28b300b235..ca808ded61ac 100644
--- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c
@@ -5,10 +5,9 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <linux/jiffies.h>
#include <net/cfg80211.h>
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
void rtw_os_free_recvframe(union recv_frame *precvframe)
{
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 490431484524..d18fde4e5d6c 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <hal_btcoex.h>
#include <linux/jiffies.h>
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index 0a0b04088e66..4a7c0c9cc7ef 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -6,7 +6,6 @@
*******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
static bool rtw_sdio_claim_host_needed(struct sdio_func *func)
{
diff --git a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
index 5eef1d68c6f0..dbd4bf531339 100644
--- a/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
+++ b/drivers/staging/rtl8723bs/os_dep/wifi_regd.c
@@ -6,7 +6,6 @@
*****************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
#include <rtw_wifi_regd.h>
diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index 1eeabfffd6d2..944b9c724b32 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -5,7 +5,6 @@
*
******************************************************************************/
#include <drv_types.h>
-#include <rtw_debug.h>
uint rtw_remainder_len(struct pkt_file *pfile)
@@ -144,9 +143,8 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
psta = list_entry(plist, struct sta_info, asoc_list);
stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
- if (stainfo_offset_valid(stainfo_offset)) {
+ if (stainfo_offset_valid(stainfo_offset))
chk_alive_list[chk_alive_num++] = stainfo_offset;
- }
}
spin_unlock_bh(&pstapriv->asoc_list_lock);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index c4d97dbf6ba8..3dbeffc650d3 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -857,10 +857,10 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const
switch (mode) {
case VCHIQ_BULK_MODE_NOCALLBACK:
case VCHIQ_BULK_MODE_CALLBACK:
- ret = vchiq_bulk_transfer(instance, handle,
- (void *)data, NULL,
- size, userdata, mode,
- VCHIQ_BULK_TRANSMIT);
+ ret = vchiq_bulk_xfer_callback_interruptible(instance, handle,
+ (void *)data, NULL,
+ size, mode, userdata,
+ VCHIQ_BULK_TRANSMIT);
break;
case VCHIQ_BULK_MODE_BLOCKING:
ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
@@ -895,9 +895,10 @@ int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle,
switch (mode) {
case VCHIQ_BULK_MODE_NOCALLBACK:
case VCHIQ_BULK_MODE_CALLBACK:
- ret = vchiq_bulk_transfer(instance, handle, data, NULL,
- size, userdata,
- mode, VCHIQ_BULK_RECEIVE);
+ ret = vchiq_bulk_xfer_callback_interruptible(instance, handle,
+ (void *)data, NULL,
+ size, mode, userdata,
+ VCHIQ_BULK_RECEIVE);
break;
case VCHIQ_BULK_MODE_BLOCKING:
ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
@@ -968,9 +969,8 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
return -ENOMEM;
}
- ret = vchiq_bulk_transfer(instance, handle, data, NULL, size,
- &waiter->bulk_waiter,
- VCHIQ_BULK_MODE_BLOCKING, dir);
+ ret = vchiq_bulk_xfer_blocking_interruptible(instance, handle, data, NULL, size,
+ &waiter->bulk_waiter, dir);
if ((ret != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 50af04b217f4..1f94db6e0cd9 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1139,7 +1139,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
int msgid,
ssize_t (*copy_callback)(void *context, void *dest,
size_t offset, size_t maxsize),
- void *context, int size, int is_blocking)
+ void *context, int size)
{
struct vchiq_shared_state *local;
struct vchiq_header *header;
@@ -1517,7 +1517,7 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
/* Acknowledge the OPEN */
if (service->sync) {
if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback,
- &ack_payload, sizeof(ack_payload), 0) == -EAGAIN)
+ &ack_payload, sizeof(ack_payload)) == -EAGAIN)
goto bail_not_ready;
/* The service is now open */
@@ -2655,6 +2655,132 @@ close_service_complete(struct vchiq_service *service, int failstate)
return status;
}
+/*
+ * Prepares a bulk transfer to be queued. The function is interruptible and is
+ * intended to be called from user threads. It may return -EAGAIN to indicate
+ * that a signal has been received and the call should be retried after being
+ * returned to user context.
+ */
+static int
+vchiq_bulk_xfer_queue_msg_interruptible(struct vchiq_service *service,
+ void *offset, void __user *uoffset,
+ int size, void *userdata,
+ enum vchiq_bulk_mode mode,
+ enum vchiq_bulk_dir dir)
+{
+ struct vchiq_bulk_queue *queue;
+ struct bulk_waiter *bulk_waiter = NULL;
+ struct vchiq_bulk *bulk;
+ struct vchiq_state *state = service->state;
+ const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r';
+ const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ?
+ VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX;
+ int status = -EINVAL;
+ int payload[2];
+
+ if (mode == VCHIQ_BULK_MODE_BLOCKING) {
+ bulk_waiter = userdata;
+ init_completion(&bulk_waiter->event);
+ bulk_waiter->actual = 0;
+ bulk_waiter->bulk = NULL;
+ }
+
+ queue = (dir == VCHIQ_BULK_TRANSMIT) ?
+ &service->bulk_tx : &service->bulk_rx;
+
+ if (mutex_lock_killable(&service->bulk_mutex))
+ return -EAGAIN;
+
+ if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) {
+ VCHIQ_SERVICE_STATS_INC(service, bulk_stalls);
+ do {
+ mutex_unlock(&service->bulk_mutex);
+ if (wait_for_completion_interruptible(&service->bulk_remove_event))
+ return -EAGAIN;
+ if (mutex_lock_killable(&service->bulk_mutex))
+ return -EAGAIN;
+ } while (queue->local_insert == queue->remove +
+ VCHIQ_NUM_SERVICE_BULKS);
+ }
+
+ bulk = &queue->bulks[BULK_INDEX(queue->local_insert)];
+
+ bulk->mode = mode;
+ bulk->dir = dir;
+ bulk->userdata = userdata;
+ bulk->size = size;
+ bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED;
+
+ if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, size, dir))
+ goto unlock_error_exit;
+
+ /*
+ * Ensure that the bulk data record is visible to the peer
+ * before proceeding.
+ */
+ wmb();
+
+ dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n",
+ state->id, service->localport, service->remoteport,
+ dir_char, size, &bulk->data, userdata);
+
+ /*
+ * The slot mutex must be held when the service is being closed, so
+ * claim it here to ensure that isn't happening
+ */
+ if (mutex_lock_killable(&state->slot_mutex)) {
+ status = -EAGAIN;
+ goto cancel_bulk_error_exit;
+ }
+
+ if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
+ goto unlock_both_error_exit;
+
+ payload[0] = lower_32_bits(bulk->data);
+ payload[1] = bulk->size;
+ status = queue_message(state,
+ NULL,
+ VCHIQ_MAKE_MSG(dir_msgtype,
+ service->localport,
+ service->remoteport),
+ memcpy_copy_callback,
+ &payload,
+ sizeof(payload),
+ QMFLAGS_IS_BLOCKING |
+ QMFLAGS_NO_MUTEX_LOCK |
+ QMFLAGS_NO_MUTEX_UNLOCK);
+ if (status)
+ goto unlock_both_error_exit;
+
+ queue->local_insert++;
+
+ mutex_unlock(&state->slot_mutex);
+ mutex_unlock(&service->bulk_mutex);
+
+ dev_dbg(state->dev, "core: %d: bt:%d %cx li=%x ri=%x p=%x\n",
+ state->id, service->localport, dir_char, queue->local_insert,
+ queue->remote_insert, queue->process);
+
+ if (bulk_waiter) {
+ bulk_waiter->bulk = bulk;
+ if (wait_for_completion_interruptible(&bulk_waiter->event))
+ status = -EAGAIN;
+ else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
+ status = -EINVAL;
+ }
+
+ return status;
+
+unlock_both_error_exit:
+ mutex_unlock(&state->slot_mutex);
+cancel_bulk_error_exit:
+ vchiq_complete_bulk(service->instance, bulk);
+unlock_error_exit:
+ mutex_unlock(&service->bulk_mutex);
+
+ return status;
+}
+
/* Called by the slot handler */
int
vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
@@ -2978,31 +3104,17 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
return status;
}
-/*
- * This function may be called by kernel threads or user threads.
- * User threads may receive -EAGAIN to indicate that a signal has been
- * received and the call should be retried after being returned to user
- * context.
- * When called in blocking mode, the userdata field points to a bulk_waiter
- * structure.
- */
-int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle,
- void *offset, void __user *uoffset, int size, void *userdata,
- enum vchiq_bulk_mode mode, enum vchiq_bulk_dir dir)
+int
+vchiq_bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned int handle,
+ void *offset, void __user *uoffset, int size,
+ void __user *userdata, enum vchiq_bulk_dir dir)
{
struct vchiq_service *service = find_service_by_handle(instance, handle);
- struct vchiq_bulk_queue *queue;
- struct vchiq_bulk *bulk;
- struct vchiq_state *state;
- struct bulk_waiter *bulk_waiter = NULL;
- const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r';
- const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ?
- VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX;
+ enum vchiq_bulk_mode mode = VCHIQ_BULK_MODE_BLOCKING;
int status = -EINVAL;
- int payload[2];
if (!service)
- goto error_exit;
+ return -EINVAL;
if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
goto error_exit;
@@ -3013,133 +3125,91 @@ int vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle,
if (vchiq_check_service(service))
goto error_exit;
- switch (mode) {
- case VCHIQ_BULK_MODE_NOCALLBACK:
- case VCHIQ_BULK_MODE_CALLBACK:
- break;
- case VCHIQ_BULK_MODE_BLOCKING:
- bulk_waiter = userdata;
- init_completion(&bulk_waiter->event);
- bulk_waiter->actual = 0;
- bulk_waiter->bulk = NULL;
- break;
- case VCHIQ_BULK_MODE_WAITING:
- bulk_waiter = userdata;
- bulk = bulk_waiter->bulk;
- goto waiting;
- default:
- goto error_exit;
- }
- state = service->state;
+ status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset, size,
+ userdata, mode, dir);
- queue = (dir == VCHIQ_BULK_TRANSMIT) ?
- &service->bulk_tx : &service->bulk_rx;
+error_exit:
+ vchiq_service_put(service);
- if (mutex_lock_killable(&service->bulk_mutex)) {
- status = -EAGAIN;
+ return status;
+}
+
+int
+vchiq_bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned int handle,
+ void *offset, void __user *uoffset, int size,
+ enum vchiq_bulk_mode mode, void *userdata,
+ enum vchiq_bulk_dir dir)
+{
+ struct vchiq_service *service = find_service_by_handle(instance, handle);
+ int status = -EINVAL;
+
+ if (!service)
+ return -EINVAL;
+
+ if (mode != VCHIQ_BULK_MODE_CALLBACK &&
+ mode != VCHIQ_BULK_MODE_NOCALLBACK)
goto error_exit;
- }
- if (queue->local_insert == queue->remove + VCHIQ_NUM_SERVICE_BULKS) {
- VCHIQ_SERVICE_STATS_INC(service, bulk_stalls);
- do {
- mutex_unlock(&service->bulk_mutex);
- if (wait_for_completion_interruptible(&service->bulk_remove_event)) {
- status = -EAGAIN;
- goto error_exit;
- }
- if (mutex_lock_killable(&service->bulk_mutex)) {
- status = -EAGAIN;
- goto error_exit;
- }
- } while (queue->local_insert == queue->remove +
- VCHIQ_NUM_SERVICE_BULKS);
- }
+ if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
+ goto error_exit;
- bulk = &queue->bulks[BULK_INDEX(queue->local_insert)];
+ if (!offset && !uoffset)
+ goto error_exit;
- bulk->mode = mode;
- bulk->dir = dir;
- bulk->userdata = userdata;
- bulk->size = size;
- bulk->actual = VCHIQ_BULK_ACTUAL_ABORTED;
+ if (vchiq_check_service(service))
+ goto error_exit;
- if (vchiq_prepare_bulk_data(instance, bulk, offset, uoffset, size, dir))
- goto unlock_error_exit;
+ status = vchiq_bulk_xfer_queue_msg_interruptible(service, offset, uoffset,
+ size, userdata, mode, dir);
- /*
- * Ensure that the bulk data record is visible to the peer
- * before proceeding.
- */
- wmb();
+error_exit:
+ vchiq_service_put(service);
- dev_dbg(state->dev, "core: %d: bt (%d->%d) %cx %x@%pad %pK\n",
- state->id, service->localport, service->remoteport,
- dir_char, size, &bulk->data, userdata);
+ return status;
+}
- /*
- * The slot mutex must be held when the service is being closed, so
- * claim it here to ensure that isn't happening
- */
- if (mutex_lock_killable(&state->slot_mutex)) {
- status = -EAGAIN;
- goto cancel_bulk_error_exit;
- }
+/*
+ * This function is called by VCHIQ ioctl interface and is interruptible.
+ * It may receive -EAGAIN to indicate that a signal has been received
+ * and the call should be retried after being returned to user context.
+ */
+int
+vchiq_bulk_xfer_waiting_interruptible(struct vchiq_instance *instance,
+ unsigned int handle, struct bulk_waiter *userdata)
+{
+ struct vchiq_service *service = find_service_by_handle(instance, handle);
+ struct bulk_waiter *bulk_waiter;
+ int status = -EINVAL;
- if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
- goto unlock_both_error_exit;
+ if (!service)
+ return -EINVAL;
- payload[0] = lower_32_bits(bulk->data);
- payload[1] = bulk->size;
- status = queue_message(state,
- NULL,
- VCHIQ_MAKE_MSG(dir_msgtype,
- service->localport,
- service->remoteport),
- memcpy_copy_callback,
- &payload,
- sizeof(payload),
- QMFLAGS_IS_BLOCKING |
- QMFLAGS_NO_MUTEX_LOCK |
- QMFLAGS_NO_MUTEX_UNLOCK);
- if (status)
- goto unlock_both_error_exit;
+ if (!userdata)
+ goto error_exit;
- queue->local_insert++;
+ if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
+ goto error_exit;
- mutex_unlock(&state->slot_mutex);
- mutex_unlock(&service->bulk_mutex);
+ if (vchiq_check_service(service))
+ goto error_exit;
- dev_dbg(state->dev, "core: %d: bt:%d %cx li=%x ri=%x p=%x\n",
- state->id, service->localport, dir_char, queue->local_insert,
- queue->remote_insert, queue->process);
+ bulk_waiter = userdata;
-waiting:
vchiq_service_put(service);
status = 0;
- if (bulk_waiter) {
- bulk_waiter->bulk = bulk;
- if (wait_for_completion_interruptible(&bulk_waiter->event))
- status = -EAGAIN;
- else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
- status = -EINVAL;
- }
+ if (wait_for_completion_interruptible(&bulk_waiter->event))
+ return -EAGAIN;
+ else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
+ return -EINVAL;
return status;
-unlock_both_error_exit:
- mutex_unlock(&state->slot_mutex);
-cancel_bulk_error_exit:
- vchiq_complete_bulk(service->instance, bulk);
-unlock_error_exit:
- mutex_unlock(&service->bulk_mutex);
-
error_exit:
- if (service)
- vchiq_service_put(service);
+ vchiq_service_put(service);
+
return status;
}
@@ -3175,11 +3245,12 @@ vchiq_queue_message(struct vchiq_instance *instance, unsigned int handle,
switch (service->srvstate) {
case VCHIQ_SRVSTATE_OPEN:
status = queue_message(service->state, service, data_id,
- copy_callback, context, size, 1);
+ copy_callback, context, size,
+ QMFLAGS_IS_BLOCKING);
break;
case VCHIQ_SRVSTATE_OPENSYNC:
status = queue_message_sync(service->state, service, data_id,
- copy_callback, context, size, 1);
+ copy_callback, context, size);
break;
default:
status = -EINVAL;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 77cc4d7ac077..468463f31801 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -471,9 +471,19 @@ extern void
remote_event_pollall(struct vchiq_state *state);
extern int
-vchiq_bulk_transfer(struct vchiq_instance *instance, unsigned int handle, void *offset,
- void __user *uoffset, int size, void *userdata, enum vchiq_bulk_mode mode,
- enum vchiq_bulk_dir dir);
+vchiq_bulk_xfer_waiting_interruptible(struct vchiq_instance *instance,
+ unsigned int handle, struct bulk_waiter *userdata);
+
+extern int
+vchiq_bulk_xfer_blocking_interruptible(struct vchiq_instance *instance, unsigned int handle,
+ void *offset, void __user *uoffset, int size,
+ void __user *userdata, enum vchiq_bulk_dir dir);
+
+extern int
+vchiq_bulk_xfer_callback_interruptible(struct vchiq_instance *instance, unsigned int handle,
+ void *offset, void __user *uoffset, int size,
+ enum vchiq_bulk_mode mode, void *userdata,
+ enum vchiq_bulk_dir dir);
extern void
vchiq_dump_state(struct seq_file *f, struct vchiq_state *state);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
index 9cd2a64dce5e..d41a4624cc92 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
@@ -304,6 +304,11 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
}
userdata = &waiter->bulk_waiter;
+
+ status = vchiq_bulk_xfer_blocking_interruptible(instance, args->handle,
+ NULL, args->data, args->size,
+ userdata, dir);
+
} else if (args->mode == VCHIQ_BULK_MODE_WAITING) {
mutex_lock(&instance->bulk_waiter_list_mutex);
list_for_each_entry(iter, &instance->bulk_waiter_list,
@@ -324,12 +329,16 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
dev_dbg(service->state->dev, "arm: found bulk_waiter %pK for pid %d\n",
waiter, current->pid);
userdata = &waiter->bulk_waiter;
+
+ status = vchiq_bulk_xfer_waiting_interruptible(instance, args->handle, userdata);
} else {
userdata = args->userdata;
- }
- status = vchiq_bulk_transfer(instance, args->handle, NULL, args->data, args->size,
- userdata, args->mode, dir);
+ status = vchiq_bulk_xfer_callback_interruptible(instance, args->handle, NULL,
+ args->data, args->size,
+ args->mode, userdata, dir);
+
+ }
if (!waiter) {
ret = 0;
diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c
index 9a091463656d..42304c9f83a2 100644
--- a/drivers/staging/vme_user/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -416,10 +416,6 @@ void vme_slave_free(struct vme_resource *resource)
slave_image = list_entry(resource->entry, struct vme_slave_resource,
list);
- if (!slave_image) {
- dev_err(bridge->parent, "Can't find slave resource\n");
- return;
- }
/* Unlock image */
mutex_lock(&slave_image->mtx);
@@ -794,10 +790,6 @@ void vme_master_free(struct vme_resource *resource)
master_image = list_entry(resource->entry, struct vme_master_resource,
list);
- if (!master_image) {
- dev_err(bridge->parent, "Can't find master resource\n");
- return;
- }
/* Unlock image */
spin_lock(&master_image->lock);
@@ -1265,7 +1257,7 @@ EXPORT_SYMBOL(vme_unregister_error_handler);
void vme_irq_handler(struct vme_bridge *bridge, int level, int statid)
{
- void (*call)(int, int, void *);
+ void (*call)(int level, int statid, void *priv_data);
void *priv_data;
call = bridge->irq[level - 1].callback[statid].func;
diff --git a/drivers/staging/vme_user/vme.h b/drivers/staging/vme_user/vme.h
index 26aa40f78a74..7753e736f9fd 100644
--- a/drivers/staging/vme_user/vme.h
+++ b/drivers/staging/vme_user/vme.h
@@ -129,8 +129,7 @@ struct vme_driver {
};
void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
-void vme_free_consistent(struct vme_resource *, size_t, void *,
- dma_addr_t);
+void vme_free_consistent(struct vme_resource *, size_t, void *, dma_addr_t);
size_t vme_get_size(struct vme_resource *);
int vme_check_window(struct vme_bridge *bridge, u32 aspace,
@@ -138,20 +137,20 @@ int vme_check_window(struct vme_bridge *bridge, u32 aspace,
struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
- unsigned long long, dma_addr_t, u32, u32);
+ unsigned long long, dma_addr_t, u32, u32);
int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
- unsigned long long *, dma_addr_t *, u32 *, u32 *);
+ unsigned long long *, dma_addr_t *, u32 *, u32 *);
void vme_slave_free(struct vme_resource *);
struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32);
int vme_master_set(struct vme_resource *, int, unsigned long long,
- unsigned long long, u32, u32, u32);
+ unsigned long long, u32, u32, u32);
int vme_master_get(struct vme_resource *, int *, unsigned long long *,
- unsigned long long *, u32 *, u32 *, u32 *);
+ unsigned long long *, u32 *, u32 *, u32 *);
ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
- unsigned int, loff_t);
+ unsigned int, loff_t);
int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma);
void vme_master_free(struct vme_resource *);
@@ -162,13 +161,13 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32);
void vme_dma_free_attribute(struct vme_dma_attr *);
int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *,
- struct vme_dma_attr *, size_t);
+ struct vme_dma_attr *, size_t);
int vme_dma_list_exec(struct vme_dma_list *);
int vme_dma_list_free(struct vme_dma_list *);
int vme_dma_free(struct vme_resource *);
int vme_irq_request(struct vme_dev *, int, int,
- void (*callback)(int, int, void *), void *);
+ void (*callback)(int, int, void *), void *);
void vme_irq_free(struct vme_dev *, int, int);
int vme_irq_generate(struct vme_dev *, int, int);
diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
index 7f84d1c86f29..4a59c9069605 100644
--- a/drivers/staging/vme_user/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -79,7 +79,7 @@ struct fake_driver {
};
/* Module parameter */
-static int geoid;
+static u32 geoid;
static const char driver_name[] = "vme_fake";
@@ -1059,6 +1059,12 @@ static int __init fake_init(void)
struct vme_slave_resource *slave_image;
struct vme_lm_resource *lm;
+ if (geoid >= VME_MAX_SLOTS) {
+ pr_err("VME geographical address must be between 0 and %d (exclusive), but got %d\n",
+ VME_MAX_SLOTS, geoid);
+ return -EINVAL;
+ }
+
/* We need a fake parent device */
vme_root = root_device_register("vme");
if (IS_ERR(vme_root))
@@ -1283,7 +1289,7 @@ static void __exit fake_exit(void)
}
MODULE_PARM_DESC(geoid, "Set geographical addressing");
-module_param(geoid, int, 0);
+module_param(geoid, uint, 0);
MODULE_DESCRIPTION("Fake VME bridge driver");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
index 2ec9c2904404..31a44025e08f 100644
--- a/drivers/staging/vme_user/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -36,7 +36,7 @@ static void tsi148_remove(struct pci_dev *);
/* Module parameter */
static bool err_chk;
-static int geoid;
+static u32 geoid;
static const char driver_name[] = "vme_tsi148";
@@ -55,14 +55,14 @@ static struct pci_driver tsi148_driver = {
};
static void reg_join(unsigned int high, unsigned int low,
- unsigned long long *variable)
+ unsigned long long *variable)
{
*variable = (unsigned long long)high << 32;
*variable |= (unsigned long long)low;
}
static void reg_split(unsigned long long variable, unsigned int *high,
- unsigned int *low)
+ unsigned int *low)
{
*low = (unsigned int)variable & 0xFFFFFFFF;
*high = (unsigned int)(variable >> 32);
@@ -72,7 +72,7 @@ static void reg_split(unsigned long long variable, unsigned int *high,
* Wakes up DMA queue.
*/
static u32 tsi148_DMA_irqhandler(struct tsi148_driver *bridge,
- int channel_mask)
+ int channel_mask)
{
u32 serviced = 0;
@@ -207,7 +207,7 @@ static u32 tsi148_IACK_irqhandler(struct tsi148_driver *bridge)
* Calling VME bus interrupt callback if provided.
*/
static u32 tsi148_VIRQ_irqhandler(struct vme_bridge *tsi148_bridge,
- u32 stat)
+ u32 stat)
{
int vec, i, serviced = 0;
struct tsi148_driver *bridge;
@@ -358,7 +358,7 @@ static int tsi148_irq_init(struct vme_bridge *tsi148_bridge)
}
static void tsi148_irq_exit(struct vme_bridge *tsi148_bridge,
- struct pci_dev *pdev)
+ struct pci_dev *pdev)
{
struct tsi148_driver *bridge = tsi148_bridge->driver_priv;
@@ -392,7 +392,7 @@ static int tsi148_iack_received(struct tsi148_driver *bridge)
* Configure VME interrupt
*/
static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
- int state, int sync)
+ int state, int sync)
{
struct pci_dev *pdev;
u32 tmp;
@@ -430,7 +430,7 @@ static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
* interrupt to be acked.
*/
static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level,
- int statid)
+ int statid)
{
u32 tmp;
struct tsi148_driver *bridge;
@@ -453,7 +453,7 @@ static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level,
/* XXX Consider implementing a timeout? */
wait_event_interruptible(bridge->iack_queue,
- tsi148_iack_received(bridge));
+ tsi148_iack_received(bridge));
mutex_unlock(&bridge->vme_int);
@@ -464,8 +464,8 @@ static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level,
* Initialize a slave window with the requested attributes.
*/
static int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
- unsigned long long vme_base, unsigned long long size,
- dma_addr_t pci_base, u32 aspace, u32 cycle)
+ unsigned long long vme_base, unsigned long long size,
+ dma_addr_t pci_base, u32 aspace, u32 cycle)
{
unsigned int i, addr = 0, granularity = 0;
unsigned int temp_ctl = 0;
@@ -607,8 +607,8 @@ static int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
* Get slave window configuration.
*/
static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
- unsigned long long *vme_base, unsigned long long *size,
- dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
+ unsigned long long *vme_base, unsigned long long *size,
+ dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
{
unsigned int i, granularity = 0, ctl = 0;
unsigned int vme_base_low, vme_base_high;
@@ -706,7 +706,7 @@ static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
* Allocate and map PCI Resource
*/
static int tsi148_alloc_resource(struct vme_master_resource *image,
- unsigned long long size)
+ unsigned long long size)
{
unsigned long long existing_size;
int retval = 0;
@@ -751,9 +751,9 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
image->bus_resource.end = (unsigned long)size;
image->bus_resource.flags = IORESOURCE_MEM;
- retval = pci_bus_alloc_resource(pdev->bus,
- &image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM,
- 0, NULL, NULL);
+ retval = pci_bus_alloc_resource(pdev->bus, &image->bus_resource,
+ size, 0x10000, PCIBIOS_MIN_MEM,
+ 0, NULL, NULL);
if (retval) {
dev_err(tsi148_bridge->parent, "Failed to allocate mem resource for window %d size 0x%lx start 0x%lx\n",
image->number, (unsigned long)size,
@@ -796,8 +796,8 @@ static void tsi148_free_resource(struct vme_master_resource *image)
* Set the attributes of an outbound window.
*/
static int tsi148_master_set(struct vme_master_resource *image, int enabled,
- unsigned long long vme_base, unsigned long long size, u32 aspace,
- u32 cycle, u32 dwidth)
+ unsigned long long vme_base, unsigned long long size,
+ u32 aspace, u32 cycle, u32 dwidth)
{
int retval = 0;
unsigned int i;
@@ -1031,8 +1031,8 @@ err_window:
* XXX Not parsing prefetch information.
*/
static int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
- unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
- u32 *cycle, u32 *dwidth)
+ unsigned long long *vme_base, unsigned long long *size,
+ u32 *aspace, u32 *cycle, u32 *dwidth)
{
unsigned int i, ctl;
unsigned int pci_base_low, pci_base_high;
@@ -1140,15 +1140,15 @@ static int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
}
static int tsi148_master_get(struct vme_master_resource *image, int *enabled,
- unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
- u32 *cycle, u32 *dwidth)
+ unsigned long long *vme_base, unsigned long long *size,
+ u32 *aspace, u32 *cycle, u32 *dwidth)
{
int retval;
spin_lock(&image->lock);
retval = __tsi148_master_get(image, enabled, vme_base, size, aspace,
- cycle, dwidth);
+ cycle, dwidth);
spin_unlock(&image->lock);
@@ -1156,7 +1156,7 @@ static int tsi148_master_get(struct vme_master_resource *image, int *enabled,
}
static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+ size_t count, loff_t offset)
{
int retval, enabled;
unsigned long long vme_base, size;
@@ -1241,7 +1241,7 @@ out:
}
static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+ size_t count, loff_t offset)
{
int retval = 0, enabled;
unsigned long long vme_base, size;
@@ -1342,9 +1342,8 @@ out:
*
* Requires a previously configured master window, returns final value.
*/
-static unsigned int tsi148_master_rmw(struct vme_master_resource *image,
- unsigned int mask, unsigned int compare, unsigned int swap,
- loff_t offset)
+static unsigned int tsi148_master_rmw(struct vme_master_resource *image, unsigned int mask,
+ unsigned int compare, unsigned int swap, loff_t offset)
{
unsigned long long pci_addr;
unsigned int pci_addr_high, pci_addr_low;
@@ -1399,7 +1398,7 @@ static unsigned int tsi148_master_rmw(struct vme_master_resource *image,
}
static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr,
- u32 aspace, u32 cycle, u32 dwidth)
+ u32 aspace, u32 cycle, u32 dwidth)
{
u32 val;
@@ -1497,7 +1496,7 @@ static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr,
}
static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr,
- u32 aspace, u32 cycle, u32 dwidth)
+ u32 aspace, u32 cycle, u32 dwidth)
{
u32 val;
@@ -1599,8 +1598,8 @@ static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr,
*
* Note: DMA engine expects the DMA descriptor to be big endian.
*/
-static int tsi148_dma_list_add(struct vme_dma_list *list,
- struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
+static int tsi148_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
+ struct vme_dma_attr *dest, size_t count)
{
struct tsi148_dma_entry *entry, *prev;
u32 address_high, address_low, val;
@@ -1653,8 +1652,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
case VME_DMA_PCI:
pci_attr = src->private;
- reg_split((unsigned long long)pci_attr->address, &address_high,
- &address_low);
+ reg_split((unsigned long long)pci_attr->address, &address_high, &address_low);
entry->descriptor.dsau = cpu_to_be32(address_high);
entry->descriptor.dsal = cpu_to_be32(address_low);
entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_PCI);
@@ -1662,15 +1660,16 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
case VME_DMA_VME:
vme_attr = src->private;
- reg_split((unsigned long long)vme_attr->address, &address_high,
- &address_low);
+ reg_split((unsigned long long)vme_attr->address, &address_high, &address_low);
entry->descriptor.dsau = cpu_to_be32(address_high);
entry->descriptor.dsal = cpu_to_be32(address_low);
entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_VME);
- retval = tsi148_dma_set_vme_src_attributes(
- tsi148_bridge->parent, &entry->descriptor.dsat,
- vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth);
+ retval = tsi148_dma_set_vme_src_attributes(tsi148_bridge->parent,
+ &entry->descriptor.dsat,
+ vme_attr->aspace,
+ vme_attr->cycle,
+ vme_attr->dwidth);
if (retval < 0)
goto err_source;
break;
@@ -1690,7 +1689,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
pci_attr = dest->private;
reg_split((unsigned long long)pci_attr->address, &address_high,
- &address_low);
+ &address_low);
entry->descriptor.ddau = cpu_to_be32(address_high);
entry->descriptor.ddal = cpu_to_be32(address_low);
entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_PCI);
@@ -1699,14 +1698,16 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
vme_attr = dest->private;
reg_split((unsigned long long)vme_attr->address, &address_high,
- &address_low);
+ &address_low);
entry->descriptor.ddau = cpu_to_be32(address_high);
entry->descriptor.ddal = cpu_to_be32(address_low);
entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_VME);
- retval = tsi148_dma_set_vme_dest_attributes(
- tsi148_bridge->parent, &entry->descriptor.ddat,
- vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth);
+ retval = tsi148_dma_set_vme_dest_attributes(tsi148_bridge->parent,
+ &entry->descriptor.ddat,
+ vme_attr->aspace,
+ vme_attr->cycle,
+ vme_attr->dwidth);
if (retval < 0)
goto err_dest;
break;
@@ -1735,7 +1736,7 @@ static int tsi148_dma_list_add(struct vme_dma_list *list,
/* Fill out previous descriptors "Next Address" */
if (entry->list.prev != &list->entries) {
reg_split((unsigned long long)entry->dma_handle, &address_high,
- &address_low);
+ &address_low);
prev = list_entry(entry->list.prev, struct tsi148_dma_entry,
list);
prev->descriptor.dnlau = cpu_to_be32(address_high);
@@ -1813,7 +1814,7 @@ static int tsi148_dma_list_exec(struct vme_dma_list *list)
/* Get first bus address and write into registers */
entry = list_first_entry(&list->entries, struct tsi148_dma_entry,
- list);
+ list);
mutex_unlock(&ctrlr->mtx);
@@ -1832,7 +1833,7 @@ static int tsi148_dma_list_exec(struct vme_dma_list *list)
TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DCTL);
retval = wait_event_interruptible(bridge->dma_queue[channel],
- tsi148_dma_busy(ctrlr->parent, channel));
+ tsi148_dma_busy(ctrlr->parent, channel));
if (retval) {
iowrite32be(dctlreg | TSI148_LCSR_DCTL_ABT, bridge->base +
@@ -1883,7 +1884,7 @@ static int tsi148_dma_list_empty(struct vme_dma_list *list)
entry = list_entry(pos, struct tsi148_dma_entry, list);
dma_unmap_single(tsi148_bridge->parent, entry->dma_handle,
- sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
+ sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
kfree(entry);
}
@@ -1898,7 +1899,7 @@ static int tsi148_dma_list_empty(struct vme_dma_list *list)
* callback is attached and disabled when the last callback is removed.
*/
static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
- u32 aspace, u32 cycle)
+ u32 aspace, u32 cycle)
{
u32 lm_base_high, lm_base_low, lm_ctl = 0;
int i;
@@ -1963,7 +1964,7 @@ static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
* or disabled.
*/
static int tsi148_lm_get(struct vme_lm_resource *lm,
- unsigned long long *lm_base, u32 *aspace, u32 *cycle)
+ unsigned long long *lm_base, u32 *aspace, u32 *cycle)
{
u32 lm_base_high, lm_base_low, lm_ctl, enabled = 0;
struct tsi148_driver *bridge;
@@ -2013,7 +2014,7 @@ static int tsi148_lm_get(struct vme_lm_resource *lm,
* Callback will be passed the monitor triggered.
*/
static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
- void (*callback)(void *), void *data)
+ void (*callback)(void *), void *data)
{
u32 lm_ctl, tmp;
struct vme_bridge *tsi148_bridge;
@@ -2086,7 +2087,7 @@ static int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
iowrite32be(TSI148_LCSR_INTC_LMC[monitor],
- bridge->base + TSI148_LCSR_INTC);
+ bridge->base + TSI148_LCSR_INTC);
/* Detach callback */
bridge->lm_callback[monitor] = NULL;
@@ -2126,7 +2127,7 @@ static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
}
static void *tsi148_alloc_consistent(struct device *parent, size_t size,
- dma_addr_t *dma)
+ dma_addr_t *dma)
{
struct pci_dev *pdev;
@@ -2137,7 +2138,7 @@ static void *tsi148_alloc_consistent(struct device *parent, size_t size,
}
static void tsi148_free_consistent(struct device *parent, size_t size,
- void *vaddr, dma_addr_t dma)
+ void *vaddr, dma_addr_t dma)
{
struct pci_dev *pdev;
@@ -2160,7 +2161,7 @@ static void tsi148_free_consistent(struct device *parent, size_t size,
* be mapped onto PCI memory.
*/
static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
- struct pci_dev *pdev)
+ struct pci_dev *pdev)
{
u32 cbar, crat, vstat;
u32 crcsr_bus_high, crcsr_bus_low;
@@ -2201,8 +2202,7 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
dev_info(tsi148_bridge->parent, "CR/CSR already enabled\n");
} else {
dev_info(tsi148_bridge->parent, "Enabling CR/CSR space\n");
- iowrite32be(crat | TSI148_LCSR_CRAT_EN,
- bridge->base + TSI148_LCSR_CRAT);
+ iowrite32be(crat | TSI148_LCSR_CRAT_EN, bridge->base + TSI148_LCSR_CRAT);
}
/* If we want flushed, error-checked writes, set up a window
@@ -2210,9 +2210,8 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
* through VME writes.
*/
if (err_chk) {
- retval = tsi148_master_set(bridge->flush_image, 1,
- (vstat * 0x80000), 0x80000, VME_CRCSR, VME_SCT,
- VME_D16);
+ retval = tsi148_master_set(bridge->flush_image, 1, (vstat * 0x80000),
+ 0x80000, VME_CRCSR, VME_SCT, VME_D16);
if (retval)
dev_err(tsi148_bridge->parent, "Configuring flush image failed\n");
}
@@ -2221,7 +2220,7 @@ static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
}
static void tsi148_crcsr_exit(struct vme_bridge *tsi148_bridge,
- struct pci_dev *pdev)
+ struct pci_dev *pdev)
{
u32 crat;
struct tsi148_driver *bridge;
@@ -2231,7 +2230,7 @@ static void tsi148_crcsr_exit(struct vme_bridge *tsi148_bridge,
/* Turn off CR/CSR space */
crat = ioread32be(bridge->base + TSI148_LCSR_CRAT);
iowrite32be(crat & ~TSI148_LCSR_CRAT_EN,
- bridge->base + TSI148_LCSR_CRAT);
+ bridge->base + TSI148_LCSR_CRAT);
/* Free image */
iowrite32be(0, bridge->base + TSI148_LCSR_CROU);
@@ -2253,6 +2252,12 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct vme_dma_resource *dma_ctrlr;
struct vme_lm_resource *lm;
+ if (geoid >= VME_MAX_SLOTS) {
+ dev_err(&pdev->dev, "VME geographical address must be between 0 and %d (exclusive), but got %d\n",
+ VME_MAX_SLOTS, geoid);
+ return -EINVAL;
+ }
+
/* If we want to support more than one of each bridge, we need to
* dynamically generate this so we get one per device
*/
@@ -2287,7 +2292,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* map registers in BAR 0 */
tsi148_device->base = ioremap(pci_resource_start(pdev, 0),
- 4096);
+ 4096);
if (!tsi148_device->base) {
dev_err(&pdev->dev, "Unable to remap CRG region\n");
retval = -EIO;
@@ -2367,7 +2372,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
sizeof(master_image->bus_resource));
master_image->kern_base = NULL;
list_add_tail(&master_image->list,
- &tsi148_bridge->master_resources);
+ &tsi148_bridge->master_resources);
}
/* Add slave windows to list */
@@ -2388,7 +2393,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
VME_PROG | VME_DATA;
list_add_tail(&slave_image->list,
- &tsi148_bridge->slave_resources);
+ &tsi148_bridge->slave_resources);
}
/* Add dma engines to list */
@@ -2409,7 +2414,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
INIT_LIST_HEAD(&dma_ctrlr->pending);
INIT_LIST_HEAD(&dma_ctrlr->running);
list_add_tail(&dma_ctrlr->list,
- &tsi148_bridge->dma_resources);
+ &tsi148_bridge->dma_resources);
}
/* Add location monitor to list */
@@ -2447,16 +2452,16 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
data = ioread32be(tsi148_device->base + TSI148_LCSR_VSTAT);
dev_info(&pdev->dev, "Board is%s the VME system controller\n",
- (data & TSI148_LCSR_VSTAT_SCONS) ? "" : " not");
+ (data & TSI148_LCSR_VSTAT_SCONS) ? "" : " not");
if (!geoid)
dev_info(&pdev->dev, "VME geographical address is %d\n",
- data & TSI148_LCSR_VSTAT_GA_M);
+ data & TSI148_LCSR_VSTAT_GA_M);
else
dev_info(&pdev->dev, "VME geographical address is set to %d\n",
- geoid);
+ geoid);
dev_info(&pdev->dev, "VME Write and flush and error check is %s\n",
- err_chk ? "enabled" : "disabled");
+ err_chk ? "enabled" : "disabled");
retval = tsi148_crcsr_init(tsi148_bridge, pdev);
if (retval) {
@@ -2507,8 +2512,7 @@ err_slave:
err_master:
/* resources are stored in link list */
list_for_each_safe(pos, n, &tsi148_bridge->master_resources) {
- master_image = list_entry(pos, struct vme_master_resource,
- list);
+ master_image = list_entry(pos, struct vme_master_resource, list);
list_del(pos);
kfree(master_image);
}
@@ -2605,8 +2609,7 @@ static void tsi148_remove(struct pci_dev *pdev)
/* resources are stored in link list */
list_for_each_safe(pos, tmplist, &tsi148_bridge->master_resources) {
- master_image = list_entry(pos, struct vme_master_resource,
- list);
+ master_image = list_entry(pos, struct vme_master_resource, list);
list_del(pos);
kfree(master_image);
}
@@ -2628,7 +2631,7 @@ MODULE_PARM_DESC(err_chk, "Check for VME errors on reads and writes");
module_param(err_chk, bool, 0);
MODULE_PARM_DESC(geoid, "Override geographical addressing");
-module_param(geoid, int, 0);
+module_param(geoid, uint, 0);
MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/vt6655/TODO b/drivers/staging/vt6655/TODO
index 7f6870f2ee5d..27654bd0ff5d 100644
--- a/drivers/staging/vt6655/TODO
+++ b/drivers/staging/vt6655/TODO
@@ -17,4 +17,4 @@ TODO:
- integrate with drivers/net/wireless
Please send any patches to Greg Kroah-Hartman <greg@kroah.com>
-and Forest Bond <forest@alittletooquiet.net>.
+and Philipp Hortmann <philipp.g.hortmann@gmail.com>.
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 688c870d89bc..6a2e390e9493 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -388,22 +388,22 @@ void card_safe_reset_tx(struct vnt_private *priv)
struct vnt_tx_desc *curr_td;
/* initialize TD index */
- priv->tail_td[0] = &priv->apTD0Rings[0];
- priv->apCurrTD[0] = &priv->apTD0Rings[0];
+ priv->tail_td[0] = &priv->ap_td0_rings[0];
+ priv->apCurrTD[0] = &priv->ap_td0_rings[0];
- priv->tail_td[1] = &priv->apTD1Rings[0];
- priv->apCurrTD[1] = &priv->apTD1Rings[0];
+ priv->tail_td[1] = &priv->ap_td1_rings[0];
+ priv->apCurrTD[1] = &priv->ap_td1_rings[0];
for (uu = 0; uu < TYPE_MAXTD; uu++)
priv->iTDUsed[uu] = 0;
for (uu = 0; uu < priv->opts.tx_descs[0]; uu++) {
- curr_td = &priv->apTD0Rings[uu];
+ curr_td = &priv->ap_td0_rings[uu];
curr_td->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */
}
for (uu = 0; uu < priv->opts.tx_descs[1]; uu++) {
- curr_td = &priv->apTD1Rings[uu];
+ curr_td = &priv->ap_td1_rings[uu];
curr_td->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */
}
diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h
index f52e42564e81..f6b462ebca51 100644
--- a/drivers/staging/vt6655/card.h
+++ b/drivers/staging/vt6655/card.h
@@ -55,8 +55,8 @@ void CARDvSafeResetRx(struct vnt_private *priv);
void card_radio_power_off(struct vnt_private *priv);
bool card_set_phy_parameter(struct vnt_private *priv, u8 bb_type);
bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate,
- u64 bss_timestamp);
+ u64 bss_timestamp);
bool card_set_beacon_period(struct vnt_private *priv,
- unsigned short beacon_interval);
+ unsigned short beacon_interval);
#endif /* __CARD_H__ */
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 0212240ba23f..5eaab6b172d3 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -135,8 +135,8 @@ struct vnt_private {
struct vnt_tx_desc *apCurrTD[TYPE_MAXTD];
struct vnt_tx_desc *tail_td[TYPE_MAXTD];
- struct vnt_tx_desc *apTD0Rings;
- struct vnt_tx_desc *apTD1Rings;
+ struct vnt_tx_desc *ap_td0_rings;
+ struct vnt_tx_desc *ap_td1_rings;
struct vnt_rx_desc *aRD0Ring;
struct vnt_rx_desc *aRD1Ring;
@@ -189,10 +189,10 @@ struct vnt_private {
u8 byBBType; /* 0:11A, 1:11B, 2:11G */
u8 packet_type; /*
- * 0:11a,1:11b,2:11gb (only CCK
- * in BasicRate), 3:11ga (OFDM in
- * Basic Rate)
- */
+ * 0:11a,1:11b,2:11gb (only CCK
+ * in BasicRate), 3:11ga (OFDM in
+ * Basic Rate)
+ */
unsigned short wBasicRate;
unsigned char byACKRate;
unsigned char byTopOFDMBasicRate;
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 3ff8103366c1..bf3ecf720206 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -550,11 +550,11 @@ static bool device_init_rings(struct vnt_private *priv)
priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc);
/* vir_pool: pvoid type */
- priv->apTD0Rings = vir_pool
+ priv->ap_td0_rings = vir_pool
+ priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc)
+ priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc);
- priv->apTD1Rings = vir_pool
+ priv->ap_td1_rings = vir_pool
+ priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc)
+ priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc)
+ priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc);
@@ -720,7 +720,7 @@ static int device_init_td0_ring(struct vnt_private *priv)
curr = priv->td0_pool_dma;
for (i = 0; i < priv->opts.tx_descs[0];
i++, curr += sizeof(struct vnt_tx_desc)) {
- desc = &priv->apTD0Rings[i];
+ desc = &priv->ap_td0_rings[i];
desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL);
if (!desc->td_info) {
ret = -ENOMEM;
@@ -730,20 +730,20 @@ static int device_init_td0_ring(struct vnt_private *priv)
desc->td_info->buf = priv->tx0_bufs + i * PKT_BUF_SZ;
desc->td_info->buf_dma = priv->tx_bufs_dma0 + i * PKT_BUF_SZ;
- desc->next = &(priv->apTD0Rings[(i + 1) % priv->opts.tx_descs[0]]);
+ desc->next = &(priv->ap_td0_rings[(i + 1) % priv->opts.tx_descs[0]]);
desc->next_desc = cpu_to_le32(curr +
sizeof(struct vnt_tx_desc));
}
if (i > 0)
- priv->apTD0Rings[i - 1].next_desc = cpu_to_le32(priv->td0_pool_dma);
- priv->tail_td[0] = priv->apCurrTD[0] = &priv->apTD0Rings[0];
+ priv->ap_td0_rings[i - 1].next_desc = cpu_to_le32(priv->td0_pool_dma);
+ priv->tail_td[0] = priv->apCurrTD[0] = &priv->ap_td0_rings[0];
return 0;
err_free_desc:
while (i--) {
- desc = &priv->apTD0Rings[i];
+ desc = &priv->ap_td0_rings[i];
kfree(desc->td_info);
}
@@ -761,7 +761,7 @@ static int device_init_td1_ring(struct vnt_private *priv)
curr = priv->td1_pool_dma;
for (i = 0; i < priv->opts.tx_descs[1];
i++, curr += sizeof(struct vnt_tx_desc)) {
- desc = &priv->apTD1Rings[i];
+ desc = &priv->ap_td1_rings[i];
desc->td_info = kzalloc(sizeof(*desc->td_info), GFP_KERNEL);
if (!desc->td_info) {
ret = -ENOMEM;
@@ -771,19 +771,19 @@ static int device_init_td1_ring(struct vnt_private *priv)
desc->td_info->buf = priv->tx1_bufs + i * PKT_BUF_SZ;
desc->td_info->buf_dma = priv->tx_bufs_dma1 + i * PKT_BUF_SZ;
- desc->next = &(priv->apTD1Rings[(i + 1) % priv->opts.tx_descs[1]]);
+ desc->next = &(priv->ap_td1_rings[(i + 1) % priv->opts.tx_descs[1]]);
desc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_tx_desc));
}
if (i > 0)
- priv->apTD1Rings[i - 1].next_desc = cpu_to_le32(priv->td1_pool_dma);
- priv->tail_td[1] = priv->apCurrTD[1] = &priv->apTD1Rings[0];
+ priv->ap_td1_rings[i - 1].next_desc = cpu_to_le32(priv->td1_pool_dma);
+ priv->tail_td[1] = priv->apCurrTD[1] = &priv->ap_td1_rings[0];
return 0;
err_free_desc:
while (i--) {
- desc = &priv->apTD1Rings[i];
+ desc = &priv->ap_td1_rings[i];
kfree(desc->td_info);
}
@@ -795,7 +795,7 @@ static void device_free_td0_ring(struct vnt_private *priv)
int i;
for (i = 0; i < priv->opts.tx_descs[0]; i++) {
- struct vnt_tx_desc *desc = &priv->apTD0Rings[i];
+ struct vnt_tx_desc *desc = &priv->ap_td0_rings[i];
struct vnt_td_info *td_info = desc->td_info;
dev_kfree_skb(td_info->skb);
@@ -808,7 +808,7 @@ static void device_free_td1_ring(struct vnt_private *priv)
int i;
for (i = 0; i < priv->opts.tx_descs[1]; i++) {
- struct vnt_tx_desc *desc = &priv->apTD1Rings[i];
+ struct vnt_tx_desc *desc = &priv->ap_td1_rings[i];
struct vnt_td_info *td_info = desc->td_info;
dev_kfree_skb(td_info->skb);
@@ -1140,7 +1140,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
PSbIsNextTBTTWakeUp((void *)priv);
if ((priv->op_mode == NL80211_IFTYPE_AP ||
- priv->op_mode == NL80211_IFTYPE_ADHOC) &&
+ priv->op_mode == NL80211_IFTYPE_ADHOC) &&
priv->vif->bss_conf.enable_beacon)
MACvOneShotTimer1MicroSec(priv,
(priv->vif->bss_conf.beacon_int -
@@ -1535,7 +1535,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
priv->op_mode != NL80211_IFTYPE_AP) {
if (vif->cfg.assoc && conf->beacon_rate) {
card_update_tsf(priv, conf->beacon_rate->hw_value,
- conf->sync_tsf);
+ conf->sync_tsf);
card_set_beacon_period(priv, conf->beacon_int);
@@ -1763,7 +1763,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
priv->memaddr = pci_resource_start(pcid, 0);
priv->ioaddr = pci_resource_start(pcid, 1);
priv->port_offset = ioremap(priv->memaddr & PCI_BASE_ADDRESS_MEM_MASK,
- 256);
+ 256);
if (!priv->port_offset) {
dev_err(&pcid->dev, ": Failed to IO remapping ..\n");
device_free_info(priv);
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index acf931c3f5fd..a33af2852227 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -537,9 +537,9 @@
/*--------------------- Export Macros ------------------------------*/
-#define VT6655_MAC_SELECT_PAGE0(iobase) iowrite8(0, iobase + MAC_REG_PAGE1SEL)
+#define VT6655_MAC_SELECT_PAGE0(iobase) iowrite8(0, (iobase) + MAC_REG_PAGE1SEL)
-#define VT6655_MAC_SELECT_PAGE1(iobase) iowrite8(1, iobase + MAC_REG_PAGE1SEL)
+#define VT6655_MAC_SELECT_PAGE1(iobase) iowrite8(1, (iobase) + MAC_REG_PAGE1SEL)
#define MAKEWORD(lb, hb) \
((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 5e5ed582c35e..3705cb1e87b6 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -493,9 +493,9 @@ s_uFillDataHead(
buf->duration_a = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
buf->duration_b = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
buf->duration_a_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
buf->duration_a_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
@@ -520,7 +520,7 @@ s_uFillDataHead(
buf->duration_f0 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
buf->duration_f1 = cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption));
buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate);
return buf->duration;
}
@@ -1375,8 +1375,8 @@ static int vnt_beacon_xmit(struct vnt_private *priv,
/* Get Duration and TimeStampOff */
short_head->duration =
cpu_to_le16((u16)s_uGetDataDuration(priv, DATADUR_B,
- frame_size, PK_TYPE_11A, current_rate,
- false, 0, 0, 1, AUTO_FB_NONE));
+ frame_size, PK_TYPE_11A, current_rate,
+ false, 0, 0, 1, AUTO_FB_NONE));
short_head->time_stamp_off =
vnt_time_stamp_off(priv, current_rate);
@@ -1391,8 +1391,8 @@ static int vnt_beacon_xmit(struct vnt_private *priv,
/* Get Duration and TimeStampOff */
short_head->duration =
cpu_to_le16((u16)s_uGetDataDuration(priv, DATADUR_B,
- frame_size, PK_TYPE_11B, current_rate,
- false, 0, 0, 1, AUTO_FB_NONE));
+ frame_size, PK_TYPE_11B, current_rate,
+ false, 0, 0, 1, AUTO_FB_NONE));
short_head->time_stamp_off =
vnt_time_stamp_off(priv, current_rate);