diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-03-21 21:03:44 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-03-21 21:03:44 +0100 |
commit | 0a59b3f42e5703a89dd6ddf5bc818a4cff975302 (patch) | |
tree | 7df74c07cdccce31e00bfe8c2afdf21cb17d92c6 | |
parent | Merge tag 'tty-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/greg... (diff) | |
parent | staging: greybus: Replaces directive __attribute__((packed)) by __packed as s... (diff) | |
download | linux-0a59b3f42e5703a89dd6ddf5bc818a4cff975302.tar.xz linux-0a59b3f42e5703a89dd6ddf5bc818a4cff975302.zip |
Merge tag 'staging-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here is the big set of Staging driver cleanups for 6.9-rc1. Nothing
major in here, lots of small coding style cleanups for most drivers,
and the removal of some obsolete hardare (the emxx_udc and some
drivers/staging/board/ files).
All of these have been in linux-next for a long time with no reported
issues"
* tag 'staging-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (122 commits)
staging: greybus: Replaces directive __attribute__((packed)) by __packed as suggested by checkpatch
staging: greybus: Replace __attribute__((packed)) by __packed in various instances
Staging: rtl8192e: Rename function GetHalfNmodeSupportByAPsHandler()
Staging: rtl8192e: Rename function rtllib_FlushRxTsPendingPkts()
Staging: rtl8192e: Rename goto OnADDBARsp_Reject
Staging: rtl8192e: Rename goto OnADDBAReq_Fail
Staging: rtl8192e: Rename function rtllib_send_ADDBARsp()
Staging: rtl8192e: Rename function rtllib_send_ADDBAReq()
Staging: rtl8192e: Rename variable TxRxSelect
Staging: rtl8192e: Fix 5 chckpatch alignment warnings in rtl819x_BAProc.c
Staging: rtl8192e: Rename function MgntQuery_MgntFrameTxRate
Staging: rtl8192e: Rename boolean variable bHalfWirelessN24GMode
Staging: rtl8192e: Rename reference AllowAllDestAddrHandler
Staging: rtl8192e: Rename varoable asSta
Staging: rtl8192e: Rename varoable osCcxVerNum
Staging: rtl8192e: Rename variable CcxAironetBuf
Staging: rtl8192e: Rename variable osCcxAironetIE
Staging: rtl8192e: Rename variable AironetIeOui
Staging: rtl8192e: Rename variable asRsn
Staging: rtl8192e: Rename variable CcxVerNumBuf
...
72 files changed, 537 insertions, 4820 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 784b9f673ead..5175b1c4f161 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -46,14 +46,10 @@ source "drivers/staging/iio/Kconfig" source "drivers/staging/sm750fb/Kconfig" -source "drivers/staging/emxx_udc/Kconfig" - source "drivers/staging/nvec/Kconfig" source "drivers/staging/media/Kconfig" -source "drivers/staging/board/Kconfig" - source "drivers/staging/gdm724x/Kconfig" source "drivers/staging/fbtft/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 2ea99c7b05d9..67399c0ad871 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -14,9 +14,7 @@ obj-$(CONFIG_VT6656) += vt6656/ obj-$(CONFIG_VME_BUS) += vme_user/ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_FB_SM750) += sm750fb/ -obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_MFD_NVEC) += nvec/ -obj-$(CONFIG_STAGING_BOARD) += board/ obj-$(CONFIG_LTE_GDM724X) += gdm724x/ obj-$(CONFIG_FB_TFT) += fbtft/ obj-$(CONFIG_MOST) += most/ diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 727b956aa231..c51818c56dd2 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -165,14 +165,9 @@ static ssize_t sysfs_read(struct device *dev, char *buf, { struct axis_fifo *fifo = dev_get_drvdata(dev); unsigned int read_val; - unsigned int len; - char tmp[32]; read_val = ioread32(fifo->base_addr + addr_offset); - len = snprintf(tmp, sizeof(tmp), "0x%x\n", read_val); - memcpy(buf, tmp, len); - - return len; + return sysfs_emit(buf, "0x%x\n", read_val); } static ssize_t isr_store(struct device *dev, struct device_attribute *attr, diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig deleted file mode 100644 index b49216768ef6..000000000000 --- a/drivers/staging/board/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config STAGING_BOARD - bool "Staging Board Support" - depends on OF_ADDRESS && OF_IRQ && HAVE_CLK - help - Staging board base is to support continuous upstream - in-tree development and integration of platform devices. - - Helps developers integrate devices as platform devices for - device drivers that only provide platform device bindings. - This in turn allows for incremental development of both - hardware feature support and DT binding work in parallel. diff --git a/drivers/staging/board/Makefile b/drivers/staging/board/Makefile deleted file mode 100644 index ed7839752e12..000000000000 --- a/drivers/staging/board/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-y := board.o -obj-$(CONFIG_ARCH_EMEV2) += kzm9d.o -obj-$(CONFIG_ARCH_R8A7740) += armadillo800eva.o diff --git a/drivers/staging/board/TODO b/drivers/staging/board/TODO deleted file mode 100644 index 8db70e10aa67..000000000000 --- a/drivers/staging/board/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* replace platform device code with DT nodes once the driver supports DT -* remove staging board code when no more platform devices are needed diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c deleted file mode 100644 index 0225234dd7aa..000000000000 --- a/drivers/staging/board/armadillo800eva.c +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Staging board support for Armadillo 800 eva. - * Enable not-yet-DT-capable devices here. - * - * Based on board-armadillo800eva.c - * - * Copyright (C) 2012 Renesas Solutions Corp. - * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - */ - -#include <linux/dma-mapping.h> -#include <linux/fb.h> -#include <linux/kernel.h> -#include <linux/platform_device.h> -#include <linux/videodev2.h> - -#include <video/sh_mobile_lcdc.h> - -#include "board.h" - -static struct fb_videomode lcdc0_mode = { - .name = "AMPIER/AM-800480", - .xres = 800, - .yres = 480, - .left_margin = 88, - .right_margin = 40, - .hsync_len = 128, - .upper_margin = 20, - .lower_margin = 5, - .vsync_len = 5, - .sync = 0, -}; - -static struct sh_mobile_lcdc_info lcdc0_info = { - .clock_source = LCDC_CLK_BUS, - .ch[0] = { - .chan = LCDC_CHAN_MAINLCD, - .fourcc = V4L2_PIX_FMT_RGB565, - .interface_type = RGB24, - .clock_divider = 5, - .flags = 0, - .lcd_modes = &lcdc0_mode, - .num_modes = 1, - .panel_cfg = { - .width = 111, - .height = 68, - }, - }, -}; - -static struct resource lcdc0_resources[] = { - DEFINE_RES_MEM_NAMED(0xfe940000, 0x4000, "LCD0"), - DEFINE_RES_IRQ(177 + 32), -}; - -static struct platform_device lcdc0_device = { - .name = "sh_mobile_lcdc_fb", - .num_resources = ARRAY_SIZE(lcdc0_resources), - .resource = lcdc0_resources, - .id = 0, - .dev = { - .platform_data = &lcdc0_info, - .coherent_dma_mask = DMA_BIT_MASK(32), - }, -}; - -static const struct board_staging_clk lcdc0_clocks[] __initconst = { - { "lcdc0", NULL, "sh_mobile_lcdc_fb.0" }, -}; - -static const struct board_staging_dev armadillo800eva_devices[] __initconst = { - { - .pdev = &lcdc0_device, - .clocks = lcdc0_clocks, - .nclocks = ARRAY_SIZE(lcdc0_clocks), - .domain = "/system-controller@e6180000/pm-domains/c5/a4lc@1" - }, -}; - -static void __init armadillo800eva_init(void) -{ - board_staging_gic_setup_xlate("arm,pl390", 32); - board_staging_register_devices(armadillo800eva_devices, - ARRAY_SIZE(armadillo800eva_devices)); -} - -board_staging("renesas,armadillo800eva", armadillo800eva_init); diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c deleted file mode 100644 index f980af037345..000000000000 --- a/drivers/staging/board/board.c +++ /dev/null @@ -1,204 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2014 Magnus Damm - * Copyright (C) 2015 Glider bvba - */ - -#define pr_fmt(fmt) "board_staging: " fmt - -#include <linux/clkdev.h> -#include <linux/init.h> -#include <linux/irq.h> -#include <linux/device.h> -#include <linux/kernel.h> -#include <linux/of.h> -#include <linux/of_address.h> -#include <linux/of_irq.h> -#include <linux/platform_device.h> -#include <linux/pm_domain.h> - -#include "board.h" - -static struct device_node *irqc_node __initdata; -static unsigned int irqc_base __initdata; - -static bool find_by_address(u64 base_address) -{ - struct device_node *dn = of_find_all_nodes(NULL); - struct resource res; - - while (dn) { - if (!of_address_to_resource(dn, 0, &res)) { - if (res.start == base_address) { - of_node_put(dn); - return true; - } - } - dn = of_find_all_nodes(dn); - } - - return false; -} - -bool __init board_staging_dt_node_available(const struct resource *resource, - unsigned int num_resources) -{ - unsigned int i; - - for (i = 0; i < num_resources; i++) { - const struct resource *r = resource + i; - - if (resource_type(r) == IORESOURCE_MEM) - if (find_by_address(r->start)) - return true; /* DT node available */ - } - - return false; /* Nothing found */ -} - -int __init board_staging_gic_setup_xlate(const char *gic_match, - unsigned int base) -{ - WARN_ON(irqc_node); - - irqc_node = of_find_compatible_node(NULL, NULL, gic_match); - - WARN_ON(!irqc_node); - if (!irqc_node) - return -ENOENT; - - irqc_base = base; - return 0; -} - -static void __init gic_fixup_resource(struct resource *res) -{ - struct of_phandle_args irq_data; - unsigned int hwirq = res->start; - unsigned int virq; - - if (resource_type(res) != IORESOURCE_IRQ || !irqc_node) - return; - - irq_data.np = irqc_node; - irq_data.args_count = 3; - irq_data.args[0] = 0; - irq_data.args[1] = hwirq - irqc_base; - switch (res->flags & - (IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE | - IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL)) { - case IORESOURCE_IRQ_LOWEDGE: - irq_data.args[2] = IRQ_TYPE_EDGE_FALLING; - break; - case IORESOURCE_IRQ_HIGHEDGE: - irq_data.args[2] = IRQ_TYPE_EDGE_RISING; - break; - case IORESOURCE_IRQ_LOWLEVEL: - irq_data.args[2] = IRQ_TYPE_LEVEL_LOW; - break; - case IORESOURCE_IRQ_HIGHLEVEL: - default: - irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH; - break; - } - - virq = irq_create_of_mapping(&irq_data); - if (WARN_ON(!virq)) - return; - - pr_debug("hwirq %u -> virq %u\n", hwirq, virq); - res->start = virq; -} - -void __init board_staging_gic_fixup_resources(struct resource *res, - unsigned int nres) -{ - unsigned int i; - - for (i = 0; i < nres; i++) - gic_fixup_resource(&res[i]); -} - -int __init board_staging_register_clock(const struct board_staging_clk *bsc) -{ - int error; - - pr_debug("Aliasing clock %s for con_id %s dev_id %s\n", bsc->clk, - bsc->con_id, bsc->dev_id); - error = clk_add_alias(bsc->con_id, bsc->dev_id, bsc->clk, NULL); - if (error) - pr_err("Failed to alias clock %s (%d)\n", bsc->clk, error); - - return error; -} - -#ifdef CONFIG_PM_GENERIC_DOMAINS_OF -static int board_staging_add_dev_domain(struct platform_device *pdev, - const char *domain) -{ - struct device *dev = &pdev->dev; - struct of_phandle_args pd_args; - struct device_node *np; - - np = of_find_node_by_path(domain); - if (!np) { - pr_err("Cannot find domain node %s\n", domain); - return -ENOENT; - } - - pd_args.np = np; - pd_args.args_count = 0; - - /* Initialization similar to device_pm_init_common() */ - spin_lock_init(&dev->power.lock); - dev->power.early_init = true; - - return of_genpd_add_device(&pd_args, dev); -} -#else -static inline int board_staging_add_dev_domain(struct platform_device *pdev, - const char *domain) -{ - return 0; -} -#endif - -int __init board_staging_register_device(const struct board_staging_dev *dev) -{ - struct platform_device *pdev = dev->pdev; - unsigned int i; - int error; - - pr_debug("Trying to register device %s\n", pdev->name); - if (board_staging_dt_node_available(pdev->resource, - pdev->num_resources)) { - pr_warn("Skipping %s, already in DT\n", pdev->name); - return -EEXIST; - } - - board_staging_gic_fixup_resources(pdev->resource, pdev->num_resources); - - for (i = 0; i < dev->nclocks; i++) - board_staging_register_clock(&dev->clocks[i]); - - if (dev->domain) - board_staging_add_dev_domain(pdev, dev->domain); - - error = platform_device_register(pdev); - if (error) { - pr_err("Failed to register device %s (%d)\n", pdev->name, - error); - return error; - } - - return error; -} - -void __init board_staging_register_devices(const struct board_staging_dev *devs, - unsigned int ndevs) -{ - unsigned int i; - - for (i = 0; i < ndevs; i++) - board_staging_register_device(&devs[i]); -} diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h deleted file mode 100644 index 5609daf4d869..000000000000 --- a/drivers/staging/board/board.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __BOARD_H__ -#define __BOARD_H__ - -#include <linux/init.h> -#include <linux/of.h> - -struct board_staging_clk { - const char *clk; - const char *con_id; - const char *dev_id; -}; - -struct board_staging_dev { - /* Platform Device */ - struct platform_device *pdev; - /* Clocks (optional) */ - const struct board_staging_clk *clocks; - unsigned int nclocks; - /* Generic PM Domain (optional) */ - const char *domain; -}; - -struct resource; - -bool board_staging_dt_node_available(const struct resource *resource, - unsigned int num_resources); -int board_staging_gic_setup_xlate(const char *gic_match, unsigned int base); -void board_staging_gic_fixup_resources(struct resource *res, unsigned int nres); -int board_staging_register_clock(const struct board_staging_clk *bsc); -int board_staging_register_device(const struct board_staging_dev *dev); -void board_staging_register_devices(const struct board_staging_dev *devs, - unsigned int ndevs); - -#define board_staging(str, fn) \ -static int __init runtime_board_check(void) \ -{ \ - if (of_machine_is_compatible(str)) \ - fn(); \ - \ - return 0; \ -} \ - \ -device_initcall(runtime_board_check) - -#endif /* __BOARD_H__ */ diff --git a/drivers/staging/board/kzm9d.c b/drivers/staging/board/kzm9d.c deleted file mode 100644 index d449a837414e..000000000000 --- a/drivers/staging/board/kzm9d.c +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Staging board support for KZM9D. Enable not-yet-DT-capable devices here. */ - -#include <linux/kernel.h> -#include <linux/platform_device.h> -#include "board.h" - -static struct resource usbs1_res[] __initdata = { - DEFINE_RES_MEM(0xe2800000, 0x2000), - DEFINE_RES_IRQ(159), -}; - -static void __init kzm9d_init(void) -{ - board_staging_gic_setup_xlate("arm,pl390", 32); - - if (!board_staging_dt_node_available(usbs1_res, - ARRAY_SIZE(usbs1_res))) { - board_staging_gic_fixup_resources(usbs1_res, - ARRAY_SIZE(usbs1_res)); - platform_device_register_simple("emxx_udc", -1, usbs1_res, - ARRAY_SIZE(usbs1_res)); - } -} - -board_staging("renesas,kzm9d", kzm9d_init); diff --git a/drivers/staging/emxx_udc/Kconfig b/drivers/staging/emxx_udc/Kconfig deleted file mode 100644 index e7a95b3b6a2f..000000000000 --- a/drivers/staging/emxx_udc/Kconfig +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config USB_EMXX - tristate "EMXX USB Function Device Controller" - depends on USB_GADGET && (ARCH_RENESAS || COMPILE_TEST) - help - The Emma Mobile series of SoCs from Renesas Electronics and - former NEC Electronics include USB Function hardware. - - Say "y" to link the driver statically, or "m" to build a - dynamically linked module called "emxx_udc" and force all - gadget drivers to also be dynamically linked. diff --git a/drivers/staging/emxx_udc/Makefile b/drivers/staging/emxx_udc/Makefile deleted file mode 100644 index 569c5e9a9bae..000000000000 --- a/drivers/staging/emxx_udc/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_USB_EMXX) := emxx_udc.o diff --git a/drivers/staging/emxx_udc/TODO b/drivers/staging/emxx_udc/TODO deleted file mode 100644 index 471529a470c7..000000000000 --- a/drivers/staging/emxx_udc/TODO +++ /dev/null @@ -1,6 +0,0 @@ -* add clock framework support (platform device with CCF needs special care) -* break out board-specific VBUS GPIO to work with multiplatform -* convert VBUS GPIO to use GPIO descriptors from <linux/gpio/consumer.h> - and stop using the old GPIO API -* DT bindings -* move driver into drivers/usb/gadget/ diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c deleted file mode 100644 index eb63daaca702..000000000000 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ /dev/null @@ -1,3223 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * drivers/usb/gadget/emxx_udc.c - * EMXX FCD (Function Controller Driver) for USB. - * - * Copyright (C) 2010 Renesas Electronics Corporation - */ - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/platform_device.h> -#include <linux/delay.h> -#include <linux/ioport.h> -#include <linux/slab.h> -#include <linux/errno.h> -#include <linux/list.h> -#include <linux/interrupt.h> -#include <linux/proc_fs.h> -#include <linux/clk.h> -#include <linux/ctype.h> -#include <linux/string.h> -#include <linux/dma-mapping.h> -#include <linux/workqueue.h> -#include <linux/device.h> - -#include <linux/usb/ch9.h> -#include <linux/usb/gadget.h> - -#include <linux/irq.h> -#include <linux/gpio/consumer.h> - -#include "emxx_udc.h" - -#define DRIVER_DESC "EMXX UDC driver" -#define DMA_ADDR_INVALID (~(dma_addr_t)0) - -static struct gpio_desc *vbus_gpio; -static int vbus_irq; - -static const char driver_name[] = "emxx_udc"; - -/*===========================================================================*/ -/* Prototype */ -static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *, struct nbu2ss_ep *); -static void _nbu2ss_ep0_enable(struct nbu2ss_udc *); -/*static void _nbu2ss_ep0_disable(struct nbu2ss_udc *);*/ -static void _nbu2ss_ep_done(struct nbu2ss_ep *, struct nbu2ss_req *, int); -static void _nbu2ss_set_test_mode(struct nbu2ss_udc *, u32 mode); -static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, u8 ep_adrs); - -static int _nbu2ss_pullup(struct nbu2ss_udc *, int); -static void _nbu2ss_fifo_flush(struct nbu2ss_udc *, struct nbu2ss_ep *); - -/*===========================================================================*/ -/* Macro */ -#define _nbu2ss_zero_len_pkt(udc, epnum) \ - _nbu2ss_ep_in_end(udc, epnum, 0, 0) - -/*===========================================================================*/ -/* Global */ -static struct nbu2ss_udc udc_controller; - -/*-------------------------------------------------------------------------*/ -/* Read */ -static inline u32 _nbu2ss_readl(void __iomem *address) -{ - return __raw_readl(address); -} - -/*-------------------------------------------------------------------------*/ -/* Write */ -static inline void _nbu2ss_writel(void __iomem *address, u32 udata) -{ - __raw_writel(udata, address); -} - -/*-------------------------------------------------------------------------*/ -/* Set Bit */ -static inline void _nbu2ss_bitset(void __iomem *address, u32 udata) -{ - u32 reg_dt = __raw_readl(address) | (udata); - - __raw_writel(reg_dt, address); -} - -/*-------------------------------------------------------------------------*/ -/* Clear Bit */ -static inline void _nbu2ss_bitclr(void __iomem *address, u32 udata) -{ - u32 reg_dt = __raw_readl(address) & ~(udata); - - __raw_writel(reg_dt, address); -} - -#ifdef UDC_DEBUG_DUMP -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) -{ - int i; - u32 reg_data; - - pr_info("=== %s()\n", __func__); - - if (!udc) { - pr_err("%s udc == NULL\n", __func__); - return; - } - - spin_unlock(&udc->lock); - - dev_dbg(&udc->dev, "\n-USB REG-\n"); - for (i = 0x0 ; i < USB_BASE_SIZE ; i += 16) { - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i)); - dev_dbg(&udc->dev, "USB%04x =%08x", i, (int)reg_data); - - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 4)); - dev_dbg(&udc->dev, " %08x", (int)reg_data); - - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 8)); - dev_dbg(&udc->dev, " %08x", (int)reg_data); - - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 12)); - dev_dbg(&udc->dev, " %08x\n", (int)reg_data); - } - - spin_lock(&udc->lock); -} -#endif /* UDC_DEBUG_DUMP */ - -/*-------------------------------------------------------------------------*/ -/* Endpoint 0 Callback (Complete) */ -static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req) -{ - u8 recipient; - u16 selector; - u16 wIndex; - u32 test_mode; - struct usb_ctrlrequest *p_ctrl; - struct nbu2ss_udc *udc; - - if (!_ep || !_req) - return; - - udc = (struct nbu2ss_udc *)_req->context; - p_ctrl = &udc->ctrl; - if ((p_ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { - if (p_ctrl->bRequest == USB_REQ_SET_FEATURE) { - /*-------------------------------------------------*/ - /* SET_FEATURE */ - recipient = (u8)(p_ctrl->bRequestType & USB_RECIP_MASK); - selector = le16_to_cpu(p_ctrl->wValue); - if ((recipient == USB_RECIP_DEVICE) && - (selector == USB_DEVICE_TEST_MODE)) { - wIndex = le16_to_cpu(p_ctrl->wIndex); - test_mode = (u32)(wIndex >> 8); - _nbu2ss_set_test_mode(udc, test_mode); - } - } - } -} - -/*-------------------------------------------------------------------------*/ -/* Initialization usb_request */ -static void _nbu2ss_create_ep0_packet(struct nbu2ss_udc *udc, - void *p_buf, unsigned int length) -{ - udc->ep0_req.req.buf = p_buf; - udc->ep0_req.req.length = length; - udc->ep0_req.req.dma = 0; - udc->ep0_req.req.zero = true; - udc->ep0_req.req.complete = _nbu2ss_ep0_complete; - udc->ep0_req.req.status = -EINPROGRESS; - udc->ep0_req.req.context = udc; - udc->ep0_req.req.actual = 0; -} - -/*-------------------------------------------------------------------------*/ -/* Acquisition of the first address of RAM(FIFO) */ -static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) -{ - u32 num, buf_type; - u32 data, last_ram_adr, use_ram_size; - - struct ep_regs __iomem *p_ep_regs; - - last_ram_adr = (D_RAM_SIZE_CTRL / sizeof(u32)) * 2; - use_ram_size = 0; - - for (num = 0; num < NUM_ENDPOINTS - 1; num++) { - p_ep_regs = &udc->p_regs->EP_REGS[num]; - data = _nbu2ss_readl(&p_ep_regs->EP_PCKT_ADRS); - buf_type = _nbu2ss_readl(&p_ep_regs->EP_CONTROL) & EPN_BUF_TYPE; - if (buf_type == 0) { - /* Single Buffer */ - use_ram_size += (data & EPN_MPKT) / sizeof(u32); - } else { - /* Double Buffer */ - use_ram_size += ((data & EPN_MPKT) / sizeof(u32)) * 2; - } - - if ((data >> 16) > last_ram_adr) - last_ram_adr = data >> 16; - } - - return last_ram_adr + use_ram_size; -} - -/*-------------------------------------------------------------------------*/ -/* Construction of Endpoint */ -static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - u32 num; - u32 data; - u32 begin_adrs; - - if (ep->epnum == 0) - return -EINVAL; - - num = ep->epnum - 1; - - /*-------------------------------------------------------------*/ - /* RAM Transfer Address */ - begin_adrs = _nbu2ss_get_begin_ram_address(udc); - data = (begin_adrs << 16) | ep->ep.maxpacket; - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_PCKT_ADRS, data); - - /*-------------------------------------------------------------*/ - /* Interrupt Enable */ - data = 1 << (ep->epnum + 8); - _nbu2ss_bitset(&udc->p_regs->USB_INT_ENA, data); - - /*-------------------------------------------------------------*/ - /* Endpoint Type(Mode) */ - /* Bulk, Interrupt, ISO */ - switch (ep->ep_type) { - case USB_ENDPOINT_XFER_BULK: - data = EPN_BULK; - break; - - case USB_ENDPOINT_XFER_INT: - data = EPN_BUF_SINGLE | EPN_INTERRUPT; - break; - - case USB_ENDPOINT_XFER_ISOC: - data = EPN_ISO; - break; - - default: - data = 0; - break; - } - - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - _nbu2ss_endpoint_toggle_reset(udc, (ep->epnum | ep->direct)); - - if (ep->direct == USB_DIR_OUT) { - /*---------------------------------------------------------*/ - /* OUT */ - data = EPN_EN | EPN_BCLR | EPN_DIR0; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_ONAK | EPN_OSTL_EN | EPN_OSTL; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_OUT_EN | EPN_OUT_END_EN; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); - } else { - /*---------------------------------------------------------*/ - /* IN */ - data = EPN_EN | EPN_BCLR | EPN_AUTO; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_ISTL; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_IN_EN | EPN_IN_END_EN; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -/* Release of Endpoint */ -static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - u32 num; - u32 data; - - if ((ep->epnum == 0) || (udc->vbus_active == 0)) - return -EINVAL; - - num = ep->epnum - 1; - - /*-------------------------------------------------------------*/ - /* RAM Transfer Address */ - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_PCKT_ADRS, 0); - - /*-------------------------------------------------------------*/ - /* Interrupt Disable */ - data = 1 << (ep->epnum + 8); - _nbu2ss_bitclr(&udc->p_regs->USB_INT_ENA, data); - - if (ep->direct == USB_DIR_OUT) { - /*---------------------------------------------------------*/ - /* OUT */ - data = EPN_ONAK | EPN_BCLR; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_EN | EPN_DIR0; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_OUT_EN | EPN_OUT_END_EN; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); - } else { - /*---------------------------------------------------------*/ - /* IN */ - data = EPN_BCLR; - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_EN | EPN_AUTO; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); - - data = EPN_IN_EN | EPN_IN_END_EN; - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -/* DMA setting (without Endpoint 0) */ -static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - u32 num; - u32 data; - - data = _nbu2ss_readl(&udc->p_regs->USBSSCONF); - if (((ep->epnum == 0) || (data & (1 << ep->epnum)) == 0)) - return; /* Not Support DMA */ - - num = ep->epnum - 1; - - if (ep->direct == USB_DIR_OUT) { - /*---------------------------------------------------------*/ - /* OUT */ - data = ep->ep.maxpacket; - _nbu2ss_writel(&udc->p_regs->EP_DCR[num].EP_DCR2, data); - - /*---------------------------------------------------------*/ - /* Transfer Direct */ - data = DCR1_EPN_DIR0; - _nbu2ss_bitset(&udc->p_regs->EP_DCR[num].EP_DCR1, data); - - /*---------------------------------------------------------*/ - /* DMA Mode etc. */ - data = EPN_STOP_MODE | EPN_STOP_SET | EPN_DMAMODE0; - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); - } else { - /*---------------------------------------------------------*/ - /* IN */ - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, EPN_AUTO); - - /*---------------------------------------------------------*/ - /* DMA Mode etc. */ - data = EPN_BURST_SET | EPN_DMAMODE0; - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); - } -} - -/*-------------------------------------------------------------------------*/ -/* DMA setting release */ -static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - u32 num; - u32 data; - struct fc_regs __iomem *preg = udc->p_regs; - - if (udc->vbus_active == 0) - return; /* VBUS OFF */ - - data = _nbu2ss_readl(&preg->USBSSCONF); - if ((ep->epnum == 0) || ((data & (1 << ep->epnum)) == 0)) - return; /* Not Support DMA */ - - num = ep->epnum - 1; - - _nbu2ss_ep_dma_abort(udc, ep); - - if (ep->direct == USB_DIR_OUT) { - /*---------------------------------------------------------*/ - /* OUT */ - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, 0); - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_DIR0); - _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); - } else { - /*---------------------------------------------------------*/ - /* IN */ - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); - _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); - } -} - -/*-------------------------------------------------------------------------*/ -/* Abort DMA */ -static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - struct fc_regs __iomem *preg = udc->p_regs; - - _nbu2ss_bitclr(&preg->EP_DCR[ep->epnum - 1].EP_DCR1, DCR1_EPN_REQEN); - mdelay(DMA_DISABLE_TIME); /* DCR1_EPN_REQEN Clear */ - _nbu2ss_bitclr(&preg->EP_REGS[ep->epnum - 1].EP_DMA_CTRL, EPN_DMA_EN); -} - -/*-------------------------------------------------------------------------*/ -/* Start IN Transfer */ -static void _nbu2ss_ep_in_end(struct nbu2ss_udc *udc, - u32 epnum, u32 data32, u32 length) -{ - u32 data; - u32 num; - struct fc_regs __iomem *preg = udc->p_regs; - - if (length >= sizeof(u32)) - return; - - if (epnum == 0) { - _nbu2ss_bitclr(&preg->EP0_CONTROL, EP0_AUTO); - - /* Writing of 1-4 bytes */ - if (length) - _nbu2ss_writel(&preg->EP0_WRITE, data32); - - data = ((length << 5) & EP0_DW) | EP0_DEND; - _nbu2ss_writel(&preg->EP0_CONTROL, data); - - _nbu2ss_bitset(&preg->EP0_CONTROL, EP0_AUTO); - } else { - num = epnum - 1; - - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); - - /* Writing of 1-4 bytes */ - if (length) - _nbu2ss_writel(&preg->EP_REGS[num].EP_WRITE, data32); - - data = (((length) << 5) & EPN_DW) | EPN_DEND; - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); - - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); - } -} - -#ifdef USE_DMA -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_dma_map_single(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u8 direct) -{ - if (req->req.dma == DMA_ADDR_INVALID) { - if (req->unaligned) { - req->req.dma = ep->phys_buf; - } else { - req->req.dma = dma_map_single(udc->gadget.dev.parent, - req->req.buf, - req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); - } - req->mapped = 1; - } else { - if (!req->unaligned) - dma_sync_single_for_device(udc->gadget.dev.parent, - req->req.dma, - req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); - - req->mapped = 0; - } -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u8 direct) -{ - u8 data[4]; - u8 *p; - u32 count = 0; - - if (direct == USB_DIR_OUT) { - count = req->req.actual % 4; - if (count) { - p = req->req.buf; - p += (req->req.actual - count); - memcpy(data, p, count); - } - } - - if (req->mapped) { - if (req->unaligned) { - if (direct == USB_DIR_OUT) - memcpy(req->req.buf, ep->virt_buf, - req->req.actual & 0xfffffffc); - } else { - dma_unmap_single(udc->gadget.dev.parent, - req->req.dma, req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); - } - req->req.dma = DMA_ADDR_INVALID; - req->mapped = 0; - } else { - if (!req->unaligned) - dma_sync_single_for_cpu(udc->gadget.dev.parent, - req->req.dma, req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); - } - - if (count) { - p = req->req.buf; - p += (req->req.actual - count); - memcpy(p, data, count); - } -} -#endif - -/*-------------------------------------------------------------------------*/ -/* Endpoint 0 OUT Transfer (PIO) */ -static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) -{ - u32 i; - u32 numreads = length / sizeof(u32); - union usb_reg_access *buf32 = (union usb_reg_access *)buf; - - if (!numreads) - return 0; - - /* PIO Read */ - for (i = 0; i < numreads; i++) { - buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); - buf32++; - } - - return numreads * sizeof(u32); -} - -/*-------------------------------------------------------------------------*/ -/* Endpoint 0 OUT Transfer (PIO, OverBytes) */ -static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) -{ - u32 i; - u32 i_read_size = 0; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; - - if ((length > 0) && (length < sizeof(u32))) { - temp_32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); - for (i = 0 ; i < length ; i++) - p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; - i_read_size += length; - } - - return i_read_size; -} - -/*-------------------------------------------------------------------------*/ -/* Endpoint 0 IN Transfer (PIO) */ -static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) -{ - u32 i; - u32 i_max_length = EP0_PACKETSIZE; - u32 i_word_length = 0; - u32 i_write_length = 0; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; - - /*------------------------------------------------------------*/ - /* Transfer Length */ - if (i_max_length < length) - i_word_length = i_max_length / sizeof(u32); - else - i_word_length = length / sizeof(u32); - - /*------------------------------------------------------------*/ - /* PIO */ - for (i = 0; i < i_word_length; i++) { - _nbu2ss_writel(&udc->p_regs->EP0_WRITE, p_buf_32->dw); - p_buf_32++; - i_write_length += sizeof(u32); - } - - return i_write_length; -} - -/*-------------------------------------------------------------------------*/ -/* Endpoint 0 IN Transfer (PIO, OverBytes) */ -static int ep0_in_overbytes(struct nbu2ss_udc *udc, - u8 *p_buf, - u32 i_remain_size) -{ - u32 i; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; - - if ((i_remain_size > 0) && (i_remain_size < sizeof(u32))) { - for (i = 0 ; i < i_remain_size ; i++) - temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; - _nbu2ss_ep_in_end(udc, 0, temp_32.dw, i_remain_size); - - return i_remain_size; - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -/* Transfer NULL Packet (Epndoint 0) */ -static int EP0_send_NULL(struct nbu2ss_udc *udc, bool pid_flag) -{ - u32 data; - - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); - data &= ~(u32)EP0_INAK; - - if (pid_flag) - data |= (EP0_INAK_EN | EP0_PIDCLR | EP0_DEND); - else - data |= (EP0_INAK_EN | EP0_DEND); - - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -/* Receive NULL Packet (Endpoint 0) */ -static int EP0_receive_NULL(struct nbu2ss_udc *udc, bool pid_flag) -{ - u32 data; - - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); - data &= ~(u32)EP0_ONAK; - - if (pid_flag) - data |= EP0_PIDCLR; - - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_ep0_in_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_req *req) -{ - u8 *p_buffer; /* IN Data Buffer */ - u32 data; - u32 i_remain_size = 0; - int result = 0; - - /*-------------------------------------------------------------*/ - /* End confirmation */ - if (req->req.actual == req->req.length) { - if ((req->req.actual % EP0_PACKETSIZE) == 0) { - if (req->zero) { - req->zero = false; - EP0_send_NULL(udc, false); - return 1; - } - } - - return 0; /* Transfer End */ - } - - /*-------------------------------------------------------------*/ - /* NAK release */ - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); - data |= EP0_INAK_EN; - data &= ~(u32)EP0_INAK; - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); - - i_remain_size = req->req.length - req->req.actual; - p_buffer = (u8 *)req->req.buf; - p_buffer += req->req.actual; - - /*-------------------------------------------------------------*/ - /* Data transfer */ - result = EP0_in_PIO(udc, p_buffer, i_remain_size); - - req->div_len = result; - i_remain_size -= result; - - if (i_remain_size == 0) { - EP0_send_NULL(udc, false); - return result; - } - - if ((i_remain_size < sizeof(u32)) && (result != EP0_PACKETSIZE)) { - p_buffer += result; - result += ep0_in_overbytes(udc, p_buffer, i_remain_size); - req->div_len = result; - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_req *req) -{ - u8 *p_buffer; - u32 i_remain_size; - u32 i_recv_length; - int result = 0; - int f_rcv_zero; - - /*-------------------------------------------------------------*/ - /* Receive data confirmation */ - i_recv_length = _nbu2ss_readl(&udc->p_regs->EP0_LENGTH) & EP0_LDATA; - if (i_recv_length != 0) { - f_rcv_zero = 0; - - i_remain_size = req->req.length - req->req.actual; - p_buffer = (u8 *)req->req.buf; - p_buffer += req->req.actual; - - result = ep0_out_pio(udc, p_buffer - , min(i_remain_size, i_recv_length)); - if (result < 0) - return result; - - req->req.actual += result; - i_recv_length -= result; - - if ((i_recv_length > 0) && (i_recv_length < sizeof(u32))) { - p_buffer += result; - i_remain_size -= result; - - result = ep0_out_overbytes(udc, p_buffer - , min(i_remain_size, i_recv_length)); - req->req.actual += result; - } - } else { - f_rcv_zero = 1; - } - - /*-------------------------------------------------------------*/ - /* End confirmation */ - if (req->req.actual == req->req.length) { - if ((req->req.actual % EP0_PACKETSIZE) == 0) { - if (req->zero) { - req->zero = false; - EP0_receive_NULL(udc, false); - return 1; - } - } - - return 0; /* Transfer End */ - } - - if ((req->req.actual % EP0_PACKETSIZE) != 0) - return 0; /* Short Packet Transfer End */ - - if (req->req.actual > req->req.length) { - dev_err(udc->dev, " *** Overrun Error\n"); - return -EOVERFLOW; - } - - if (f_rcv_zero != 0) { - i_remain_size = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); - if (i_remain_size & EP0_ONAK) { - /*---------------------------------------------------*/ - /* NACK release */ - _nbu2ss_bitclr(&udc->p_regs->EP0_CONTROL, EP0_ONAK); - } - result = 1; - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req, - u32 num, u32 length) -{ - dma_addr_t p_buffer; - u32 mpkt; - u32 lmpkt; - u32 dmacnt; - u32 burst = 1; - u32 data; - int result; - struct fc_regs __iomem *preg = udc->p_regs; - - if (req->dma_flag) - return 1; /* DMA is forwarded */ - - req->dma_flag = true; - p_buffer = req->req.dma; - p_buffer += req->req.actual; - - /* DMA Address */ - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); - - /* Number of transfer packets */ - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; - dmacnt = length / mpkt; - lmpkt = (length % mpkt) & ~(u32)0x03; - - if (dmacnt > DMA_MAX_COUNT) { - dmacnt = DMA_MAX_COUNT; - lmpkt = 0; - } else if (lmpkt != 0) { - if (dmacnt == 0) - burst = 0; /* Burst OFF */ - dmacnt++; - } - - data = mpkt | (lmpkt << 16); - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); - - data = ((dmacnt & 0xff) << 16) | DCR1_EPN_DIR0 | DCR1_EPN_REQEN; - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); - - if (burst == 0) { - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, 0); - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); - } else { - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT - , (dmacnt << 16)); - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); - } - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); - - result = length & ~(u32)0x03; - req->div_len = result; - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u32 length) -{ - u8 *p_buffer; - u32 i; - u32 data; - u32 i_word_length; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32; - int result = 0; - struct fc_regs __iomem *preg = udc->p_regs; - - if (req->dma_flag) - return 1; /* DMA is forwarded */ - - if (length == 0) - return 0; - - p_buffer = (u8 *)req->req.buf; - p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); - - i_word_length = length / sizeof(u32); - if (i_word_length > 0) { - /*---------------------------------------------------------*/ - /* Copy of every four bytes */ - for (i = 0; i < i_word_length; i++) { - p_buf_32->dw = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); - p_buf_32++; - } - result = i_word_length * sizeof(u32); - } - - data = length - result; - if (data > 0) { - /*---------------------------------------------------------*/ - /* Copy of fraction byte */ - temp_32.dw = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); - for (i = 0 ; i < data ; i++) - p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; - result += data; - } - - req->req.actual += result; - - if ((req->req.actual == req->req.length) || - ((req->req.actual % ep->ep.maxpacket) != 0)) { - result = 0; - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u32 data_size) -{ - u32 num; - u32 i_buf_size; - int nret = 1; - - if (ep->epnum == 0) - return -EINVAL; - - num = ep->epnum - 1; - - i_buf_size = min((req->req.length - req->req.actual), data_size); - - if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && - (i_buf_size >= sizeof(u32))) { - nret = _nbu2ss_out_dma(udc, req, num, i_buf_size); - } else { - i_buf_size = min_t(u32, i_buf_size, ep->ep.maxpacket); - nret = _nbu2ss_epn_out_pio(udc, ep, req, i_buf_size); - } - - return nret; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) -{ - u32 num; - u32 i_recv_length; - int result = 1; - struct fc_regs __iomem *preg = udc->p_regs; - - if (ep->epnum == 0) - return -EINVAL; - - num = ep->epnum - 1; - - /*-------------------------------------------------------------*/ - /* Receive Length */ - i_recv_length = - _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; - - if (i_recv_length != 0) { - result = _nbu2ss_epn_out_data(udc, ep, req, i_recv_length); - if (i_recv_length < ep->ep.maxpacket) { - if (i_recv_length == result) { - req->req.actual += result; - result = 0; - } - } - } else { - if ((req->req.actual == req->req.length) || - ((req->req.actual % ep->ep.maxpacket) != 0)) { - result = 0; - } - } - - if (result == 0) { - if ((req->req.actual % ep->ep.maxpacket) == 0) { - if (req->zero) { - req->zero = false; - return 1; - } - } - } - - if (req->req.actual > req->req.length) { - dev_err(udc->dev, " Overrun Error\n"); - dev_err(udc->dev, " actual = %d, length = %d\n", - req->req.actual, req->req.length); - result = -EOVERFLOW; - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u32 num, u32 length) -{ - dma_addr_t p_buffer; - u32 mpkt; /* MaxPacketSize */ - u32 lmpkt; /* Last Packet Data Size */ - u32 dmacnt; /* IN Data Size */ - u32 i_write_length; - u32 data; - int result = -EINVAL; - struct fc_regs __iomem *preg = udc->p_regs; - - if (req->dma_flag) - return 1; /* DMA is forwarded */ - -#ifdef USE_DMA - if (req->req.actual == 0) - _nbu2ss_dma_map_single(udc, ep, req, USB_DIR_IN); -#endif - req->dma_flag = true; - - /* MAX Packet Size */ - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; - - i_write_length = min(DMA_MAX_COUNT * mpkt, length); - - /*------------------------------------------------------------*/ - /* Number of transmission packets */ - if (mpkt < i_write_length) { - dmacnt = i_write_length / mpkt; - lmpkt = (i_write_length % mpkt) & ~(u32)0x3; - if (lmpkt != 0) - dmacnt++; - else - lmpkt = mpkt & ~(u32)0x3; - - } else { - dmacnt = 1; - lmpkt = i_write_length & ~(u32)0x3; - } - - /* Packet setting */ - data = mpkt | (lmpkt << 16); - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); - - /* Address setting */ - p_buffer = req->req.dma; - p_buffer += req->req.actual; - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); - - /* Packet and DMA setting */ - data = ((dmacnt & 0xff) << 16) | DCR1_EPN_REQEN; - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); - - /* Packet setting of EPC */ - data = dmacnt << 16; - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, data); - - /*DMA setting of EPC */ - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); - - result = i_write_length & ~(u32)0x3; - req->div_len = result; - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u32 length) -{ - u8 *p_buffer; - u32 i; - u32 data; - u32 i_word_length; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = NULL; - int result = 0; - struct fc_regs __iomem *preg = udc->p_regs; - - if (req->dma_flag) - return 1; /* DMA is forwarded */ - - if (length > 0) { - p_buffer = (u8 *)req->req.buf; - p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); - - i_word_length = length / sizeof(u32); - if (i_word_length > 0) { - for (i = 0; i < i_word_length; i++) { - _nbu2ss_writel(&preg->EP_REGS[ep->epnum - 1].EP_WRITE, - p_buf_32->dw); - - p_buf_32++; - } - result = i_word_length * sizeof(u32); - } - } - - if (result != ep->ep.maxpacket) { - data = length - result; - temp_32.dw = 0; - for (i = 0 ; i < data ; i++) - temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; - - _nbu2ss_ep_in_end(udc, ep->epnum, temp_32.dw, data); - result += data; - } - - req->div_len = result; - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, u32 data_size) -{ - u32 num; - int nret = 1; - - if (ep->epnum == 0) - return -EINVAL; - - num = ep->epnum - 1; - - if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && - (data_size >= sizeof(u32))) { - nret = _nbu2ss_in_dma(udc, ep, req, num, data_size); - } else { - data_size = min_t(u32, data_size, ep->ep.maxpacket); - nret = _nbu2ss_epn_in_pio(udc, ep, req, data_size); - } - - return nret; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, struct nbu2ss_req *req) -{ - u32 num; - u32 i_buf_size; - int result = 0; - u32 status; - - if (ep->epnum == 0) - return -EINVAL; - - num = ep->epnum - 1; - - status = _nbu2ss_readl(&udc->p_regs->EP_REGS[num].EP_STATUS); - - /*-------------------------------------------------------------*/ - /* State confirmation of FIFO */ - if (req->req.actual == 0) { - if ((status & EPN_IN_EMPTY) == 0) - return 1; /* Not Empty */ - - } else { - if ((status & EPN_IN_FULL) != 0) - return 1; /* Not Empty */ - } - - /*-------------------------------------------------------------*/ - /* Start transfer */ - i_buf_size = req->req.length - req->req.actual; - if (i_buf_size > 0) - result = _nbu2ss_epn_in_data(udc, ep, req, i_buf_size); - else if (req->req.length == 0) - _nbu2ss_zero_len_pkt(udc, ep->epnum); - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_start_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - bool bflag) -{ - int nret = -EINVAL; - - req->dma_flag = false; - req->div_len = 0; - - if (req->req.length == 0) { - req->zero = false; - } else { - if ((req->req.length % ep->ep.maxpacket) == 0) - req->zero = req->req.zero; - else - req->zero = false; - } - - if (ep->epnum == 0) { - /* EP0 */ - switch (udc->ep0state) { - case EP0_IN_DATA_PHASE: - nret = _nbu2ss_ep0_in_transfer(udc, req); - break; - - case EP0_OUT_DATA_PHASE: - nret = _nbu2ss_ep0_out_transfer(udc, req); - break; - - case EP0_IN_STATUS_PHASE: - nret = EP0_send_NULL(udc, true); - break; - - default: - break; - } - - } else { - /* EPN */ - if (ep->direct == USB_DIR_OUT) { - /* OUT */ - if (!bflag) - nret = _nbu2ss_epn_out_transfer(udc, ep, req); - } else { - /* IN */ - nret = _nbu2ss_epn_in_transfer(udc, ep, req); - } - } - - return nret; -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) -{ - u32 length; - bool bflag = false; - struct nbu2ss_req *req; - - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); - if (!req) - return; - - if (ep->epnum > 0) { - length = _nbu2ss_readl(&ep->udc->p_regs->EP_REGS[ep->epnum - 1].EP_LEN_DCNT); - - length &= EPN_LDATA; - if (length < ep->ep.maxpacket) - bflag = true; - } - - _nbu2ss_start_transfer(ep->udc, ep, req, bflag); -} - -/*-------------------------------------------------------------------------*/ -/* Endpoint Toggle Reset */ -static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, u8 ep_adrs) -{ - u8 num; - u32 data; - - if ((ep_adrs == 0) || (ep_adrs == 0x80)) - return; - - num = (ep_adrs & 0x7F) - 1; - - if (ep_adrs & USB_DIR_IN) - data = EPN_IPIDCLR; - else - data = EPN_BCLR | EPN_OPIDCLR; - - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); -} - -/*-------------------------------------------------------------------------*/ -/* Endpoint STALL set */ -static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, - u8 ep_adrs, bool bstall) -{ - u8 num, epnum; - u32 data; - struct nbu2ss_ep *ep; - struct fc_regs __iomem *preg = udc->p_regs; - - if ((ep_adrs == 0) || (ep_adrs == 0x80)) { - if (bstall) { - /* Set STALL */ - _nbu2ss_bitset(&preg->EP0_CONTROL, EP0_STL); - } else { - /* Clear STALL */ - _nbu2ss_bitclr(&preg->EP0_CONTROL, EP0_STL); - } - } else { - epnum = ep_adrs & USB_ENDPOINT_NUMBER_MASK; - num = epnum - 1; - ep = &udc->ep[epnum]; - - if (bstall) { - /* Set STALL */ - ep->halted = true; - - if (ep_adrs & USB_DIR_IN) - data = EPN_BCLR | EPN_ISTL; - else - data = EPN_OSTL_EN | EPN_OSTL; - - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); - } else { - if (ep_adrs & USB_DIR_IN) { - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL - , EPN_ISTL); - } else { - data = - _nbu2ss_readl(&preg->EP_REGS[num].EP_CONTROL); - - data &= ~EPN_OSTL; - data |= EPN_OSTL_EN; - - _nbu2ss_writel(&preg->EP_REGS[num].EP_CONTROL - , data); - } - - /* Clear STALL */ - ep->stalled = false; - if (ep->halted) { - ep->halted = false; - _nbu2ss_restert_transfer(ep); - } - } - } -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_set_test_mode(struct nbu2ss_udc *udc, u32 mode) -{ - u32 data; - - if (mode > MAX_TEST_MODE_NUM) - return; - - dev_info(udc->dev, "SET FEATURE : test mode = %d\n", mode); - - data = _nbu2ss_readl(&udc->p_regs->USB_CONTROL); - data &= ~TEST_FORCE_ENABLE; - data |= mode << TEST_MODE_SHIFT; - - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, data); - _nbu2ss_bitset(&udc->p_regs->TEST_CONTROL, CS_TESTMODEEN); -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_set_feature_device(struct nbu2ss_udc *udc, - u16 selector, u16 wIndex) -{ - int result = -EOPNOTSUPP; - - switch (selector) { - case USB_DEVICE_REMOTE_WAKEUP: - if (wIndex == 0x0000) { - udc->remote_wakeup = U2F_ENABLE; - result = 0; - } - break; - - case USB_DEVICE_TEST_MODE: - wIndex >>= 8; - if (wIndex <= MAX_TEST_MODE_NUM) - result = 0; - break; - - default: - break; - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) -{ - u8 epnum; - u32 data = 0, bit_data; - struct fc_regs __iomem *preg = udc->p_regs; - - epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK; - if (epnum == 0) { - data = _nbu2ss_readl(&preg->EP0_CONTROL); - bit_data = EP0_STL; - - } else { - data = _nbu2ss_readl(&preg->EP_REGS[epnum - 1].EP_CONTROL); - if ((data & EPN_EN) == 0) - return -1; - - if (ep_adrs & USB_ENDPOINT_DIR_MASK) - bit_data = EPN_ISTL; - else - bit_data = EPN_OSTL; - } - - if ((data & bit_data) == 0) - return 0; - return 1; -} - -/*-------------------------------------------------------------------------*/ -static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset) -{ - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); - u16 selector = le16_to_cpu(udc->ctrl.wValue); - u16 wIndex = le16_to_cpu(udc->ctrl.wIndex); - u8 ep_adrs; - int result = -EOPNOTSUPP; - - if ((udc->ctrl.wLength != 0x0000) || - (direction != USB_DIR_OUT)) { - return -EINVAL; - } - - switch (recipient) { - case USB_RECIP_DEVICE: - if (bset) - result = - _nbu2ss_set_feature_device(udc, selector, wIndex); - break; - - case USB_RECIP_ENDPOINT: - if (0x0000 == (wIndex & 0xFF70)) { - if (selector == USB_ENDPOINT_HALT) { - ep_adrs = wIndex & 0xFF; - if (!bset) { - _nbu2ss_endpoint_toggle_reset(udc, - ep_adrs); - } - - _nbu2ss_set_endpoint_stall(udc, ep_adrs, bset); - - result = 0; - } - } - break; - - default: - break; - } - - if (result >= 0) - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, 0); - - return result; -} - -/*-------------------------------------------------------------------------*/ -static inline enum usb_device_speed _nbu2ss_get_speed(struct nbu2ss_udc *udc) -{ - u32 data; - enum usb_device_speed speed = USB_SPEED_FULL; - - data = _nbu2ss_readl(&udc->p_regs->USB_STATUS); - if (data & HIGH_SPEED) - speed = USB_SPEED_HIGH; - - return speed; -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_epn_set_stall(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep) -{ - u8 ep_adrs; - u32 regdata; - int limit_cnt = 0; - - struct fc_regs __iomem *preg = udc->p_regs; - - if (ep->direct == USB_DIR_IN) { - for (limit_cnt = 0 - ; limit_cnt < IN_DATA_EMPTY_COUNT - ; limit_cnt++) { - regdata = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); - - if ((regdata & EPN_IN_DATA) == 0) - break; - - mdelay(1); - } - } - - ep_adrs = ep->epnum | ep->direct; - _nbu2ss_set_endpoint_stall(udc, ep_adrs, 1); -} - -/*-------------------------------------------------------------------------*/ -static int std_req_get_status(struct nbu2ss_udc *udc) -{ - u32 length; - u16 status_data = 0; - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); - u8 ep_adrs; - int result = -EINVAL; - - if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) - return result; - - length = - min_t(u16, le16_to_cpu(udc->ctrl.wLength), sizeof(status_data)); - switch (recipient) { - case USB_RECIP_DEVICE: - if (udc->ctrl.wIndex == 0x0000) { - if (udc->gadget.is_selfpowered) - status_data |= BIT(USB_DEVICE_SELF_POWERED); - - if (udc->remote_wakeup) - status_data |= BIT(USB_DEVICE_REMOTE_WAKEUP); - - result = 0; - } - break; - - case USB_RECIP_ENDPOINT: - if (0x0000 == (le16_to_cpu(udc->ctrl.wIndex) & 0xFF70)) { - ep_adrs = (u8)(le16_to_cpu(udc->ctrl.wIndex) & 0xFF); - result = _nbu2ss_get_ep_stall(udc, ep_adrs); - - if (result > 0) - status_data |= BIT(USB_ENDPOINT_HALT); - } - break; - - default: - break; - } - - if (result >= 0) { - memcpy(udc->ep0_buf, &status_data, length); - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, length); - _nbu2ss_ep0_in_transfer(udc, &udc->ep0_req); - - } else { - dev_err(udc->dev, " Error GET_STATUS\n"); - } - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int std_req_clear_feature(struct nbu2ss_udc *udc) -{ - return _nbu2ss_req_feature(udc, false); -} - -/*-------------------------------------------------------------------------*/ -static int std_req_set_feature(struct nbu2ss_udc *udc) -{ - return _nbu2ss_req_feature(udc, true); -} - -/*-------------------------------------------------------------------------*/ -static int std_req_set_address(struct nbu2ss_udc *udc) -{ - int result = 0; - u32 wValue = le16_to_cpu(udc->ctrl.wValue); - - if ((udc->ctrl.bRequestType != 0x00) || - (udc->ctrl.wIndex != 0x0000) || - (udc->ctrl.wLength != 0x0000)) { - return -EINVAL; - } - - if (wValue != (wValue & 0x007F)) - return -EINVAL; - - wValue <<= USB_ADRS_SHIFT; - - _nbu2ss_writel(&udc->p_regs->USB_ADDRESS, wValue); - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, 0); - - return result; -} - -/*-------------------------------------------------------------------------*/ -static int std_req_set_configuration(struct nbu2ss_udc *udc) -{ - u32 config_value = (u32)(le16_to_cpu(udc->ctrl.wValue) & 0x00ff); - - if ((udc->ctrl.wIndex != 0x0000) || - (udc->ctrl.wLength != 0x0000) || - (udc->ctrl.bRequestType != 0x00)) { - return -EINVAL; - } - - udc->curr_config = config_value; - - if (config_value > 0) { - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, CONF); - udc->devstate = USB_STATE_CONFIGURED; - - } else { - _nbu2ss_bitclr(&udc->p_regs->USB_CONTROL, CONF); - udc->devstate = USB_STATE_ADDRESS; - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_read_request_data(struct nbu2ss_udc *udc, u32 *pdata) -{ - *pdata = _nbu2ss_readl(&udc->p_regs->SETUP_DATA0); - pdata++; - *pdata = _nbu2ss_readl(&udc->p_regs->SETUP_DATA1); -} - -/*-------------------------------------------------------------------------*/ -static inline int _nbu2ss_decode_request(struct nbu2ss_udc *udc) -{ - bool bcall_back = true; - int nret = -EINVAL; - struct usb_ctrlrequest *p_ctrl; - - p_ctrl = &udc->ctrl; - _nbu2ss_read_request_data(udc, (u32 *)p_ctrl); - - /* ep0 state control */ - if (p_ctrl->wLength == 0) { - udc->ep0state = EP0_IN_STATUS_PHASE; - - } else { - if (p_ctrl->bRequestType & USB_DIR_IN) - udc->ep0state = EP0_IN_DATA_PHASE; - else - udc->ep0state = EP0_OUT_DATA_PHASE; - } - - if ((p_ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { - switch (p_ctrl->bRequest) { - case USB_REQ_GET_STATUS: - nret = std_req_get_status(udc); - bcall_back = false; - break; - - case USB_REQ_CLEAR_FEATURE: - nret = std_req_clear_feature(udc); - bcall_back = false; - break; - - case USB_REQ_SET_FEATURE: - nret = std_req_set_feature(udc); - bcall_back = false; - break; - - case USB_REQ_SET_ADDRESS: - nret = std_req_set_address(udc); - bcall_back = false; - break; - - case USB_REQ_SET_CONFIGURATION: - nret = std_req_set_configuration(udc); - break; - - default: - break; - } - } - - if (!bcall_back) { - if (udc->ep0state == EP0_IN_STATUS_PHASE) { - if (nret >= 0) { - /*--------------------------------------*/ - /* Status Stage */ - nret = EP0_send_NULL(udc, true); - } - } - - } else { - spin_unlock(&udc->lock); - nret = udc->driver->setup(&udc->gadget, &udc->ctrl); - spin_lock(&udc->lock); - } - - if (nret < 0) - udc->ep0state = EP0_IDLE; - - return nret; -} - -/*-------------------------------------------------------------------------*/ -static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) -{ - int nret; - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; - - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); - if (!req) - req = &udc->ep0_req; - - req->req.actual += req->div_len; - req->div_len = 0; - - nret = _nbu2ss_ep0_in_transfer(udc, req); - if (nret == 0) { - udc->ep0state = EP0_OUT_STATUS_PAHSE; - EP0_receive_NULL(udc, true); - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) -{ - int nret; - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; - - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); - if (!req) - req = &udc->ep0_req; - - nret = _nbu2ss_ep0_out_transfer(udc, req); - if (nret == 0) { - udc->ep0state = EP0_IN_STATUS_PHASE; - EP0_send_NULL(udc, true); - - } else if (nret < 0) { - _nbu2ss_bitset(&udc->p_regs->EP0_CONTROL, EP0_BCLR); - req->req.status = nret; - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) -{ - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; - - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); - if (!req) { - req = &udc->ep0_req; - if (req->req.complete) - req->req.complete(&ep->ep, &req->req); - - } else { - if (req->req.complete) - _nbu2ss_ep_done(ep, req, 0); - } - - udc->ep0state = EP0_IDLE; - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) -{ - int i; - u32 status; - u32 intr; - int nret = -1; - - status = _nbu2ss_readl(&udc->p_regs->EP0_STATUS); - intr = status & EP0_STATUS_RW_BIT; - _nbu2ss_writel(&udc->p_regs->EP0_STATUS, ~intr); - - status &= (SETUP_INT | EP0_IN_INT | EP0_OUT_INT - | STG_END_INT | EP0_OUT_NULL_INT); - - if (status == 0) { - dev_info(udc->dev, "%s Not Decode Interrupt\n", __func__); - dev_info(udc->dev, "EP0_STATUS = 0x%08x\n", intr); - return; - } - - if (udc->gadget.speed == USB_SPEED_UNKNOWN) - udc->gadget.speed = _nbu2ss_get_speed(udc); - - for (i = 0; i < EP0_END_XFER; i++) { - switch (udc->ep0state) { - case EP0_IDLE: - if (status & SETUP_INT) { - status = 0; - nret = _nbu2ss_decode_request(udc); - } - break; - - case EP0_IN_DATA_PHASE: - if (status & EP0_IN_INT) { - status &= ~EP0_IN_INT; - nret = _nbu2ss_ep0_in_data_stage(udc); - } - break; - - case EP0_OUT_DATA_PHASE: - if (status & EP0_OUT_INT) { - status &= ~EP0_OUT_INT; - nret = _nbu2ss_ep0_out_data_stage(udc); - } - break; - - case EP0_IN_STATUS_PHASE: - if ((status & STG_END_INT) || (status & SETUP_INT)) { - status &= ~(STG_END_INT | EP0_IN_INT); - nret = _nbu2ss_ep0_status_stage(udc); - } - break; - - case EP0_OUT_STATUS_PAHSE: - if ((status & STG_END_INT) || (status & SETUP_INT) || - (status & EP0_OUT_NULL_INT)) { - status &= ~(STG_END_INT - | EP0_OUT_INT - | EP0_OUT_NULL_INT); - - nret = _nbu2ss_ep0_status_stage(udc); - } - - break; - - default: - status = 0; - break; - } - - if (status == 0) - break; - } - - if (nret < 0) { - /* Send Stall */ - _nbu2ss_set_endpoint_stall(udc, 0, true); - } -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_ep_done(struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - int status) -{ - struct nbu2ss_udc *udc = ep->udc; - - list_del_init(&req->queue); - - if (status == -ECONNRESET) - _nbu2ss_fifo_flush(udc, ep); - - if (likely(req->req.status == -EINPROGRESS)) - req->req.status = status; - - if (ep->stalled) { - _nbu2ss_epn_set_stall(udc, ep); - } else { - if (!list_empty(&ep->queue)) - _nbu2ss_restert_transfer(ep); - } - -#ifdef USE_DMA - if ((ep->direct == USB_DIR_OUT) && (ep->epnum > 0) && - (req->req.dma != 0)) - _nbu2ss_dma_unmap_single(udc, ep, req, USB_DIR_OUT); -#endif - - spin_unlock(&udc->lock); - req->req.complete(&ep->ep, &req->req); - spin_lock(&udc->lock); -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_in_int(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) -{ - int result = 0; - u32 status; - - struct fc_regs __iomem *preg = udc->p_regs; - - if (req->dma_flag) - return; /* DMA is forwarded */ - - req->req.actual += req->div_len; - req->div_len = 0; - - if (req->req.actual != req->req.length) { - /*---------------------------------------------------------*/ - /* remainder of data */ - result = _nbu2ss_epn_in_transfer(udc, ep, req); - - } else { - if (req->zero && ((req->req.actual % ep->ep.maxpacket) == 0)) { - status = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); - - if ((status & EPN_IN_FULL) == 0) { - /*-----------------------------------------*/ - /* 0 Length Packet */ - req->zero = false; - _nbu2ss_zero_len_pkt(udc, ep->epnum); - } - return; - } - } - - if (result <= 0) { - /*---------------------------------------------------------*/ - /* Complete */ - _nbu2ss_ep_done(ep, req, result); - } -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_out_int(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) -{ - int result; - - result = _nbu2ss_epn_out_transfer(udc, ep, req); - if (result <= 0) - _nbu2ss_ep_done(ep, req, result); -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_in_dma_int(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) -{ - u32 mpkt; - u32 size; - struct usb_request *preq; - - preq = &req->req; - - if (!req->dma_flag) - return; - - preq->actual += req->div_len; - req->div_len = 0; - req->dma_flag = false; - -#ifdef USE_DMA - _nbu2ss_dma_unmap_single(udc, ep, req, USB_DIR_IN); -#endif - - if (preq->actual != preq->length) { - _nbu2ss_epn_in_transfer(udc, ep, req); - } else { - mpkt = ep->ep.maxpacket; - size = preq->actual % mpkt; - if (size > 0) { - if (((preq->actual & 0x03) == 0) && (size < mpkt)) - _nbu2ss_ep_in_end(udc, ep->epnum, 0, 0); - } else { - _nbu2ss_epn_in_int(udc, ep, req); - } - } -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) -{ - int i; - u32 num; - u32 dmacnt, ep_dmacnt; - u32 mpkt; - struct fc_regs __iomem *preg = udc->p_regs; - - num = ep->epnum - 1; - - if (req->req.actual == req->req.length) { - if ((req->req.length % ep->ep.maxpacket) && !req->zero) { - req->div_len = 0; - req->dma_flag = false; - _nbu2ss_ep_done(ep, req, 0); - return; - } - } - - ep_dmacnt = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) - & EPN_DMACNT; - ep_dmacnt >>= 16; - - for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { - dmacnt = _nbu2ss_readl(&preg->EP_DCR[num].EP_DCR1) - & DCR1_EPN_DMACNT; - dmacnt >>= 16; - if (ep_dmacnt == dmacnt) - break; - } - - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_REQEN); - - if (dmacnt != 0) { - mpkt = ep->ep.maxpacket; - if ((req->div_len % mpkt) == 0) - req->div_len -= mpkt * dmacnt; - } - - if ((req->req.actual % ep->ep.maxpacket) > 0) { - if (req->req.actual == req->div_len) { - req->div_len = 0; - req->dma_flag = false; - _nbu2ss_ep_done(ep, req, 0); - return; - } - } - - req->req.actual += req->div_len; - req->div_len = 0; - req->dma_flag = false; - - _nbu2ss_epn_out_int(udc, ep, req); -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) -{ - u32 num; - u32 status; - - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[epnum]; - - num = epnum - 1; - - /* Interrupt Status */ - status = _nbu2ss_readl(&udc->p_regs->EP_REGS[num].EP_STATUS); - - /* Interrupt Clear */ - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~status); - - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); - if (!req) { - /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */ - return; - } - - if (status & EPN_OUT_END_INT) { - status &= ~EPN_OUT_INT; - _nbu2ss_epn_out_dma_int(udc, ep, req); - } - - if (status & EPN_OUT_INT) - _nbu2ss_epn_out_int(udc, ep, req); - - if (status & EPN_IN_END_INT) { - status &= ~EPN_IN_INT; - _nbu2ss_epn_in_dma_int(udc, ep, req); - } - - if (status & EPN_IN_INT) - _nbu2ss_epn_in_int(udc, ep, req); -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_ep_int(struct nbu2ss_udc *udc, u32 epnum) -{ - if (epnum == 0) - _nbu2ss_ep0_int(udc); - else - _nbu2ss_epn_int(udc, epnum); -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_ep0_enable(struct nbu2ss_udc *udc) -{ - _nbu2ss_bitset(&udc->p_regs->EP0_CONTROL, (EP0_AUTO | EP0_BCLR)); - _nbu2ss_writel(&udc->p_regs->EP0_INT_ENA, EP0_INT_EN_BIT); -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_nuke(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - int status) -{ - struct nbu2ss_req *req, *n; - - /* Endpoint Disable */ - _nbu2ss_epn_exit(udc, ep); - - /* DMA Disable */ - _nbu2ss_ep_dma_exit(udc, ep); - - if (list_empty(&ep->queue)) - return 0; - - /* called with irqs blocked */ - list_for_each_entry_safe(req, n, &ep->queue, queue) { - _nbu2ss_ep_done(ep, req, status); - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_quiesce(struct nbu2ss_udc *udc) -{ - struct nbu2ss_ep *ep; - - udc->gadget.speed = USB_SPEED_UNKNOWN; - - _nbu2ss_nuke(udc, &udc->ep[0], -ESHUTDOWN); - - /* Endpoint n */ - list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { - _nbu2ss_nuke(udc, ep, -ESHUTDOWN); - } -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) -{ - u32 reg_dt; - - if (udc->vbus_active == 0) - return -ESHUTDOWN; - - if (is_on) { - /* D+ Pullup */ - if (udc->driver) { - reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) - | PUE2) & ~(u32)CONNECTB; - - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); - } - - } else { - /* D+ Pulldown */ - reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) | CONNECTB) - & ~(u32)PUE2; - - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); - udc->gadget.speed = USB_SPEED_UNKNOWN; - } - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) -{ - struct fc_regs __iomem *p = udc->p_regs; - - if (udc->vbus_active == 0) - return; - - if (ep->epnum == 0) { - /* EP0 */ - _nbu2ss_bitset(&p->EP0_CONTROL, EP0_BCLR); - - } else { - /* EPN */ - _nbu2ss_ep_dma_abort(udc, ep); - _nbu2ss_bitset(&p->EP_REGS[ep->epnum - 1].EP_CONTROL, EPN_BCLR); - } -} - -/*-------------------------------------------------------------------------*/ -static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) -{ - int waitcnt = 0; - - if (udc->udc_enabled) - return 0; - - /* Reset */ - _nbu2ss_bitset(&udc->p_regs->EPCTR, (DIRPD | EPC_RST)); - udelay(EPC_RST_DISABLE_TIME); /* 1us wait */ - - _nbu2ss_bitclr(&udc->p_regs->EPCTR, DIRPD); - mdelay(EPC_DIRPD_DISABLE_TIME); /* 1ms wait */ - - _nbu2ss_bitclr(&udc->p_regs->EPCTR, EPC_RST); - - _nbu2ss_writel(&udc->p_regs->AHBSCTR, WAIT_MODE); - - _nbu2ss_writel(&udc->p_regs->AHBMCTR, - HBUSREQ_MODE | HTRANS_MODE | WBURST_TYPE); - - while (!(_nbu2ss_readl(&udc->p_regs->EPCTR) & PLL_LOCK)) { - waitcnt++; - udelay(1); /* 1us wait */ - if (waitcnt == EPC_PLL_LOCK_COUNT) { - dev_err(udc->dev, "*** Reset Cancel failed\n"); - return -EINVAL; - } - } - - _nbu2ss_bitset(&udc->p_regs->UTMI_CHARACTER_1, USB_SQUSET); - - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, (INT_SEL | SOF_RCV)); - - /* EP0 */ - _nbu2ss_ep0_enable(udc); - - /* USB Interrupt Enable */ - _nbu2ss_bitset(&udc->p_regs->USB_INT_ENA, USB_INT_EN_BIT); - - udc->udc_enabled = true; - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_reset_controller(struct nbu2ss_udc *udc) -{ - _nbu2ss_bitset(&udc->p_regs->EPCTR, EPC_RST); - _nbu2ss_bitclr(&udc->p_regs->EPCTR, EPC_RST); -} - -/*-------------------------------------------------------------------------*/ -static void _nbu2ss_disable_controller(struct nbu2ss_udc *udc) -{ - if (udc->udc_enabled) { - udc->udc_enabled = false; - _nbu2ss_reset_controller(udc); - _nbu2ss_bitset(&udc->p_regs->EPCTR, (DIRPD | EPC_RST)); - } -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) -{ - int nret; - u32 reg_dt; - - /* chattering */ - mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */ - - /* VBUS ON Check*/ - reg_dt = gpiod_get_value(vbus_gpio); - if (reg_dt == 0) { - udc->linux_suspended = 0; - - _nbu2ss_reset_controller(udc); - dev_info(udc->dev, " ----- VBUS OFF\n"); - - if (udc->vbus_active == 1) { - /* VBUS OFF */ - udc->vbus_active = 0; - if (udc->usb_suspended) { - udc->usb_suspended = 0; - /* _nbu2ss_reset_controller(udc); */ - } - udc->devstate = USB_STATE_NOTATTACHED; - - _nbu2ss_quiesce(udc); - if (udc->driver) { - spin_unlock(&udc->lock); - udc->driver->disconnect(&udc->gadget); - spin_lock(&udc->lock); - } - - _nbu2ss_disable_controller(udc); - } - } else { - mdelay(5); /* wait (5ms) */ - reg_dt = gpiod_get_value(vbus_gpio); - if (reg_dt == 0) - return; - - dev_info(udc->dev, " ----- VBUS ON\n"); - - if (udc->linux_suspended) - return; - - if (udc->vbus_active == 0) { - /* VBUS ON */ - udc->vbus_active = 1; - udc->devstate = USB_STATE_POWERED; - - nret = _nbu2ss_enable_controller(udc); - if (nret < 0) { - _nbu2ss_disable_controller(udc); - udc->vbus_active = 0; - return; - } - - _nbu2ss_pullup(udc, 1); - -#ifdef UDC_DEBUG_DUMP - _nbu2ss_dump_register(udc); -#endif /* UDC_DEBUG_DUMP */ - - } else { - if (udc->devstate == USB_STATE_POWERED) - _nbu2ss_pullup(udc, 1); - } - } -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_int_bus_reset(struct nbu2ss_udc *udc) -{ - udc->devstate = USB_STATE_DEFAULT; - udc->remote_wakeup = 0; - - _nbu2ss_quiesce(udc); - - udc->ep0state = EP0_IDLE; -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_int_usb_resume(struct nbu2ss_udc *udc) -{ - if (udc->usb_suspended == 1) { - udc->usb_suspended = 0; - if (udc->driver && udc->driver->resume) { - spin_unlock(&udc->lock); - udc->driver->resume(&udc->gadget); - spin_lock(&udc->lock); - } - } -} - -/*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_int_usb_suspend(struct nbu2ss_udc *udc) -{ - u32 reg_dt; - - if (udc->usb_suspended == 0) { - reg_dt = gpiod_get_value(vbus_gpio); - - if (reg_dt == 0) - return; - - udc->usb_suspended = 1; - if (udc->driver && udc->driver->suspend) { - spin_unlock(&udc->lock); - udc->driver->suspend(&udc->gadget); - spin_lock(&udc->lock); - } - - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, SUSPEND); - } -} - -/*-------------------------------------------------------------------------*/ -/* VBUS (GPIO153) Interrupt */ -static irqreturn_t _nbu2ss_vbus_irq(int irq, void *_udc) -{ - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; - - spin_lock(&udc->lock); - _nbu2ss_check_vbus(udc); - spin_unlock(&udc->lock); - - return IRQ_HANDLED; -} - -/*-------------------------------------------------------------------------*/ -/* Interrupt (udc) */ -static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) -{ - u8 suspend_flag = 0; - u32 status; - u32 epnum, int_bit; - - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; - struct fc_regs __iomem *preg = udc->p_regs; - - if (gpiod_get_value(vbus_gpio) == 0) { - _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); - _nbu2ss_writel(&preg->USB_INT_ENA, 0); - return IRQ_HANDLED; - } - - spin_lock(&udc->lock); - - for (;;) { - if (gpiod_get_value(vbus_gpio) == 0) { - _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); - _nbu2ss_writel(&preg->USB_INT_ENA, 0); - status = 0; - } else { - status = _nbu2ss_readl(&preg->USB_INT_STA); - } - - if (status == 0) - break; - - _nbu2ss_writel(&preg->USB_INT_STA, ~(status & USB_INT_STA_RW)); - - if (status & USB_RST_INT) { - /* USB Reset */ - _nbu2ss_int_bus_reset(udc); - } - - if (status & RSUM_INT) { - /* Resume */ - _nbu2ss_int_usb_resume(udc); - } - - if (status & SPND_INT) { - /* Suspend */ - suspend_flag = 1; - } - - if (status & EPN_INT) { - /* EP INT */ - int_bit = status >> 8; - - for (epnum = 0; epnum < NUM_ENDPOINTS; epnum++) { - if (0x01 & int_bit) - _nbu2ss_ep_int(udc, epnum); - - int_bit >>= 1; - - if (int_bit == 0) - break; - } - } - } - - if (suspend_flag) - _nbu2ss_int_usb_suspend(udc); - - spin_unlock(&udc->lock); - - return IRQ_HANDLED; -} - -/*-------------------------------------------------------------------------*/ -/* usb_ep_ops */ -static int nbu2ss_ep_enable(struct usb_ep *_ep, - const struct usb_endpoint_descriptor *desc) -{ - u8 ep_type; - unsigned long flags; - - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - - if (!_ep || !desc) { - pr_err(" *** %s, bad param\n", __func__); - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - if (!ep->udc) { - pr_err(" *** %s, ep == NULL !!\n", __func__); - return -EINVAL; - } - - ep_type = usb_endpoint_type(desc); - if ((ep_type == USB_ENDPOINT_XFER_CONTROL) || - (ep_type == USB_ENDPOINT_XFER_ISOC)) { - pr_err(" *** %s, bat bmAttributes\n", __func__); - return -EINVAL; - } - - udc = ep->udc; - if (udc->vbus_active == 0) - return -ESHUTDOWN; - - if ((!udc->driver) || (udc->gadget.speed == USB_SPEED_UNKNOWN)) { - dev_err(ep->udc->dev, " *** %s, udc !!\n", __func__); - return -ESHUTDOWN; - } - - spin_lock_irqsave(&udc->lock, flags); - - ep->desc = desc; - ep->epnum = usb_endpoint_num(desc); - ep->direct = desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK; - ep->ep_type = ep_type; - ep->wedged = 0; - ep->halted = false; - ep->stalled = false; - - ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize); - - /* DMA setting */ - _nbu2ss_ep_dma_init(udc, ep); - - /* Endpoint setting */ - _nbu2ss_ep_init(udc, ep); - - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_disable(struct usb_ep *_ep) -{ - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - - if (!_ep) { - pr_err(" *** %s, bad param\n", __func__); - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - if (!ep->udc) { - pr_err("udc: *** %s, ep == NULL !!\n", __func__); - return -EINVAL; - } - - udc = ep->udc; - if (udc->vbus_active == 0) - return -ESHUTDOWN; - - spin_lock_irqsave(&udc->lock, flags); - _nbu2ss_nuke(udc, ep, -EINPROGRESS); /* dequeue request */ - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static struct usb_request *nbu2ss_ep_alloc_request(struct usb_ep *ep, - gfp_t gfp_flags) -{ - struct nbu2ss_req *req; - - req = kzalloc(sizeof(*req), gfp_flags); - if (!req) - return NULL; - -#ifdef USE_DMA - req->req.dma = DMA_ADDR_INVALID; -#endif - INIT_LIST_HEAD(&req->queue); - - return &req->req; -} - -/*-------------------------------------------------------------------------*/ -static void nbu2ss_ep_free_request(struct usb_ep *_ep, - struct usb_request *_req) -{ - struct nbu2ss_req *req; - - if (_req) { - req = container_of(_req, struct nbu2ss_req, req); - - kfree(req); - } -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_queue(struct usb_ep *_ep, - struct usb_request *_req, gfp_t gfp_flags) -{ - struct nbu2ss_req *req; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - bool bflag; - int result = -EINVAL; - - /* catch various bogus parameters */ - if (!_ep || !_req) { - if (!_ep) - pr_err("udc: %s --- _ep == NULL\n", __func__); - - if (!_req) - pr_err("udc: %s --- _req == NULL\n", __func__); - - return -EINVAL; - } - - req = container_of(_req, struct nbu2ss_req, req); - if (unlikely(!_req->complete || - !_req->buf || - !list_empty(&req->queue))) { - if (!_req->complete) - pr_err("udc: %s --- !_req->complete\n", __func__); - - if (!_req->buf) - pr_err("udc:%s --- !_req->buf\n", __func__); - - if (!list_empty(&req->queue)) - pr_err("%s --- !list_empty(&req->queue)\n", __func__); - - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - udc = ep->udc; - - if (udc->vbus_active == 0) { - dev_info(udc->dev, "Can't ep_queue (VBUS OFF)\n"); - return -ESHUTDOWN; - } - - if (unlikely(!udc->driver)) { - dev_err(udc->dev, "%s, bogus device state %p\n", __func__, - udc->driver); - return -ESHUTDOWN; - } - - spin_lock_irqsave(&udc->lock, flags); - -#ifdef USE_DMA - if ((uintptr_t)req->req.buf & 0x3) - req->unaligned = true; - else - req->unaligned = false; - - if (req->unaligned) { - if (!ep->virt_buf) { - ep->virt_buf = dma_alloc_coherent(udc->dev, PAGE_SIZE, - &ep->phys_buf, - GFP_ATOMIC | GFP_DMA); - if (!ep->virt_buf) { - spin_unlock_irqrestore(&udc->lock, flags); - return -ENOMEM; - } - } - if (ep->epnum > 0) { - if (ep->direct == USB_DIR_IN) - memcpy(ep->virt_buf, req->req.buf, - req->req.length); - } - } - - if ((ep->epnum > 0) && (ep->direct == USB_DIR_OUT) && - (req->req.dma != 0)) - _nbu2ss_dma_map_single(udc, ep, req, USB_DIR_OUT); -#endif - - _req->status = -EINPROGRESS; - _req->actual = 0; - - bflag = list_empty(&ep->queue); - list_add_tail(&req->queue, &ep->queue); - - if (bflag && !ep->stalled) { - result = _nbu2ss_start_transfer(udc, ep, req, false); - if (result < 0) { - dev_err(udc->dev, " *** %s, result = %d\n", __func__, - result); - list_del(&req->queue); - } else if ((ep->epnum > 0) && (ep->direct == USB_DIR_OUT)) { -#ifdef USE_DMA - if (req->req.length < 4 && - req->req.length == req->req.actual) -#else - if (req->req.length == req->req.actual) -#endif - _nbu2ss_ep_done(ep, req, result); - } - } - - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) -{ - struct nbu2ss_req *req; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - - /* catch various bogus parameters */ - if (!_ep || !_req) { - /* pr_err("%s, bad param(1)\n", __func__); */ - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - - udc = ep->udc; - if (!udc) - return -EINVAL; - - spin_lock_irqsave(&udc->lock, flags); - - /* make sure it's actually queued on this endpoint */ - list_for_each_entry(req, &ep->queue, queue) { - if (&req->req == _req) { - _nbu2ss_ep_done(ep, req, -ECONNRESET); - spin_unlock_irqrestore(&udc->lock, flags); - return 0; - } - } - - spin_unlock_irqrestore(&udc->lock, flags); - - pr_debug("%s no queue(EINVAL)\n", __func__); - - return -EINVAL; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) -{ - u8 ep_adrs; - unsigned long flags; - - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - - if (!_ep) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - - udc = ep->udc; - if (!udc) { - dev_err(ep->udc->dev, " *** %s, bad udc\n", __func__); - return -EINVAL; - } - - spin_lock_irqsave(&udc->lock, flags); - - ep_adrs = ep->epnum | ep->direct; - if (value == 0) { - _nbu2ss_set_endpoint_stall(udc, ep_adrs, value); - ep->stalled = false; - } else { - if (list_empty(&ep->queue)) - _nbu2ss_epn_set_stall(udc, ep); - else - ep->stalled = true; - } - - if (value == 0) - ep->wedged = 0; - - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -static int nbu2ss_ep_set_wedge(struct usb_ep *_ep) -{ - return nbu2ss_ep_set_halt(_ep, 1); -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) -{ - u32 data; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - struct fc_regs __iomem *preg; - - if (!_ep) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - - udc = ep->udc; - if (!udc) { - dev_err(ep->udc->dev, "%s, bad udc\n", __func__); - return -EINVAL; - } - - preg = udc->p_regs; - - data = gpiod_get_value(vbus_gpio); - if (data == 0) - return -EINVAL; - - spin_lock_irqsave(&udc->lock, flags); - - if (ep->epnum == 0) { - data = _nbu2ss_readl(&preg->EP0_LENGTH) & EP0_LDATA; - - } else { - data = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_LEN_DCNT) - & EPN_LDATA; - } - - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) -{ - u32 data; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - - if (!_ep) { - pr_err("udc: %s, bad param\n", __func__); - return; - } - - ep = container_of(_ep, struct nbu2ss_ep, ep); - - udc = ep->udc; - if (!udc) { - dev_err(ep->udc->dev, "%s, bad udc\n", __func__); - return; - } - - data = gpiod_get_value(vbus_gpio); - if (data == 0) - return; - - spin_lock_irqsave(&udc->lock, flags); - _nbu2ss_fifo_flush(udc, ep); - spin_unlock_irqrestore(&udc->lock, flags); -} - -/*-------------------------------------------------------------------------*/ -static const struct usb_ep_ops nbu2ss_ep_ops = { - .enable = nbu2ss_ep_enable, - .disable = nbu2ss_ep_disable, - - .alloc_request = nbu2ss_ep_alloc_request, - .free_request = nbu2ss_ep_free_request, - - .queue = nbu2ss_ep_queue, - .dequeue = nbu2ss_ep_dequeue, - - .set_halt = nbu2ss_ep_set_halt, - .set_wedge = nbu2ss_ep_set_wedge, - - .fifo_status = nbu2ss_ep_fifo_status, - .fifo_flush = nbu2ss_ep_fifo_flush, -}; - -/*-------------------------------------------------------------------------*/ -/* usb_gadget_ops */ - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) -{ - u32 data; - struct nbu2ss_udc *udc; - - if (!pgadget) { - pr_err("udc: %s, bad param\n", __func__); - return -EINVAL; - } - - udc = container_of(pgadget, struct nbu2ss_udc, gadget); - data = gpiod_get_value(vbus_gpio); - if (data == 0) - return -EINVAL; - - return _nbu2ss_readl(&udc->p_regs->USB_ADDRESS) & FRAME; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) -{ - int i; - u32 data; - - struct nbu2ss_udc *udc; - - if (!pgadget) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - udc = container_of(pgadget, struct nbu2ss_udc, gadget); - - data = gpiod_get_value(vbus_gpio); - if (data == 0) { - dev_warn(&pgadget->dev, "VBUS LEVEL = %d\n", data); - return -EINVAL; - } - - _nbu2ss_bitset(&udc->p_regs->EPCTR, PLL_RESUME); - - for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { - data = _nbu2ss_readl(&udc->p_regs->EPCTR); - - if (data & PLL_LOCK) - break; - } - - _nbu2ss_bitclr(&udc->p_regs->EPCTR, PLL_RESUME); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget, - int is_selfpowered) -{ - struct nbu2ss_udc *udc; - unsigned long flags; - - if (!pgadget) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - udc = container_of(pgadget, struct nbu2ss_udc, gadget); - - spin_lock_irqsave(&udc->lock, flags); - pgadget->is_selfpowered = (is_selfpowered != 0); - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_vbus_session(struct usb_gadget *pgadget, int is_active) -{ - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned int mA) -{ - struct nbu2ss_udc *udc; - unsigned long flags; - - if (!pgadget) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - udc = container_of(pgadget, struct nbu2ss_udc, gadget); - - spin_lock_irqsave(&udc->lock, flags); - udc->mA = mA; - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) -{ - struct nbu2ss_udc *udc; - unsigned long flags; - - if (!pgadget) { - pr_err("%s, bad param\n", __func__); - return -EINVAL; - } - - udc = container_of(pgadget, struct nbu2ss_udc, gadget); - - if (!udc->driver) { - pr_warn("%s, Not Regist Driver\n", __func__); - return -EINVAL; - } - - if (udc->vbus_active == 0) - return -ESHUTDOWN; - - spin_lock_irqsave(&udc->lock, flags); - _nbu2ss_pullup(udc, is_on); - spin_unlock_irqrestore(&udc->lock, flags); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_ioctl(struct usb_gadget *pgadget, - unsigned int code, unsigned long param) -{ - return 0; -} - -static const struct usb_gadget_ops nbu2ss_gadget_ops = { - .get_frame = nbu2ss_gad_get_frame, - .wakeup = nbu2ss_gad_wakeup, - .set_selfpowered = nbu2ss_gad_set_selfpowered, - .vbus_session = nbu2ss_gad_vbus_session, - .vbus_draw = nbu2ss_gad_vbus_draw, - .pullup = nbu2ss_gad_pullup, - .ioctl = nbu2ss_gad_ioctl, -}; - -static const struct { - const char *name; - const struct usb_ep_caps caps; -} ep_info[NUM_ENDPOINTS] = { -#define EP_INFO(_name, _caps) \ - { \ - .name = _name, \ - .caps = _caps, \ - } - - EP_INFO("ep0", - USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep1-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep2-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep3in-int", - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), - EP_INFO("ep4-iso", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep5-iso", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep6-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep7-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("ep8in-int", - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), - EP_INFO("ep9-iso", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), - EP_INFO("epa-iso", - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), - EP_INFO("epb-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("epc-bulk", - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), - EP_INFO("epdin-int", - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), - -#undef EP_INFO -}; - -/*-------------------------------------------------------------------------*/ -static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc) -{ - int i; - - INIT_LIST_HEAD(&udc->gadget.ep_list); - udc->gadget.ep0 = &udc->ep[0].ep; - - for (i = 0; i < NUM_ENDPOINTS; i++) { - struct nbu2ss_ep *ep = &udc->ep[i]; - - ep->udc = udc; - ep->desc = NULL; - - ep->ep.driver_data = NULL; - ep->ep.name = ep_info[i].name; - ep->ep.caps = ep_info[i].caps; - ep->ep.ops = &nbu2ss_ep_ops; - - usb_ep_set_maxpacket_limit(&ep->ep, - i == 0 ? EP0_PACKETSIZE - : EP_PACKETSIZE); - - list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); - INIT_LIST_HEAD(&ep->queue); - } - - list_del_init(&udc->ep[0].ep.ep_list); -} - -/*-------------------------------------------------------------------------*/ -/* platform_driver */ -static int nbu2ss_drv_contest_init(struct platform_device *pdev, - struct nbu2ss_udc *udc) -{ - spin_lock_init(&udc->lock); - udc->dev = &pdev->dev; - - udc->gadget.is_selfpowered = 1; - udc->devstate = USB_STATE_NOTATTACHED; - udc->pdev = pdev; - udc->mA = 0; - - udc->pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - - /* init Endpoint */ - nbu2ss_drv_ep_init(udc); - - /* init Gadget */ - udc->gadget.ops = &nbu2ss_gadget_ops; - udc->gadget.ep0 = &udc->ep[0].ep; - udc->gadget.speed = USB_SPEED_UNKNOWN; - udc->gadget.name = driver_name; - /* udc->gadget.is_dualspeed = 1; */ - - device_initialize(&udc->gadget.dev); - - dev_set_name(&udc->gadget.dev, "gadget"); - udc->gadget.dev.parent = &pdev->dev; - udc->gadget.dev.dma_mask = pdev->dev.dma_mask; - - return 0; -} - -/* - * probe - binds to the platform device - */ -static int nbu2ss_drv_probe(struct platform_device *pdev) -{ - int status; - struct nbu2ss_udc *udc; - int irq; - void __iomem *mmio_base; - - udc = &udc_controller; - memset(udc, 0, sizeof(struct nbu2ss_udc)); - - platform_set_drvdata(pdev, udc); - - /* require I/O memory and IRQ to be provided as resources */ - mmio_base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(mmio_base)) - return PTR_ERR(mmio_base); - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; - status = devm_request_irq(&pdev->dev, irq, _nbu2ss_udc_irq, - 0, driver_name, udc); - - /* IO Memory */ - udc->p_regs = (struct fc_regs __iomem *)mmio_base; - - /* USB Function Controller Interrupt */ - if (status != 0) { - dev_err(udc->dev, "request_irq(USB_UDC_IRQ_1) failed\n"); - return status; - } - - /* Driver Initialization */ - status = nbu2ss_drv_contest_init(pdev, udc); - if (status < 0) { - /* Error */ - return status; - } - - /* VBUS Interrupt */ - vbus_irq = gpiod_to_irq(vbus_gpio); - irq_set_irq_type(vbus_irq, IRQ_TYPE_EDGE_BOTH); - status = request_irq(vbus_irq, - _nbu2ss_vbus_irq, IRQF_SHARED, driver_name, udc); - - if (status != 0) { - dev_err(udc->dev, "request_irq(vbus_irq) failed\n"); - return status; - } - - return status; -} - -/*-------------------------------------------------------------------------*/ -static void nbu2ss_drv_shutdown(struct platform_device *pdev) -{ - struct nbu2ss_udc *udc; - - udc = platform_get_drvdata(pdev); - if (!udc) - return; - - _nbu2ss_disable_controller(udc); -} - -/*-------------------------------------------------------------------------*/ -static void nbu2ss_drv_remove(struct platform_device *pdev) -{ - struct nbu2ss_udc *udc; - struct nbu2ss_ep *ep; - int i; - - udc = &udc_controller; - - for (i = 0; i < NUM_ENDPOINTS; i++) { - ep = &udc->ep[i]; - if (ep->virt_buf) - dma_free_coherent(udc->dev, PAGE_SIZE, (void *)ep->virt_buf, - ep->phys_buf); - } - - /* Interrupt Handler - Release */ - free_irq(vbus_irq, udc); -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state) -{ - struct nbu2ss_udc *udc; - - udc = platform_get_drvdata(pdev); - if (!udc) - return 0; - - if (udc->vbus_active) { - udc->vbus_active = 0; - udc->devstate = USB_STATE_NOTATTACHED; - udc->linux_suspended = 1; - - if (udc->usb_suspended) { - udc->usb_suspended = 0; - _nbu2ss_reset_controller(udc); - } - - _nbu2ss_quiesce(udc); - } - _nbu2ss_disable_controller(udc); - - return 0; -} - -/*-------------------------------------------------------------------------*/ -static int nbu2ss_drv_resume(struct platform_device *pdev) -{ - u32 data; - struct nbu2ss_udc *udc; - - udc = platform_get_drvdata(pdev); - if (!udc) - return 0; - - data = gpiod_get_value(vbus_gpio); - if (data) { - udc->vbus_active = 1; - udc->devstate = USB_STATE_POWERED; - _nbu2ss_enable_controller(udc); - _nbu2ss_pullup(udc, 1); - } - - udc->linux_suspended = 0; - - return 0; -} - -static struct platform_driver udc_driver = { - .probe = nbu2ss_drv_probe, - .shutdown = nbu2ss_drv_shutdown, - .remove_new = nbu2ss_drv_remove, - .suspend = nbu2ss_drv_suspend, - .resume = nbu2ss_drv_resume, - .driver = { - .name = driver_name, - }, -}; - -module_platform_driver(udc_driver); - -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_AUTHOR("Renesas Electronics Corporation"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h deleted file mode 100644 index c9e37a1b8139..000000000000 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ /dev/null @@ -1,554 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * EMXX FCD (Function Controller Driver) for USB. - * - * Copyright (C) 2010 Renesas Electronics Corporation - */ - -#ifndef _LINUX_EMXX_H -#define _LINUX_EMXX_H - -/*---------------------------------------------------------------------------*/ - -/*----------------- Default define */ -#define USE_DMA 1 -#define USE_SUSPEND_WAIT 1 - -/*------------ Board dependence(Resource) */ -#define VBUS_VALUE GPIO_VBUS - -/* below hacked up for staging integration */ -#define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ -#define INT_VBUS 0 /* IRQ for GPIO_P153 */ - -/*------------ Board dependence(Wait) */ - -/* CHATTERING wait time ms */ -#define VBUS_CHATTERING_MDELAY 1 -/* DMA Abort wait time ms */ -#define DMA_DISABLE_TIME 10 - -/*------------ Controller dependence */ -#define NUM_ENDPOINTS 14 /* Endpoint */ -#define REG_EP_NUM 15 /* Endpoint Register */ -#define DMA_MAX_COUNT 256 /* DMA Block */ - -#define EPC_RST_DISABLE_TIME 1 /* 1 usec */ -#define EPC_DIRPD_DISABLE_TIME 1 /* 1 msec */ -#define EPC_PLL_LOCK_COUNT 1000 /* 1000 */ -#define IN_DATA_EMPTY_COUNT 1000 /* 1000 */ - -#define CHATGER_TIME 700 /* 700msec */ -#define USB_SUSPEND_TIME 2000 /* 2 sec */ - -/* U2F FLAG */ -#define U2F_ENABLE 1 -#define U2F_DISABLE 0 - -#define TEST_FORCE_ENABLE (BIT(18) | BIT(16)) - -#define INT_SEL BIT(10) -#define CONSTFS BIT(9) -#define SOF_RCV BIT(8) -#define RSUM_IN BIT(7) -#define SUSPEND BIT(6) -#define CONF BIT(5) -#define DEFAULT BIT(4) -#define CONNECTB BIT(3) -#define PUE2 BIT(2) - -#define MAX_TEST_MODE_NUM 0x05 -#define TEST_MODE_SHIFT 16 - -/*------- (0x0004) USB Status Register */ -#define SPEED_MODE BIT(6) -#define HIGH_SPEED BIT(6) - -#define CONF BIT(5) -#define DEFAULT BIT(4) -#define USB_RST BIT(3) -#define SPND_OUT BIT(2) -#define RSUM_OUT BIT(1) - -/*------- (0x0008) USB Address Register */ -#define USB_ADDR 0x007F0000 -#define SOF_STATUS BIT(15) -#define UFRAME (BIT(14) | BIT(13) | BIT(12)) -#define FRAME 0x000007FF - -#define USB_ADRS_SHIFT 16 - -/*------- (0x000C) UTMI Characteristic 1 Register */ -#define SQUSET (BIT(7) | BIT(6) | BIT(5) | BIT(4)) - -#define USB_SQUSET (BIT(6) | BIT(5) | BIT(4)) - -/*------- (0x0010) TEST Control Register */ -#define FORCEHS BIT(2) -#define CS_TESTMODEEN BIT(1) -#define LOOPBACK BIT(0) - -/*------- (0x0018) Setup Data 0 Register */ -/*------- (0x001C) Setup Data 1 Register */ - -/*------- (0x0020) USB Interrupt Status Register */ -#define EPN_INT 0x00FFFF00 -#define EP15_INT BIT(23) -#define EP14_INT BIT(22) -#define EP13_INT BIT(21) -#define EP12_INT BIT(20) -#define EP11_INT BIT(19) -#define EP10_INT BIT(18) -#define EP9_INT BIT(17) -#define EP8_INT BIT(16) -#define EP7_INT BIT(15) -#define EP6_INT BIT(14) -#define EP5_INT BIT(13) -#define EP4_INT BIT(12) -#define EP3_INT BIT(11) -#define EP2_INT BIT(10) -#define EP1_INT BIT(9) -#define EP0_INT BIT(8) -#define SPEED_MODE_INT BIT(6) -#define SOF_ERROR_INT BIT(5) -#define SOF_INT BIT(4) -#define USB_RST_INT BIT(3) -#define SPND_INT BIT(2) -#define RSUM_INT BIT(1) - -#define USB_INT_STA_RW 0x7E - -/*------- (0x0024) USB Interrupt Enable Register */ -#define EP15_0_EN 0x00FFFF00 -#define EP15_EN BIT(23) -#define EP14_EN BIT(22) -#define EP13_EN BIT(21) -#define EP12_EN BIT(20) -#define EP11_EN BIT(19) -#define EP10_EN BIT(18) -#define EP9_EN BIT(17) -#define EP8_EN BIT(16) -#define EP7_EN BIT(15) -#define EP6_EN BIT(14) -#define EP5_EN BIT(13) -#define EP4_EN BIT(12) -#define EP3_EN BIT(11) -#define EP2_EN BIT(10) -#define EP1_EN BIT(9) -#define EP0_EN BIT(8) -#define SPEED_MODE_EN BIT(6) -#define SOF_ERROR_EN BIT(5) -#define SOF_EN BIT(4) -#define USB_RST_EN BIT(3) -#define SPND_EN BIT(2) -#define RSUM_EN BIT(1) - -#define USB_INT_EN_BIT \ - (EP0_EN | SPEED_MODE_EN | USB_RST_EN | SPND_EN | RSUM_EN) - -/*------- (0x0028) EP0 Control Register */ -#define EP0_STGSEL BIT(18) -#define EP0_OVERSEL BIT(17) -#define EP0_AUTO BIT(16) -#define EP0_PIDCLR BIT(9) -#define EP0_BCLR BIT(8) -#define EP0_DEND BIT(7) -#define EP0_DW (BIT(6) | BIT(5)) -#define EP0_DW4 0 -#define EP0_DW3 (BIT(6) | BIT(5)) -#define EP0_DW2 BIT(6) -#define EP0_DW1 BIT(5) - -#define EP0_INAK_EN BIT(4) -#define EP0_PERR_NAK_CLR BIT(3) -#define EP0_STL BIT(2) -#define EP0_INAK BIT(1) -#define EP0_ONAK BIT(0) - -/*------- (0x002C) EP0 Status Register */ -#define EP0_PID BIT(18) -#define EP0_PERR_NAK BIT(17) -#define EP0_PERR_NAK_INT BIT(16) -#define EP0_OUT_NAK_INT BIT(15) -#define EP0_OUT_NULL BIT(14) -#define EP0_OUT_FULL BIT(13) -#define EP0_OUT_EMPTY BIT(12) -#define EP0_IN_NAK_INT BIT(11) -#define EP0_IN_DATA BIT(10) -#define EP0_IN_FULL BIT(9) -#define EP0_IN_EMPTY BIT(8) -#define EP0_OUT_NULL_INT BIT(7) -#define EP0_OUT_OR_INT BIT(6) -#define EP0_OUT_INT BIT(5) -#define EP0_IN_INT BIT(4) -#define EP0_STALL_INT BIT(3) -#define STG_END_INT BIT(2) -#define STG_START_INT BIT(1) -#define SETUP_INT BIT(0) - -#define EP0_STATUS_RW_BIT (BIT(16) | BIT(15) | BIT(11) | 0xFF) - -/*------- (0x0030) EP0 Interrupt Enable Register */ -#define EP0_PERR_NAK_EN BIT(16) -#define EP0_OUT_NAK_EN BIT(15) - -#define EP0_IN_NAK_EN BIT(11) - -#define EP0_OUT_NULL_EN BIT(7) -#define EP0_OUT_OR_EN BIT(6) -#define EP0_OUT_EN BIT(5) -#define EP0_IN_EN BIT(4) -#define EP0_STALL_EN BIT(3) -#define STG_END_EN BIT(2) -#define STG_START_EN BIT(1) -#define SETUP_EN BIT(0) - -#define EP0_INT_EN_BIT \ - (EP0_OUT_OR_EN | EP0_OUT_EN | EP0_IN_EN | STG_END_EN | SETUP_EN) - -/*------- (0x0034) EP0 Length Register */ -#define EP0_LDATA 0x0000007F - -/*------- (0x0038) EP0 Read Register */ -/*------- (0x003C) EP0 Write Register */ - -/*------- (0x0040:) EPN Control Register */ -#define EPN_EN BIT(31) -#define EPN_BUF_TYPE BIT(30) -#define EPN_BUF_SINGLE BIT(30) - -#define EPN_DIR0 BIT(26) -#define EPN_MODE (BIT(25) | BIT(24)) -#define EPN_BULK 0 -#define EPN_INTERRUPT BIT(24) -#define EPN_ISO BIT(25) - -#define EPN_OVERSEL BIT(17) -#define EPN_AUTO BIT(16) - -#define EPN_IPIDCLR BIT(11) -#define EPN_OPIDCLR BIT(10) -#define EPN_BCLR BIT(9) -#define EPN_CBCLR BIT(8) -#define EPN_DEND BIT(7) -#define EPN_DW (BIT(6) | BIT(5)) -#define EPN_DW4 0 -#define EPN_DW3 (BIT(6) | BIT(5)) -#define EPN_DW2 BIT(6) -#define EPN_DW1 BIT(5) - -#define EPN_OSTL_EN BIT(4) -#define EPN_ISTL BIT(3) -#define EPN_OSTL BIT(2) - -#define EPN_ONAK BIT(0) - -/*------- (0x0044:) EPN Status Register */ -#define EPN_ISO_PIDERR BIT(29) /* R */ -#define EPN_OPID BIT(28) /* R */ -#define EPN_OUT_NOTKN BIT(27) /* R */ -#define EPN_ISO_OR BIT(26) /* R */ - -#define EPN_ISO_CRC BIT(24) /* R */ -#define EPN_OUT_END_INT BIT(23) /* RW */ -#define EPN_OUT_OR_INT BIT(22) /* RW */ -#define EPN_OUT_NAK_ERR_INT BIT(21) /* RW */ -#define EPN_OUT_STALL_INT BIT(20) /* RW */ -#define EPN_OUT_INT BIT(19) /* RW */ -#define EPN_OUT_NULL_INT BIT(18) /* RW */ -#define EPN_OUT_FULL BIT(17) /* R */ -#define EPN_OUT_EMPTY BIT(16) /* R */ - -#define EPN_IPID BIT(10) /* R */ -#define EPN_IN_NOTKN BIT(9) /* R */ -#define EPN_ISO_UR BIT(8) /* R */ -#define EPN_IN_END_INT BIT(7) /* RW */ - -#define EPN_IN_NAK_ERR_INT BIT(5) /* RW */ -#define EPN_IN_STALL_INT BIT(4) /* RW */ -#define EPN_IN_INT BIT(3) /* RW */ -#define EPN_IN_DATA BIT(2) /* R */ -#define EPN_IN_FULL BIT(1) /* R */ -#define EPN_IN_EMPTY BIT(0) /* R */ - -#define EPN_INT_EN \ - (EPN_OUT_END_INT | EPN_OUT_INT | EPN_IN_END_INT | EPN_IN_INT) - -/*------- (0x0048:) EPN Interrupt Enable Register */ -#define EPN_OUT_END_EN BIT(23) /* RW */ -#define EPN_OUT_OR_EN BIT(22) /* RW */ -#define EPN_OUT_NAK_ERR_EN BIT(21) /* RW */ -#define EPN_OUT_STALL_EN BIT(20) /* RW */ -#define EPN_OUT_EN BIT(19) /* RW */ -#define EPN_OUT_NULL_EN BIT(18) /* RW */ - -#define EPN_IN_END_EN BIT(7) /* RW */ - -#define EPN_IN_NAK_ERR_EN BIT(5) /* RW */ -#define EPN_IN_STALL_EN BIT(4) /* RW */ -#define EPN_IN_EN BIT(3) /* RW */ - -/*------- (0x004C:) EPN Interrupt Enable Register */ -#define EPN_STOP_MODE BIT(11) -#define EPN_DEND_SET BIT(10) -#define EPN_BURST_SET BIT(9) -#define EPN_STOP_SET BIT(8) - -#define EPN_DMA_EN BIT(4) - -#define EPN_DMAMODE0 BIT(0) - -/*------- (0x0050:) EPN MaxPacket & BaseAddress Register */ -#define EPN_BASEAD 0x1FFF0000 -#define EPN_MPKT 0x000007FF - -/*------- (0x0054:) EPN Length & DMA Count Register */ -#define EPN_DMACNT 0x01FF0000 -#define EPN_LDATA 0x000007FF - -/*------- (0x0058:) EPN Read Register */ -/*------- (0x005C:) EPN Write Register */ - -/*------- (0x1000) AHBSCTR Register */ -#define WAIT_MODE BIT(0) - -/*------- (0x1004) AHBMCTR Register */ -#define ARBITER_CTR BIT(31) /* RW */ -#define MCYCLE_RST BIT(12) /* RW */ - -#define ENDIAN_CTR (BIT(9) | BIT(8)) /* RW */ -#define ENDIAN_BYTE_SWAP BIT(9) -#define ENDIAN_HALF_WORD_SWAP ENDIAN_CTR - -#define HBUSREQ_MODE BIT(5) /* RW */ -#define HTRANS_MODE BIT(4) /* RW */ - -#define WBURST_TYPE BIT(2) /* RW */ -#define BURST_TYPE (BIT(1) | BIT(0)) /* RW */ -#define BURST_MAX_16 0 -#define BURST_MAX_8 BIT(0) -#define BURST_MAX_4 BIT(1) -#define BURST_SINGLE BURST_TYPE - -/*------- (0x1008) AHBBINT Register */ -#define DMA_ENDINT 0xFFFE0000 /* RW */ - -#define AHB_VBUS_INT BIT(13) /* RW */ - -#define MBUS_ERRINT BIT(6) /* RW */ - -#define SBUS_ERRINT0 BIT(4) /* RW */ -#define ERR_MASTER 0x0000000F /* R */ - -/*------- (0x100C) AHBBINTEN Register */ -#define DMA_ENDINTEN 0xFFFE0000 /* RW */ - -#define VBUS_INTEN BIT(13) /* RW */ - -#define MBUS_ERRINTEN BIT(6) /* RW */ - -#define SBUS_ERRINT0EN BIT(4) /* RW */ - -/*------- (0x1010) EPCTR Register */ -#define DIRPD BIT(12) /* RW */ - -#define VBUS_LEVEL BIT(8) /* R */ - -#define PLL_RESUME BIT(5) /* RW */ -#define PLL_LOCK BIT(4) /* R */ - -#define EPC_RST BIT(0) /* RW */ - -/*------- (0x1014) USBF_EPTEST Register */ -#define LINESTATE (BIT(9) | BIT(8)) /* R */ -#define DM_LEVEL BIT(9) /* R */ -#define DP_LEVEL BIT(8) /* R */ - -#define PHY_TST BIT(1) /* RW */ -#define PHY_TSTCLK BIT(0) /* RW */ - -/*------- (0x1020) USBSSVER Register */ -#define AHBB_VER 0x00FF0000 /* R */ -#define EPC_VER 0x0000FF00 /* R */ -#define SS_VER 0x000000FF /* R */ - -/*------- (0x1024) USBSSCONF Register */ -#define EP_AVAILABLE 0xFFFF0000 /* R */ -#define DMA_AVAILABLE 0x0000FFFF /* R */ - -/*------- (0x1110:) EPNDCR1 Register */ -#define DCR1_EPN_DMACNT 0x00FF0000 /* RW */ - -#define DCR1_EPN_DIR0 BIT(1) /* RW */ -#define DCR1_EPN_REQEN BIT(0) /* RW */ - -/*------- (0x1114:) EPNDCR2 Register */ -#define DCR2_EPN_LMPKT 0x07FF0000 /* RW */ - -#define DCR2_EPN_MPKT 0x000007FF /* RW */ - -/*------- (0x1118:) EPNTADR Register */ -#define EPN_TADR 0xFFFFFFFF /* RW */ - -/*===========================================================================*/ -/* Struct */ -/*------- ep_regs */ -struct ep_regs { - u32 EP_CONTROL; /* EP Control */ - u32 EP_STATUS; /* EP Status */ - u32 EP_INT_ENA; /* EP Interrupt Enable */ - u32 EP_DMA_CTRL; /* EP DMA Control */ - u32 EP_PCKT_ADRS; /* EP Maxpacket & BaseAddress */ - u32 EP_LEN_DCNT; /* EP Length & DMA count */ - u32 EP_READ; /* EP Read */ - u32 EP_WRITE; /* EP Write */ -}; - -/*------- ep_dcr */ -struct ep_dcr { - u32 EP_DCR1; /* EP_DCR1 */ - u32 EP_DCR2; /* EP_DCR2 */ - u32 EP_TADR; /* EP_TADR */ - u32 Reserved; /* Reserved */ -}; - -/*------- Function Registers */ -struct fc_regs { - u32 USB_CONTROL; /* (0x0000) USB Control */ - u32 USB_STATUS; /* (0x0004) USB Status */ - u32 USB_ADDRESS; /* (0x0008) USB Address */ - u32 UTMI_CHARACTER_1; /* (0x000C) UTMI Setting */ - u32 TEST_CONTROL; /* (0x0010) TEST Control */ - u32 reserved_14; /* (0x0014) Reserved */ - u32 SETUP_DATA0; /* (0x0018) Setup Data0 */ - u32 SETUP_DATA1; /* (0x001C) Setup Data1 */ - u32 USB_INT_STA; /* (0x0020) USB Interrupt Status */ - u32 USB_INT_ENA; /* (0x0024) USB Interrupt Enable */ - u32 EP0_CONTROL; /* (0x0028) EP0 Control */ - u32 EP0_STATUS; /* (0x002C) EP0 Status */ - u32 EP0_INT_ENA; /* (0x0030) EP0 Interrupt Enable */ - u32 EP0_LENGTH; /* (0x0034) EP0 Length */ - u32 EP0_READ; /* (0x0038) EP0 Read */ - u32 EP0_WRITE; /* (0x003C) EP0 Write */ - - struct ep_regs EP_REGS[REG_EP_NUM]; /* Endpoint Register */ - - u8 reserved_220[0x1000 - 0x220]; /* (0x0220:0x0FFF) Reserved */ - - u32 AHBSCTR; /* (0x1000) AHBSCTR */ - u32 AHBMCTR; /* (0x1004) AHBMCTR */ - u32 AHBBINT; /* (0x1008) AHBBINT */ - u32 AHBBINTEN; /* (0x100C) AHBBINTEN */ - u32 EPCTR; /* (0x1010) EPCTR */ - u32 USBF_EPTEST; /* (0x1014) USBF_EPTEST */ - - u8 reserved_1018[0x20 - 0x18]; /* (0x1018:0x101F) Reserved */ - - u32 USBSSVER; /* (0x1020) USBSSVER */ - u32 USBSSCONF; /* (0x1024) USBSSCONF */ - - u8 reserved_1028[0x110 - 0x28]; /* (0x1028:0x110F) Reserved */ - - struct ep_dcr EP_DCR[REG_EP_NUM]; /* */ - - u8 reserved_1200[0x1000 - 0x200]; /* Reserved */ -} __aligned(32); - -#define EP0_PACKETSIZE 64 -#define EP_PACKETSIZE 1024 - -/* EPN RAM SIZE */ -#define D_RAM_SIZE_CTRL 64 - -/* EPN Bulk Endpoint Max Packet Size */ -#define D_FS_RAM_SIZE_BULK 64 -#define D_HS_RAM_SIZE_BULK 512 - -struct nbu2ss_udc; - -enum ep0_state { - EP0_IDLE, - EP0_IN_DATA_PHASE, - EP0_OUT_DATA_PHASE, - EP0_IN_STATUS_PHASE, - EP0_OUT_STATUS_PAHSE, - EP0_END_XFER, - EP0_SUSPEND, - EP0_STALL, -}; - -struct nbu2ss_req { - struct usb_request req; - struct list_head queue; - - u32 div_len; - bool dma_flag; - bool zero; - - bool unaligned; - - unsigned mapped:1; -}; - -struct nbu2ss_ep { - struct usb_ep ep; - struct list_head queue; - - struct nbu2ss_udc *udc; - - const struct usb_endpoint_descriptor *desc; - - u8 epnum; - u8 direct; - u8 ep_type; - - unsigned wedged:1; - unsigned halted:1; - unsigned stalled:1; - - u8 *virt_buf; - dma_addr_t phys_buf; -}; - -struct nbu2ss_udc { - struct usb_gadget gadget; - struct usb_gadget_driver *driver; - struct platform_device *pdev; - struct device *dev; - spinlock_t lock; /* Protects nbu2ss_udc structure fields */ - struct completion *pdone; - - enum ep0_state ep0state; - enum usb_device_state devstate; - struct usb_ctrlrequest ctrl; - struct nbu2ss_req ep0_req; - u8 ep0_buf[EP0_PACKETSIZE]; - - struct nbu2ss_ep ep[NUM_ENDPOINTS]; - - unsigned softconnect:1; - unsigned vbus_active:1; - unsigned linux_suspended:1; - unsigned linux_resume:1; - unsigned usb_suspended:1; - unsigned remote_wakeup:1; - unsigned udc_enabled:1; - - unsigned int mA; - - u32 curr_config; /* Current Configuration Number */ - - struct fc_regs __iomem *p_regs; -}; - -/* USB register access structure */ -union usb_reg_access { - struct { - unsigned char DATA[4]; - } byte; - unsigned int dw; -}; - -/*-------------------------------------------------------------------------*/ - -#endif /* _LINUX_EMXX_H */ diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 68add4d598ae..38845f23023f 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -327,7 +327,6 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflis unsigned int dirty_lines_start, dirty_lines_end; struct fb_deferred_io_pageref *pageref; unsigned int y_low = 0, y_high = 0; - int count = 0; spin_lock(&par->dirty_lock); dirty_lines_start = par->dirty_lines_start; @@ -339,7 +338,6 @@ static void fbtft_deferred_io(struct fb_info *info, struct list_head *pagereflis /* Mark display lines as dirty */ list_for_each_entry(pageref, pagereflist, list) { - count++; y_low = pageref->offset / info->fix.line_length; y_high = (pageref->offset + PAGE_SIZE - 1) / info->fix.line_length; dev_dbg(info->device, diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c index 34d18b09bedd..fcd3e3722ae0 100644 --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c @@ -285,7 +285,7 @@ static int controller_probe(struct platform_device *pdev) } } - id = ida_simple_get(&controller_index_ida, 0, 0, GFP_KERNEL); + id = ida_alloc(&controller_index_ida, GFP_KERNEL); if (id < 0) { err = id; goto out_reset; @@ -318,7 +318,7 @@ static int controller_probe(struct platform_device *pdev) out_dev: put_device(cd->class_dev); out_ida: - ida_simple_remove(&controller_index_ida, id); + ida_free(&controller_index_ida, id); out_reset: gpiod_set_value_cansleep(cd->reset_gpiod, 1); return err; @@ -330,7 +330,7 @@ static void controller_remove(struct platform_device *pdev) int id = cd->class_dev->id; device_unregister(cd->class_dev); - ida_simple_remove(&controller_index_ida, id); + ida_free(&controller_index_ida, id); gpiod_set_value_cansleep(cd->reset_gpiod, 1); } diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index cd86b9c9e345..410e6f8073c0 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1195,7 +1195,7 @@ static void anybus_bus_remove(struct device *dev) adrv->remove(to_anybuss_client(dev)); } -static struct bus_type anybus_bus = { +static const struct bus_type anybus_bus = { .name = "anybuss", .match = anybus_bus_match, .probe = anybus_bus_probe, diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c index bf1812d8924f..0053ebd91442 100644 --- a/drivers/staging/fieldbus/dev_core.c +++ b/drivers/staging/fieldbus/dev_core.c @@ -152,7 +152,7 @@ static const struct attribute_group fieldbus_group = { }; __ATTRIBUTE_GROUPS(fieldbus); -static struct class fieldbus_class = { +static const struct class fieldbus_class = { .name = "fieldbus_dev", .dev_groups = fieldbus_groups, }; @@ -247,7 +247,7 @@ static void __fieldbus_dev_unregister(struct fieldbus_dev *fb) return; device_destroy(&fieldbus_class, fb->cdev.dev); cdev_del(&fb->cdev); - ida_simple_remove(&fieldbus_ida, fb->id); + ida_free(&fieldbus_ida, fb->id); } void fieldbus_dev_unregister(struct fieldbus_dev *fb) @@ -267,7 +267,7 @@ static int __fieldbus_dev_register(struct fieldbus_dev *fb) return -EINVAL; if (!fb->read_area || !fb->write_area || !fb->fieldbus_id_get) return -EINVAL; - fb->id = ida_simple_get(&fieldbus_ida, 0, MAX_FIELDBUSES, GFP_KERNEL); + fb->id = ida_alloc_max(&fieldbus_ida, MAX_FIELDBUSES - 1, GFP_KERNEL); if (fb->id < 0) return fb->id; devno = MKDEV(MAJOR(fieldbus_devt), fb->id); @@ -290,7 +290,7 @@ static int __fieldbus_dev_register(struct fieldbus_dev *fb) err_dev_create: cdev_del(&fb->cdev); err_cdev: - ida_simple_remove(&fieldbus_ida, fb->id); + ida_free(&fieldbus_ida, fb->id); return err; } diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 5703a9ddb6d0..eb754b231429 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -43,7 +43,7 @@ static struct { struct sock *sock; } lte_event; -static struct device_type wwan_type = { +static const struct device_type wwan_type = { .name = "wwan", }; diff --git a/drivers/staging/greybus/audio_apbridgea.h b/drivers/staging/greybus/audio_apbridgea.h index efec0f815efd..ab707d310129 100644 --- a/drivers/staging/greybus/audio_apbridgea.h +++ b/drivers/staging/greybus/audio_apbridgea.h @@ -65,7 +65,6 @@ struct audio_apbridgea_hdr { __u8 type; __le16 i2s_port; - __u8 data[]; } __packed; struct audio_apbridgea_set_config_request { diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c index 9a3f7c034ab4..fa43d35bbcec 100644 --- a/drivers/staging/greybus/audio_manager.c +++ b/drivers/staging/greybus/audio_manager.c @@ -44,14 +44,14 @@ int gb_audio_manager_add(struct gb_audio_manager_module_descriptor *desc) int id; int err; - id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL); + id = ida_alloc(&module_id, GFP_KERNEL); if (id < 0) return id; err = gb_audio_manager_module_create(&module, manager_kset, id, desc); if (err) { - ida_simple_remove(&module_id, id); + ida_free(&module_id, id); return err; } @@ -78,7 +78,7 @@ int gb_audio_manager_remove(int id) list_del(&module->list); kobject_put(&module->kobj); up_write(&modules_rwsem); - ida_simple_remove(&module_id, id); + ida_free(&module_id, id); return 0; } EXPORT_SYMBOL_GPL(gb_audio_manager_remove); @@ -92,7 +92,7 @@ void gb_audio_manager_remove_all(void) list_for_each_entry_safe(module, next, &modules_list, list) { list_del(&module->list); - ida_simple_remove(&module_id, module->id); + ida_free(&module_id, module->id); kobject_put(&module->kobj); } diff --git a/drivers/staging/greybus/audio_topology.c b/drivers/staging/greybus/audio_topology.c index 08e6a807c132..5dc4721105d4 100644 --- a/drivers/staging/greybus/audio_topology.c +++ b/drivers/staging/greybus/audio_topology.c @@ -761,7 +761,6 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, { int ret, wi, ctl_id; unsigned int val, mux, change; - unsigned int mask; struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); struct snd_soc_dapm_widget *widget = wlist->widgets[0]; struct gb_audio_ctl_elem_value gbvalue; @@ -802,7 +801,6 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, mux = ucontrol->value.enumerated.item[0]; val = mux << e->shift_l; - mask = e->mask << e->shift_l; if (le32_to_cpu(gbvalue.value.enumerated_item[0]) != ucontrol->value.enumerated.item[0]) { @@ -815,7 +813,6 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, if (ucontrol->value.enumerated.item[1] > e->items - 1) return -EINVAL; val |= ucontrol->value.enumerated.item[1] << e->shift_r; - mask |= e->mask << e->shift_r; if (le32_to_cpu(gbvalue.value.enumerated_item[1]) != ucontrol->value.enumerated.item[1]) { change = 1; diff --git a/drivers/staging/greybus/authentication.c b/drivers/staging/greybus/authentication.c index b67315641d18..d53e58f92e81 100644 --- a/drivers/staging/greybus/authentication.c +++ b/drivers/staging/greybus/authentication.c @@ -324,7 +324,7 @@ int gb_cap_connection_init(struct gb_connection *connection) if (ret) goto err_list_del; - minor = ida_simple_get(&cap_minors_map, 0, NUM_MINORS, GFP_KERNEL); + minor = ida_alloc_max(&cap_minors_map, NUM_MINORS - 1, GFP_KERNEL); if (minor < 0) { ret = minor; goto err_connection_disable; @@ -351,7 +351,7 @@ int gb_cap_connection_init(struct gb_connection *connection) err_del_cdev: cdev_del(&cap->cdev); err_remove_ida: - ida_simple_remove(&cap_minors_map, minor); + ida_free(&cap_minors_map, minor); err_connection_disable: gb_connection_disable(connection); err_list_del: @@ -375,7 +375,7 @@ void gb_cap_connection_exit(struct gb_connection *connection) device_destroy(&cap_class, cap->dev_num); cdev_del(&cap->cdev); - ida_simple_remove(&cap_minors_map, MINOR(cap->dev_num)); + ida_free(&cap_minors_map, MINOR(cap->dev_num)); /* * Disallow any new ioctl operations on the char device and wait for diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index 79581457c4af..c0d338db6b52 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -243,10 +243,10 @@ static int gb_bootrom_get_firmware(struct gb_operation *op) struct gb_bootrom *bootrom = gb_connection_get_data(op->connection); const struct firmware *fw; struct gb_bootrom_get_firmware_request *firmware_request; - struct gb_bootrom_get_firmware_response *firmware_response; struct device *dev = &op->connection->bundle->dev; unsigned int offset, size; enum next_request_type next_request; + u8 *firmware_response; int ret = 0; /* Disable timeouts */ @@ -280,15 +280,15 @@ static int gb_bootrom_get_firmware(struct gb_operation *op) goto unlock; } - if (!gb_operation_response_alloc(op, sizeof(*firmware_response) + size, - GFP_KERNEL)) { + /* gb_bootrom_get_firmware_response contains only a byte array */ + if (!gb_operation_response_alloc(op, size, GFP_KERNEL)) { dev_err(dev, "%s: error allocating response\n", __func__); ret = -ENOMEM; goto unlock; } firmware_response = op->response->payload; - memcpy(firmware_response->data, fw->data + offset, size); + memcpy(firmware_response, fw->data + offset, size); dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", offset, size); diff --git a/drivers/staging/greybus/fw-download.c b/drivers/staging/greybus/fw-download.c index 543692c567f9..9a09bd3af79b 100644 --- a/drivers/staging/greybus/fw-download.c +++ b/drivers/staging/greybus/fw-download.c @@ -63,8 +63,7 @@ static void fw_req_release(struct kref *kref) * just hope that it never happens. */ if (!fw_req->timedout) - ida_simple_remove(&fw_req->fw_download->id_map, - fw_req->firmware_id); + ida_free(&fw_req->fw_download->id_map, fw_req->firmware_id); kfree(fw_req); } @@ -171,7 +170,7 @@ static struct fw_request *find_firmware(struct fw_download *fw_download, return ERR_PTR(-ENOMEM); /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ - ret = ida_simple_get(&fw_download->id_map, 1, 256, GFP_KERNEL); + ret = ida_alloc_range(&fw_download->id_map, 1, 255, GFP_KERNEL); if (ret < 0) { dev_err(fw_download->parent, "failed to allocate firmware id (%d)\n", ret); @@ -212,7 +211,7 @@ static struct fw_request *find_firmware(struct fw_download *fw_download, return fw_req; err_free_id: - ida_simple_remove(&fw_download->id_map, fw_req->firmware_id); + ida_free(&fw_download->id_map, fw_req->firmware_id); err_free_req: kfree(fw_req); @@ -271,11 +270,11 @@ static int fw_download_fetch_firmware(struct gb_operation *op) struct gb_connection *connection = op->connection; struct fw_download *fw_download = gb_connection_get_data(connection); struct gb_fw_download_fetch_firmware_request *request; - struct gb_fw_download_fetch_firmware_response *response; struct fw_request *fw_req; const struct firmware *fw; unsigned int offset, size; u8 firmware_id; + u8 *response; int ret = 0; if (op->request->payload_size != sizeof(*request)) { @@ -325,8 +324,8 @@ static int fw_download_fetch_firmware(struct gb_operation *op) goto put_fw; } - if (!gb_operation_response_alloc(op, sizeof(*response) + size, - GFP_KERNEL)) { + /* gb_fw_download_fetch_firmware_response contains only a byte array */ + if (!gb_operation_response_alloc(op, size, GFP_KERNEL)) { dev_err(fw_download->parent, "error allocating fetch firmware response\n"); ret = -ENOMEM; @@ -334,7 +333,7 @@ static int fw_download_fetch_firmware(struct gb_operation *op) } response = op->response->payload; - memcpy(response->data, fw->data + offset, size); + memcpy(response, fw->data + offset, size); dev_dbg(fw_download->parent, "responding with firmware (offs = %u, size = %u)\n", offset, diff --git a/drivers/staging/greybus/fw-management.c b/drivers/staging/greybus/fw-management.c index 93137a3c4907..3054f084d777 100644 --- a/drivers/staging/greybus/fw-management.c +++ b/drivers/staging/greybus/fw-management.c @@ -165,7 +165,7 @@ static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt, } /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ - ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL); + ret = ida_alloc_range(&fw_mgmt->id_map, 1, 255, GFP_KERNEL); if (ret < 0) { dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n", ret); @@ -180,8 +180,7 @@ static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt, GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW, &request, sizeof(request), NULL, 0); if (ret) { - ida_simple_remove(&fw_mgmt->id_map, - fw_mgmt->intf_fw_request_id); + ida_free(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); fw_mgmt->intf_fw_request_id = 0; dev_err(fw_mgmt->parent, "load and validate firmware request failed (%d)\n", @@ -220,7 +219,7 @@ static int fw_mgmt_interface_fw_loaded_operation(struct gb_operation *op) return -ENODEV; } - ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); + ida_free(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); fw_mgmt->intf_fw_request_id = 0; fw_mgmt->intf_fw_status = request->status; fw_mgmt->intf_fw_major = le16_to_cpu(request->major); @@ -316,7 +315,7 @@ static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt, } /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ - ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL); + ret = ida_alloc_range(&fw_mgmt->id_map, 1, 255, GFP_KERNEL); if (ret < 0) { dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n", ret); @@ -330,8 +329,7 @@ static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt, GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE, &request, sizeof(request), NULL, 0); if (ret) { - ida_simple_remove(&fw_mgmt->id_map, - fw_mgmt->backend_fw_request_id); + ida_free(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); fw_mgmt->backend_fw_request_id = 0; dev_err(fw_mgmt->parent, "backend %s firmware update request failed (%d)\n", tag, @@ -369,7 +367,7 @@ static int fw_mgmt_backend_fw_updated_operation(struct gb_operation *op) return -ENODEV; } - ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); + ida_free(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); fw_mgmt->backend_fw_request_id = 0; fw_mgmt->backend_fw_status = request->status; @@ -617,7 +615,7 @@ int gb_fw_mgmt_connection_init(struct gb_connection *connection) if (ret) goto err_list_del; - minor = ida_simple_get(&fw_mgmt_minors_map, 0, NUM_MINORS, GFP_KERNEL); + minor = ida_alloc_max(&fw_mgmt_minors_map, NUM_MINORS - 1, GFP_KERNEL); if (minor < 0) { ret = minor; goto err_connection_disable; @@ -645,7 +643,7 @@ int gb_fw_mgmt_connection_init(struct gb_connection *connection) err_del_cdev: cdev_del(&fw_mgmt->cdev); err_remove_ida: - ida_simple_remove(&fw_mgmt_minors_map, minor); + ida_free(&fw_mgmt_minors_map, minor); err_connection_disable: gb_connection_disable(connection); err_list_del: @@ -669,7 +667,7 @@ void gb_fw_mgmt_connection_exit(struct gb_connection *connection) device_destroy(&fw_mgmt_class, fw_mgmt->dev_num); cdev_del(&fw_mgmt->cdev); - ida_simple_remove(&fw_mgmt_minors_map, MINOR(fw_mgmt->dev_num)); + ida_free(&fw_mgmt_minors_map, MINOR(fw_mgmt->dev_num)); /* * Disallow any new ioctl operations on the char device and wait for diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c index 6a7d8cf2a1eb..d827f03f5253 100644 --- a/drivers/staging/greybus/gbphy.c +++ b/drivers/staging/greybus/gbphy.c @@ -46,7 +46,7 @@ static void gbphy_dev_release(struct device *dev) { struct gbphy_device *gbphy_dev = to_gbphy_dev(dev); - ida_simple_remove(&gbphy_id, gbphy_dev->id); + ida_free(&gbphy_id, gbphy_dev->id); kfree(gbphy_dev); } @@ -182,7 +182,7 @@ static void gbphy_dev_remove(struct device *dev) pm_runtime_dont_use_autosuspend(dev); } -static struct bus_type gbphy_bus_type = { +static const struct bus_type gbphy_bus_type = { .name = "gbphy", .match = gbphy_dev_match, .probe = gbphy_dev_probe, @@ -225,13 +225,13 @@ static struct gbphy_device *gb_gbphy_create_dev(struct gb_bundle *bundle, int retval; int id; - id = ida_simple_get(&gbphy_id, 1, 0, GFP_KERNEL); + id = ida_alloc_min(&gbphy_id, 1, GFP_KERNEL); if (id < 0) return ERR_PTR(id); gbphy_dev = kzalloc(sizeof(*gbphy_dev), GFP_KERNEL); if (!gbphy_dev) { - ida_simple_remove(&gbphy_id, id); + ida_free(&gbphy_id, id); return ERR_PTR(-ENOMEM); } diff --git a/drivers/staging/greybus/greybus_authentication.h b/drivers/staging/greybus/greybus_authentication.h index 48b4a9794d3c..ee88f880cfe3 100644 --- a/drivers/staging/greybus/greybus_authentication.h +++ b/drivers/staging/greybus/greybus_authentication.h @@ -44,7 +44,7 @@ /* IOCTL support */ struct cap_ioc_get_endpoint_uid { __u8 uid[8]; -} __attribute__ ((__packed__)); +} __packed; struct cap_ioc_get_ims_certificate { __u32 certificate_class; @@ -53,7 +53,7 @@ struct cap_ioc_get_ims_certificate { __u8 result_code; __u32 cert_size; __u8 certificate[CAP_CERTIFICATE_MAX_SIZE]; -} __attribute__ ((__packed__)); +} __packed; struct cap_ioc_authenticate { __u32 auth_type; @@ -64,7 +64,7 @@ struct cap_ioc_authenticate { __u8 response[64]; __u32 signature_size; __u8 signature[CAP_SIGNATURE_MAX_SIZE]; -} __attribute__ ((__packed__)); +} __packed; #define CAP_IOCTL_BASE 'C' #define CAP_IOC_GET_ENDPOINT_UID _IOR(CAP_IOCTL_BASE, 0, struct cap_ioc_get_endpoint_uid) diff --git a/drivers/staging/greybus/greybus_firmware.h b/drivers/staging/greybus/greybus_firmware.h index f68fd5e25321..b6042a82ada4 100644 --- a/drivers/staging/greybus/greybus_firmware.h +++ b/drivers/staging/greybus/greybus_firmware.h @@ -41,14 +41,14 @@ struct fw_mgmt_ioc_get_intf_version { __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; __u16 major; __u16 minor; -} __attribute__ ((__packed__)); +} __packed; struct fw_mgmt_ioc_get_backend_version { __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; __u16 major; __u16 minor; __u8 status; -} __attribute__ ((__packed__)); +} __packed; struct fw_mgmt_ioc_intf_load_and_validate { __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; @@ -56,12 +56,12 @@ struct fw_mgmt_ioc_intf_load_and_validate { __u8 status; __u16 major; __u16 minor; -} __attribute__ ((__packed__)); +} __packed; struct fw_mgmt_ioc_backend_fw_update { __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; __u8 status; -} __attribute__ ((__packed__)); +} __packed; #define FW_MGMT_IOCTL_BASE 'F' #define FW_MGMT_IOC_GET_INTF_FW _IOR(FW_MGMT_IOCTL_BASE, 0, struct fw_mgmt_ioc_get_intf_version) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index d62f97249aca..a5c2fe963866 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -95,15 +95,15 @@ static struct led_classdev *get_channel_cdev(struct gb_channel *channel) static struct gb_channel *get_channel_from_mode(struct gb_light *light, u32 mode) { - struct gb_channel *channel = NULL; + struct gb_channel *channel; int i; for (i = 0; i < light->channels_count; i++) { channel = &light->channels[i]; - if (channel && channel->mode == mode) - break; + if (channel->mode == mode) + return channel; } - return channel; + return NULL; } static int __gb_lights_flash_intensity_set(struct gb_channel *channel, diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index d7b39f3bb652..bb33379b5297 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -1028,7 +1028,7 @@ static int gb_loopback_probe(struct gb_bundle *bundle, gb->file = debugfs_create_file(name, S_IFREG | 0444, gb_dev.root, gb, &gb_loopback_dbgfs_latency_fops); - gb->id = ida_simple_get(&loopback_ida, 0, 0, GFP_KERNEL); + gb->id = ida_alloc(&loopback_ida, GFP_KERNEL); if (gb->id < 0) { retval = gb->id; goto out_debugfs_remove; @@ -1079,7 +1079,7 @@ out_conn: out_connection_disable: gb_connection_disable(connection); out_ida_remove: - ida_simple_remove(&loopback_ida, gb->id); + ida_free(&loopback_ida, gb->id); out_debugfs_remove: debugfs_remove(gb->file); out_connection_destroy: @@ -1121,7 +1121,7 @@ static void gb_loopback_disconnect(struct gb_bundle *bundle) spin_unlock_irqrestore(&gb_dev.lock, flags); device_unregister(gb->dev); - ida_simple_remove(&loopback_ida, gb->id); + ida_free(&loopback_ida, gb->id); gb_connection_destroy(gb->connection); kfree(gb); diff --git a/drivers/staging/greybus/raw.c b/drivers/staging/greybus/raw.c index b9c6eff7cdc1..836d35e5fa85 100644 --- a/drivers/staging/greybus/raw.c +++ b/drivers/staging/greybus/raw.c @@ -181,7 +181,7 @@ static int gb_raw_probe(struct gb_bundle *bundle, raw->connection = connection; greybus_set_drvdata(bundle, raw); - minor = ida_simple_get(&minors, 0, 0, GFP_KERNEL); + minor = ida_alloc(&minors, GFP_KERNEL); if (minor < 0) { retval = minor; goto error_connection_destroy; @@ -214,7 +214,7 @@ error_connection_disable: gb_connection_disable(connection); error_remove_ida: - ida_simple_remove(&minors, minor); + ida_free(&minors, minor); error_connection_destroy: gb_connection_destroy(connection); @@ -235,7 +235,7 @@ static void gb_raw_disconnect(struct gb_bundle *bundle) device_destroy(&raw_class, raw->dev); cdev_del(&raw->cdev); gb_connection_disable(connection); - ida_simple_remove(&minors, MINOR(raw->dev)); + ida_free(&minors, MINOR(raw->dev)); gb_connection_destroy(connection); mutex_lock(&raw->list_lock); diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c index 227e18d92a95..89bef8045549 100644 --- a/drivers/staging/greybus/vibrator.c +++ b/drivers/staging/greybus/vibrator.c @@ -153,7 +153,7 @@ static int gb_vibrator_probe(struct gb_bundle *bundle, * there is a "real" device somewhere in the kernel for this, but I * can't find it at the moment... */ - vib->minor = ida_simple_get(&minors, 0, 0, GFP_KERNEL); + vib->minor = ida_alloc(&minors, GFP_KERNEL); if (vib->minor < 0) { retval = vib->minor; goto err_connection_disable; @@ -173,7 +173,7 @@ static int gb_vibrator_probe(struct gb_bundle *bundle, return 0; err_ida_remove: - ida_simple_remove(&minors, vib->minor); + ida_free(&minors, vib->minor); err_connection_disable: gb_connection_disable(connection); err_connection_destroy: @@ -197,7 +197,7 @@ static void gb_vibrator_disconnect(struct gb_bundle *bundle) turn_off(vib); device_unregister(vib->dev); - ida_simple_remove(&minors, vib->minor); + ida_free(&minors, vib->minor); gb_connection_disable(vib->connection); gb_connection_destroy(vib->connection); kfree(vib); diff --git a/drivers/staging/nvec/TODO b/drivers/staging/nvec/TODO index e4d85d9b4681..8afde3ccc960 100644 --- a/drivers/staging/nvec/TODO +++ b/drivers/staging/nvec/TODO @@ -1,6 +1,5 @@ ToDo list (incomplete, unordered) - - add compile as module support - - move half of the nvec init stuff to i2c-tegra.c - - move event handling to nvec_events + - move the driver to the new i2c slave framework - finish suspend/resume support - - add support for more device implementations + - fix udelay in the isr + - add atomic ops in order to fix shutoff/reboot problems diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 2823cacde130..282a664c9176 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -709,10 +709,11 @@ static irqreturn_t nvec_interrupt(int irq, void *dev) status & RNW ? " RNW" : ""); /* - * TODO: A correct fix needs to be found for this. + * TODO: replace the udelay with a read back after each writel above + * in order to work around a hardware issue, see i2c-tegra.c * - * We experience less incomplete messages with this delay than without - * it, but we don't know why. Help is appreciated. + * Unfortunately, this change causes an intialisation issue with the + * touchpad, which needs to be fixed first. */ udelay(100); diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index b3049108edc4..211423059e30 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -10,7 +10,6 @@ #include <linux/phy.h> #include <linux/ratelimit.h> #include <linux/of_mdio.h> -#include <generated/utsrelease.h> #include <net/dst.h> #include "octeon-ethernet.h" @@ -22,7 +21,6 @@ static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); - strscpy(info->version, UTS_RELEASE, sizeof(info->version)); strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); } diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h index 3e7b92cd2e35..44cced319c11 100644 --- a/drivers/staging/octeon/octeon-stubs.h +++ b/drivers/staging/octeon/octeon-stubs.h @@ -1362,7 +1362,7 @@ static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait) } static inline int cvmx_spi_restart_interface(int interface, - cvmx_spi_mode_t mode, int timeout) + cvmx_spi_mode_t mode, int timeout) { return 0; } diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 0ec3130225db..b6c4917d515e 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -49,6 +49,7 @@ #define N_PI433_MINORS BIT(MINORBITS) /*32*/ /* ... up to 256 */ #define MAX_MSG_SIZE 900 /* min: FIFO_SIZE! */ #define MSG_FIFO_SIZE 65536 /* 65536 = 2^16 */ +#define FIFO_THRESHOLD 15 /* bytes */ #define NUM_DIO 2 static dev_t pi433_dev; diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index 8c7fab6a46bb..5a1c362badb6 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -8,12 +8,12 @@ #include <linux/types.h> #include <linux/spi/spi.h> +#include <linux/units.h> #include "rf69.h" #include "rf69_registers.h" -#define F_OSC 32000000 /* in Hz */ -#define FIFO_SIZE 66 /* in byte */ +#define F_OSC (32 * HZ_PER_MHZ) /*-------------------------------------------------------------------------*/ diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h index 78fa0b8bab8b..76f0f9896a52 100644 --- a/drivers/staging/pi433/rf69.h +++ b/drivers/staging/pi433/rf69.h @@ -11,11 +11,7 @@ #include "rf69_enum.h" #include "rf69_registers.h" -/* NOTE: Modifying FREQUENCY value impacts CE certification */ -#define F_OSC 32000000 /* Hz */ -#define FREQUENCY 433920000 /* Hz */ #define FIFO_SIZE 66 /* bytes */ -#define FIFO_THRESHOLD 15 /* bytes */ u8 rf69_read_reg(struct spi_device *spi, u8 addr); int rf69_get_version(struct spi_device *spi); diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index c7a2eae2fdb9..e3ed709a7674 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -164,7 +164,7 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) eACI); break; } - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACM_CTRL, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACM_CTRL, &pAcParam); break; } @@ -693,11 +693,10 @@ void rtl92e_link_change(struct net_device *dev) u32 reg; reg = rtl92e_readl(dev, RCR); - if (priv->rtllib->link_state == MAC80211_LINKED) { + if (priv->rtllib->link_state == MAC80211_LINKED) priv->receive_config = reg |= RCR_CBSSID; - } else { + else priv->receive_config = reg &= ~RCR_CBSSID; - } rtl92e_writel(dev, RCR, reg); } @@ -1296,7 +1295,6 @@ static void _rtl92e_query_rxphystatus( pwdb_all = rtl92e_rx_db_to_percent(rx_pwr_all); pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; - pstats->RxPower = precord_stats->RxPower = rx_pwr_all; pstats->RecvSignalPower = rx_pwr_all; if (pdrvinfo->RxHT && pdrvinfo->RxRate >= DESC90_RATEMCS8 && pdrvinfo->RxRate <= DESC90_RATEMCS15) @@ -1348,14 +1346,7 @@ static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer, static u32 slide_beacon_adc_pwdb_index; static u32 slide_beacon_adc_pwdb_statistics; static u32 last_beacon_adc_pwdb; - struct ieee80211_hdr_3addr *hdr; - u16 sc; - unsigned int seq; - hdr = (struct ieee80211_hdr_3addr *)buffer; - sc = le16_to_cpu(hdr->seq_ctrl); - seq = WLAN_GET_SEQ_SEQ(sc); - curr_st->Seq_Num = seq; if (!prev_st->bIsAMPDU) bcheck = true; @@ -1536,7 +1527,7 @@ static void _rtl92e_update_received_rate_histogram_stats( { struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); u32 rcvType = 1; - u32 rateIndex; + u32 rate_index; if (pstats->bCRC) rcvType = 2; @@ -1545,95 +1536,95 @@ static void _rtl92e_update_received_rate_histogram_stats( switch (pstats->rate) { case MGN_1M: - rateIndex = 0; + rate_index = 0; break; case MGN_2M: - rateIndex = 1; + rate_index = 1; break; case MGN_5_5M: - rateIndex = 2; + rate_index = 2; break; case MGN_11M: - rateIndex = 3; + rate_index = 3; break; case MGN_6M: - rateIndex = 4; + rate_index = 4; break; case MGN_9M: - rateIndex = 5; + rate_index = 5; break; case MGN_12M: - rateIndex = 6; + rate_index = 6; break; case MGN_18M: - rateIndex = 7; + rate_index = 7; break; case MGN_24M: - rateIndex = 8; + rate_index = 8; break; case MGN_36M: - rateIndex = 9; + rate_index = 9; break; case MGN_48M: - rateIndex = 10; + rate_index = 10; break; case MGN_54M: - rateIndex = 11; + rate_index = 11; break; case MGN_MCS0: - rateIndex = 12; + rate_index = 12; break; case MGN_MCS1: - rateIndex = 13; + rate_index = 13; break; case MGN_MCS2: - rateIndex = 14; + rate_index = 14; break; case MGN_MCS3: - rateIndex = 15; + rate_index = 15; break; case MGN_MCS4: - rateIndex = 16; + rate_index = 16; break; case MGN_MCS5: - rateIndex = 17; + rate_index = 17; break; case MGN_MCS6: - rateIndex = 18; + rate_index = 18; break; case MGN_MCS7: - rateIndex = 19; + rate_index = 19; break; case MGN_MCS8: - rateIndex = 20; + rate_index = 20; break; case MGN_MCS9: - rateIndex = 21; + rate_index = 21; break; case MGN_MCS10: - rateIndex = 22; + rate_index = 22; break; case MGN_MCS11: - rateIndex = 23; + rate_index = 23; break; case MGN_MCS12: - rateIndex = 24; + rate_index = 24; break; case MGN_MCS13: - rateIndex = 25; + rate_index = 25; break; case MGN_MCS14: - rateIndex = 26; + rate_index = 26; break; case MGN_MCS15: - rateIndex = 27; + rate_index = 27; break; default: - rateIndex = 28; + rate_index = 28; break; } - priv->stats.received_rate_histogram[0][rateIndex]++; - priv->stats.received_rate_histogram[rcvType][rateIndex]++; + priv->stats.received_rate_histogram[0][rate_index]++; + priv->stats.received_rate_histogram[rcvType][rate_index]++; } bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, @@ -1650,7 +1641,6 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, stats->bHwError |= 1; if (stats->bHwError) { - stats->bShift = false; return false; } @@ -1662,7 +1652,6 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, stats->rate = _rtl92e_rate_hw_to_mgn((bool)pDrvInfo->RxHT, pDrvInfo->RxRate); - stats->bShortPreamble = pDrvInfo->SPLCP; _rtl92e_update_received_rate_histogram_stats(dev, stats); @@ -1673,19 +1662,9 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, stats->TimeStampLow = pDrvInfo->TSFL; stats->TimeStampHigh = rtl92e_readl(dev, TSFR + 4); - if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) - stats->bShift = 1; - - stats->RxIs40MHzPacket = pDrvInfo->BW; - _rtl92e_translate_rx_signal_stats(dev, skb, stats, pdesc, pDrvInfo); skb_trim(skb, skb->len - S_CRC_LEN); - - stats->packetlength = stats->Length - 4; - stats->fraglength = stats->packetlength; - stats->fragoffset = 0; - stats->ntotalfrag = 1; return true; } @@ -1698,7 +1677,7 @@ void rtl92e_stop_adapter(struct net_device *dev, bool reset) u32 ulRegRead; op_mode = RT_OP_MODE_NO_LINK; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_MEDIA_STATUS, &op_mode); + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_MEDIA_STATUS, &op_mode); if (!priv->rtllib->bSupportRemoteWakeUp) { u1bTmp = 0x0; @@ -1852,7 +1831,7 @@ bool rtl92e_is_rx_stuck(struct net_device *dev) u16 RegRxCounter = rtl92e_readw(dev, 0x130); bool bStuck = false; static u8 rx_chk_cnt; - u32 SlotIndex = 0, TotalRxStuckCount = 0; + u32 slot_index = 0, TotalRxStuckCount = 0; u8 i; u8 SilentResetRxSoltNum = 4; @@ -1882,10 +1861,10 @@ bool rtl92e_is_rx_stuck(struct net_device *dev) } - SlotIndex = (priv->silent_reset_rx_slot_index++) % SilentResetRxSoltNum; + slot_index = (priv->silent_reset_rx_slot_index++) % SilentResetRxSoltNum; if (priv->rx_ctr == RegRxCounter) { - priv->silent_reset_rx_stuck_event[SlotIndex] = 1; + priv->silent_reset_rx_stuck_event[slot_index] = 1; for (i = 0; i < SilentResetRxSoltNum; i++) TotalRxStuckCount += priv->silent_reset_rx_stuck_event[i]; @@ -1897,7 +1876,7 @@ bool rtl92e_is_rx_stuck(struct net_device *dev) priv->silent_reset_rx_stuck_event[i]; } } else { - priv->silent_reset_rx_stuck_event[SlotIndex] = 0; + priv->silent_reset_rx_stuck_event[slot_index] = 0; } priv->rx_ctr = RegRxCounter; @@ -1938,5 +1917,5 @@ bool rtl92e_is_halfn_supported_by_ap(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); struct rtllib_device *ieee = priv->rtllib; - return ieee->bHalfWirelessN24GMode; + return ieee->half_wireless_n24g_mode; } diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index e1bd4d67e862..18b948d4d86d 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -714,7 +714,6 @@ void rtl92e_set_channel(struct net_device *dev, u8 channel) if (priv->up) _rtl92e_phy_switch_channel_work_item(dev); priv->sw_chnl_in_progress = false; - return; } static void _rtl92e_cck_tx_power_track_bw_switch_tssi(struct net_device *dev) diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 6815d18a7919..649b529657ba 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -172,7 +172,7 @@ bool rtl92e_set_rf_state(struct net_device *dev, priv->blinked_ingpio = true; else priv->blinked_ingpio = false; - rtllib_MgntDisconnect(priv->rtllib, + rtllib_mgnt_disconnect(priv->rtllib, WLAN_REASON_DISASSOC_STA_HAS_LEFT); } } @@ -236,14 +236,14 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap) if (priv->dot11_current_preamble_mode != PREAMBLE_SHORT) { ShortPreamble = true; priv->dot11_current_preamble_mode = PREAMBLE_SHORT; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } } else { if (priv->dot11_current_preamble_mode != PREAMBLE_LONG) { ShortPreamble = false; priv->dot11_current_preamble_mode = PREAMBLE_LONG; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACK_PREAMBLE, (unsigned char *)&ShortPreamble); } } @@ -256,13 +256,13 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap) (!priv->rtllib->ht_info->current_rt2rt_long_slot_time)) { if (cur_slot_time != SHORT_SLOT_TIME) { slot_time_val = SHORT_SLOT_TIME; - priv->rtllib->SetHwRegHandler(dev, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_SLOT_TIME, &slot_time_val); } } else { if (cur_slot_time != NON_SHORT_SLOT_TIME) { slot_time_val = NON_SHORT_SLOT_TIME; - priv->rtllib->SetHwRegHandler(dev, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_SLOT_TIME, &slot_time_val); } } @@ -301,7 +301,7 @@ static void _rtl92e_qos_activate(void *data) goto success; for (i = 0; i < QOS_QUEUE_NUM; i++) - priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); success: mutex_unlock(&priv->mutex); @@ -656,12 +656,12 @@ static void _rtl92e_init_priv_handler(struct net_device *dev) priv->rtllib->enter_sleep_state = rtl92e_enter_sleep; priv->rtllib->ps_is_queue_empty = _rtl92e_is_tx_queue_empty; - priv->rtllib->GetNmodeSupportBySecCfg = rtl92e_get_nmode_support_by_sec; - priv->rtllib->GetHalfNmodeSupportByAPsHandler = + priv->rtllib->get_nmode_support_by_sec_cfg = rtl92e_get_nmode_support_by_sec; + priv->rtllib->get_half_nmode_support_by_aps_handler = rtl92e_is_halfn_supported_by_ap; - priv->rtllib->SetHwRegHandler = rtl92e_set_reg; - priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; + priv->rtllib->set_hw_reg_handler = rtl92e_set_reg; + priv->rtllib->allow_all_dest_addr_handler = rtl92e_set_monitor_mode; priv->rtllib->init_gain_handler = rtl92e_init_gain; priv->rtllib->rtllib_ips_leave_wq = rtl92e_rtllib_ips_leave_wq; priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave; @@ -705,7 +705,7 @@ static void _rtl92e_init_priv_variable(struct net_device *dev) priv->hw_rf_off_action = 0; priv->set_rf_pwr_state_in_progress = false; priv->rtllib->pwr_save_ctrl.bLeisurePs = true; - priv->rtllib->LPSDelayCnt = 0; + priv->rtllib->lps_delay_cnt = 0; priv->rtllib->sta_sleep = LPS_IS_WAKE; priv->rtllib->rf_power_state = rf_on; @@ -909,25 +909,24 @@ static void _rtl92e_if_check_reset(struct net_device *dev) netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", __func__, TxResetType, RxResetType); } - return; } static void _rtl92e_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, u32 *TotalRxDataNum) { - u16 SlotIndex; + u16 slot_index; u8 i; *TotalRxBcnNum = 0; *TotalRxDataNum = 0; - SlotIndex = (priv->rtllib->link_detect_info.SlotIndex++) % - (priv->rtllib->link_detect_info.SlotNum); - priv->rtllib->link_detect_info.RxBcnNum[SlotIndex] = - priv->rtllib->link_detect_info.NumRecvBcnInPeriod; - priv->rtllib->link_detect_info.RxDataNum[SlotIndex] = - priv->rtllib->link_detect_info.NumRecvDataInPeriod; - for (i = 0; i < priv->rtllib->link_detect_info.SlotNum; i++) { + slot_index = (priv->rtllib->link_detect_info.slot_index++) % + (priv->rtllib->link_detect_info.slot_num); + priv->rtllib->link_detect_info.RxBcnNum[slot_index] = + priv->rtllib->link_detect_info.num_recv_bcn_in_period; + priv->rtllib->link_detect_info.RxDataNum[slot_index] = + priv->rtllib->link_detect_info.num_recv_data_in_period; + for (i = 0; i < priv->rtllib->link_detect_info.slot_num; i++) { *TotalRxBcnNum += priv->rtllib->link_detect_info.RxBcnNum[i]; *TotalRxDataNum += priv->rtllib->link_detect_info.RxDataNum[i]; } @@ -943,7 +942,7 @@ static void _rtl92e_watchdog_wq_cb(void *data) unsigned long flags; struct rt_pwr_save_ctrl *psc = (struct rt_pwr_save_ctrl *) (&priv->rtllib->pwr_save_ctrl); - bool bBusyTraffic = false; + bool busy_traffic = false; bool bHigherBusyTraffic = false; bool bHigherBusyRxTraffic = false; bool bEnterPS = false; @@ -965,15 +964,14 @@ static void _rtl92e_watchdog_wq_cb(void *data) MAC80211_NOLINK) && (ieee->rf_power_state == rf_on) && !ieee->is_set_key && (!ieee->proto_stoppping) && !ieee->wx_set_enc) { - if (ieee->pwr_save_ctrl.ReturnPoint == IPS_CALLBACK_NONE) { + if (ieee->pwr_save_ctrl.ReturnPoint == IPS_CALLBACK_NONE) rtl92e_ips_enter(dev); - } } } if ((ieee->link_state == MAC80211_LINKED) && (ieee->iw_mode == IW_MODE_INFRA)) { if (ieee->link_detect_info.num_rx_ok_in_period > 100 || ieee->link_detect_info.num_tx_ok_in_period > 100) - bBusyTraffic = true; + busy_traffic = true; if (ieee->link_detect_info.num_rx_ok_in_period > 4000 || ieee->link_detect_info.num_tx_ok_in_period > 4000) { @@ -984,9 +982,9 @@ static void _rtl92e_watchdog_wq_cb(void *data) bHigherBusyRxTraffic = false; } - if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + + if (((ieee->link_detect_info.num_rx_unicast_ok_in_period + ieee->link_detect_info.num_tx_ok_in_period) > 8) || - (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) + (ieee->link_detect_info.num_rx_unicast_ok_in_period > 2)) bEnterPS = false; else bEnterPS = true; @@ -1005,8 +1003,8 @@ static void _rtl92e_watchdog_wq_cb(void *data) ieee->link_detect_info.num_rx_ok_in_period = 0; ieee->link_detect_info.num_tx_ok_in_period = 0; - ieee->link_detect_info.NumRxUnicastOkInPeriod = 0; - ieee->link_detect_info.bBusyTraffic = bBusyTraffic; + ieee->link_detect_info.num_rx_unicast_ok_in_period = 0; + ieee->link_detect_info.busy_traffic = busy_traffic; ieee->link_detect_info.bHigherBusyTraffic = bHigherBusyTraffic; ieee->link_detect_info.bHigherBusyRxTraffic = bHigherBusyRxTraffic; @@ -1032,7 +1030,7 @@ static void _rtl92e_watchdog_wq_cb(void *data) ieee->link_state = RTLLIB_ASSOCIATING; - RemovePeerTS(priv->rtllib, + remove_peer_ts(priv->rtllib, priv->rtllib->current_network.bssid); ieee->is_roaming = true; ieee->is_set_key = false; @@ -1046,8 +1044,8 @@ static void _rtl92e_watchdog_wq_cb(void *data) priv->check_roaming_cnt = 0; } - ieee->link_detect_info.NumRecvBcnInPeriod = 0; - ieee->link_detect_info.NumRecvDataInPeriod = 0; + ieee->link_detect_info.num_recv_bcn_in_period = 0; + ieee->link_detect_info.num_recv_data_in_period = 0; } spin_lock_irqsave(&priv->tx_lock, flags); @@ -1257,7 +1255,7 @@ static short _rtl92e_tx(struct net_device *dev, struct sk_buff *skb) int idx; u32 fwinfo_size = 0; - priv->rtllib->bAwakePktSent = true; + priv->rtllib->awake_pkt_sent = true; fwinfo_size = sizeof(struct tx_fwinfo_8190pci); @@ -1502,8 +1500,6 @@ static void _rtl92e_rx_normal(struct net_device *dev) }; unsigned int count = priv->rxringcount; - stats.nic_type = NIC_8192E; - while (count--) { struct rx_desc *pdesc = &priv->rx_ring [priv->rx_idx]; diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index 92143c50c149..c34087af973c 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c @@ -354,7 +354,7 @@ static void _rtl92e_dm_check_rate_adaptive(struct net_device *dev) } } - if (priv->rtllib->GetHalfNmodeSupportByAPsHandler(dev)) + if (priv->rtllib->get_half_nmode_support_by_aps_handler(dev)) target_ratr &= 0xf00fffff; current_ratr = rtl92e_readl(dev, RATR0); @@ -1185,7 +1185,7 @@ static void _rtl92e_dm_check_edca_turbo(struct net_device *dev) if (priv->bcurrent_turbo_EDCA) { u8 tmp = AC0_BE; - priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_AC_PARAM, (u8 *)(&tmp)); priv->bcurrent_turbo_EDCA = false; } @@ -1523,7 +1523,7 @@ static void _rtl92e_dm_init_fsync(struct net_device *dev) priv->rtllib->fsync_multiple_timeinterval = 3; priv->rtllib->fsync_firstdiff_ratethreshold = 100; priv->rtllib->fsync_seconddiff_ratethreshold = 200; - priv->rtllib->fsync_state = Default_Fsync; + priv->rtllib->fsync_state = DEFAULT_FSYNC; timer_setup(&priv->fsync_timer, _rtl92e_dm_fsync_timer_callback, 0); } @@ -1636,7 +1636,7 @@ static void _rtl92e_dm_start_hw_fsync(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c12cf); - priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_RF_TIMING, (u8 *)(&rf_timing)); rtl92e_writeb(dev, 0xc3b, 0x41); } @@ -1647,7 +1647,7 @@ static void _rtl92e_dm_end_hw_fsync(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c52cd); - priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *) + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_RF_TIMING, (u8 *) (&rf_timing)); rtl92e_writeb(dev, 0xc3b, 0x49); } @@ -1716,31 +1716,29 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev) priv->rtllib->ht_info->iot_peer == HT_IOT_PEER_BROADCOM) { if (priv->rtllib->bfsync_enable == 0) { switch (priv->rtllib->fsync_state) { - case Default_Fsync: + case DEFAULT_FSYNC: _rtl92e_dm_start_hw_fsync(dev); - priv->rtllib->fsync_state = HW_Fsync; + priv->rtllib->fsync_state = HW_FSYNC; break; - case SW_Fsync: + case SW_FSYNC: _rtl92e_dm_end_sw_fsync(dev); _rtl92e_dm_start_hw_fsync(dev); - priv->rtllib->fsync_state = HW_Fsync; + priv->rtllib->fsync_state = HW_FSYNC; break; - case HW_Fsync: default: break; } } else { switch (priv->rtllib->fsync_state) { - case Default_Fsync: + case DEFAULT_FSYNC: _rtl92e_dm_start_sw_fsync(dev); - priv->rtllib->fsync_state = SW_Fsync; + priv->rtllib->fsync_state = SW_FSYNC; break; - case HW_Fsync: + case HW_FSYNC: _rtl92e_dm_end_hw_fsync(dev); _rtl92e_dm_start_sw_fsync(dev); - priv->rtllib->fsync_state = SW_Fsync; + priv->rtllib->fsync_state = SW_FSYNC; break; - case SW_Fsync: default: break; } @@ -1752,15 +1750,14 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev) } } else { switch (priv->rtllib->fsync_state) { - case HW_Fsync: + case HW_FSYNC: _rtl92e_dm_end_hw_fsync(dev); - priv->rtllib->fsync_state = Default_Fsync; + priv->rtllib->fsync_state = DEFAULT_FSYNC; break; - case SW_Fsync: + case SW_FSYNC: _rtl92e_dm_end_sw_fsync(dev); - priv->rtllib->fsync_state = Default_Fsync; + priv->rtllib->fsync_state = DEFAULT_FSYNC; break; - case Default_Fsync: default: break; } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 44a9fe831849..5aac9110bff6 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -208,12 +208,12 @@ void rtl92e_leisure_ps_enter(struct net_device *dev) return; if (psc->bLeisurePs) { - if (psc->LpsIdleCount >= RT_CHECK_FOR_HANG_PERIOD) { + if (psc->lps_idle_count >= RT_CHECK_FOR_HANG_PERIOD) { if (priv->rtllib->ps == RTLLIB_PS_DISABLED) _rtl92e_ps_set_mode(dev, RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST); } else { - psc->LpsIdleCount++; + psc->lps_idle_count++; } } } diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 4c884c5277f9..d131ef525f46 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -253,7 +253,7 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, rt_state = priv->rtllib->rf_power_state; if (!priv->up) return -ENETDOWN; - if (priv->rtllib->link_detect_info.bBusyTraffic) + if (priv->rtllib->link_detect_info.busy_traffic) return -EAGAIN; if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { @@ -269,7 +269,7 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, mutex_lock(&priv->wx_mutex); - priv->rtllib->FirstIe_InScan = true; + priv->rtllib->first_ie_in_scan = true; if (priv->rtllib->link_state != MAC80211_LINKED) { if (rt_state == rf_off) { diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index ee9ce392155c..834329886ea2 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -125,7 +125,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *dst, static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, struct ba_record *ba, - enum tr_select TxRxSelect, u16 reason_code) + enum tr_select tx_rx_select, u16 reason_code) { union delba_param_set del_ba_param_set; struct sk_buff *skb = NULL; @@ -139,7 +139,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, memset(&del_ba_param_set, 0, 2); - del_ba_param_set.field.initiator = (TxRxSelect == TX_DIR) ? 1 : 0; + del_ba_param_set.field.initiator = (tx_rx_select == TX_DIR) ? 1 : 0; del_ba_param_set.field.tid = ba->ba_param_set.field.tid; skb = dev_alloc_skb(len + sizeof(struct ieee80211_hdr_3addr)); @@ -173,8 +173,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, return skb; } -static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, - struct ba_record *ba) +static void rtllib_send_add_ba_req(struct rtllib_device *ieee, u8 *dst, + struct ba_record *ba) { struct sk_buff *skb; @@ -186,8 +186,8 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, netdev_dbg(ieee->dev, "Failed to generate ADDBAReq packet.\n"); } -static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, - struct ba_record *ba, u16 status_code) +static void rtllib_send_add_ba_rsp(struct rtllib_device *ieee, u8 *dst, + struct ba_record *ba, u16 status_code) { struct sk_buff *skb; @@ -199,19 +199,19 @@ static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, } static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, - struct ba_record *ba, enum tr_select TxRxSelect, + struct ba_record *ba, enum tr_select tx_rx_select, u16 reason_code) { struct sk_buff *skb; - skb = rtllib_DELBA(ieee, dst, ba, TxRxSelect, reason_code); + skb = rtllib_DELBA(ieee, dst, ba, tx_rx_select, reason_code); if (skb) softmac_mgmt_xmit(skb, ieee); else netdev_dbg(ieee->dev, "Failed to generate DELBA packet.\n"); } -int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) +int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb) { struct ieee80211_hdr_3addr *req = NULL; u16 rc = 0; @@ -251,13 +251,13 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->ht_info->current_ht_support); - goto OnADDBAReq_Fail; + goto on_add_ba_req_fail; } if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, - (u8)(ba_param_set->field.tid), RX_DIR, true)) { + (u8)(ba_param_set->field.tid), RX_DIR, true)) { rc = ADDBA_STATUS_REFUSED; netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); - goto OnADDBAReq_Fail; + goto on_add_ba_req_fail; } ba = &ts->rx_admitted_ba_record; @@ -265,10 +265,10 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) rc = ADDBA_STATUS_INVALID_PARAM; netdev_warn(ieee->dev, "%s(): BA Policy is not correct\n", __func__); - goto OnADDBAReq_Fail; + goto on_add_ba_req_fail; } - rtllib_FlushRxTsPendingPkts(ieee, ts); + rtllib_flush_rx_ts_pending_pkts(ieee, ts); deactivate_ba_entry(ieee, ba); ba->dialog_token = *dialog_token; @@ -276,18 +276,18 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) ba->ba_timeout_value = *ba_timeout_value; ba->ba_start_seq_ctrl = *ba_start_seq_ctrl; - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev) || - (ieee->ht_info->iot_action & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT)) + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev) || + (ieee->ht_info->iot_action & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT)) ba->ba_param_set.field.buffer_size = 1; else ba->ba_param_set.field.buffer_size = 32; activate_ba_entry(ba, 0); - rtllib_send_ADDBARsp(ieee, dst, ba, ADDBA_STATUS_SUCCESS); + rtllib_send_add_ba_rsp(ieee, dst, ba, ADDBA_STATUS_SUCCESS); return 0; -OnADDBAReq_Fail: +on_add_ba_req_fail: { struct ba_record BA; @@ -295,12 +295,12 @@ OnADDBAReq_Fail: BA.ba_timeout_value = *ba_timeout_value; BA.dialog_token = *dialog_token; BA.ba_param_set.field.ba_policy = BA_POLICY_IMMEDIATE; - rtllib_send_ADDBARsp(ieee, dst, &BA, rc); + rtllib_send_add_ba_rsp(ieee, dst, &BA, rc); return 0; } } -int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) +int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb) { struct ieee80211_hdr_3addr *rsp = NULL; struct ba_record *pending_ba, *admitted_ba; @@ -334,14 +334,14 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) ieee->ht_info->current_ht_support, ieee->ht_info->current_ampdu_enable); reason_code = DELBA_REASON_UNKNOWN_BA; - goto OnADDBARsp_Reject; + goto on_add_ba_rsp_reject; } if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, - (u8)(ba_param_set->field.tid), TX_DIR, false)) { + (u8)(ba_param_set->field.tid), TX_DIR, false)) { netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); reason_code = DELBA_REASON_UNKNOWN_BA; - goto OnADDBARsp_Reject; + goto on_add_ba_rsp_reject; } ts->add_ba_req_in_progress = false; @@ -358,7 +358,7 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) "%s(): ADDBA Rsp. BA invalid, DELBA!\n", __func__); reason_code = DELBA_REASON_UNKNOWN_BA; - goto OnADDBARsp_Reject; + goto on_add_ba_rsp_reject; } else { netdev_dbg(ieee->dev, "%s(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", @@ -371,7 +371,7 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) ts->add_ba_req_delayed = true; deactivate_ba_entry(ieee, admitted_ba); reason_code = DELBA_REASON_END_BA; - goto OnADDBARsp_Reject; + goto on_add_ba_rsp_reject; } admitted_ba->dialog_token = *dialog_token; @@ -384,12 +384,12 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) ts->add_ba_req_delayed = true; ts->disable_add_ba = true; reason_code = DELBA_REASON_END_BA; - goto OnADDBARsp_Reject; + goto on_add_ba_rsp_reject; } return 0; -OnADDBARsp_Reject: +on_add_ba_rsp_reject: { struct ba_record BA; @@ -433,7 +433,7 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) struct rx_ts_record *ts; if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, - (u8)del_ba_param_set->field.tid, RX_DIR, false)) { + (u8)del_ba_param_set->field.tid, RX_DIR, false)) { netdev_warn(ieee->dev, "%s(): can't get TS for RXTS. dst:%pM TID:%d\n", __func__, dst, @@ -446,7 +446,7 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb) struct tx_ts_record *ts; if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, - (u8)del_ba_param_set->field.tid, TX_DIR, false)) { + (u8)del_ba_param_set->field.tid, TX_DIR, false)) { netdev_warn(ieee->dev, "%s(): can't get TS for TXTS\n", __func__); return -1; @@ -481,14 +481,14 @@ void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts, activate_ba_entry(ba, BA_SETUP_TIMEOUT); - rtllib_send_ADDBAReq(ieee, ts->ts_common_info.addr, ba); + rtllib_send_add_ba_req(ieee, ts->ts_common_info.addr, ba); } void rtllib_ts_init_del_ba(struct rtllib_device *ieee, struct ts_common_info *ts_common_info, - enum tr_select TxRxSelect) + enum tr_select tx_rx_select) { - if (TxRxSelect == TX_DIR) { + if (tx_rx_select == TX_DIR) { struct tx_ts_record *ts = (struct tx_ts_record *)ts_common_info; @@ -497,14 +497,14 @@ void rtllib_ts_init_del_ba(struct rtllib_device *ieee, (ts->tx_admitted_ba_record.b_valid) ? (&ts->tx_admitted_ba_record) : (&ts->tx_pending_ba_record), - TxRxSelect, DELBA_REASON_END_BA); - } else if (TxRxSelect == RX_DIR) { + tx_rx_select, DELBA_REASON_END_BA); + } else if (tx_rx_select == RX_DIR) { struct rx_ts_record *ts = (struct rx_ts_record *)ts_common_info; if (rx_ts_delete_ba(ieee, ts)) rtllib_send_DELBA(ieee, ts_common_info->addr, &ts->rx_admitted_ba_record, - TxRxSelect, DELBA_REASON_END_BA); + tx_rx_select, DELBA_REASON_END_BA); } } diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h index 68577bffb936..a4580445305d 100644 --- a/drivers/staging/rtl8192e/rtl819x_HT.h +++ b/drivers/staging/rtl8192e/rtl819x_HT.h @@ -98,9 +98,9 @@ struct rt_hi_throughput { u8 cur_short_gi_40mhz; u8 cur_short_gi_20mhz; enum ht_spec_ver peer_ht_spec_ver; - struct ht_capab_ele SelfHTCap; - u8 PeerHTCapBuf[32]; - u8 PeerHTInfoBuf[32]; + struct ht_capab_ele self_ht_cap; + u8 peer_ht_cap_buf[32]; + u8 peer_ht_info_buf[32]; u8 ampdu_enable; u8 current_ampdu_enable; u8 ampdu_factor; diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index 6d0912f90198..fa96a2c2c916 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -252,7 +252,7 @@ void ht_construct_capability_element(struct rtllib_device *ieee, u8 *pos_ht_cap, } cap_ele->AdvCoding = 0; - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) cap_ele->ChlWidth = 0; else cap_ele->ChlWidth = 1; @@ -301,7 +301,7 @@ void ht_construct_capability_element(struct rtllib_device *ieee, u8 *pos_ht_cap, if (ht->iot_action & HT_IOT_ACT_DISABLE_RX_40MHZ_SHORT_GI) cap_ele->ShortGI40Mhz = 0; - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) { + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) { cap_ele->ChlWidth = 0; cap_ele->MCS[1] = 0; } @@ -408,7 +408,7 @@ static u8 ht_filter_mcs_rate(struct rtllib_device *ieee, u8 *pSupportMCS, ht_pick_mcs_rate(ieee, pOperateMCS); - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) pOperateMCS[1] = 0; for (i = 2; i <= 15; i++) @@ -437,16 +437,16 @@ void ht_on_assoc_rsp(struct rtllib_device *ieee) } netdev_dbg(ieee->dev, "%s(): HT_ENABLE\n", __func__); - if (!memcmp(ht_info->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap))) - pPeerHTCap = (struct ht_capab_ele *)(&ht_info->PeerHTCapBuf[4]); + if (!memcmp(ht_info->peer_ht_cap_buf, EWC11NHTCap, sizeof(EWC11NHTCap))) + pPeerHTCap = (struct ht_capab_ele *)(&ht_info->peer_ht_cap_buf[4]); else - pPeerHTCap = (struct ht_capab_ele *)(ht_info->PeerHTCapBuf); + pPeerHTCap = (struct ht_capab_ele *)(ht_info->peer_ht_cap_buf); - if (!memcmp(ht_info->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) + if (!memcmp(ht_info->peer_ht_info_buf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) pPeerHTInfo = (struct ht_info_ele *) - (&ht_info->PeerHTInfoBuf[4]); + (&ht_info->peer_ht_info_buf[4]); else - pPeerHTInfo = (struct ht_info_ele *)(ht_info->PeerHTInfoBuf); + pPeerHTInfo = (struct ht_info_ele *)(ht_info->peer_ht_info_buf); #ifdef VERBOSE_DEBUG print_hex_dump_bytes("%s: ", __func__, DUMP_PREFIX_NONE, @@ -480,9 +480,9 @@ void ht_on_assoc_rsp(struct rtllib_device *ieee) } ht_info->current_mpdu_density = pPeerHTCap->MPDUDensity; - if (ht_info->iot_action & HT_IOT_ACT_TX_USE_AMSDU_8K) { + if (ht_info->iot_action & HT_IOT_ACT_TX_USE_AMSDU_8K) ht_info->current_ampdu_enable = false; - } + ht_info->cur_rx_reorder_enable = 1; if (pPeerHTCap->MCS[0] == 0) @@ -516,12 +516,12 @@ void ht_initialize_ht_info(struct rtllib_device *ieee) ht_info->current_mpdu_density = 0; ht_info->CurrentAMPDUFactor = ht_info->ampdu_factor; - memset((void *)(&ht_info->SelfHTCap), 0, - sizeof(ht_info->SelfHTCap)); - memset((void *)(&ht_info->PeerHTCapBuf), 0, - sizeof(ht_info->PeerHTCapBuf)); - memset((void *)(&ht_info->PeerHTInfoBuf), 0, - sizeof(ht_info->PeerHTInfoBuf)); + memset((void *)(&ht_info->self_ht_cap), 0, + sizeof(ht_info->self_ht_cap)); + memset((void *)(&ht_info->peer_ht_cap_buf), 0, + sizeof(ht_info->peer_ht_cap_buf)); + memset((void *)(&ht_info->peer_ht_info_buf), 0, + sizeof(ht_info->peer_ht_info_buf)); ht_info->sw_bw_in_progress = false; @@ -572,15 +572,15 @@ void ht_reset_self_and_save_peer_setting(struct rtllib_device *ieee, ht_info->peer_ht_spec_ver = pNetwork->bssht.bd_ht_spec_ver; if (pNetwork->bssht.bd_ht_cap_len > 0 && - pNetwork->bssht.bd_ht_cap_len <= sizeof(ht_info->PeerHTCapBuf)) - memcpy(ht_info->PeerHTCapBuf, + pNetwork->bssht.bd_ht_cap_len <= sizeof(ht_info->peer_ht_cap_buf)) + memcpy(ht_info->peer_ht_cap_buf, pNetwork->bssht.bd_ht_cap_buf, pNetwork->bssht.bd_ht_cap_len); if (pNetwork->bssht.bd_ht_info_len > 0 && pNetwork->bssht.bd_ht_info_len <= - sizeof(ht_info->PeerHTInfoBuf)) - memcpy(ht_info->PeerHTInfoBuf, + sizeof(ht_info->peer_ht_info_buf)) + memcpy(ht_info->peer_ht_info_buf, pNetwork->bssht.bd_ht_info_buf, pNetwork->bssht.bd_ht_info_len); @@ -666,7 +666,7 @@ void ht_set_connect_bw_mode(struct rtllib_device *ieee, { struct rt_hi_throughput *ht_info = ieee->ht_info; - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) bandwidth = HT_CHANNEL_WIDTH_20; if (ht_info->sw_bw_in_progress) { diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h index 50e01ca49a4c..dc991100742f 100644 --- a/drivers/staging/rtl8192e/rtl819x_Qos.h +++ b/drivers/staging/rtl8192e/rtl819x_Qos.h @@ -13,7 +13,7 @@ struct qos_tsinfo { }; struct octet_string { - u8 *Octet; + u8 *octet; u16 Length; }; diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 7e73d31dcccf..9903fe3f3c77 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -171,14 +171,14 @@ void rtllib_ts_init(struct rtllib_device *ieee) static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, u8 *addr, u8 TID, - enum tr_select TxRxSelect) + enum tr_select tx_rx_select) { u8 dir; bool search_dir[4] = {0}; struct list_head *psearch_list; struct ts_common_info *pRet = NULL; - if (TxRxSelect == TX_DIR) { + if (tx_rx_select == TX_DIR) { search_dir[DIR_UP] = true; search_dir[DIR_BI_DIR] = true; search_dir[DIR_DIRECT] = true; @@ -188,7 +188,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, search_dir[DIR_DIRECT] = true; } - if (TxRxSelect == TX_DIR) + if (tx_rx_select == TX_DIR) psearch_list = &ieee->Tx_TS_Admit_List; else psearch_list = &ieee->Rx_TS_Admit_List; @@ -225,7 +225,7 @@ static void MakeTSEntry(struct ts_common_info *ts_common_info, u8 *addr, } bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, - u8 *addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) + u8 *addr, u8 TID, enum tr_select tx_rx_select, bool bAddNewTs) { u8 UP = 0; struct qos_tsinfo tspec; @@ -265,7 +265,7 @@ bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, } } - *ppTS = SearchAdmitTRStream(ieee, addr, UP, TxRxSelect); + *ppTS = SearchAdmitTRStream(ieee, addr, UP, tx_rx_select); if (*ppTS) return true; @@ -274,21 +274,21 @@ bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, return false; } - pUnusedList = (TxRxSelect == TX_DIR) ? + pUnusedList = (tx_rx_select == TX_DIR) ? (&ieee->Tx_TS_Unused_List) : (&ieee->Rx_TS_Unused_List); - pAddmitList = (TxRxSelect == TX_DIR) ? + pAddmitList = (tx_rx_select == TX_DIR) ? (&ieee->Tx_TS_Admit_List) : (&ieee->Rx_TS_Admit_List); - Dir = ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); + Dir = ((tx_rx_select == TX_DIR) ? DIR_UP : DIR_DOWN); if (!list_empty(pUnusedList)) { (*ppTS) = list_entry(pUnusedList->next, struct ts_common_info, list); list_del_init(&(*ppTS)->list); - if (TxRxSelect == TX_DIR) { + if (tx_rx_select == TX_DIR) { struct tx_ts_record *tmp = container_of(*ppTS, struct tx_ts_record, @@ -321,11 +321,11 @@ bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, } static void RemoveTsEntry(struct rtllib_device *ieee, - struct ts_common_info *pTs, enum tr_select TxRxSelect) + struct ts_common_info *pTs, enum tr_select tx_rx_select) { - rtllib_ts_init_del_ba(ieee, pTs, TxRxSelect); + rtllib_ts_init_del_ba(ieee, pTs, tx_rx_select); - if (TxRxSelect == RX_DIR) { + if (tx_rx_select == RX_DIR) { struct rx_reorder_entry *pRxReorderEntry; struct rx_ts_record *ts = (struct rx_ts_record *)pTs; @@ -360,7 +360,7 @@ static void RemoveTsEntry(struct rtllib_device *ieee, } } -void RemovePeerTS(struct rtllib_device *ieee, u8 *addr) +void remove_peer_ts(struct rtllib_device *ieee, u8 *addr) { struct ts_common_info *ts, *pTmpTS; @@ -400,9 +400,9 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *addr) } } } -EXPORT_SYMBOL(RemovePeerTS); +EXPORT_SYMBOL(remove_peer_ts); -void RemoveAllTS(struct rtllib_device *ieee) +void remove_all_ts(struct rtllib_device *ieee) { struct ts_common_info *ts, *pTmpTS; diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 7b39a1987fdd..6fbf11ac168f 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -123,7 +123,7 @@ struct cb_desc { u8 bPacketBW:1; u8 bRTSUseShortPreamble:1; u8 bRTSUseShortGI:1; - u8 bMulticast:1; + u8 multicast:1; u8 bBroadcast:1; u8 drv_agg_enable:1; u8 reserved2:1; @@ -474,47 +474,30 @@ struct rtllib_rx_stats { u8 control; u8 mask; u16 len; - u64 tsf; - u32 beacon_time; - u8 nic_type; u16 Length; u8 SignalQuality; s32 RecvSignalPower; - s8 RxPower; u8 SignalStrength; u16 bHwError:1; u16 bCRC:1; u16 bICV:1; - u16 bShortPreamble:1; - u16 Antenna:1; u16 Decrypted:1; - u16 Wakeup:1; - u16 Reserved0:1; - u8 AGC; u32 TimeStampLow; u32 TimeStampHigh; - bool bShift; - bool bIsQosData; u8 RxDrvInfoSize; u8 RxBufShift; bool bIsAMPDU; bool bFirstMPDU; bool bContainHTC; - bool RxIs40MHzPacket; u32 RxPWDBAll; u8 RxMIMOSignalStrength[4]; s8 RxMIMOSignalQuality[2]; bool bPacketMatchBSSID; bool bIsCCK; bool bPacketToSelf; - u16 packetlength; - u16 fraglength; - u16 fragoffset; - u16 ntotalfrag; bool bPacketBeacon; bool bToSelfBA; - u16 Seq_Num; }; /* IEEE 802.11 requires that STA supports concurrent reception of at least @@ -928,14 +911,14 @@ struct rtllib_network { struct rtllib_qos_data qos_data; bool bWithAironetIE; - bool bCkipSupported; - bool bCcxRmEnable; + bool ckip_supported; + bool ccx_rm_enable; u8 CcxRmState[2]; bool bMBssidValid; u8 MBssidMask; u8 MBssid[ETH_ALEN]; bool bWithCcxVerNum; - u8 BssCcxVerNumber; + u8 bss_ccx_ver_number; /* These are network statistics */ struct rtllib_rx_stats stats; u16 capability; @@ -965,7 +948,7 @@ struct rtllib_network { u8 wmm_info; struct rtllib_wmm_ac_param wmm_param[4]; - u8 Turbo_Enable; + u8 turbo_enable; u16 CountryIeLen; u8 CountryIeBuf[MAX_IE_LEN]; struct bss_ht bssht; @@ -1048,9 +1031,9 @@ struct rx_reorder_entry { }; enum fsync_state { - Default_Fsync, - HW_Fsync, - SW_Fsync + DEFAULT_FSYNC, + HW_FSYNC, + SW_FSYNC }; enum ips_callback_function { @@ -1071,8 +1054,8 @@ struct rt_pwr_save_ctrl { enum ips_callback_function ReturnPoint; bool bLeisurePs; - u8 LpsIdleCount; - u8 LPSAwakeIntvl; + u8 lps_idle_count; + u8 lps_awake_intvl; u32 CurPsLevel; }; @@ -1110,18 +1093,18 @@ enum scan_op_backup_opt { #define RT_MAX_LD_SLOT_NUM 10 struct rt_link_detect { - u32 NumRecvBcnInPeriod; - u32 NumRecvDataInPeriod; + u32 num_recv_bcn_in_period; + u32 num_recv_data_in_period; u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; - u16 SlotNum; - u16 SlotIndex; + u16 slot_num; + u16 slot_index; u32 num_tx_ok_in_period; u32 num_rx_ok_in_period; - u32 NumRxUnicastOkInPeriod; - bool bBusyTraffic; + u32 num_rx_unicast_ok_in_period; + bool busy_traffic; bool bHigherBusyTraffic; bool bHigherBusyRxTraffic; }; @@ -1161,7 +1144,7 @@ struct rate_adaptive { #define NUM_PMKID_CACHE 16 struct rt_pmkid_list { - u8 Bssid[ETH_ALEN]; + u8 bssid[ETH_ALEN]; u8 PMKID[16]; u8 SsidBuf[33]; u8 used; @@ -1193,7 +1176,7 @@ struct rtllib_device { u8 *assocreq_ies, *assocresp_ies; size_t assocreq_ies_len, assocresp_ies_len; - bool bForcedBgMode; + bool forced_bg_mode; u8 hwsec_active; bool is_roaming; @@ -1201,7 +1184,7 @@ struct rtllib_device { bool cannot_notify; bool bSupportRemoteWakeUp; bool actscanning; - bool FirstIe_InScan; + bool first_ie_in_scan; bool be_scan_inprogress; bool beinretry; enum rt_rf_power_state rf_power_state; @@ -1264,7 +1247,7 @@ struct rtllib_device { int ieee802_1x; /* is IEEE 802.1X used */ /* WPA data */ - bool bHalfWirelessN24GMode; + bool half_wireless_n24g_mode; int wpa_enabled; int drop_unencrypted; int tkip_countermeasures; @@ -1281,7 +1264,7 @@ struct rtllib_device { struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; - struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; + struct rt_pmkid_list pmkid_list[NUM_PMKID_CACHE]; /* Fragmentation structures */ struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN]; @@ -1374,14 +1357,14 @@ struct rtllib_device { /* for PS mode */ unsigned long last_rx_ps_time; - bool bAwakePktSent; - u8 LPSDelayCnt; + bool awake_pkt_sent; + u8 lps_delay_cnt; /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; int mgmt_queue_head; int mgmt_queue_tail; - u8 AsocRetryCount; + u8 asoc_retry_count; struct sk_buff_head skb_waitq[MAX_QUEUE_SIZE]; bool bdynamic_txpower_enable; @@ -1484,17 +1467,18 @@ struct rtllib_device { void (*set_bw_mode_handler)(struct net_device *dev, enum ht_channel_width bandwidth, enum ht_extchnl_offset Offset); - bool (*GetNmodeSupportBySecCfg)(struct net_device *dev); + bool (*get_nmode_support_by_sec_cfg)(struct net_device *dev); void (*set_wireless_mode)(struct net_device *dev, u8 wireless_mode); - bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev); + bool (*get_half_nmode_support_by_aps_handler)(struct net_device *dev); u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee); void (*init_gain_handler)(struct net_device *dev, u8 Operation); void (*ScanOperationBackupHandler)(struct net_device *dev, u8 Operation); - void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val); + void (*set_hw_reg_handler)(struct net_device *dev, u8 variable, u8 *val); - void (*AllowAllDestAddrHandler)(struct net_device *dev, - bool bAllowAllDA, bool WriteIntoReg); + void (*allow_all_dest_addr_handler)(struct net_device *dev, + bool bAllowAllDA, + bool WriteIntoReg); void (*rtllib_ips_leave_wq)(struct net_device *dev); void (*rtllib_ips_leave)(struct net_device *dev); @@ -1662,7 +1646,7 @@ int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb, void rtllib_softmac_new_net(struct rtllib_device *ieee, struct rtllib_network *net); -void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn); +void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn); void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); int rtllib_softmac_init(struct rtllib_device *ieee); @@ -1771,25 +1755,25 @@ u8 ht_c_check(struct rtllib_device *ieee, u8 *pFrame); void ht_reset_iot_setting(struct rt_hi_throughput *ht_info); bool is_ht_half_nmode_aps(struct rtllib_device *ieee); u16 tx_count_to_data_rate(struct rtllib_device *ieee, u8 nDataRate); -int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); -int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); +int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb); +int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb); int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb); void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts, u8 policy, u8 overwrite_pending); void rtllib_ts_init_del_ba(struct rtllib_device *ieee, struct ts_common_info *ts_common_info, - enum tr_select TxRxSelect); + enum tr_select tx_rx_select); void rtllib_ba_setup_timeout(struct timer_list *t); void rtllib_tx_ba_inact_timeout(struct timer_list *t); void rtllib_rx_ba_inact_timeout(struct timer_list *t); void rtllib_reset_ba_entry(struct ba_record *ba); bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *addr, - u8 TID, enum tr_select TxRxSelect, bool bAddNewTs); + u8 TID, enum tr_select tx_rx_select, bool bAddNewTs); void rtllib_ts_init(struct rtllib_device *ieee); void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS); -void RemovePeerTS(struct rtllib_device *ieee, u8 *addr); -void RemoveAllTS(struct rtllib_device *ieee); +void remove_peer_ts(struct rtllib_device *ieee, u8 *addr); +void remove_all_ts(struct rtllib_device *ieee); static inline const char *escape_essid(const char *essid, u8 essid_len) { @@ -1805,13 +1789,13 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) } /* fun with the built-in rtllib stack... */ -bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); +bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn); /* For the function is more related to hardware setting, it's better to use the * ieee handler to refer to it. */ -void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, - struct rx_ts_record *ts); +void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee, + struct rx_ts_record *ts); int rtllib_parse_info_param(struct rtllib_device *ieee, struct rtllib_info_element *info_element, u16 length, @@ -1821,6 +1805,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prxbIndicateArray, u8 index); #define RT_ASOC_RETRY_LIMIT 5 -u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); +u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee); #endif /* RTLLIB_H */ diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 4df20f4d6bf9..ebf8a2fd36d3 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -487,8 +487,8 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, } } -void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, - struct rx_ts_record *ts) +void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee, + struct rx_ts_record *ts) { struct rx_reorder_entry *pRxReorderEntry; u8 RfdCnt = 0; @@ -865,9 +865,6 @@ static size_t rtllib_rx_get_hdrlen(struct rtllib_device *ieee, rx_stats->bContainHTC = true; } - if (RTLLIB_QOS_HAS_SEQ(fc)) - rx_stats->bIsQosData = true; - return hdrlen; } @@ -943,10 +940,9 @@ static void rtllib_rx_extract_addr(struct rtllib_device *ieee, static int rtllib_rx_data_filter(struct rtllib_device *ieee, struct ieee80211_hdr *hdr, u8 *dst, u8 *src, u8 *bssid, u8 *addr2) { - u8 type, stype; u16 fc = le16_to_cpu(hdr->frame_control); - type = WLAN_FC_GET_TYPE(fc); - stype = WLAN_FC_GET_STYPE(fc); + u8 type = WLAN_FC_GET_TYPE(fc); + u8 stype = WLAN_FC_GET_STYPE(fc); /* Filter frames from different BSS */ if (ieee80211_has_a4(hdr->frame_control) && @@ -1149,9 +1145,9 @@ static void rtllib_rx_check_leave_lps(struct rtllib_device *ieee, u8 unicast, { if (unicast) { if (ieee->link_state == MAC80211_LINKED) { - if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + + if (((ieee->link_detect_info.num_rx_unicast_ok_in_period + ieee->link_detect_info.num_tx_ok_in_period) > 8) || - (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) { + (ieee->link_detect_info.num_rx_unicast_ok_in_period > 2)) { ieee->leisure_ps_leave(ieee->dev); } } @@ -1284,7 +1280,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* Filter WAPI DATA Frame */ /* Update statstics for AP roaming */ - ieee->link_detect_info.NumRecvDataInPeriod++; + ieee->link_detect_info.num_recv_data_in_period++; ieee->link_detect_info.num_rx_ok_in_period++; /* Data frame - extract src/dst addresses */ @@ -1363,7 +1359,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, else nr_subframes = 1; if (unicast) - ieee->link_detect_info.NumRxUnicastOkInPeriod += nr_subframes; + ieee->link_detect_info.num_rx_unicast_ok_in_period += nr_subframes; rtllib_rx_check_leave_lps(ieee, unicast, nr_subframes); /* Indicate packets to upper layer or Rx Reorder */ @@ -1689,7 +1685,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, info_element->data[2] == 0x4c && info_element->data[3] == 0x01 && info_element->data[4] == 0x02) - network->Turbo_Enable = 1; + network->turbo_enable = 1; if (*tmp_htcap_len == 0) { if (info_element->len >= 4 && @@ -1819,9 +1815,9 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, if (info_element->len == 6) { memcpy(network->CcxRmState, &info_element->data[4], 2); if (network->CcxRmState[0] != 0) - network->bCcxRmEnable = true; + network->ccx_rm_enable = true; else - network->bCcxRmEnable = false; + network->ccx_rm_enable = false; network->MBssidMask = network->CcxRmState[1] & 0x07; if (network->MBssidMask != 0) { network->bMBssidValid = true; @@ -1834,7 +1830,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, network->bMBssidValid = false; } } else { - network->bCcxRmEnable = false; + network->ccx_rm_enable = false; } } if (info_element->len > 4 && @@ -1844,10 +1840,10 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, info_element->data[3] == 0x03) { if (info_element->len == 5) { network->bWithCcxVerNum = true; - network->BssCcxVerNumber = info_element->data[4]; + network->bss_ccx_ver_number = info_element->data[4]; } else { network->bWithCcxVerNum = false; - network->BssCcxVerNumber = 0; + network->bss_ccx_ver_number = 0; } } if (info_element->len > 4 && @@ -2100,12 +2096,12 @@ int rtllib_parse_info_param(struct rtllib_device *ieee, & SUPPORT_CKIP_MIC) || (info_element->data[IE_CISCO_FLAG_POSITION] & SUPPORT_CKIP_PK)) - network->bCkipSupported = true; + network->ckip_supported = true; else - network->bCkipSupported = false; + network->ckip_supported = false; } else { network->bWithAironetIE = false; - network->bCkipSupported = false; + network->ckip_supported = false; } break; case MFIE_TYPE_QOS_PARAMETER: @@ -2184,7 +2180,7 @@ static inline int rtllib_network_init( network->realtek_cap_exit = false; network->marvell_cap_exist = false; network->airgo_cap_exist = false; - network->Turbo_Enable = 0; + network->turbo_enable = 0; network->SignalStrength = stats->SignalStrength; network->RSSI = stats->SignalStrength; network->CountryIeLen = 0; @@ -2344,20 +2340,20 @@ static inline void update_network(struct rtllib_device *ieee, dst->SignalStrength = src->SignalStrength; dst->RSSI = src->RSSI; - dst->Turbo_Enable = src->Turbo_Enable; + dst->turbo_enable = src->turbo_enable; dst->CountryIeLen = src->CountryIeLen; memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen); dst->bWithAironetIE = src->bWithAironetIE; - dst->bCkipSupported = src->bCkipSupported; + dst->ckip_supported = src->ckip_supported; memcpy(dst->CcxRmState, src->CcxRmState, 2); - dst->bCcxRmEnable = src->bCcxRmEnable; + dst->ccx_rm_enable = src->ccx_rm_enable; dst->MBssidMask = src->MBssidMask; dst->bMBssidValid = src->bMBssidValid; memcpy(dst->MBssid, src->MBssid, 6); dst->bWithCcxVerNum = src->bWithCcxVerNum; - dst->BssCcxVerNumber = src->BssCcxVerNumber; + dst->bss_ccx_ver_number = src->bss_ccx_ver_number; } static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) @@ -2470,7 +2466,7 @@ static inline void rtllib_process_probe_response( } if (ieee80211_is_beacon(frame_ctl)) { if (ieee->link_state >= MAC80211_LINKED) - ieee->link_detect_info.NumRecvBcnInPeriod++; + ieee->link_detect_info.num_recv_bcn_in_period++; } } list_for_each_entry(target, &ieee->network_list, list) { diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index b9278b26accd..97fdca828da7 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -138,7 +138,7 @@ static void init_mgmt_queue(struct rtllib_device *ieee) ieee->mgmt_queue_head = 0; } -u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee) +u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee) { u16 i; u8 query_rate = 0; @@ -163,7 +163,7 @@ u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee) return query_rate; } -static u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee) +static u8 mgnt_query_mgnt_frame_tx_rate(struct rtllib_device *ieee) { struct rt_hi_throughput *ht_info = ieee->ht_info; u8 rate; @@ -201,7 +201,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) if (ieee->disable_mgnt_queue) tcb_desc->queue_index = HIGH_QUEUE; - tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); + tcb_desc->data_rate = mgnt_query_mgnt_frame_tx_rate(ieee); tcb_desc->ratr_index = 7; tcb_desc->tx_dis_rate_fallback = 1; tcb_desc->tx_use_drv_assinged_rate = 1; @@ -277,7 +277,7 @@ softmac_ps_mgmt_xmit(struct sk_buff *skb, if (ieee->disable_mgnt_queue) tcb_desc->queue_index = HIGH_QUEUE; - tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); + tcb_desc->data_rate = mgnt_query_mgnt_frame_tx_rate(ieee); tcb_desc->ratr_index = 7; tcb_desc->tx_dis_rate_fallback = 1; tcb_desc->tx_use_drv_assinged_rate = 1; @@ -355,20 +355,19 @@ void rtllib_enable_net_monitor_mode(struct net_device *dev, netdev_info(dev, "========>Enter Monitor Mode\n"); - ieee->AllowAllDestAddrHandler(dev, true, !init_state); + ieee->allow_all_dest_addr_handler(dev, true, !init_state); } /* Disables network monitor mode. Only packets destinated to * us will be received. */ -void rtllib_disable_net_monitor_mode(struct net_device *dev, - bool init_state) +void rtllib_disable_net_monitor_mode(struct net_device *dev, bool init_state) { struct rtllib_device *ieee = netdev_priv_rsl(dev); netdev_info(dev, "========>Exit Monitor Mode\n"); - ieee->AllowAllDestAddrHandler(dev, false, !init_state); + ieee->allow_all_dest_addr_handler(dev, false, !init_state); } static void rtllib_send_probe(struct rtllib_device *ieee) @@ -665,13 +664,13 @@ static struct sk_buff *rtllib_pspoll_func(struct rtllib_device *ieee) return skb; } -static inline int SecIsInPMKIDList(struct rtllib_device *ieee, u8 *bssid) +static inline int sec_is_in_pmkid_list(struct rtllib_device *ieee, u8 *bssid) { int i = 0; do { - if ((ieee->PMKIDList[i].used) && - (memcmp(ieee->PMKIDList[i].Bssid, bssid, ETH_ALEN) == 0)) + if ((ieee->pmkid_list[i].used) && + (memcmp(ieee->pmkid_list[i].bssid, bssid, ETH_ALEN) == 0)) break; i++; } while (i < NUM_PMKID_CACHE); @@ -700,7 +699,7 @@ rtllib_association_req(struct rtllib_network *beacon, unsigned int cxvernum_ie_len = 0; struct lib80211_crypt_data *crypt; int encrypt; - int PMKCacheIdx; + int pmk_cache_idx; unsigned int rate_len = (beacon->rates_len ? (beacon->rates_len + 2) : 0) + @@ -708,7 +707,7 @@ rtllib_association_req(struct rtllib_network *beacon, 2 : 0); unsigned int wmm_info_len = beacon->qos_data.supported ? 9 : 0; - unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0; + unsigned int turbo_info_len = beacon->turbo_enable ? 9 : 0; int len = 0; @@ -722,14 +721,14 @@ rtllib_association_req(struct rtllib_network *beacon, if ((ieee->rtllib_ap_sec_type && (ieee->rtllib_ap_sec_type(ieee) & SEC_ALG_TKIP)) || - ieee->bForcedBgMode) { + ieee->forced_bg_mode) { ieee->ht_info->enable_ht = 0; ieee->mode = WIRELESS_MODE_G; } if (ieee->ht_info->current_ht_support && ieee->ht_info->enable_ht) { - ht_cap_buf = (u8 *)&ieee->ht_info->SelfHTCap; - ht_cap_len = sizeof(ieee->ht_info->SelfHTCap); + ht_cap_buf = (u8 *)&ieee->ht_info->self_ht_cap; + ht_cap_len = sizeof(ieee->ht_info->self_ht_cap); ht_construct_capability_element(ieee, ht_cap_buf, &ht_cap_len, encrypt, true); if (ieee->ht_info->current_rt2rt_aggregation) { @@ -741,15 +740,15 @@ rtllib_association_req(struct rtllib_network *beacon, } } - if (beacon->bCkipSupported) + if (beacon->ckip_supported) ckip_ie_len = 30 + 2; - if (beacon->bCcxRmEnable) + if (beacon->ccx_rm_enable) ccxrm_ie_len = 6 + 2; - if (beacon->BssCcxVerNumber >= 2) + if (beacon->bss_ccx_ver_number >= 2) cxvernum_ie_len = 5 + 2; - PMKCacheIdx = SecIsInPMKIDList(ieee, ieee->current_network.bssid); - if (PMKCacheIdx >= 0) { + pmk_cache_idx = sec_is_in_pmkid_list(ieee, ieee->current_network.bssid); + if (pmk_cache_idx >= 0) { wpa_ie_len += 18; netdev_info(ieee->dev, "[PMK cache]: WPA2 IE length: %x\n", wpa_ie_len); @@ -818,52 +817,52 @@ rtllib_association_req(struct rtllib_network *beacon, *tag++ = beacon->rates_ex[i]; } - if (beacon->bCkipSupported) { - static const u8 AironetIeOui[] = {0x00, 0x01, 0x66}; - u8 CcxAironetBuf[30]; - struct octet_string osCcxAironetIE; + if (beacon->ckip_supported) { + static const u8 aironet_ie_oui[] = {0x00, 0x01, 0x66}; + u8 ccx_aironet_buf[30]; + struct octet_string os_ccx_aironet_ie; - memset(CcxAironetBuf, 0, 30); - osCcxAironetIE.Octet = CcxAironetBuf; - osCcxAironetIE.Length = sizeof(CcxAironetBuf); - memcpy(osCcxAironetIE.Octet, AironetIeOui, - sizeof(AironetIeOui)); + memset(ccx_aironet_buf, 0, 30); + os_ccx_aironet_ie.octet = ccx_aironet_buf; + os_ccx_aironet_ie.Length = sizeof(ccx_aironet_buf); + memcpy(os_ccx_aironet_ie.octet, aironet_ie_oui, + sizeof(aironet_ie_oui)); - osCcxAironetIE.Octet[IE_CISCO_FLAG_POSITION] |= + os_ccx_aironet_ie.octet[IE_CISCO_FLAG_POSITION] |= (SUPPORT_CKIP_PK | SUPPORT_CKIP_MIC); tag = skb_put(skb, ckip_ie_len); *tag++ = MFIE_TYPE_AIRONET; - *tag++ = osCcxAironetIE.Length; - memcpy(tag, osCcxAironetIE.Octet, osCcxAironetIE.Length); - tag += osCcxAironetIE.Length; + *tag++ = os_ccx_aironet_ie.Length; + memcpy(tag, os_ccx_aironet_ie.octet, os_ccx_aironet_ie.Length); + tag += os_ccx_aironet_ie.Length; } - if (beacon->bCcxRmEnable) { - static const u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, + if (beacon->ccx_rm_enable) { + static const u8 ccx_rm_cap_buf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 0x00}; - struct octet_string osCcxRmCap; + struct octet_string os_ccx_rm_cap; - osCcxRmCap.Octet = (u8 *)CcxRmCapBuf; - osCcxRmCap.Length = sizeof(CcxRmCapBuf); + os_ccx_rm_cap.octet = (u8 *)ccx_rm_cap_buf; + os_ccx_rm_cap.Length = sizeof(ccx_rm_cap_buf); tag = skb_put(skb, ccxrm_ie_len); *tag++ = MFIE_TYPE_GENERIC; - *tag++ = osCcxRmCap.Length; - memcpy(tag, osCcxRmCap.Octet, osCcxRmCap.Length); - tag += osCcxRmCap.Length; + *tag++ = os_ccx_rm_cap.Length; + memcpy(tag, os_ccx_rm_cap.octet, os_ccx_rm_cap.Length); + tag += os_ccx_rm_cap.Length; } - if (beacon->BssCcxVerNumber >= 2) { - u8 CcxVerNumBuf[] = {0x00, 0x40, 0x96, 0x03, 0x00}; - struct octet_string osCcxVerNum; + if (beacon->bss_ccx_ver_number >= 2) { + u8 ccx_ver_num_buf[] = {0x00, 0x40, 0x96, 0x03, 0x00}; + struct octet_string os_ccx_ver_num; - CcxVerNumBuf[4] = beacon->BssCcxVerNumber; - osCcxVerNum.Octet = CcxVerNumBuf; - osCcxVerNum.Length = sizeof(CcxVerNumBuf); + ccx_ver_num_buf[4] = beacon->bss_ccx_ver_number; + os_ccx_ver_num.octet = ccx_ver_num_buf; + os_ccx_ver_num.Length = sizeof(ccx_ver_num_buf); tag = skb_put(skb, cxvernum_ie_len); *tag++ = MFIE_TYPE_GENERIC; - *tag++ = osCcxVerNum.Length; - memcpy(tag, osCcxVerNum.Octet, osCcxVerNum.Length); - tag += osCcxVerNum.Length; + *tag++ = os_ccx_ver_num.Length; + memcpy(tag, os_ccx_ver_num.octet, os_ccx_ver_num.Length); + tag += os_ccx_ver_num.Length; } if (ieee->ht_info->current_ht_support && ieee->ht_info->enable_ht) { if (ieee->ht_info->peer_ht_spec_ver != HT_SPEC_VER_EWC) { @@ -878,11 +877,11 @@ rtllib_association_req(struct rtllib_network *beacon, if (wpa_ie_len) { skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); - if (PMKCacheIdx >= 0) { + if (pmk_cache_idx >= 0) { tag = skb_put(skb, 18); *tag = 1; *(tag + 1) = 0; - memcpy((tag + 2), &ieee->PMKIDList[PMKCacheIdx].PMKID, + memcpy((tag + 2), &ieee->pmkid_list[pmk_cache_idx].PMKID, 16); } } @@ -1072,17 +1071,16 @@ static void rtllib_associate_complete_wq(void *data) ieee->ht_info->enable_ht); memset(ieee->dot11ht_oper_rate_set, 0, 16); } - ieee->link_detect_info.SlotNum = 2 * (1 + + ieee->link_detect_info.slot_num = 2 * (1 + ieee->current_network.beacon_interval / 500); - if (ieee->link_detect_info.NumRecvBcnInPeriod == 0 || - ieee->link_detect_info.NumRecvDataInPeriod == 0) { - ieee->link_detect_info.NumRecvBcnInPeriod = 1; - ieee->link_detect_info.NumRecvDataInPeriod = 1; + if (ieee->link_detect_info.num_recv_bcn_in_period == 0 || + ieee->link_detect_info.num_recv_data_in_period == 0) { + ieee->link_detect_info.num_recv_bcn_in_period = 1; + ieee->link_detect_info.num_recv_data_in_period = 1; } - psc->LpsIdleCount = 0; + psc->lps_idle_count = 0; ieee->link_change(ieee->dev); - } static void rtllib_sta_send_associnfo(struct rtllib_device *ieee) @@ -1209,18 +1207,18 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, ieee->current_network.flags); if ((rtllib_act_scanning(ieee, false)) && - !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) + !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) rtllib_stop_scan_syncro(ieee); ht_reset_iot_setting(ieee->ht_info); ieee->wmm_acm = 0; if (ieee->iw_mode == IW_MODE_INFRA) { /* Join the network for the first time */ - ieee->AsocRetryCount = 0; + ieee->asoc_retry_count = 0; if ((ieee->current_network.qos_data.supported == 1) && ieee->current_network.bssht.bd_support_ht) ht_reset_self_and_save_peer_setting(ieee, - &(ieee->current_network)); + &ieee->current_network); else ieee->ht_info->current_ht_support = false; @@ -1319,10 +1317,10 @@ static inline u16 assoc_parse(struct rtllib_device *ieee, struct sk_buff *skb, status_code == WLAN_STATUS_CAPS_UNSUPPORTED) && ((ieee->mode == WIRELESS_MODE_G) && (ieee->current_network.mode == WIRELESS_MODE_N_24G) && - (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT - 1)))) { + (ieee->asoc_retry_count++ < (RT_ASOC_RETRY_LIMIT - 1)))) { ieee->ht_info->iot_action |= HT_IOT_ACT_PURE_N_MODE; } else { - ieee->AsocRetryCount = 0; + ieee->asoc_retry_count = 0; } return le16_to_cpu(response_head->status); @@ -1351,8 +1349,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) u8 dtim; struct rt_pwr_save_ctrl *psc = &ieee->pwr_save_ctrl; - if (ieee->LPSDelayCnt) { - ieee->LPSDelayCnt--; + if (ieee->lps_delay_cnt) { + ieee->lps_delay_cnt--; return 0; } @@ -1378,45 +1376,45 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) return 0; if (time) { - if (ieee->bAwakePktSent) { - psc->LPSAwakeIntvl = 1; + if (ieee->awake_pkt_sent) { + psc->lps_awake_intvl = 1; } else { - u8 MaxPeriod = 5; + u8 max_period = 5; - if (psc->LPSAwakeIntvl == 0) - psc->LPSAwakeIntvl = 1; - psc->LPSAwakeIntvl = (psc->LPSAwakeIntvl >= - MaxPeriod) ? MaxPeriod : - (psc->LPSAwakeIntvl + 1); + if (psc->lps_awake_intvl == 0) + psc->lps_awake_intvl = 1; + psc->lps_awake_intvl = (psc->lps_awake_intvl >= + max_period) ? max_period : + (psc->lps_awake_intvl + 1); } { - u8 LPSAwakeIntvl_tmp = 0; + u8 lps_awake_intvl_tmp = 0; u8 period = ieee->current_network.dtim_period; u8 count = ieee->current_network.tim.tim_count; if (count == 0) { - if (psc->LPSAwakeIntvl > period) - LPSAwakeIntvl_tmp = period + - (psc->LPSAwakeIntvl - + if (psc->lps_awake_intvl > period) + lps_awake_intvl_tmp = period + + (psc->lps_awake_intvl - period) - - ((psc->LPSAwakeIntvl - period) % + ((psc->lps_awake_intvl - period) % period); else - LPSAwakeIntvl_tmp = psc->LPSAwakeIntvl; + lps_awake_intvl_tmp = psc->lps_awake_intvl; } else { - if (psc->LPSAwakeIntvl > + if (psc->lps_awake_intvl > ieee->current_network.tim.tim_count) - LPSAwakeIntvl_tmp = count + - (psc->LPSAwakeIntvl - count) - - ((psc->LPSAwakeIntvl - count) % period); + lps_awake_intvl_tmp = count + + (psc->lps_awake_intvl - count) - + ((psc->lps_awake_intvl - count) % period); else - LPSAwakeIntvl_tmp = psc->LPSAwakeIntvl; + lps_awake_intvl_tmp = psc->lps_awake_intvl; } *time = ieee->current_network.last_dtim_sta_time + msecs_to_jiffies(ieee->current_network.beacon_interval * - LPSAwakeIntvl_tmp); + lps_awake_intvl_tmp); } } @@ -1461,7 +1459,7 @@ static inline void rtllib_sta_ps(struct work_struct *work) spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); } - ieee->bAwakePktSent = false; + ieee->awake_pkt_sent = false; } else if (sleep == 2) { spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); @@ -1553,10 +1551,10 @@ static void rtllib_process_action(struct rtllib_device *ieee, case ACT_CAT_BA: switch (*act) { case ACT_ADDBAREQ: - rtllib_rx_ADDBAReq(ieee, skb); + rtllib_rx_add_ba_req(ieee, skb); break; case ACT_ADDBARSP: - rtllib_rx_ADDBARsp(ieee, skb); + rtllib_rx_add_ba_rsp(ieee, skb); break; case ACT_DELBA: rtllib_rx_DELBA(ieee, skb); @@ -1606,10 +1604,10 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, kfree(network); return 1; } - memcpy(ieee->ht_info->PeerHTCapBuf, + memcpy(ieee->ht_info->peer_ht_cap_buf, network->bssht.bd_ht_cap_buf, network->bssht.bd_ht_cap_len); - memcpy(ieee->ht_info->PeerHTInfoBuf, + memcpy(ieee->ht_info->peer_ht_info_buf, network->bssht.bd_ht_info_buf, network->bssht.bd_ht_info_len); ieee->handle_assoc_response(ieee->dev, @@ -1634,7 +1632,7 @@ rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, netdev_info(ieee->dev, "Association response status code 0x%x\n", errcode); - if (ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) + if (ieee->asoc_retry_count < RT_ASOC_RETRY_LIMIT) schedule_delayed_work(&ieee->associate_procedure_wq, 0); else rtllib_associate_abort(ieee); @@ -1648,7 +1646,7 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) int errcode; u8 *challenge; int chlen = 0; - bool bSupportNmode = true, bHalfSupportNmode = false; + bool support_nmode = true, half_support_nmode = false; errcode = auth_parse(ieee->dev, skb, &challenge, &chlen); @@ -1664,18 +1662,18 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) ieee->link_state = RTLLIB_ASSOCIATING_AUTHENTICATED; ieee->softmac_stats.rx_auth_rs_ok++; if (!(ieee->ht_info->iot_action & HT_IOT_ACT_PURE_N_MODE)) { - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { + if (!ieee->get_nmode_support_by_sec_cfg(ieee->dev)) { if (is_ht_half_nmode_aps(ieee)) { - bSupportNmode = true; - bHalfSupportNmode = true; + support_nmode = true; + half_support_nmode = true; } else { - bSupportNmode = false; - bHalfSupportNmode = false; + support_nmode = false; + half_support_nmode = false; } } } /* Dummy wirless mode setting to avoid encryption issue */ - if (bSupportNmode) { + if (support_nmode) { ieee->set_wireless_mode(ieee->dev, ieee->current_network.mode); } else { @@ -1684,11 +1682,11 @@ static void rtllib_rx_auth_resp(struct rtllib_device *ieee, struct sk_buff *skb) } if ((ieee->current_network.mode == WIRELESS_MODE_N_24G) && - bHalfSupportNmode) { + half_support_nmode) { netdev_info(ieee->dev, "======>enter half N mode\n"); - ieee->bHalfWirelessN24GMode = true; + ieee->half_wireless_n24g_mode = true; } else { - ieee->bHalfWirelessN24GMode = false; + ieee->half_wireless_n24g_mode = false; } rtllib_associate_step2(ieee); } else { @@ -1734,13 +1732,11 @@ rtllib_rx_deauth(struct rtllib_device *ieee, struct sk_buff *skb) ieee->link_state = RTLLIB_ASSOCIATING; ieee->softmac_stats.reassoc++; ieee->is_roaming = true; - ieee->link_detect_info.bBusyTraffic = false; + ieee->link_detect_info.busy_traffic = false; rtllib_disassociate(ieee); - RemovePeerTS(ieee, header->addr2); - if (!(ieee->rtllib_ap_sec_type(ieee) & - (SEC_ALG_CCMP | SEC_ALG_TKIP))) - schedule_delayed_work( - &ieee->associate_procedure_wq, 5); + remove_peer_ts(ieee, header->addr2); + if (!(ieee->rtllib_ap_sec_type(ieee) & (SEC_ALG_CCMP | SEC_ALG_TKIP))) + schedule_delayed_work(&ieee->associate_procedure_wq, 5); } return 0; } @@ -1816,7 +1812,7 @@ void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee) /* update the tx status */ tcb_desc = (struct cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE); - if (tcb_desc->bMulticast) + if (tcb_desc->multicast) ieee->stats.multicast++; /* if xmit available, just xmit it immediately, else just insert it to @@ -1998,11 +1994,11 @@ void rtllib_stop_protocol(struct rtllib_device *ieee) if (ieee->link_state == MAC80211_LINKED) { if (ieee->iw_mode == IW_MODE_INFRA) - SendDisassociation(ieee, 1, WLAN_REASON_DEAUTH_LEAVING); + send_disassociation(ieee, 1, WLAN_REASON_DEAUTH_LEAVING); rtllib_disassociate(ieee); } - RemoveAllTS(ieee); + remove_all_ts(ieee); ieee->proto_stoppping = 0; kfree(ieee->assocreq_ies); @@ -2072,13 +2068,13 @@ int rtllib_softmac_init(struct rtllib_device *ieee) for (i = 0; i < 5; i++) ieee->seq_ctrl[i] = 0; - ieee->link_detect_info.SlotIndex = 0; - ieee->link_detect_info.SlotNum = 2; - ieee->link_detect_info.NumRecvBcnInPeriod = 0; - ieee->link_detect_info.NumRecvDataInPeriod = 0; + ieee->link_detect_info.slot_index = 0; + ieee->link_detect_info.slot_num = 2; + ieee->link_detect_info.num_recv_bcn_in_period = 0; + ieee->link_detect_info.num_recv_data_in_period = 0; ieee->link_detect_info.num_tx_ok_in_period = 0; ieee->link_detect_info.num_rx_ok_in_period = 0; - ieee->link_detect_info.NumRxUnicastOkInPeriod = 0; + ieee->link_detect_info.num_rx_unicast_ok_in_period = 0; ieee->is_aggregate_frame = false; ieee->assoc_id = 0; ieee->queue_stop = 0; @@ -2101,7 +2097,7 @@ int rtllib_softmac_init(struct rtllib_device *ieee) ieee->reg_dot11tx_ht_oper_rate_set[1] = 0xff; ieee->reg_dot11tx_ht_oper_rate_set[4] = 0x01; - ieee->FirstIe_InScan = false; + ieee->first_ie_in_scan = false; ieee->actscanning = false; ieee->beinretry = false; ieee->is_set_key = false; @@ -2148,7 +2144,7 @@ void rtllib_softmac_free(struct rtllib_device *ieee) static inline struct sk_buff * rtllib_disauth_skb(struct rtllib_network *beacon, - struct rtllib_device *ieee, u16 asRsn) + struct rtllib_device *ieee, u16 rsn) { struct sk_buff *skb; struct rtllib_disauth *disauth; @@ -2168,13 +2164,13 @@ rtllib_disauth_skb(struct rtllib_network *beacon, ether_addr_copy(disauth->header.addr2, ieee->dev->dev_addr); ether_addr_copy(disauth->header.addr3, beacon->bssid); - disauth->reason = cpu_to_le16(asRsn); + disauth->reason = cpu_to_le16(rsn); return skb; } static inline struct sk_buff * rtllib_disassociate_skb(struct rtllib_network *beacon, - struct rtllib_device *ieee, u16 asRsn) + struct rtllib_device *ieee, u16 rsn) { struct sk_buff *skb; struct rtllib_disassoc *disass; @@ -2195,19 +2191,19 @@ rtllib_disassociate_skb(struct rtllib_network *beacon, ether_addr_copy(disass->header.addr2, ieee->dev->dev_addr); ether_addr_copy(disass->header.addr3, beacon->bssid); - disass->reason = cpu_to_le16(asRsn); + disass->reason = cpu_to_le16(rsn); return skb; } -void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn) +void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn) { struct rtllib_network *beacon = &ieee->current_network; struct sk_buff *skb; if (deauth) - skb = rtllib_disauth_skb(beacon, ieee, asRsn); + skb = rtllib_disauth_skb(beacon, ieee, rsn); else - skb = rtllib_disassociate_skb(beacon, ieee, asRsn); + skb = rtllib_disassociate_skb(beacon, ieee, rsn); if (skb) softmac_mgmt_xmit(skb, ieee); @@ -2241,56 +2237,56 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) } } -static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, - u8 *asSta, u8 asRsn) +static void rtllib_mlme_disassociate_request(struct rtllib_device *rtllib, + u8 *addr, u8 rsn) { u8 i; u8 op_mode; - RemovePeerTS(rtllib, asSta); + remove_peer_ts(rtllib, addr); - if (memcmp(rtllib->current_network.bssid, asSta, 6) == 0) { + if (memcmp(rtllib->current_network.bssid, addr, 6) == 0) { rtllib->link_state = MAC80211_NOLINK; for (i = 0; i < 6; i++) rtllib->current_network.bssid[i] = 0x22; op_mode = RT_OP_MODE_NO_LINK; rtllib->op_mode = RT_OP_MODE_NO_LINK; - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_MEDIA_STATUS, + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_MEDIA_STATUS, (u8 *)(&op_mode)); rtllib_disassociate(rtllib); - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_BSSID, + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_BSSID, rtllib->current_network.bssid); } } -static void rtllib_MgntDisconnectAP(struct rtllib_device *rtllib, u8 asRsn) +static void rtllib_mgnt_disconnect_ap(struct rtllib_device *rtllib, u8 rsn) { - bool bFilterOutNonAssociatedBSSID = false; + bool filter_out_nonassociated_bssid = false; - bFilterOutNonAssociatedBSSID = false; - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_CECHK_BSSID, - (u8 *)(&bFilterOutNonAssociatedBSSID)); - rtllib_MlmeDisassociateRequest(rtllib, rtllib->current_network.bssid, - asRsn); + filter_out_nonassociated_bssid = false; + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_CECHK_BSSID, + (u8 *)(&filter_out_nonassociated_bssid)); + rtllib_mlme_disassociate_request(rtllib, rtllib->current_network.bssid, + rsn); rtllib->link_state = MAC80211_NOLINK; } -bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn) +bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn) { if (rtllib->ps != RTLLIB_PS_DISABLED) rtllib->sta_wake_up(rtllib->dev); if (rtllib->link_state == MAC80211_LINKED) { if (rtllib->iw_mode == IW_MODE_INFRA) - rtllib_MgntDisconnectAP(rtllib, asRsn); + rtllib_mgnt_disconnect_ap(rtllib, rsn); } return true; } -EXPORT_SYMBOL(rtllib_MgntDisconnect); +EXPORT_SYMBOL(rtllib_mgnt_disconnect); void notify_wx_assoc_event(struct rtllib_device *ieee) { diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 2afa701e5445..d6bc74ba9092 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -347,10 +347,10 @@ void rtllib_wx_sync_scan_wq(void *data) /* Notify AP that I wake up again */ rtllib_sta_ps_send_null_frame(ieee, 0); - if (ieee->link_detect_info.NumRecvBcnInPeriod == 0 || - ieee->link_detect_info.NumRecvDataInPeriod == 0) { - ieee->link_detect_info.NumRecvBcnInPeriod = 1; - ieee->link_detect_info.NumRecvDataInPeriod = 1; + if (ieee->link_detect_info.num_recv_bcn_in_period == 0 || + ieee->link_detect_info.num_recv_data_in_period == 0) { + ieee->link_detect_info.num_recv_bcn_in_period = 1; + ieee->link_detect_info.num_recv_data_in_period = 1; } rtllib_wake_all_queues(ieee); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index f7098a2ba8b0..54100dd81505 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -286,7 +286,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee, if (ht_info->iot_action & HT_IOT_ACT_TX_NO_AGGREGATION) return; - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) + if (!ieee->get_nmode_support_by_sec_cfg(ieee->dev)) return; if (ht_info->current_ampdu_enable) { if (!rtllib_get_ts(ieee, (struct ts_common_info **)(&ts), hdr->addr1, @@ -356,7 +356,7 @@ static void rtllib_query_BandwidthMode(struct rtllib_device *ieee, if (!ht_info->current_ht_support || !ht_info->enable_ht) return; - if (tcb_desc->bMulticast || tcb_desc->bBroadcast) + if (tcb_desc->multicast || tcb_desc->bBroadcast) return; if ((tcb_desc->data_rate & 0x80) == 0) @@ -378,7 +378,7 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee, tcb_desc->RTSSC = 0; tcb_desc->bRTSBW = false; - if (tcb_desc->bBroadcast || tcb_desc->bMulticast) + if (tcb_desc->bBroadcast || tcb_desc->multicast) return; if (is_broadcast_ether_addr(skb->data + 16)) @@ -595,14 +595,14 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) ((((u8 *)udp)[1] == 67) && (((u8 *)udp)[3] == 68))) { bdhcp = true; - ieee->LPSDelayCnt = 200; + ieee->lps_delay_cnt = 200; } } } else if (ether_type == ETH_P_ARP) { netdev_info(ieee->dev, "=================>DHCP Protocol start tx ARP pkt!!\n"); bdhcp = true; - ieee->LPSDelayCnt = + ieee->lps_delay_cnt = ieee->current_network.tim.tim_count; } } @@ -832,7 +832,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->ht_info->iot_action & HT_IOT_ACT_WA_IOT_Broadcom) { tcb_desc->data_rate = - MgntQuery_TxRateExcludeCCKRates(ieee); + mgnt_query_tx_rate_exclude_cck_rates(ieee); tcb_desc->tx_dis_rate_fallback = false; } else { tcb_desc->data_rate = ieee->basic_rate; @@ -843,11 +843,11 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) tcb_desc->tx_use_drv_assinged_rate = 1; } else { if (is_multicast_ether_addr(header.addr1)) - tcb_desc->bMulticast = 1; + tcb_desc->multicast = 1; if (is_broadcast_ether_addr(header.addr1)) tcb_desc->bBroadcast = 1; rtllib_txrate_selectmode(ieee, tcb_desc); - if (tcb_desc->bMulticast || tcb_desc->bBroadcast) + if (tcb_desc->multicast || tcb_desc->bBroadcast) tcb_desc->data_rate = ieee->basic_rate; else tcb_desc->data_rate = rtllib_current_rate(ieee); @@ -856,7 +856,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) if (ieee->ht_info->iot_action & HT_IOT_ACT_WA_IOT_Broadcom) { tcb_desc->data_rate = - MgntQuery_TxRateExcludeCCKRates(ieee); + mgnt_query_tx_rate_exclude_cck_rates(ieee); tcb_desc->tx_dis_rate_fallback = false; } else { tcb_desc->data_rate = MGN_1M; diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index f92ec0faf4d5..55a3e4222cd6 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -636,7 +636,7 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee, ieee->cannot_notify = true; - SendDisassociation(ieee, deauth, mlme->reason_code); + send_disassociation(ieee, deauth, mlme->reason_code); rtllib_disassociate(ieee); ieee->wap_set = 0; diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c index 30e7457a9c31..b89e88d6a82d 100644 --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c @@ -1035,8 +1035,8 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) u16 wpa_len = 0, rsn_len = 0; struct HT_info_element *pht_info = NULL; struct ieee80211_ht_cap *pht_cap = NULL; - unsigned int len; - unsigned char *p; + unsigned int len; + unsigned char *p; __le16 le_cap; memcpy((u8 *)&le_cap, rtw_get_capability_from_ie(pnetwork->network.ies), 2); diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index b221913733fb..bfb27f902753 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -169,7 +169,6 @@ void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwor { unsigned int delta_time; u32 lifetime = SCANQUEUE_LIFETIME; -/* _irqL irqL; */ struct __queue *free_queue = &(pmlmepriv->free_bss_pool); if (!pnetwork) @@ -389,7 +388,6 @@ int is_same_network(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst, u8 fea d_cap = le16_to_cpu(tmpd); return (src->ssid.ssid_length == dst->ssid.ssid_length) && - /* (src->configuration.ds_config == dst->configuration.ds_config) && */ ((!memcmp(src->mac_address, dst->mac_address, ETH_ALEN))) && ((!memcmp(src->ssid.ssid, dst->ssid.ssid, src->ssid.ssid_length))) && ((s_cap & WLAN_CAPABILITY_IBSS) == @@ -1548,9 +1546,9 @@ void _rtw_join_timeout_handler(struct timer_list *t) int do_join_r; do_join_r = rtw_do_join(adapter); - if (do_join_r != _SUCCESS) { + if (do_join_r != _SUCCESS) continue; - } + break; } else { rtw_indicate_disconnect(adapter); @@ -2432,9 +2430,8 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe return; /* maybe needs check if ap supports rx ampdu. */ - if (!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1) { + if (!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1) phtpriv->ampdu_enable = true; - } /* check Max Rx A-MPDU Size */ len = 0; diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c index 1593980d2c6a..0145c4da5ac0 100644 --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c @@ -127,9 +127,8 @@ void kfree_all_stainfo(struct sta_priv *pstapriv) phead = get_list_head(&pstapriv->free_sta_queue); plist = get_next(phead); - while (phead != plist) { + while (phead != plist) plist = get_next(plist); - } spin_unlock_bh(&pstapriv->sta_hash_lock); } diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index c5219a4a4919..7a5c3a98183b 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -954,7 +954,7 @@ static u16 hal_EfuseGetCurrentSize_WiFi( #endif u16 efuse_addr = 0; u16 start_addr = 0; /* for debug */ - u8 hoffset = 0, hworden = 0; + u8 hworden = 0; u8 efuse_data, word_cnts = 0; u32 count = 0; /* for debug */ @@ -1001,16 +1001,13 @@ static u16 hal_EfuseGetCurrentSize_WiFi( } if (EXT_HEADER(efuse_data)) { - hoffset = GET_HDR_OFFSET_2_0(efuse_data); efuse_addr++; efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); if (ALL_WORDS_DISABLED(efuse_data)) continue; - hoffset |= ((efuse_data & 0xF0) >> 1); hworden = efuse_data & 0x0F; } else { - hoffset = (efuse_data>>4) & 0x0F; hworden = efuse_data & 0x0F; } @@ -1047,7 +1044,7 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) u16 btusedbytes; u16 efuse_addr; u8 bank, startBank; - u8 hoffset = 0, hworden = 0; + u8 hworden = 0; u8 efuse_data, word_cnts = 0; u16 retU2 = 0; @@ -1085,7 +1082,6 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) break; if (EXT_HEADER(efuse_data)) { - hoffset = GET_HDR_OFFSET_2_0(efuse_data); efuse_addr++; efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); @@ -1094,11 +1090,8 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) continue; } -/* hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); */ - hoffset |= ((efuse_data & 0xF0) >> 1); hworden = efuse_data & 0x0F; } else { - hoffset = (efuse_data>>4) & 0x0F; hworden = efuse_data & 0x0F; } @@ -1114,18 +1107,15 @@ static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) ) { if (efuse_data != 0xFF) { if ((efuse_data&0x1F) == 0x0F) { /* extended header */ - hoffset = efuse_data; efuse_addr++; efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); if ((efuse_data & 0x0F) == 0x0F) { efuse_addr++; continue; } else { - hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); hworden = efuse_data & 0x0F; } } else { - hoffset = (efuse_data>>4) & 0x0F; hworden = efuse_data & 0x0F; } word_cnts = Efuse_CalculateWordCnts(hworden); diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 1ff763c10064..65a450fcdce7 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -1259,8 +1259,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy goto check_need_indicate_scan_done; } - ssid = kzalloc(RTW_SSID_SCAN_AMOUNT * sizeof(struct ndis_802_11_ssid), - GFP_KERNEL); + ssid = kcalloc(RTW_SSID_SCAN_AMOUNT, sizeof(*ssid), GFP_KERNEL); if (!ssid) { ret = -ENOMEM; goto check_need_indicate_scan_done; diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index e6e89784d84b..c3ba490e53cb 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -350,12 +350,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, if (is_capturing(dev)) { v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Grab another frame"); - vchiq_mmal_port_parameter_set( - instance, - dev->capture.camera_port, - MMAL_PARAMETER_CAPTURE, - &dev->capture.frame_count, - sizeof(dev->capture.frame_count)); + vchiq_mmal_port_parameter_set(instance, + dev->capture.camera_port, + MMAL_PARAMETER_CAPTURE, + &dev->capture.frame_count, + sizeof(dev->capture.frame_count)); } if (vchiq_mmal_submit_buffer(instance, port, &buf->mmal)) @@ -406,12 +405,11 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, is_capturing(dev)) { v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Grab another frame as buffer has EOS"); - vchiq_mmal_port_parameter_set( - instance, - dev->capture.camera_port, - MMAL_PARAMETER_CAPTURE, - &dev->capture.frame_count, - sizeof(dev->capture.frame_count)); + vchiq_mmal_port_parameter_set(instance, + dev->capture.camera_port, + MMAL_PARAMETER_CAPTURE, + &dev->capture.frame_count, + sizeof(dev->capture.frame_count)); } } @@ -420,11 +418,10 @@ static int enable_camera(struct bcm2835_mmal_dev *dev) int ret; if (!dev->camera_use_count) { - ret = vchiq_mmal_port_parameter_set( - dev->instance, - &dev->component[COMP_CAMERA]->control, - MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, - sizeof(dev->camera_num)); + ret = vchiq_mmal_port_parameter_set(dev->instance, + &dev->component[COMP_CAMERA]->control, + MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, + sizeof(dev->camera_num)); if (ret < 0) { v4l2_err(&dev->v4l2_dev, "Failed setting camera num, ret %d\n", ret); @@ -468,11 +465,11 @@ static int disable_camera(struct bcm2835_mmal_dev *dev) "Failed disabling camera, ret %d\n", ret); return -EINVAL; } - vchiq_mmal_port_parameter_set( - dev->instance, - &dev->component[COMP_CAMERA]->control, - MMAL_PARAMETER_CAMERA_NUM, &i, - sizeof(i)); + vchiq_mmal_port_parameter_set(dev->instance, + &dev->component[COMP_CAMERA]->control, + MMAL_PARAMETER_CAMERA_NUM, + &i, + sizeof(i)); } v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "Camera refcount now %d\n", dev->camera_use_count); @@ -786,9 +783,8 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on) ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, NULL); if (ret >= 0) - ret = vchiq_mmal_component_disable( - dev->instance, - dev->component[COMP_PREVIEW]); + ret = vchiq_mmal_component_disable(dev->instance, + dev->component[COMP_PREVIEW]); disable_camera(dev); return ret; @@ -1006,7 +1002,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, return 0; } - static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev, struct v4l2_format *f) { @@ -1042,8 +1037,8 @@ static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev, if (overlay_enabled) { ret = vchiq_mmal_port_connect_tunnel(dev->instance, - preview_port, - &dev->component[COMP_PREVIEW]->input[0]); + preview_port, + &dev->component[COMP_PREVIEW]->input[0]); if (ret) return ret; @@ -1720,11 +1715,11 @@ static int mmal_init(struct bcm2835_mmal_dev *dev) { unsigned int enable = 1; - vchiq_mmal_port_parameter_set( - dev->instance, - &dev->component[COMP_VIDEO_ENCODE]->control, - MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, - &enable, sizeof(enable)); + vchiq_mmal_port_parameter_set(dev->instance, + &dev->component[COMP_VIDEO_ENCODE]->control, + MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, + &enable, + sizeof(enable)); vchiq_mmal_port_parameter_set(dev->instance, &dev->component[COMP_VIDEO_ENCODE]->control, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c index 933027e0011e..68f830d75531 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c @@ -37,7 +37,7 @@ static int vchiq_bus_probe(struct device *dev) return driver->probe(device); } -struct bus_type vchiq_bus_type = { +const struct bus_type vchiq_bus_type = { .name = "vchiq-bus", .match = vchiq_bus_type_match, .uevent = vchiq_bus_uevent, diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h index caa6fdf25bb1..4db86e76edbd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h @@ -34,7 +34,7 @@ static inline struct vchiq_driver *to_vchiq_driver(struct device_driver *d) return container_of(d, struct vchiq_driver, driver); } -extern struct bus_type vchiq_bus_type; +extern const struct bus_type vchiq_bus_type; struct vchiq_device * vchiq_device_register(struct device *parent, const char *name); diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c index e9461a7a7ab8..0cd370ab1008 100644 --- a/drivers/staging/vme_user/vme.c +++ b/drivers/staging/vme_user/vme.c @@ -1970,7 +1970,7 @@ static void vme_bus_remove(struct device *dev) driver->remove(vdev); } -struct bus_type vme_bus_type = { +const struct bus_type vme_bus_type = { .name = "vme", .match = vme_bus_match, .probe = vme_bus_probe, diff --git a/drivers/staging/vme_user/vme.h b/drivers/staging/vme_user/vme.h index 06504dccd5ff..26aa40f78a74 100644 --- a/drivers/staging/vme_user/vme.h +++ b/drivers/staging/vme_user/vme.h @@ -81,7 +81,7 @@ struct vme_resource { struct list_head *entry; }; -extern struct bus_type vme_bus_type; +extern const struct bus_type vme_bus_type; /* Number of VME interrupt vectors */ #define VME_NUM_STATUSID 256 diff --git a/drivers/staging/vme_user/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h index 4dd224d0b86e..db246cbc54c3 100644 --- a/drivers/staging/vme_user/vme_tsi148.h +++ b/drivers/staging/vme_user/vme_tsi148.h @@ -691,8 +691,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VMCTRL_RMWEN BIT(20) /* RMW Enable */ -#define TSI148_LCSR_VMCTRL_ATO_M (7 << 16) /* Master Access Time-out Mask - */ +#define TSI148_LCSR_VMCTRL_ATO_M (7 << 16) /* Master Access Time-out Mask */ #define TSI148_LCSR_VMCTRL_ATO_32 (0 << 16) /* 32 us */ #define TSI148_LCSR_VMCTRL_ATO_128 BIT(16) /* 128 us */ #define TSI148_LCSR_VMCTRL_ATO_512 (2 << 16) /* 512 us */ @@ -753,8 +752,7 @@ static const int TSI148_GCSR_MBOX[4] = { TSI148_GCSR_MBOX0, #define TSI148_LCSR_VCTRL_DLT_16384 (0xB << 24) /* 16384 VCLKS */ #define TSI148_LCSR_VCTRL_DLT_32768 (0xC << 24) /* 32768 VCLKS */ -#define TSI148_LCSR_VCTRL_NERBB BIT(20) /* No Early Release of Bus Busy - */ +#define TSI148_LCSR_VCTRL_NERBB BIT(20) /* No Early Release of Bus Busy */ #define TSI148_LCSR_VCTRL_SRESET BIT(17) /* System Reset */ #define TSI148_LCSR_VCTRL_LRESET BIT(16) /* Local Reset */ diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c index 36183f2a64c1..688c870d89bc 100644 --- a/drivers/staging/vt6655/card.c +++ b/drivers/staging/vt6655/card.c @@ -81,9 +81,9 @@ static void vt6655_mac_set_bb_type(void __iomem *iobase, u32 mask) * Return Value: none */ static void calculate_ofdmr_parameter(unsigned char rate, - u8 bb_type, - unsigned char *tx_rate, - unsigned char *rsv_time) + u8 bb_type, + unsigned char *tx_rate, + unsigned char *rsv_time) { switch (rate) { case RATE_6M: @@ -288,7 +288,7 @@ bool card_set_phy_parameter(struct vnt_private *priv, u8 bb_type) * Return Value: none */ bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate, - u64 bss_timestamp) + u64 bss_timestamp) { u64 local_tsf; u64 tsf_offset = 0; @@ -297,7 +297,7 @@ bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate, if (bss_timestamp != local_tsf) { tsf_offset = card_get_tsf_offset(rx_rate, bss_timestamp, - local_tsf); + local_tsf); /* adjust TSF, HW's TSF add TSF Offset reg */ tsf_offset = le64_to_cpu(tsf_offset); iowrite32((u32)tsf_offset, priv->port_offset + MAC_REG_TSFOFST); @@ -321,7 +321,7 @@ bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate, * Return Value: true if succeed; otherwise false */ bool card_set_beacon_period(struct vnt_private *priv, - unsigned short beacon_interval) + unsigned short beacon_interval) { u64 next_tbtt; @@ -586,61 +586,61 @@ void card_set_rspinf(struct vnt_private *priv, u8 bb_type) /* RSPINF_a_6 */ calculate_ofdmr_parameter(RATE_6M, - bb_type, - &byTxRate, - &byRsvTime); + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_6); /* RSPINF_a_9 */ calculate_ofdmr_parameter(RATE_9M, - bb_type, - &byTxRate, - &byRsvTime); + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_9); /* RSPINF_a_12 */ calculate_ofdmr_parameter(RATE_12M, - bb_type, - &byTxRate, - &byRsvTime); + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_12); /* RSPINF_a_18 */ calculate_ofdmr_parameter(RATE_18M, - bb_type, - &byTxRate, - &byRsvTime); + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_18); /* RSPINF_a_24 */ calculate_ofdmr_parameter(RATE_24M, - bb_type, - &byTxRate, - &byRsvTime); + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_24); /* RSPINF_a_36 */ calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, - RATE_36M), - bb_type, - &byTxRate, - &byRsvTime); + RATE_36M), + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_36); /* RSPINF_a_48 */ calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, - RATE_48M), - bb_type, - &byTxRate, - &byRsvTime); + RATE_48M), + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_48); /* RSPINF_a_54 */ calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, - RATE_54M), - bb_type, - &byTxRate, - &byRsvTime); + RATE_54M), + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_54); /* RSPINF_a_72 */ calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, - RATE_54M), - bb_type, - &byTxRate, - &byRsvTime); + RATE_54M), + bb_type, + &byTxRate, + &byRsvTime); iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_72); /* Set to Page0 */ VT6655_MAC_SELECT_PAGE0(priv->port_offset); diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h index a67757c9bb5c..be1e5180d57b 100644 --- a/drivers/staging/vt6655/rxtx.h +++ b/drivers/staging/vt6655/rxtx.h @@ -19,7 +19,6 @@ #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 /* 64us */ #define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */ - /*--------------------- Export Definitions -------------------------*/ /*--------------------- Export Variables --------------------------*/ diff --git a/include/linux/greybus/greybus_protocols.h b/include/linux/greybus/greybus_protocols.h index aeb8f9243545..820134b0105c 100644 --- a/include/linux/greybus/greybus_protocols.h +++ b/include/linux/greybus/greybus_protocols.h @@ -232,9 +232,7 @@ struct gb_fw_download_fetch_firmware_request { __le32 size; } __packed; -struct gb_fw_download_fetch_firmware_response { - __u8 data[0]; -} __packed; +/* gb_fw_download_fetch_firmware_response contains no other data */ /* firmware download release firmware request */ struct gb_fw_download_release_firmware_request { @@ -414,9 +412,7 @@ struct gb_bootrom_get_firmware_request { __le32 size; } __packed; -struct gb_bootrom_get_firmware_response { - __u8 data[0]; -} __packed; +/* gb_bootrom_get_firmware_response contains no other data */ /* Bootrom protocol Ready to boot request */ struct gb_bootrom_ready_to_boot_request { |